ivprog.bundle.js 1.9 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["ivprogCore"] = factory();
  8. else
  9. root["ivprogCore"] = factory();
  10. })(window, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = "./js/main.js");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "./grammar/en/ivprog.g4":
  99. /*!******************************!*\
  100. !*** ./grammar/en/ivprog.g4 ***!
  101. \******************************/
  102. /*! no static exports found */
  103. /***/ (function(module, exports, __webpack_require__) {
  104. module.exports =
  105. /******/ (function(modules) { // webpackBootstrap
  106. /******/ // The module cache
  107. /******/ var installedModules = {};
  108. /******/
  109. /******/ // The require function
  110. /******/ function __webpack_require__(moduleId) {
  111. /******/
  112. /******/ // Check if module is in cache
  113. /******/ if(installedModules[moduleId]) {
  114. /******/ return installedModules[moduleId].exports;
  115. /******/ }
  116. /******/ // Create a new module (and put it into the cache)
  117. /******/ var module = installedModules[moduleId] = {
  118. /******/ i: moduleId,
  119. /******/ l: false,
  120. /******/ exports: {}
  121. /******/ };
  122. /******/
  123. /******/ // Execute the module function
  124. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  125. /******/
  126. /******/ // Flag the module as loaded
  127. /******/ module.l = true;
  128. /******/
  129. /******/ // Return the exports of the module
  130. /******/ return module.exports;
  131. /******/ }
  132. /******/
  133. /******/
  134. /******/ // expose the modules object (__webpack_modules__)
  135. /******/ __webpack_require__.m = modules;
  136. /******/
  137. /******/ // expose the module cache
  138. /******/ __webpack_require__.c = installedModules;
  139. /******/
  140. /******/ // identity function for calling harmony imports with the correct context
  141. /******/ __webpack_require__.i = function(value) { return value; };
  142. /******/
  143. /******/ // define getter function for harmony exports
  144. /******/ __webpack_require__.d = function(exports, name, getter) {
  145. /******/ if(!__webpack_require__.o(exports, name)) {
  146. /******/ Object.defineProperty(exports, name, {
  147. /******/ configurable: false,
  148. /******/ enumerable: true,
  149. /******/ get: getter
  150. /******/ });
  151. /******/ }
  152. /******/ };
  153. /******/
  154. /******/ // getDefaultExport function for compatibility with non-harmony modules
  155. /******/ __webpack_require__.n = function(module) {
  156. /******/ var getter = module && module.__esModule ?
  157. /******/ function getDefault() { return module['default']; } :
  158. /******/ function getModuleExports() { return module; };
  159. /******/ __webpack_require__.d(getter, 'a', getter);
  160. /******/ return getter;
  161. /******/ };
  162. /******/
  163. /******/ // Object.prototype.hasOwnProperty.call
  164. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  165. /******/
  166. /******/ // __webpack_public_path__
  167. /******/ __webpack_require__.p = "";
  168. /******/
  169. /******/ // Load entry module and return exports
  170. /******/ return __webpack_require__(__webpack_require__.s = 1);
  171. /******/ })
  172. /************************************************************************/
  173. /******/ ([
  174. /* 0 */
  175. /***/ (function(module, exports, __webpack_require__) {
  176. // Generated from /tmp/tmp-5517iMTHf45ZFIl1/ivprog.g4 by ANTLR 4.7
  177. // jshint ignore: start
  178. var antlr4 = __webpack_require__(2);
  179. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  180. "\u0002/\u01d1\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  181. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  182. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  183. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  184. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  185. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  186. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  187. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  188. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  189. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  190. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  191. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  192. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  193. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003",
  194. "\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
  195. "\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
  196. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003",
  197. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0007\u0003",
  198. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  199. "\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  200. "\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  201. "\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b\u0003\u000b\u0003",
  202. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003",
  203. "\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003",
  204. "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  205. "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  206. "\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u0010\u0003",
  207. "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003",
  208. "\u0011\u0003\u0011\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  209. "\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0014\u0003",
  210. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0015\u0003\u0015\u0003",
  211. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003",
  212. "\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0017\u0003",
  213. "\u0017\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  214. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  215. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  216. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  217. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  218. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0125\n&\u0003\'\u0003\'\u0003",
  219. "(\u0003(\u0003)\u0003)\u0007)\u012d\n)\f)\u000e)\u0130\u000b)\u0003",
  220. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0137\n+\r+\u000e+\u0138\u0003",
  221. "+\u0003+\u0003+\u0003+\u0005+\u013f\n+\u0003+\u0006+\u0142\n+\r+\u000e",
  222. "+\u0143\u0003+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d",
  223. "\n+\r+\u000e+\u014e\u0005+\u0151\n+\u0003,\u0006,\u0154\n,\r,\u000e",
  224. ",\u0155\u0003,\u0003,\u0006,\u015a\n,\r,\u000e,\u015b\u0003,\u0006,",
  225. "\u015f\n,\r,\u000e,\u0160\u0003,\u0003,\u0007,\u0165\n,\f,\u000e,\u0168",
  226. "\u000b,\u0003,\u0005,\u016b\n,\u0003-\u0003-\u0005-\u016f\n-\u0003-",
  227. "\u0006-\u0172\n-\r-\u000e-\u0173\u0003.\u0003.\u0007.\u0178\n.\f.\u000e",
  228. ".\u017b\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u0181\n/\u00030\u0003",
  229. "0\u00030\u00050\u0186\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  230. "2\u00032\u00033\u00063\u0191\n3\r3\u000e3\u0192\u00033\u00053\u0196",
  231. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01a0",
  232. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  233. "7\u00037\u00057\u01ad\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  234. "8\u00039\u00039\u00039\u00039\u00079\u01ba\n9\f9\u000e9\u01bd\u000b",
  235. "9\u00039\u00059\u01c0\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01c7",
  236. "\n9\f9\u000e9\u01ca\u000b9\u00039\u00039\u00059\u01ce\n9\u00039\u0003",
  237. "9\u0003\u01c8\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  238. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  239. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  240. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  241. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  242. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  243. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  244. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  245. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  246. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  247. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01e5\u0002\u0003\u0003",
  248. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  249. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  250. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  251. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  252. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  253. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  254. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  255. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  256. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  257. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  258. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  259. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  260. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  261. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  262. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  263. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  264. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  265. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  266. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  267. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  268. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  269. "s\u0003\u0002\u0002\u0002\u0005{\u0003\u0002\u0002\u0002\u0007\u0080",
  270. "\u0003\u0002\u0002\u0002\t\u0085\u0003\u0002\u0002\u0002\u000b\u008d",
  271. "\u0003\u0002\u0002\u0002\r\u0094\u0003\u0002\u0002\u0002\u000f\u009c",
  272. "\u0003\u0002\u0002\u0002\u0011\u00a6\u0003\u0002\u0002\u0002\u0013\u00ad",
  273. "\u0003\u0002\u0002\u0002\u0015\u00b2\u0003\u0002\u0002\u0002\u0017\u00bc",
  274. "\u0003\u0002\u0002\u0002\u0019\u00c2\u0003\u0002\u0002\u0002\u001b\u00cb",
  275. "\u0003\u0002\u0002\u0002\u001d\u00d2\u0003\u0002\u0002\u0002\u001f\u00d6",
  276. "\u0003\u0002\u0002\u0002!\u00dc\u0003\u0002\u0002\u0002#\u00df\u0003",
  277. "\u0002\u0002\u0002%\u00e5\u0003\u0002\u0002\u0002\'\u00e8\u0003\u0002",
  278. "\u0002\u0002)\u00ed\u0003\u0002\u0002\u0002+\u00f3\u0003\u0002\u0002",
  279. "\u0002-\u00f8\u0003\u0002\u0002\u0002/\u00fc\u0003\u0002\u0002\u0002",
  280. "1\u0100\u0003\u0002\u0002\u00023\u0103\u0003\u0002\u0002\u00025\u0105",
  281. "\u0003\u0002\u0002\u00027\u0107\u0003\u0002\u0002\u00029\u0109\u0003",
  282. "\u0002\u0002\u0002;\u010b\u0003\u0002\u0002\u0002=\u010d\u0003\u0002",
  283. "\u0002\u0002?\u010f\u0003\u0002\u0002\u0002A\u0111\u0003\u0002\u0002",
  284. "\u0002C\u0113\u0003\u0002\u0002\u0002E\u0115\u0003\u0002\u0002\u0002",
  285. "G\u0117\u0003\u0002\u0002\u0002I\u0119\u0003\u0002\u0002\u0002K\u0124",
  286. "\u0003\u0002\u0002\u0002M\u0126\u0003\u0002\u0002\u0002O\u0128\u0003",
  287. "\u0002\u0002\u0002Q\u012a\u0003\u0002\u0002\u0002S\u0131\u0003\u0002",
  288. "\u0002\u0002U\u0150\u0003\u0002\u0002\u0002W\u016a\u0003\u0002\u0002",
  289. "\u0002Y\u016c\u0003\u0002\u0002\u0002[\u0175\u0003\u0002\u0002\u0002",
  290. "]\u0180\u0003\u0002\u0002\u0002_\u0182\u0003\u0002\u0002\u0002a\u0189",
  291. "\u0003\u0002\u0002\u0002c\u018d\u0003\u0002\u0002\u0002e\u0195\u0003",
  292. "\u0002\u0002\u0002g\u0197\u0003\u0002\u0002\u0002i\u0199\u0003\u0002",
  293. "\u0002\u0002k\u019f\u0003\u0002\u0002\u0002m\u01ac\u0003\u0002\u0002",
  294. "\u0002o\u01ae\u0003\u0002\u0002\u0002q\u01cd\u0003\u0002\u0002\u0002",
  295. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  296. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  297. "\u0002z\u0004\u0003\u0002\u0002\u0002{|\u0007t\u0002\u0002|}\u0007g",
  298. "\u0002\u0002}~\u0007c\u0002\u0002~\u007f\u0007n\u0002\u0002\u007f\u0006",
  299. "\u0003\u0002\u0002\u0002\u0080\u0081\u0007x\u0002\u0002\u0081\u0082",
  300. "\u0007q\u0002\u0002\u0082\u0083\u0007k\u0002\u0002\u0083\u0084\u0007",
  301. "f\u0002\u0002\u0084\b\u0003\u0002\u0002\u0002\u0085\u0086\u0007d\u0002",
  302. "\u0002\u0086\u0087\u0007q\u0002\u0002\u0087\u0088\u0007q\u0002\u0002",
  303. "\u0088\u0089\u0007n\u0002\u0002\u0089\u008a\u0007g\u0002\u0002\u008a",
  304. "\u008b\u0007c\u0002\u0002\u008b\u008c\u0007p\u0002\u0002\u008c\n\u0003",
  305. "\u0002\u0002\u0002\u008d\u008e\u0007u\u0002\u0002\u008e\u008f\u0007",
  306. "v\u0002\u0002\u008f\u0090\u0007t\u0002\u0002\u0090\u0091\u0007k\u0002",
  307. "\u0002\u0091\u0092\u0007p\u0002\u0002\u0092\u0093\u0007i\u0002\u0002",
  308. "\u0093\f\u0003\u0002\u0002\u0002\u0094\u0095\u0007k\u0002\u0002\u0095",
  309. "\u0096\u0007p\u0002\u0002\u0096\u0097\u0007v\u0002\u0002\u0097\u0098",
  310. "\u0007g\u0002\u0002\u0098\u0099\u0007i\u0002\u0002\u0099\u009a\u0007",
  311. "g\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u000e\u0003\u0002",
  312. "\u0002\u0002\u009c\u009d\u0007e\u0002\u0002\u009d\u009e\u0007j\u0002",
  313. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  314. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  315. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  316. "\u0007t\u0002\u0002\u00a5\u0010\u0003\u0002\u0002\u0002\u00a6\u00a7",
  317. "\u0007u\u0002\u0002\u00a7\u00a8\u0007y\u0002\u0002\u00a8\u00a9\u0007",
  318. "k\u0002\u0002\u00a9\u00aa\u0007v\u0002\u0002\u00aa\u00ab\u0007e\u0002",
  319. "\u0002\u00ab\u00ac\u0007j\u0002\u0002\u00ac\u0012\u0003\u0002\u0002",
  320. "\u0002\u00ad\u00ae\u0007e\u0002\u0002\u00ae\u00af\u0007c\u0002\u0002",
  321. "\u00af\u00b0\u0007u\u0002\u0002\u00b0\u00b1\u0007g\u0002\u0002\u00b1",
  322. "\u0014\u0003\u0002\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3",
  323. "\u00b4\u0007v\u0002\u0002\u00b4\u00b5\u0007j\u0002\u0002\u00b5\u00b6",
  324. "\u0007g\u0002\u0002\u00b6\u00b7\u0007t\u0002\u0002\u00b7\u00b8\u0007",
  325. "y\u0002\u0002\u00b8\u00b9\u0007k\u0002\u0002\u00b9\u00ba\u0007u\u0002",
  326. "\u0002\u00ba\u00bb\u0007g\u0002\u0002\u00bb\u0016\u0003\u0002\u0002",
  327. "\u0002\u00bc\u00bd\u0007e\u0002\u0002\u00bd\u00be\u0007q\u0002\u0002",
  328. "\u00be\u00bf\u0007p\u0002\u0002\u00bf\u00c0\u0007u\u0002\u0002\u00c0",
  329. "\u00c1\u0007v\u0002\u0002\u00c1\u0018\u0003\u0002\u0002\u0002\u00c2",
  330. "\u00c3\u0007h\u0002\u0002\u00c3\u00c4\u0007w\u0002\u0002\u00c4\u00c5",
  331. "\u0007p\u0002\u0002\u00c5\u00c6\u0007e\u0002\u0002\u00c6\u00c7\u0007",
  332. "v\u0002\u0002\u00c7\u00c8\u0007k\u0002\u0002\u00c8\u00c9\u0007q\u0002",
  333. "\u0002\u00c9\u00ca\u0007p\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  334. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  335. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007w\u0002\u0002\u00cf",
  336. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u001c",
  337. "\u0003\u0002\u0002\u0002\u00d2\u00d3\u0007h\u0002\u0002\u00d3\u00d4",
  338. "\u0007q\u0002\u0002\u00d4\u00d5\u0007t\u0002\u0002\u00d5\u001e\u0003",
  339. "\u0002\u0002\u0002\u00d6\u00d7\u0007d\u0002\u0002\u00d7\u00d8\u0007",
  340. "t\u0002\u0002\u00d8\u00d9\u0007g\u0002\u0002\u00d9\u00da\u0007c\u0002",
  341. "\u0002\u00da\u00db\u0007m\u0002\u0002\u00db \u0003\u0002\u0002\u0002",
  342. "\u00dc\u00dd\u0007f\u0002\u0002\u00dd\u00de\u0007q\u0002\u0002\u00de",
  343. "\"\u0003\u0002\u0002\u0002\u00df\u00e0\u0007y\u0002\u0002\u00e0\u00e1",
  344. "\u0007j\u0002\u0002\u00e1\u00e2\u0007k\u0002\u0002\u00e2\u00e3\u0007",
  345. "n\u0002\u0002\u00e3\u00e4\u0007g\u0002\u0002\u00e4$\u0003\u0002\u0002",
  346. "\u0002\u00e5\u00e6\u0007k\u0002\u0002\u00e6\u00e7\u0007h\u0002\u0002",
  347. "\u00e7&\u0003\u0002\u0002\u0002\u00e8\u00e9\u0007g\u0002\u0002\u00e9",
  348. "\u00ea\u0007n\u0002\u0002\u00ea\u00eb\u0007u\u0002\u0002\u00eb\u00ec",
  349. "\u0007g\u0002\u0002\u00ec(\u0003\u0002\u0002\u0002\u00ed\u00ee\u0007",
  350. "h\u0002\u0002\u00ee\u00ef\u0007c\u0002\u0002\u00ef\u00f0\u0007n\u0002",
  351. "\u0002\u00f0\u00f1\u0007u\u0002\u0002\u00f1\u00f2\u0007g\u0002\u0002",
  352. "\u00f2*\u0003\u0002\u0002\u0002\u00f3\u00f4\u0007v\u0002\u0002\u00f4",
  353. "\u00f5\u0007t\u0002\u0002\u00f5\u00f6\u0007w\u0002\u0002\u00f6\u00f7",
  354. "\u0007g\u0002\u0002\u00f7,\u0003\u0002\u0002\u0002\u00f8\u00f9\u0007",
  355. "p\u0002\u0002\u00f9\u00fa\u0007q\u0002\u0002\u00fa\u00fb\u0007v\u0002",
  356. "\u0002\u00fb.\u0003\u0002\u0002\u0002\u00fc\u00fd\u0007C\u0002\u0002",
  357. "\u00fd\u00fe\u0007P\u0002\u0002\u00fe\u00ff\u0007F\u0002\u0002\u00ff",
  358. "0\u0003\u0002\u0002\u0002\u0100\u0101\u0007Q\u0002\u0002\u0101\u0102",
  359. "\u0007T\u0002\u0002\u01022\u0003\u0002\u0002\u0002\u0103\u0104\u0007",
  360. "*\u0002\u0002\u01044\u0003\u0002\u0002\u0002\u0105\u0106\u0007+\u0002",
  361. "\u0002\u01066\u0003\u0002\u0002\u0002\u0107\u0108\u0007]\u0002\u0002",
  362. "\u01088\u0003\u0002\u0002\u0002\u0109\u010a\u0007_\u0002\u0002\u010a",
  363. ":\u0003\u0002\u0002\u0002\u010b\u010c\u0007}\u0002\u0002\u010c<\u0003",
  364. "\u0002\u0002\u0002\u010d\u010e\u0007\u007f\u0002\u0002\u010e>\u0003",
  365. "\u0002\u0002\u0002\u010f\u0110\u0007.\u0002\u0002\u0110@\u0003\u0002",
  366. "\u0002\u0002\u0111\u0112\u0007?\u0002\u0002\u0112B\u0003\u0002\u0002",
  367. "\u0002\u0113\u0114\t\u0002\u0002\u0002\u0114D\u0003\u0002\u0002\u0002",
  368. "\u0115\u0116\t\u0003\u0002\u0002\u0116F\u0003\u0002\u0002\u0002\u0117",
  369. "\u0118\u0005/\u0018\u0002\u0118H\u0003\u0002\u0002\u0002\u0119\u011a",
  370. "\u00051\u0019\u0002\u011aJ\u0003\u0002\u0002\u0002\u011b\u011c\u0007",
  371. "@\u0002\u0002\u011c\u0125\u0007?\u0002\u0002\u011d\u011e\u0007?\u0002",
  372. "\u0002\u011e\u0125\u0007?\u0002\u0002\u011f\u0120\u0007>\u0002\u0002",
  373. "\u0120\u0125\u0007?\u0002\u0002\u0121\u0125\t\u0004\u0002\u0002\u0122",
  374. "\u0123\u0007#\u0002\u0002\u0123\u0125\u0007?\u0002\u0002\u0124\u011b",
  375. "\u0003\u0002\u0002\u0002\u0124\u011d\u0003\u0002\u0002\u0002\u0124\u011f",
  376. "\u0003\u0002\u0002\u0002\u0124\u0121\u0003\u0002\u0002\u0002\u0124\u0122",
  377. "\u0003\u0002\u0002\u0002\u0125L\u0003\u0002\u0002\u0002\u0126\u0127",
  378. "\u0007<\u0002\u0002\u0127N\u0003\u0002\u0002\u0002\u0128\u0129\u0005",
  379. "-\u0017\u0002\u0129P\u0003\u0002\u0002\u0002\u012a\u012e\t\u0005\u0002",
  380. "\u0002\u012b\u012d\t\u0006\u0002\u0002\u012c\u012b\u0003\u0002\u0002",
  381. "\u0002\u012d\u0130\u0003\u0002\u0002\u0002\u012e\u012c\u0003\u0002\u0002",
  382. "\u0002\u012e\u012f\u0003\u0002\u0002\u0002\u012fR\u0003\u0002\u0002",
  383. "\u0002\u0130\u012e\u0003\u0002\u0002\u0002\u0131\u0132\u0005Q)\u0002",
  384. "\u0132\u0133\u00070\u0002\u0002\u0133\u0134\u0005Q)\u0002\u0134T\u0003",
  385. "\u0002\u0002\u0002\u0135\u0137\t\u0007\u0002\u0002\u0136\u0135\u0003",
  386. "\u0002\u0002\u0002\u0137\u0138\u0003\u0002\u0002\u0002\u0138\u0136\u0003",
  387. "\u0002\u0002\u0002\u0138\u0139\u0003\u0002\u0002\u0002\u0139\u0151\u0003",
  388. "\u0002\u0002\u0002\u013a\u013b\u00072\u0002\u0002\u013b\u013f\u0007",
  389. "z\u0002\u0002\u013c\u013d\u00072\u0002\u0002\u013d\u013f\u0007Z\u0002",
  390. "\u0002\u013e\u013a\u0003\u0002\u0002\u0002\u013e\u013c\u0003\u0002\u0002",
  391. "\u0002\u013f\u0141\u0003\u0002\u0002\u0002\u0140\u0142\u0005g4\u0002",
  392. "\u0141\u0140\u0003\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002",
  393. "\u0143\u0141\u0003\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002",
  394. "\u0144\u0151\u0003\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002",
  395. "\u0146\u014a\u0007d\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148",
  396. "\u014a\u0007D\u0002\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149",
  397. "\u0147\u0003\u0002\u0002\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b",
  398. "\u014d\t\b\u0002\u0002\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e",
  399. "\u0003\u0002\u0002\u0002\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f",
  400. "\u0003\u0002\u0002\u0002\u014f\u0151\u0003\u0002\u0002\u0002\u0150\u0136",
  401. "\u0003\u0002\u0002\u0002\u0150\u013e\u0003\u0002\u0002\u0002\u0150\u0149",
  402. "\u0003\u0002\u0002\u0002\u0151V\u0003\u0002\u0002\u0002\u0152\u0154",
  403. "\t\u0007\u0002\u0002\u0153\u0152\u0003\u0002\u0002\u0002\u0154\u0155",
  404. "\u0003\u0002\u0002\u0002\u0155\u0153\u0003\u0002\u0002\u0002\u0155\u0156",
  405. "\u0003\u0002\u0002\u0002\u0156\u0157\u0003\u0002\u0002\u0002\u0157\u0159",
  406. "\u00070\u0002\u0002\u0158\u015a\t\u0007\u0002\u0002\u0159\u0158\u0003",
  407. "\u0002\u0002\u0002\u015a\u015b\u0003\u0002\u0002\u0002\u015b\u0159\u0003",
  408. "\u0002\u0002\u0002\u015b\u015c\u0003\u0002\u0002\u0002\u015c\u016b\u0003",
  409. "\u0002\u0002\u0002\u015d\u015f\t\u0007\u0002\u0002\u015e\u015d\u0003",
  410. "\u0002\u0002\u0002\u015f\u0160\u0003\u0002\u0002\u0002\u0160\u015e\u0003",
  411. "\u0002\u0002\u0002\u0160\u0161\u0003\u0002\u0002\u0002\u0161\u0162\u0003",
  412. "\u0002\u0002\u0002\u0162\u0166\u00070\u0002\u0002\u0163\u0165\t\u0007",
  413. "\u0002\u0002\u0164\u0163\u0003\u0002\u0002\u0002\u0165\u0168\u0003\u0002",
  414. "\u0002\u0002\u0166\u0164\u0003\u0002\u0002\u0002\u0166\u0167\u0003\u0002",
  415. "\u0002\u0002\u0167\u0169\u0003\u0002\u0002\u0002\u0168\u0166\u0003\u0002",
  416. "\u0002\u0002\u0169\u016b\u0005Y-\u0002\u016a\u0153\u0003\u0002\u0002",
  417. "\u0002\u016a\u015e\u0003\u0002\u0002\u0002\u016bX\u0003\u0002\u0002",
  418. "\u0002\u016c\u016e\t\t\u0002\u0002\u016d\u016f\t\u0002\u0002\u0002\u016e",
  419. "\u016d\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002\u016f",
  420. "\u0171\u0003\u0002\u0002\u0002\u0170\u0172\t\u0007\u0002\u0002\u0171",
  421. "\u0170\u0003\u0002\u0002\u0002\u0172\u0173\u0003\u0002\u0002\u0002\u0173",
  422. "\u0171\u0003\u0002\u0002\u0002\u0173\u0174\u0003\u0002\u0002\u0002\u0174",
  423. "Z\u0003\u0002\u0002\u0002\u0175\u0179\u0007$\u0002\u0002\u0176\u0178",
  424. "\u0005]/\u0002\u0177\u0176\u0003\u0002\u0002\u0002\u0178\u017b\u0003",
  425. "\u0002\u0002\u0002\u0179\u0177\u0003\u0002\u0002\u0002\u0179\u017a\u0003",
  426. "\u0002\u0002\u0002\u017a\u017c\u0003\u0002\u0002\u0002\u017b\u0179\u0003",
  427. "\u0002\u0002\u0002\u017c\u017d\u0007$\u0002\u0002\u017d\\\u0003\u0002",
  428. "\u0002\u0002\u017e\u0181\n\n\u0002\u0002\u017f\u0181\u0005k6\u0002\u0180",
  429. "\u017e\u0003\u0002\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181",
  430. "^\u0003\u0002\u0002\u0002\u0182\u0185\u0007)\u0002\u0002\u0183\u0186",
  431. "\u0005k6\u0002\u0184\u0186\n\u000b\u0002\u0002\u0185\u0183\u0003\u0002",
  432. "\u0002\u0002\u0185\u0184\u0003\u0002\u0002\u0002\u0186\u0187\u0003\u0002",
  433. "\u0002\u0002\u0187\u0188\u0007)\u0002\u0002\u0188`\u0003\u0002\u0002",
  434. "\u0002\u0189\u018a\t\f\u0002\u0002\u018a\u018b\u0003\u0002\u0002\u0002",
  435. "\u018b\u018c\b1\u0002\u0002\u018cb\u0003\u0002\u0002\u0002\u018d\u018e",
  436. "\u0007=\u0002\u0002\u018ed\u0003\u0002\u0002\u0002\u018f\u0191\t\r\u0002",
  437. "\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002\u0002",
  438. "\u0002\u0192\u0190\u0003\u0002\u0002\u0002\u0192\u0193\u0003\u0002\u0002",
  439. "\u0002\u0193\u0196\u0003\u0002\u0002\u0002\u0194\u0196\u0005c2\u0002",
  440. "\u0195\u0190\u0003\u0002\u0002\u0002\u0195\u0194\u0003\u0002\u0002\u0002",
  441. "\u0196f\u0003\u0002\u0002\u0002\u0197\u0198\t\u000e\u0002\u0002\u0198",
  442. "h\u0003\u0002\u0002\u0002\u0199\u019a\t\u000f\u0002\u0002\u019aj\u0003",
  443. "\u0002\u0002\u0002\u019b\u019c\u0007^\u0002\u0002\u019c\u01a0\t\u0010",
  444. "\u0002\u0002\u019d\u01a0\u0005o8\u0002\u019e\u01a0\u0005m7\u0002\u019f",
  445. "\u019b\u0003\u0002\u0002\u0002\u019f\u019d\u0003\u0002\u0002\u0002\u019f",
  446. "\u019e\u0003\u0002\u0002\u0002\u01a0l\u0003\u0002\u0002\u0002\u01a1",
  447. "\u01a2\u0007^\u0002\u0002\u01a2\u01a3\t\u0011\u0002\u0002\u01a3\u01a4",
  448. "\u0005i5\u0002\u01a4\u01a5\u0005i5\u0002\u01a5\u01ad\u0003\u0002\u0002",
  449. "\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01a8\u0005i5\u0002\u01a8",
  450. "\u01a9\u0005i5\u0002\u01a9\u01ad\u0003\u0002\u0002\u0002\u01aa\u01ab",
  451. "\u0007^\u0002\u0002\u01ab\u01ad\u0005i5\u0002\u01ac\u01a1\u0003\u0002",
  452. "\u0002\u0002\u01ac\u01a6\u0003\u0002\u0002\u0002\u01ac\u01aa\u0003\u0002",
  453. "\u0002\u0002\u01adn\u0003\u0002\u0002\u0002\u01ae\u01af\u0007^\u0002",
  454. "\u0002\u01af\u01b0\u0007w\u0002\u0002\u01b0\u01b1\u0005g4\u0002\u01b1",
  455. "\u01b2\u0005g4\u0002\u01b2\u01b3\u0005g4\u0002\u01b3\u01b4\u0005g4\u0002",
  456. "\u01b4p\u0003\u0002\u0002\u0002\u01b5\u01b6\u00071\u0002\u0002\u01b6",
  457. "\u01b7\u00071\u0002\u0002\u01b7\u01bb\u0003\u0002\u0002\u0002\u01b8",
  458. "\u01ba\n\r\u0002\u0002\u01b9\u01b8\u0003\u0002\u0002\u0002\u01ba\u01bd",
  459. "\u0003\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bb\u01bc",
  460. "\u0003\u0002\u0002\u0002\u01bc\u01bf\u0003\u0002\u0002\u0002\u01bd\u01bb",
  461. "\u0003\u0002\u0002\u0002\u01be\u01c0\u0007\u000f\u0002\u0002\u01bf\u01be",
  462. "\u0003\u0002\u0002\u0002\u01bf\u01c0\u0003\u0002\u0002\u0002\u01c0\u01c1",
  463. "\u0003\u0002\u0002\u0002\u01c1\u01ce\u0007\f\u0002\u0002\u01c2\u01c3",
  464. "\u00071\u0002\u0002\u01c3\u01c4\u0007,\u0002\u0002\u01c4\u01c8\u0003",
  465. "\u0002\u0002\u0002\u01c5\u01c7\u000b\u0002\u0002\u0002\u01c6\u01c5\u0003",
  466. "\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c9\u0003",
  467. "\u0002\u0002\u0002\u01c8\u01c6\u0003\u0002\u0002\u0002\u01c9\u01cb\u0003",
  468. "\u0002\u0002\u0002\u01ca\u01c8\u0003\u0002\u0002\u0002\u01cb\u01cc\u0007",
  469. ",\u0002\u0002\u01cc\u01ce\u00071\u0002\u0002\u01cd\u01b5\u0003\u0002",
  470. "\u0002\u0002\u01cd\u01c2\u0003\u0002\u0002\u0002\u01ce\u01cf\u0003\u0002",
  471. "\u0002\u0002\u01cf\u01d0\b9\u0003\u0002\u01d0r\u0003\u0002\u0002\u0002",
  472. "\u001d\u0002\u0124\u012e\u0138\u013e\u0143\u0149\u014e\u0150\u0155\u015b",
  473. "\u0160\u0166\u016a\u016e\u0173\u0179\u0180\u0185\u0192\u0195\u019f\u01ac",
  474. "\u01bb\u01bf\u01c8\u01cd\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  475. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  476. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  477. function ivprog(input) {
  478. antlr4.Lexer.call(this, input);
  479. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  480. return this;
  481. }
  482. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  483. ivprog.prototype.constructor = ivprog;
  484. ivprog.EOF = antlr4.Token.EOF;
  485. ivprog.RK_PROGRAM = 1;
  486. ivprog.RK_REAL = 2;
  487. ivprog.RK_VOID = 3;
  488. ivprog.RK_BOOLEAN = 4;
  489. ivprog.RK_STRING = 5;
  490. ivprog.RK_INTEGER = 6;
  491. ivprog.RK_CHARACTER = 7;
  492. ivprog.RK_SWITCH = 8;
  493. ivprog.RK_CASE = 9;
  494. ivprog.RK_DEFAULT = 10;
  495. ivprog.RK_CONST = 11;
  496. ivprog.RK_FUNCTION = 12;
  497. ivprog.RK_RETURN = 13;
  498. ivprog.RK_FOR = 14;
  499. ivprog.RK_BREAK = 15;
  500. ivprog.RK_DO = 16;
  501. ivprog.RK_WHILE = 17;
  502. ivprog.RK_IF = 18;
  503. ivprog.RK_ELSE = 19;
  504. ivprog.RK_FALSE = 20;
  505. ivprog.RK_TRUE = 21;
  506. ivprog.OPEN_PARENTHESIS = 22;
  507. ivprog.CLOSE_PARENTHESIS = 23;
  508. ivprog.OPEN_BRACE = 24;
  509. ivprog.CLOSE_BRACE = 25;
  510. ivprog.OPEN_CURLY = 26;
  511. ivprog.CLOSE_CURLY = 27;
  512. ivprog.COMMA = 28;
  513. ivprog.EQUAL = 29;
  514. ivprog.SUM_OP = 30;
  515. ivprog.MULTI_OP = 31;
  516. ivprog.AND_OPERATOR = 32;
  517. ivprog.OR_OPERATOR = 33;
  518. ivprog.RELATIONAL_OPERATOR = 34;
  519. ivprog.COLON = 35;
  520. ivprog.NOT_OPERATOR = 36;
  521. ivprog.ID = 37;
  522. ivprog.LIB_ID = 38;
  523. ivprog.INTEGER = 39;
  524. ivprog.REAL = 40;
  525. ivprog.STRING = 41;
  526. ivprog.CHARACTER = 42;
  527. ivprog.WHITESPACE = 43;
  528. ivprog.EOS = 44;
  529. ivprog.COMMENTS = 45;
  530. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  531. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  532. ivprog.prototype.literalNames = [ null, "'program'", "'real'", "'void'",
  533. "'boolean'", "'string'", "'integer'",
  534. "'character'", "'switch'", "'case'", "'otherwise'",
  535. "'const'", "'function'", "'return'", "'for'",
  536. "'break'", "'do'", "'while'", "'if'",
  537. "'else'", "'false'", "'true'", "'('",
  538. "')'", "'['", "']'", "'{'", "'}'", "','",
  539. "'='", null, null, null, null, null, "':'" ];
  540. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  541. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  542. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  543. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  544. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  545. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  546. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  547. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  548. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  549. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  550. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  551. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  552. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  553. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  554. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  555. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  556. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  557. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  558. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  559. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  560. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  561. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  562. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  563. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  564. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  565. "STRING", "STRING_CHARACTER", "CHARACTER",
  566. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  567. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  568. "COMMENTS" ];
  569. ivprog.prototype.grammarFileName = "ivprog.g4";
  570. exports.ivprog = ivprog;
  571. /***/ }),
  572. /* 1 */
  573. /***/ (function(module, exports, __webpack_require__) {
  574. module.exports = {
  575. ivprog: __webpack_require__(0).ivprog
  576. };
  577. /***/ }),
  578. /* 2 */
  579. /***/ (function(module, exports) {
  580. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  581. /***/ })
  582. /******/ ]);
  583. /***/ }),
  584. /***/ "./grammar/en/langFunctions.js":
  585. /*!*************************************!*\
  586. !*** ./grammar/en/langFunctions.js ***!
  587. \*************************************/
  588. /*! no static exports found */
  589. /***/ (function(module, exports, __webpack_require__) {
  590. "use strict";
  591. Object.defineProperty(exports, "__esModule", {
  592. value: true
  593. });
  594. /* This is a dictionary of the language defined functions
  595. **/
  596. exports.default = {
  597. main_function: "start",
  598. $read: "read",
  599. $write: "write",
  600. $numElements: "numero_elementos",
  601. $matrixLines: "matriz_linhas",
  602. $matrixColumns: "matriz_colunas",
  603. $substring: "subcadeia",
  604. $length: "comprimento",
  605. $uppercase: "caixa_alta",
  606. $lowercase: "caixa_baixa",
  607. $charAt: "char_at",
  608. $isReal: "e_real",
  609. $isInt: "e_inteiro",
  610. $isBool: "e_logico",
  611. $castReal: "como_real",
  612. $castInt: "como_inteiro",
  613. $castBool: "como_logico",
  614. $castString: "como_cadeia",
  615. $sin: "sen",
  616. $cos: "cos",
  617. $tan: "tan",
  618. $sqrt: "raiz_quadrada",
  619. $pow: "pot",
  620. $log: "log",
  621. $abs: "modulo",
  622. $negate: "trocar_sinal",
  623. $invert: "inverter_valor",
  624. $max: "maximo",
  625. $min: "minimo"
  626. };
  627. /***/ }),
  628. /***/ "./grammar/en/langLibs.js":
  629. /*!********************************!*\
  630. !*** ./grammar/en/langLibs.js ***!
  631. \********************************/
  632. /*! no static exports found */
  633. /***/ (function(module, exports, __webpack_require__) {
  634. "use strict";
  635. Object.defineProperty(exports, "__esModule", {
  636. value: true
  637. });
  638. /**
  639. * This is the dictionary of the language defined libraries
  640. */
  641. exports.default = {
  642. $mathLib: "Matematica",
  643. $ioLib: "ES",
  644. $strLib: "Texto",
  645. $arrayLib: "Arranjo",
  646. $langLib: "IV"
  647. };
  648. /***/ }),
  649. /***/ "./grammar/es/ivprog.g4":
  650. /*!******************************!*\
  651. !*** ./grammar/es/ivprog.g4 ***!
  652. \******************************/
  653. /*! no static exports found */
  654. /***/ (function(module, exports, __webpack_require__) {
  655. module.exports =
  656. /******/ (function(modules) { // webpackBootstrap
  657. /******/ // The module cache
  658. /******/ var installedModules = {};
  659. /******/
  660. /******/ // The require function
  661. /******/ function __webpack_require__(moduleId) {
  662. /******/
  663. /******/ // Check if module is in cache
  664. /******/ if(installedModules[moduleId]) {
  665. /******/ return installedModules[moduleId].exports;
  666. /******/ }
  667. /******/ // Create a new module (and put it into the cache)
  668. /******/ var module = installedModules[moduleId] = {
  669. /******/ i: moduleId,
  670. /******/ l: false,
  671. /******/ exports: {}
  672. /******/ };
  673. /******/
  674. /******/ // Execute the module function
  675. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  676. /******/
  677. /******/ // Flag the module as loaded
  678. /******/ module.l = true;
  679. /******/
  680. /******/ // Return the exports of the module
  681. /******/ return module.exports;
  682. /******/ }
  683. /******/
  684. /******/
  685. /******/ // expose the modules object (__webpack_modules__)
  686. /******/ __webpack_require__.m = modules;
  687. /******/
  688. /******/ // expose the module cache
  689. /******/ __webpack_require__.c = installedModules;
  690. /******/
  691. /******/ // identity function for calling harmony imports with the correct context
  692. /******/ __webpack_require__.i = function(value) { return value; };
  693. /******/
  694. /******/ // define getter function for harmony exports
  695. /******/ __webpack_require__.d = function(exports, name, getter) {
  696. /******/ if(!__webpack_require__.o(exports, name)) {
  697. /******/ Object.defineProperty(exports, name, {
  698. /******/ configurable: false,
  699. /******/ enumerable: true,
  700. /******/ get: getter
  701. /******/ });
  702. /******/ }
  703. /******/ };
  704. /******/
  705. /******/ // getDefaultExport function for compatibility with non-harmony modules
  706. /******/ __webpack_require__.n = function(module) {
  707. /******/ var getter = module && module.__esModule ?
  708. /******/ function getDefault() { return module['default']; } :
  709. /******/ function getModuleExports() { return module; };
  710. /******/ __webpack_require__.d(getter, 'a', getter);
  711. /******/ return getter;
  712. /******/ };
  713. /******/
  714. /******/ // Object.prototype.hasOwnProperty.call
  715. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  716. /******/
  717. /******/ // __webpack_public_path__
  718. /******/ __webpack_require__.p = "";
  719. /******/
  720. /******/ // Load entry module and return exports
  721. /******/ return __webpack_require__(__webpack_require__.s = 1);
  722. /******/ })
  723. /************************************************************************/
  724. /******/ ([
  725. /* 0 */
  726. /***/ (function(module, exports, __webpack_require__) {
  727. // Generated from /tmp/tmp-5517ceav9uny9VwW/ivprog.g4 by ANTLR 4.7
  728. // jshint ignore: start
  729. var antlr4 = __webpack_require__(2);
  730. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  731. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  732. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  733. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  734. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  735. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  736. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  737. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  738. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  739. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  740. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  741. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  742. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  743. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  744. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  745. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  746. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  747. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  748. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  749. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  750. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  751. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  752. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  753. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  754. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  755. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  756. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  757. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  758. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  759. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  760. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  761. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  762. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  763. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  764. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  765. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  766. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  767. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  768. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  769. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  770. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  771. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  772. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  773. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  774. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  775. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  776. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  777. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  778. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  779. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  780. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  781. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  782. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  783. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  784. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  785. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  786. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  787. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  788. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  789. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  790. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  791. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  792. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  793. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  794. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  795. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  796. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  797. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  798. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  799. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  800. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  801. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  802. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  803. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  804. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  805. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  806. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  807. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  808. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  809. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  810. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  811. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  812. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  813. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  814. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  815. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  816. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  817. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  818. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  819. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  820. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  821. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  822. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  823. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  824. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  825. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  826. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  827. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  828. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  829. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  830. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  831. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  832. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  833. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  834. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  835. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  836. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  837. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  838. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  839. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  840. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  841. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  842. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  843. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  844. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  845. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  846. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  847. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  848. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  849. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  850. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  851. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  852. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  853. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  854. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  855. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  856. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  857. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  858. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  859. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  860. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  861. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  862. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  863. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  864. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  865. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  866. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  867. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  868. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  869. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  870. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  871. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  872. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  873. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  874. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  875. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  876. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  877. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  878. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  879. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  880. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  881. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  882. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  883. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  884. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  885. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  886. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  887. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  888. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  889. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  890. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  891. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  892. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  893. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  894. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  895. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  896. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  897. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  898. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  899. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  900. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  901. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  902. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  903. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  904. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  905. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  906. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  907. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  908. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  909. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  910. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  911. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  912. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  913. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  914. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  915. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  916. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  917. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  918. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  919. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  920. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  921. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  922. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  923. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  924. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  925. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  926. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  927. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  928. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  929. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  930. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  931. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  932. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  933. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  934. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  935. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  936. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  937. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  938. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  939. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  940. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  941. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  942. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  943. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  944. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  945. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  946. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  947. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  948. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  949. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  950. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  951. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  952. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  953. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  954. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  955. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  956. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  957. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  958. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  959. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  960. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  961. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  962. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  963. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  964. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  965. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  966. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  967. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  968. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  969. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  970. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  971. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  972. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  973. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  974. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  975. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  976. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  977. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  978. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  979. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  980. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  981. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  982. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  983. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  984. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  985. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  986. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  987. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  988. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  989. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  990. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  991. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  992. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  993. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  994. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  995. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  996. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  997. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  998. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  999. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1000. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1001. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1002. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1003. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1004. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1005. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1006. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1007. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1008. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1009. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1010. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1011. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1012. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1013. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1014. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1015. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1016. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1017. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1018. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1019. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1020. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1021. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1022. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1023. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1024. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1025. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1026. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1027. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1028. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1029. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1030. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1031. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1032. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1033. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1034. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1035. function ivprog(input) {
  1036. antlr4.Lexer.call(this, input);
  1037. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1038. return this;
  1039. }
  1040. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1041. ivprog.prototype.constructor = ivprog;
  1042. ivprog.EOF = antlr4.Token.EOF;
  1043. ivprog.RK_PROGRAM = 1;
  1044. ivprog.RK_REAL = 2;
  1045. ivprog.RK_VOID = 3;
  1046. ivprog.RK_BOOLEAN = 4;
  1047. ivprog.RK_STRING = 5;
  1048. ivprog.RK_INTEGER = 6;
  1049. ivprog.RK_CHARACTER = 7;
  1050. ivprog.RK_SWITCH = 8;
  1051. ivprog.RK_CASE = 9;
  1052. ivprog.RK_DEFAULT = 10;
  1053. ivprog.RK_CONST = 11;
  1054. ivprog.RK_FUNCTION = 12;
  1055. ivprog.RK_RETURN = 13;
  1056. ivprog.RK_FOR = 14;
  1057. ivprog.RK_BREAK = 15;
  1058. ivprog.RK_DO = 16;
  1059. ivprog.RK_WHILE = 17;
  1060. ivprog.RK_IF = 18;
  1061. ivprog.RK_ELSE = 19;
  1062. ivprog.RK_FALSE = 20;
  1063. ivprog.RK_TRUE = 21;
  1064. ivprog.OPEN_PARENTHESIS = 22;
  1065. ivprog.CLOSE_PARENTHESIS = 23;
  1066. ivprog.OPEN_BRACE = 24;
  1067. ivprog.CLOSE_BRACE = 25;
  1068. ivprog.OPEN_CURLY = 26;
  1069. ivprog.CLOSE_CURLY = 27;
  1070. ivprog.COMMA = 28;
  1071. ivprog.EQUAL = 29;
  1072. ivprog.SUM_OP = 30;
  1073. ivprog.MULTI_OP = 31;
  1074. ivprog.AND_OPERATOR = 32;
  1075. ivprog.OR_OPERATOR = 33;
  1076. ivprog.RELATIONAL_OPERATOR = 34;
  1077. ivprog.COLON = 35;
  1078. ivprog.NOT_OPERATOR = 36;
  1079. ivprog.ID = 37;
  1080. ivprog.LIB_ID = 38;
  1081. ivprog.INTEGER = 39;
  1082. ivprog.REAL = 40;
  1083. ivprog.STRING = 41;
  1084. ivprog.CHARACTER = 42;
  1085. ivprog.WHITESPACE = 43;
  1086. ivprog.EOS = 44;
  1087. ivprog.COMMENTS = 45;
  1088. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1089. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1090. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1091. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1092. "'escolha'", "'caso'", "'contrario'",
  1093. "'const'", "'funcao'", "'retorne'", "'para'",
  1094. "'pare'", "'faca'", "'enquanto'", "'se'",
  1095. "'senao'", "'falso'", "'verdadeiro'",
  1096. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1097. "','", "'='", null, null, null, null,
  1098. null, "':'" ];
  1099. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1100. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1101. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1102. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1103. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1104. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1105. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1106. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1107. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1108. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1109. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1110. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1111. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1112. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1113. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1114. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1115. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1116. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1117. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1118. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1119. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1120. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1121. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1122. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1123. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1124. "STRING", "STRING_CHARACTER", "CHARACTER",
  1125. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1126. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1127. "COMMENTS" ];
  1128. ivprog.prototype.grammarFileName = "ivprog.g4";
  1129. exports.ivprog = ivprog;
  1130. /***/ }),
  1131. /* 1 */
  1132. /***/ (function(module, exports, __webpack_require__) {
  1133. module.exports = {
  1134. ivprog: __webpack_require__(0).ivprog
  1135. };
  1136. /***/ }),
  1137. /* 2 */
  1138. /***/ (function(module, exports) {
  1139. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1140. /***/ })
  1141. /******/ ]);
  1142. /***/ }),
  1143. /***/ "./grammar/es/langFunctions.js":
  1144. /*!*************************************!*\
  1145. !*** ./grammar/es/langFunctions.js ***!
  1146. \*************************************/
  1147. /*! no static exports found */
  1148. /***/ (function(module, exports, __webpack_require__) {
  1149. "use strict";
  1150. Object.defineProperty(exports, "__esModule", {
  1151. value: true
  1152. });
  1153. /* This is a dictionary of the language defined functions
  1154. **/
  1155. exports.default = {
  1156. main_function: "inicio",
  1157. $read: "leia",
  1158. $write: "escreva",
  1159. $numElements: "numero_elementos",
  1160. $matrixLines: "matriz_linhas",
  1161. $matrixColumns: "matriz_colunas",
  1162. $substring: "subcadeia",
  1163. $length: "comprimento",
  1164. $uppercase: "caixa_alta",
  1165. $lowercase: "caixa_baixa",
  1166. $charAt: "char_at",
  1167. $isReal: "e_real",
  1168. $isInt: "e_inteiro",
  1169. $isBool: "e_logico",
  1170. $castReal: "como_real",
  1171. $castInt: "como_inteiro",
  1172. $castBool: "como_logico",
  1173. $castString: "como_cadeia",
  1174. $sin: "sen",
  1175. $cos: "cos",
  1176. $tan: "tan",
  1177. $sqrt: "raiz_quadrada",
  1178. $pow: "pot",
  1179. $log: "log",
  1180. $abs: "modulo",
  1181. $negate: "trocar_sinal",
  1182. $invert: "inverter_valor",
  1183. $max: "maximo",
  1184. $min: "minimo"
  1185. };
  1186. /***/ }),
  1187. /***/ "./grammar/es/langLibs.js":
  1188. /*!********************************!*\
  1189. !*** ./grammar/es/langLibs.js ***!
  1190. \********************************/
  1191. /*! no static exports found */
  1192. /***/ (function(module, exports, __webpack_require__) {
  1193. "use strict";
  1194. Object.defineProperty(exports, "__esModule", {
  1195. value: true
  1196. });
  1197. /**
  1198. * This is the dictionary of the language defined libraries
  1199. */
  1200. exports.default = {
  1201. $mathLib: "Matematica",
  1202. $ioLib: "ES",
  1203. $strLib: "Texto",
  1204. $arrayLib: "Arranjo",
  1205. $langLib: "IV"
  1206. };
  1207. /***/ }),
  1208. /***/ "./grammar/index.js":
  1209. /*!**************************!*\
  1210. !*** ./grammar/index.js ***!
  1211. \**************************/
  1212. /*! no static exports found */
  1213. /***/ (function(module, exports, __webpack_require__) {
  1214. "use strict";
  1215. var _ivprog = __webpack_require__(/*! ./pt/ivprog.g4 */ "./grammar/pt/ivprog.g4");
  1216. var PT = _interopRequireWildcard(_ivprog);
  1217. var _langFunctions = __webpack_require__(/*! ./pt/langFunctions */ "./grammar/pt/langFunctions.js");
  1218. var _langFunctions2 = _interopRequireDefault(_langFunctions);
  1219. var _langLibs = __webpack_require__(/*! ./pt/langLibs */ "./grammar/pt/langLibs.js");
  1220. var _langLibs2 = _interopRequireDefault(_langLibs);
  1221. var _ivprog2 = __webpack_require__(/*! ./en/ivprog.g4 */ "./grammar/en/ivprog.g4");
  1222. var EN = _interopRequireWildcard(_ivprog2);
  1223. var _langFunctions3 = __webpack_require__(/*! ./en/langFunctions */ "./grammar/en/langFunctions.js");
  1224. var _langFunctions4 = _interopRequireDefault(_langFunctions3);
  1225. var _langLibs3 = __webpack_require__(/*! ./en/langLibs */ "./grammar/en/langLibs.js");
  1226. var _langLibs4 = _interopRequireDefault(_langLibs3);
  1227. var _ivprog3 = __webpack_require__(/*! ./es/ivprog.g4 */ "./grammar/es/ivprog.g4");
  1228. var ES = _interopRequireWildcard(_ivprog3);
  1229. var _langFunctions5 = __webpack_require__(/*! ./es/langFunctions */ "./grammar/es/langFunctions.js");
  1230. var _langFunctions6 = _interopRequireDefault(_langFunctions5);
  1231. var _langLibs5 = __webpack_require__(/*! ./es/langLibs */ "./grammar/es/langLibs.js");
  1232. var _langLibs6 = _interopRequireDefault(_langLibs5);
  1233. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1234. 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; } }
  1235. exports.pt = { lexer: PT.ivprog, langFuncs: _langFunctions2.default, langLibs: _langLibs2.default };
  1236. exports.en = { lexer: EN.ivprog, langFuncs: _langFunctions4.default, langLibs: _langLibs4.default };
  1237. exports.es = { lexer: ES.ivprog, langFuncs: _langFunctions6.default, langLibs: _langLibs6.default };
  1238. /***/ }),
  1239. /***/ "./grammar/pt/ivprog.g4":
  1240. /*!******************************!*\
  1241. !*** ./grammar/pt/ivprog.g4 ***!
  1242. \******************************/
  1243. /*! no static exports found */
  1244. /***/ (function(module, exports, __webpack_require__) {
  1245. module.exports =
  1246. /******/ (function(modules) { // webpackBootstrap
  1247. /******/ // The module cache
  1248. /******/ var installedModules = {};
  1249. /******/
  1250. /******/ // The require function
  1251. /******/ function __webpack_require__(moduleId) {
  1252. /******/
  1253. /******/ // Check if module is in cache
  1254. /******/ if(installedModules[moduleId]) {
  1255. /******/ return installedModules[moduleId].exports;
  1256. /******/ }
  1257. /******/ // Create a new module (and put it into the cache)
  1258. /******/ var module = installedModules[moduleId] = {
  1259. /******/ i: moduleId,
  1260. /******/ l: false,
  1261. /******/ exports: {}
  1262. /******/ };
  1263. /******/
  1264. /******/ // Execute the module function
  1265. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1266. /******/
  1267. /******/ // Flag the module as loaded
  1268. /******/ module.l = true;
  1269. /******/
  1270. /******/ // Return the exports of the module
  1271. /******/ return module.exports;
  1272. /******/ }
  1273. /******/
  1274. /******/
  1275. /******/ // expose the modules object (__webpack_modules__)
  1276. /******/ __webpack_require__.m = modules;
  1277. /******/
  1278. /******/ // expose the module cache
  1279. /******/ __webpack_require__.c = installedModules;
  1280. /******/
  1281. /******/ // identity function for calling harmony imports with the correct context
  1282. /******/ __webpack_require__.i = function(value) { return value; };
  1283. /******/
  1284. /******/ // define getter function for harmony exports
  1285. /******/ __webpack_require__.d = function(exports, name, getter) {
  1286. /******/ if(!__webpack_require__.o(exports, name)) {
  1287. /******/ Object.defineProperty(exports, name, {
  1288. /******/ configurable: false,
  1289. /******/ enumerable: true,
  1290. /******/ get: getter
  1291. /******/ });
  1292. /******/ }
  1293. /******/ };
  1294. /******/
  1295. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1296. /******/ __webpack_require__.n = function(module) {
  1297. /******/ var getter = module && module.__esModule ?
  1298. /******/ function getDefault() { return module['default']; } :
  1299. /******/ function getModuleExports() { return module; };
  1300. /******/ __webpack_require__.d(getter, 'a', getter);
  1301. /******/ return getter;
  1302. /******/ };
  1303. /******/
  1304. /******/ // Object.prototype.hasOwnProperty.call
  1305. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  1306. /******/
  1307. /******/ // __webpack_public_path__
  1308. /******/ __webpack_require__.p = "";
  1309. /******/
  1310. /******/ // Load entry module and return exports
  1311. /******/ return __webpack_require__(__webpack_require__.s = 1);
  1312. /******/ })
  1313. /************************************************************************/
  1314. /******/ ([
  1315. /* 0 */
  1316. /***/ (function(module, exports, __webpack_require__) {
  1317. // Generated from /tmp/tmp-55171SASV48mmAqz/ivprog.g4 by ANTLR 4.7
  1318. // jshint ignore: start
  1319. var antlr4 = __webpack_require__(2);
  1320. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  1321. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  1322. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  1323. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  1324. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  1325. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  1326. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  1327. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  1328. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  1329. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  1330. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  1331. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  1332. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  1333. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  1334. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  1335. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  1336. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  1337. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  1338. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  1339. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  1340. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  1341. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  1342. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  1343. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  1344. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  1345. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  1346. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  1347. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  1348. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  1349. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  1350. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  1351. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  1352. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  1353. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  1354. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  1355. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  1356. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  1357. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  1358. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  1359. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  1360. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  1361. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  1362. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  1363. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  1364. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  1365. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  1366. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  1367. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  1368. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  1369. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  1370. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  1371. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  1372. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  1373. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  1374. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  1375. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  1376. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  1377. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  1378. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  1379. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  1380. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  1381. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  1382. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  1383. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  1384. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  1385. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  1386. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  1387. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  1388. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  1389. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  1390. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  1391. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  1392. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  1393. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  1394. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  1395. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  1396. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  1397. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  1398. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  1399. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  1400. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  1401. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  1402. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  1403. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  1404. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  1405. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  1406. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  1407. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  1408. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  1409. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  1410. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  1411. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  1412. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  1413. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  1414. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  1415. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  1416. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  1417. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  1418. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  1419. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  1420. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  1421. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  1422. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  1423. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  1424. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  1425. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  1426. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  1427. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  1428. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  1429. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  1430. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  1431. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  1432. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  1433. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  1434. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  1435. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  1436. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  1437. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  1438. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  1439. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  1440. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  1441. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  1442. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  1443. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  1444. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  1445. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  1446. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  1447. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  1448. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  1449. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  1450. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  1451. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  1452. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  1453. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  1454. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  1455. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  1456. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  1457. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  1458. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  1459. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  1460. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  1461. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  1462. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  1463. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  1464. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  1465. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  1466. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  1467. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  1468. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  1469. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  1470. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  1471. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  1472. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  1473. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  1474. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  1475. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  1476. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  1477. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  1478. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  1479. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  1480. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  1481. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  1482. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  1483. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  1484. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  1485. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  1486. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  1487. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  1488. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  1489. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  1490. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  1491. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  1492. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  1493. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  1494. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  1495. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  1496. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  1497. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  1498. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  1499. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  1500. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  1501. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  1502. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  1503. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  1504. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  1505. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  1506. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  1507. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  1508. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  1509. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  1510. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  1511. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  1512. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  1513. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  1514. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  1515. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  1516. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  1517. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  1518. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  1519. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  1520. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  1521. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  1522. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  1523. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  1524. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  1525. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  1526. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  1527. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  1528. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  1529. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  1530. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  1531. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  1532. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  1533. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  1534. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  1535. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  1536. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  1537. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  1538. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  1539. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  1540. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  1541. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  1542. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  1543. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  1544. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  1545. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  1546. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  1547. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  1548. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  1549. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  1550. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  1551. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  1552. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  1553. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  1554. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  1555. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  1556. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  1557. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  1558. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  1559. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  1560. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  1561. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  1562. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  1563. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  1564. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  1565. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  1566. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  1567. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  1568. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  1569. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  1570. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  1571. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  1572. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  1573. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  1574. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  1575. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  1576. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  1577. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  1578. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  1579. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  1580. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  1581. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  1582. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  1583. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  1584. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  1585. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1586. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1587. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1588. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1589. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1590. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1591. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1592. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1593. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1594. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1595. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1596. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1597. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1598. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1599. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1600. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1601. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1602. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1603. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1604. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1605. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1606. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1607. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1608. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1609. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1610. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1611. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1612. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1613. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1614. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1615. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1616. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1617. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1618. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1619. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1620. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1621. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1622. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1623. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1624. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1625. function ivprog(input) {
  1626. antlr4.Lexer.call(this, input);
  1627. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1628. return this;
  1629. }
  1630. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1631. ivprog.prototype.constructor = ivprog;
  1632. ivprog.EOF = antlr4.Token.EOF;
  1633. ivprog.RK_PROGRAM = 1;
  1634. ivprog.RK_REAL = 2;
  1635. ivprog.RK_VOID = 3;
  1636. ivprog.RK_BOOLEAN = 4;
  1637. ivprog.RK_STRING = 5;
  1638. ivprog.RK_INTEGER = 6;
  1639. ivprog.RK_CHARACTER = 7;
  1640. ivprog.RK_SWITCH = 8;
  1641. ivprog.RK_CASE = 9;
  1642. ivprog.RK_DEFAULT = 10;
  1643. ivprog.RK_CONST = 11;
  1644. ivprog.RK_FUNCTION = 12;
  1645. ivprog.RK_RETURN = 13;
  1646. ivprog.RK_FOR = 14;
  1647. ivprog.RK_BREAK = 15;
  1648. ivprog.RK_DO = 16;
  1649. ivprog.RK_WHILE = 17;
  1650. ivprog.RK_IF = 18;
  1651. ivprog.RK_ELSE = 19;
  1652. ivprog.RK_FALSE = 20;
  1653. ivprog.RK_TRUE = 21;
  1654. ivprog.OPEN_PARENTHESIS = 22;
  1655. ivprog.CLOSE_PARENTHESIS = 23;
  1656. ivprog.OPEN_BRACE = 24;
  1657. ivprog.CLOSE_BRACE = 25;
  1658. ivprog.OPEN_CURLY = 26;
  1659. ivprog.CLOSE_CURLY = 27;
  1660. ivprog.COMMA = 28;
  1661. ivprog.EQUAL = 29;
  1662. ivprog.SUM_OP = 30;
  1663. ivprog.MULTI_OP = 31;
  1664. ivprog.AND_OPERATOR = 32;
  1665. ivprog.OR_OPERATOR = 33;
  1666. ivprog.RELATIONAL_OPERATOR = 34;
  1667. ivprog.COLON = 35;
  1668. ivprog.NOT_OPERATOR = 36;
  1669. ivprog.ID = 37;
  1670. ivprog.LIB_ID = 38;
  1671. ivprog.INTEGER = 39;
  1672. ivprog.REAL = 40;
  1673. ivprog.STRING = 41;
  1674. ivprog.CHARACTER = 42;
  1675. ivprog.WHITESPACE = 43;
  1676. ivprog.EOS = 44;
  1677. ivprog.COMMENTS = 45;
  1678. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1679. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1680. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1681. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1682. "'escolha'", "'caso'", "'contrario'",
  1683. "'const'", "'funcao'", "'retorne'", "'para'",
  1684. "'pare'", "'faca'", "'enquanto'", "'se'",
  1685. "'senao'", "'falso'", "'verdadeiro'",
  1686. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1687. "','", "'='", null, null, null, null,
  1688. null, "':'" ];
  1689. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1690. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1691. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1692. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1693. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1694. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1695. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1696. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1697. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1698. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1699. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1700. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1701. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1702. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1703. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1704. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1705. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1706. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1707. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1708. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1709. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1710. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1711. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1712. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1713. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1714. "STRING", "STRING_CHARACTER", "CHARACTER",
  1715. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1716. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1717. "COMMENTS" ];
  1718. ivprog.prototype.grammarFileName = "ivprog.g4";
  1719. exports.ivprog = ivprog;
  1720. /***/ }),
  1721. /* 1 */
  1722. /***/ (function(module, exports, __webpack_require__) {
  1723. module.exports = {
  1724. ivprog: __webpack_require__(0).ivprog
  1725. };
  1726. /***/ }),
  1727. /* 2 */
  1728. /***/ (function(module, exports) {
  1729. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1730. /***/ })
  1731. /******/ ]);
  1732. /***/ }),
  1733. /***/ "./grammar/pt/langFunctions.js":
  1734. /*!*************************************!*\
  1735. !*** ./grammar/pt/langFunctions.js ***!
  1736. \*************************************/
  1737. /*! no static exports found */
  1738. /***/ (function(module, exports, __webpack_require__) {
  1739. "use strict";
  1740. Object.defineProperty(exports, "__esModule", {
  1741. value: true
  1742. });
  1743. /* This is a dictionary of the language defined functions
  1744. **/
  1745. exports.default = {
  1746. main_function: "inicio",
  1747. $read: "leia",
  1748. $write: "escreva",
  1749. $numElements: "numero_elementos",
  1750. $matrixLines: "matriz_linhas",
  1751. $matrixColumns: "matriz_colunas",
  1752. $substring: "subcadeia",
  1753. $length: "comprimento",
  1754. $uppercase: "caixa_alta",
  1755. $lowercase: "caixa_baixa",
  1756. $charAt: "char_at",
  1757. $isReal: "e_real",
  1758. $isInt: "e_inteiro",
  1759. $isBool: "e_logico",
  1760. $castReal: "como_real",
  1761. $castInt: "como_inteiro",
  1762. $castBool: "como_logico",
  1763. $castString: "como_cadeia",
  1764. $sin: "sen",
  1765. $cos: "cos",
  1766. $tan: "tan",
  1767. $sqrt: "raiz_quadrada",
  1768. $pow: "pot",
  1769. $log: "log",
  1770. $abs: "modulo",
  1771. $negate: "trocar_sinal",
  1772. $invert: "inverter_valor",
  1773. $max: "maximo",
  1774. $min: "minimo"
  1775. };
  1776. /***/ }),
  1777. /***/ "./grammar/pt/langLibs.js":
  1778. /*!********************************!*\
  1779. !*** ./grammar/pt/langLibs.js ***!
  1780. \********************************/
  1781. /*! no static exports found */
  1782. /***/ (function(module, exports, __webpack_require__) {
  1783. "use strict";
  1784. Object.defineProperty(exports, "__esModule", {
  1785. value: true
  1786. });
  1787. /**
  1788. * This is the dictionary of the language defined libraries
  1789. */
  1790. exports.default = {
  1791. $mathLib: "Matematica",
  1792. $ioLib: "ES",
  1793. $strLib: "Texto",
  1794. $arrayLib: "Arranjo",
  1795. $langLib: "IV"
  1796. };
  1797. /***/ }),
  1798. /***/ "./i18n/en/error.json":
  1799. /*!****************************!*\
  1800. !*** ./i18n/en/error.json ***!
  1801. \****************************/
  1802. /*! 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 */
  1803. /***/ (function(module) {
  1804. 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"};
  1805. /***/ }),
  1806. /***/ "./i18n/en/index.js":
  1807. /*!**************************!*\
  1808. !*** ./i18n/en/index.js ***!
  1809. \**************************/
  1810. /*! no static exports found */
  1811. /***/ (function(module, exports, __webpack_require__) {
  1812. "use strict";
  1813. Object.defineProperty(exports, "__esModule", {
  1814. value: true
  1815. });
  1816. var _error = __webpack_require__(/*! ./error.json */ "./i18n/en/error.json");
  1817. var _error2 = _interopRequireDefault(_error);
  1818. var _message = __webpack_require__(/*! ./message.json */ "./i18n/en/message.json");
  1819. var _message2 = _interopRequireDefault(_message);
  1820. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/en/ui.json");
  1821. var _ui2 = _interopRequireDefault(_ui);
  1822. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1823. exports.default = {
  1824. 'message': _message2.default,
  1825. 'error': _error2.default,
  1826. 'ui': _ui2.default
  1827. };
  1828. /***/ }),
  1829. /***/ "./i18n/en/message.json":
  1830. /*!******************************!*\
  1831. !*** ./i18n/en/message.json ***!
  1832. \******************************/
  1833. /*! exports provided: default */
  1834. /***/ (function(module) {
  1835. module.exports = {};
  1836. /***/ }),
  1837. /***/ "./i18n/en/ui.json":
  1838. /*!*************************!*\
  1839. !*** ./i18n/en/ui.json ***!
  1840. \*************************/
  1841. /*! 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_command_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, var_menu_select_var, var_menu_select_all, var_menu_select_function, default */
  1842. /***/ (function(module) {
  1843. 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_command_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","var_menu_select_var":"Select a var","var_menu_select_all":"Select","var_menu_select_function":"Select a function"};
  1844. /***/ }),
  1845. /***/ "./i18n/es/error.json":
  1846. /*!****************************!*\
  1847. !*** ./i18n/es/error.json ***!
  1848. \****************************/
  1849. /*! exports provided: default */
  1850. /***/ (function(module) {
  1851. module.exports = {};
  1852. /***/ }),
  1853. /***/ "./i18n/es/index.js":
  1854. /*!**************************!*\
  1855. !*** ./i18n/es/index.js ***!
  1856. \**************************/
  1857. /*! no static exports found */
  1858. /***/ (function(module, exports, __webpack_require__) {
  1859. "use strict";
  1860. Object.defineProperty(exports, "__esModule", {
  1861. value: true
  1862. });
  1863. var _error = __webpack_require__(/*! ./error.json */ "./i18n/es/error.json");
  1864. var _error2 = _interopRequireDefault(_error);
  1865. var _message = __webpack_require__(/*! ./message.json */ "./i18n/es/message.json");
  1866. var _message2 = _interopRequireDefault(_message);
  1867. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/es/ui.json");
  1868. var _ui2 = _interopRequireDefault(_ui);
  1869. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1870. exports.default = {
  1871. 'message': _message2.default,
  1872. 'error': _error2.default,
  1873. 'ui': _ui2.default
  1874. };
  1875. /***/ }),
  1876. /***/ "./i18n/es/message.json":
  1877. /*!******************************!*\
  1878. !*** ./i18n/es/message.json ***!
  1879. \******************************/
  1880. /*! exports provided: default */
  1881. /***/ (function(module) {
  1882. module.exports = {};
  1883. /***/ }),
  1884. /***/ "./i18n/es/ui.json":
  1885. /*!*************************!*\
  1886. !*** ./i18n/es/ui.json ***!
  1887. \*************************/
  1888. /*! 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_command_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, var_menu_select_var, var_menu_select_all, var_menu_select_function, default */
  1889. /***/ (function(module) {
  1890. 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_command_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","var_menu_select_var":"Select a var","var_menu_select_all":"Select","var_menu_select_function":"Select a function"};
  1891. /***/ }),
  1892. /***/ "./i18n/index.js":
  1893. /*!***********************!*\
  1894. !*** ./i18n/index.js ***!
  1895. \***********************/
  1896. /*! no static exports found */
  1897. /***/ (function(module, exports, __webpack_require__) {
  1898. "use strict";
  1899. Object.defineProperty(exports, "__esModule", {
  1900. value: true
  1901. });
  1902. var _en = __webpack_require__(/*! ./en */ "./i18n/en/index.js");
  1903. var _en2 = _interopRequireDefault(_en);
  1904. var _pt = __webpack_require__(/*! ./pt */ "./i18n/pt/index.js");
  1905. var _pt2 = _interopRequireDefault(_pt);
  1906. var _es = __webpack_require__(/*! ./es */ "./i18n/es/index.js");
  1907. var _es2 = _interopRequireDefault(_es);
  1908. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1909. exports.default = {
  1910. 'en': _en2.default,
  1911. 'pt': _pt2.default,
  1912. 'es': _es2.default
  1913. };
  1914. /***/ }),
  1915. /***/ "./i18n/pt/error.json":
  1916. /*!****************************!*\
  1917. !*** ./i18n/pt/error.json ***!
  1918. \****************************/
  1919. /*! 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 */
  1920. /***/ (function(module) {
  1921. 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"};
  1922. /***/ }),
  1923. /***/ "./i18n/pt/index.js":
  1924. /*!**************************!*\
  1925. !*** ./i18n/pt/index.js ***!
  1926. \**************************/
  1927. /*! no static exports found */
  1928. /***/ (function(module, exports, __webpack_require__) {
  1929. "use strict";
  1930. Object.defineProperty(exports, "__esModule", {
  1931. value: true
  1932. });
  1933. var _error = __webpack_require__(/*! ./error.json */ "./i18n/pt/error.json");
  1934. var _error2 = _interopRequireDefault(_error);
  1935. var _message = __webpack_require__(/*! ./message.json */ "./i18n/pt/message.json");
  1936. var _message2 = _interopRequireDefault(_message);
  1937. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/pt/ui.json");
  1938. var _ui2 = _interopRequireDefault(_ui);
  1939. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1940. exports.default = {
  1941. 'message': _message2.default,
  1942. 'error': _error2.default,
  1943. 'ui': _ui2.default
  1944. };
  1945. /***/ }),
  1946. /***/ "./i18n/pt/message.json":
  1947. /*!******************************!*\
  1948. !*** ./i18n/pt/message.json ***!
  1949. \******************************/
  1950. /*! exports provided: default */
  1951. /***/ (function(module) {
  1952. module.exports = {};
  1953. /***/ }),
  1954. /***/ "./i18n/pt/ui.json":
  1955. /*!*************************!*\
  1956. !*** ./i18n/pt/ui.json ***!
  1957. \*************************/
  1958. /*! 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_command_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, var_menu_select_var, var_menu_select_all, var_menu_select_function, default */
  1959. /***/ (function(module) {
  1960. 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":"faca","text_command_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","var_menu_select_var":"Selecione uma variável","var_menu_select_all":"Selecione","var_menu_select_function":"Selecione uma função"};
  1961. /***/ }),
  1962. /***/ "./js/assessment/ivprogAssessment.js":
  1963. /*!*******************************************!*\
  1964. !*** ./js/assessment/ivprogAssessment.js ***!
  1965. \*******************************************/
  1966. /*! no static exports found */
  1967. /***/ (function(module, exports, __webpack_require__) {
  1968. "use strict";
  1969. Object.defineProperty(exports, "__esModule", {
  1970. value: true
  1971. });
  1972. exports.IVProgAssessment = undefined;
  1973. 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; }; }();
  1974. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  1975. var _semanticAnalyser = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  1976. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  1977. var _inputTest = __webpack_require__(/*! ./../util/inputTest */ "./js/util/inputTest.js");
  1978. var _outputTest = __webpack_require__(/*! ./../util/outputTest */ "./js/util/outputTest.js");
  1979. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1980. var IVProgAssessment = exports.IVProgAssessment = function () {
  1981. function IVProgAssessment(textCode, testCases, domConsole) {
  1982. _classCallCheck(this, IVProgAssessment);
  1983. this.textCode = textCode;
  1984. this.testCases = testCases;
  1985. this.domConsole = domConsole;
  1986. }
  1987. _createClass(IVProgAssessment, [{
  1988. key: "runTest",
  1989. value: function runTest() {
  1990. var _this = this;
  1991. try {
  1992. // try and show error messages through domconsole
  1993. var parser = _ivprogParser.IVProgParser.createParser(this.textCode);
  1994. var semantic = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  1995. var validTree = semantic.analyseTree();
  1996. // loop test cases and show messages through domconsole
  1997. var partialTests = this.testCases.map(function (t, name) {
  1998. return _this.partialEvaluateTestCase(new _ivprogProcessor.IVProgProcessor(validTree), t.input, t.output, name);
  1999. });
  2000. var testResult = partialTests.reduce(function (acc, curr) {
  2001. return acc.then(function (v) {
  2002. return curr(v);
  2003. });
  2004. }, Promise.resolve(0));
  2005. return testResult.then(function (total) {
  2006. return Promise.resolve(total / _this.testCases.length);
  2007. }).catch(function (err) {
  2008. _this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  2009. _this.domConsole.err(err.message);
  2010. return Promise.resolve(0);
  2011. });
  2012. } catch (error) {
  2013. this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  2014. this.domConsole.err(error.message);
  2015. return Promise.resolve(0);
  2016. }
  2017. }
  2018. }, {
  2019. key: "evaluateTestCase",
  2020. value: function evaluateTestCase(prog, inputList, outputList, name, accumulator) {
  2021. var outerThis = this;
  2022. var input = new _inputTest.InputTest(inputList);
  2023. var output = new _outputTest.OutputTest();
  2024. prog.registerInput(input);
  2025. prog.registerOutput(output);
  2026. var startTime = Date.now();
  2027. return prog.interpretAST().then(function (_) {
  2028. var millis = Date.now() - startTime;
  2029. if (input.inputList.length !== input.index) {
  2030. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou, ainda restam entradas!");
  2031. outerThis.domConsole.info("Levou " + millis + "ms");
  2032. return Promise.resolve(accumulator + 1 * (input.index / inputList.length));
  2033. } else if (output.list.length < outputList.length) {
  2034. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  2035. outerThis.domConsole.info("Levou " + millis + "ms");
  2036. return Promise.resolve(accumulator + 1 * (output.list.length / outputList.length));
  2037. } else if (output.list.length > outputList.length) {
  2038. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  2039. outerThis.domConsole.info("Levou " + millis + "ms");
  2040. return Promise.resolve(accumulator + 1 * (outputList.length / output.list.length));
  2041. } else {
  2042. var isOk = outerThis.checkOutput(output.list, outputList);
  2043. if (!isOk) {
  2044. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  2045. outerThis.domConsole.info("Levou " + millis + "ms");
  2046. return Promise.resolve(accumulator);
  2047. } else {
  2048. outerThis.domConsole.info("Caso de teste " + (name + 1) + ": OK!");
  2049. outerThis.domConsole.info("Levou " + millis + "ms");
  2050. return Promise.resolve(accumulator + 1);
  2051. }
  2052. }
  2053. }).catch(function (_) {
  2054. return Promise.resolve(accumulator);
  2055. });
  2056. }
  2057. }, {
  2058. key: "partialEvaluateTestCase",
  2059. value: function partialEvaluateTestCase(prog, inputList, outputList, name) {
  2060. var _this2 = this;
  2061. var partial = function partial(accumulator) {
  2062. return _this2.evaluateTestCase(prog, inputList, outputList, name, accumulator);
  2063. };
  2064. partial.bind(this);
  2065. return partial;
  2066. }
  2067. }, {
  2068. key: "checkOutput",
  2069. value: function checkOutput(aList, bList) {
  2070. for (var i = 0; i < aList.length; i++) {
  2071. var outValue = aList[i];
  2072. if (outValue != bList[i]) {
  2073. return false;
  2074. }
  2075. }
  2076. return true;
  2077. }
  2078. }]);
  2079. return IVProgAssessment;
  2080. }();
  2081. /***/ }),
  2082. /***/ "./js/ast/commands/arrayAssign.js":
  2083. /*!****************************************!*\
  2084. !*** ./js/ast/commands/arrayAssign.js ***!
  2085. \****************************************/
  2086. /*! no static exports found */
  2087. /***/ (function(module, exports, __webpack_require__) {
  2088. "use strict";
  2089. Object.defineProperty(exports, "__esModule", {
  2090. value: true
  2091. });
  2092. exports.ArrayIndexAssign = undefined;
  2093. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  2094. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2095. 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; }
  2096. 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; }
  2097. var ArrayIndexAssign = exports.ArrayIndexAssign = function (_Assign) {
  2098. _inherits(ArrayIndexAssign, _Assign);
  2099. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  2100. _classCallCheck(this, ArrayIndexAssign);
  2101. var _this = _possibleConstructorReturn(this, (ArrayIndexAssign.__proto__ || Object.getPrototypeOf(ArrayIndexAssign)).call(this, id, expression));
  2102. _this.line = lineExpression;
  2103. _this.column = columnExpression;
  2104. return _this;
  2105. }
  2106. return ArrayIndexAssign;
  2107. }(_assign.Assign);
  2108. /***/ }),
  2109. /***/ "./js/ast/commands/arrayDeclaration.js":
  2110. /*!*********************************************!*\
  2111. !*** ./js/ast/commands/arrayDeclaration.js ***!
  2112. \*********************************************/
  2113. /*! no static exports found */
  2114. /***/ (function(module, exports, __webpack_require__) {
  2115. "use strict";
  2116. Object.defineProperty(exports, "__esModule", {
  2117. value: true
  2118. });
  2119. exports.ArrayDeclaration = undefined;
  2120. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  2121. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2122. 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; }
  2123. 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; }
  2124. var ArrayDeclaration = exports.ArrayDeclaration = function (_Declaration) {
  2125. _inherits(ArrayDeclaration, _Declaration);
  2126. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  2127. _classCallCheck(this, ArrayDeclaration);
  2128. var _this = _possibleConstructorReturn(this, (ArrayDeclaration.__proto__ || Object.getPrototypeOf(ArrayDeclaration)).call(this, id, type, initial, isConst));
  2129. _this.lines = lines;
  2130. _this.columns = columns;
  2131. return _this;
  2132. }
  2133. return ArrayDeclaration;
  2134. }(_declaration.Declaration);
  2135. /***/ }),
  2136. /***/ "./js/ast/commands/assign.js":
  2137. /*!***********************************!*\
  2138. !*** ./js/ast/commands/assign.js ***!
  2139. \***********************************/
  2140. /*! no static exports found */
  2141. /***/ (function(module, exports, __webpack_require__) {
  2142. "use strict";
  2143. Object.defineProperty(exports, "__esModule", {
  2144. value: true
  2145. });
  2146. exports.Assign = undefined;
  2147. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2148. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2149. 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; }
  2150. 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; }
  2151. var Assign = exports.Assign = function (_Command) {
  2152. _inherits(Assign, _Command);
  2153. function Assign(id, expression) {
  2154. _classCallCheck(this, Assign);
  2155. var _this = _possibleConstructorReturn(this, (Assign.__proto__ || Object.getPrototypeOf(Assign)).call(this));
  2156. _this.id = id;
  2157. _this.expression = expression;
  2158. return _this;
  2159. }
  2160. return Assign;
  2161. }(_command.Command);
  2162. /***/ }),
  2163. /***/ "./js/ast/commands/break.js":
  2164. /*!**********************************!*\
  2165. !*** ./js/ast/commands/break.js ***!
  2166. \**********************************/
  2167. /*! no static exports found */
  2168. /***/ (function(module, exports, __webpack_require__) {
  2169. "use strict";
  2170. Object.defineProperty(exports, "__esModule", {
  2171. value: true
  2172. });
  2173. exports.Break = undefined;
  2174. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2175. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2176. 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; }
  2177. 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; }
  2178. var Break = exports.Break = function (_Command) {
  2179. _inherits(Break, _Command);
  2180. function Break() {
  2181. _classCallCheck(this, Break);
  2182. return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).call(this));
  2183. }
  2184. return Break;
  2185. }(_command.Command);
  2186. /***/ }),
  2187. /***/ "./js/ast/commands/case.js":
  2188. /*!*********************************!*\
  2189. !*** ./js/ast/commands/case.js ***!
  2190. \*********************************/
  2191. /*! no static exports found */
  2192. /***/ (function(module, exports, __webpack_require__) {
  2193. "use strict";
  2194. Object.defineProperty(exports, "__esModule", {
  2195. value: true
  2196. });
  2197. exports.Case = undefined;
  2198. 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; }; }();
  2199. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2200. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2201. 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; }
  2202. 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; }
  2203. var Case = exports.Case = function (_Command) {
  2204. _inherits(Case, _Command);
  2205. function Case(expression) {
  2206. _classCallCheck(this, Case);
  2207. var _this = _possibleConstructorReturn(this, (Case.__proto__ || Object.getPrototypeOf(Case)).call(this));
  2208. _this.expression = expression;
  2209. _this.commands = [];
  2210. return _this;
  2211. }
  2212. _createClass(Case, [{
  2213. key: 'setCommands',
  2214. value: function setCommands(commands) {
  2215. this.commands = commands;
  2216. }
  2217. }, {
  2218. key: 'isDefault',
  2219. get: function get() {
  2220. return this.expression === null;
  2221. }
  2222. }]);
  2223. return Case;
  2224. }(_command.Command);
  2225. /***/ }),
  2226. /***/ "./js/ast/commands/command.js":
  2227. /*!************************************!*\
  2228. !*** ./js/ast/commands/command.js ***!
  2229. \************************************/
  2230. /*! no static exports found */
  2231. /***/ (function(module, exports, __webpack_require__) {
  2232. "use strict";
  2233. Object.defineProperty(exports, "__esModule", {
  2234. value: true
  2235. });
  2236. 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; }; }();
  2237. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2238. var Command = exports.Command = function () {
  2239. function Command() {
  2240. _classCallCheck(this, Command);
  2241. this._sourceInfo = null;
  2242. }
  2243. _createClass(Command, [{
  2244. key: "sourceInfo",
  2245. set: function set(sourceInfo) {
  2246. this._sourceInfo = sourceInfo;
  2247. },
  2248. get: function get() {
  2249. return this._sourceInfo;
  2250. }
  2251. }]);
  2252. return Command;
  2253. }();
  2254. /***/ }),
  2255. /***/ "./js/ast/commands/commandBlock.js":
  2256. /*!*****************************************!*\
  2257. !*** ./js/ast/commands/commandBlock.js ***!
  2258. \*****************************************/
  2259. /*! no static exports found */
  2260. /***/ (function(module, exports, __webpack_require__) {
  2261. "use strict";
  2262. Object.defineProperty(exports, "__esModule", {
  2263. value: true
  2264. });
  2265. 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; }; }();
  2266. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2267. var CommandBlock = exports.CommandBlock = function () {
  2268. function CommandBlock(variables, commands) {
  2269. _classCallCheck(this, CommandBlock);
  2270. this.variables = variables;
  2271. this.commands = commands;
  2272. this._sourceInfo = null;
  2273. }
  2274. _createClass(CommandBlock, [{
  2275. key: "sourceInfo",
  2276. set: function set(sourceInfo) {
  2277. this._sourceInfo = sourceInfo;
  2278. },
  2279. get: function get() {
  2280. return this._sourceInfo;
  2281. }
  2282. }]);
  2283. return CommandBlock;
  2284. }();
  2285. /***/ }),
  2286. /***/ "./js/ast/commands/declaration.js":
  2287. /*!****************************************!*\
  2288. !*** ./js/ast/commands/declaration.js ***!
  2289. \****************************************/
  2290. /*! no static exports found */
  2291. /***/ (function(module, exports, __webpack_require__) {
  2292. "use strict";
  2293. Object.defineProperty(exports, "__esModule", {
  2294. value: true
  2295. });
  2296. exports.Declaration = undefined;
  2297. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2298. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2299. 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; }
  2300. 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; }
  2301. var Declaration = exports.Declaration = function (_Command) {
  2302. _inherits(Declaration, _Command);
  2303. function Declaration(id, type, initial, isConst) {
  2304. _classCallCheck(this, Declaration);
  2305. var _this = _possibleConstructorReturn(this, (Declaration.__proto__ || Object.getPrototypeOf(Declaration)).call(this));
  2306. _this.id = id;
  2307. _this.type = type;
  2308. _this.initial = initial;
  2309. _this.isConst = isConst;
  2310. return _this;
  2311. }
  2312. return Declaration;
  2313. }(_command.Command);
  2314. /***/ }),
  2315. /***/ "./js/ast/commands/doWhile.js":
  2316. /*!************************************!*\
  2317. !*** ./js/ast/commands/doWhile.js ***!
  2318. \************************************/
  2319. /*! no static exports found */
  2320. /***/ (function(module, exports, __webpack_require__) {
  2321. "use strict";
  2322. Object.defineProperty(exports, "__esModule", {
  2323. value: true
  2324. });
  2325. exports.DoWhile = undefined;
  2326. 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; }; }();
  2327. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  2328. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2329. 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; }
  2330. 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; }
  2331. var DoWhile = exports.DoWhile = function (_While) {
  2332. _inherits(DoWhile, _While);
  2333. function DoWhile(condition, commandBlock) {
  2334. _classCallCheck(this, DoWhile);
  2335. return _possibleConstructorReturn(this, (DoWhile.__proto__ || Object.getPrototypeOf(DoWhile)).call(this, condition, commandBlock));
  2336. }
  2337. _createClass(DoWhile, [{
  2338. key: 'testFirst',
  2339. get: function get() {
  2340. return false;
  2341. }
  2342. }]);
  2343. return DoWhile;
  2344. }(_while.While);
  2345. /***/ }),
  2346. /***/ "./js/ast/commands/for.js":
  2347. /*!********************************!*\
  2348. !*** ./js/ast/commands/for.js ***!
  2349. \********************************/
  2350. /*! no static exports found */
  2351. /***/ (function(module, exports, __webpack_require__) {
  2352. "use strict";
  2353. Object.defineProperty(exports, "__esModule", {
  2354. value: true
  2355. });
  2356. exports.For = undefined;
  2357. 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; }; }();
  2358. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2359. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2360. 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; }
  2361. 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; }
  2362. var For = exports.For = function (_Command) {
  2363. _inherits(For, _Command);
  2364. function For(assignment, condition, increment, commandBlock) {
  2365. _classCallCheck(this, For);
  2366. var _this = _possibleConstructorReturn(this, (For.__proto__ || Object.getPrototypeOf(For)).call(this));
  2367. _this.assignment = assignment;
  2368. _this.condition = condition;
  2369. _this.increment = increment;
  2370. _this.commandBlock = commandBlock;
  2371. return _this;
  2372. }
  2373. _createClass(For, [{
  2374. key: 'commands',
  2375. get: function get() {
  2376. return this.commandBlock.commands;
  2377. }
  2378. }]);
  2379. return For;
  2380. }(_command.Command);
  2381. /***/ }),
  2382. /***/ "./js/ast/commands/formalParameter.js":
  2383. /*!********************************************!*\
  2384. !*** ./js/ast/commands/formalParameter.js ***!
  2385. \********************************************/
  2386. /*! no static exports found */
  2387. /***/ (function(module, exports, __webpack_require__) {
  2388. "use strict";
  2389. Object.defineProperty(exports, "__esModule", {
  2390. value: true
  2391. });
  2392. 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; }; }();
  2393. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2394. var FormalParameter = exports.FormalParameter = function () {
  2395. function FormalParameter(type, id) {
  2396. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  2397. _classCallCheck(this, FormalParameter);
  2398. this.type = type;
  2399. this.id = id;
  2400. this.byRef = byRef;
  2401. this._sourceInfo = null;
  2402. }
  2403. _createClass(FormalParameter, [{
  2404. key: "sourceInfo",
  2405. set: function set(sourceInfo) {
  2406. this._sourceInfo = sourceInfo;
  2407. },
  2408. get: function get() {
  2409. return this._sourceInfo;
  2410. }
  2411. }]);
  2412. return FormalParameter;
  2413. }();
  2414. /***/ }),
  2415. /***/ "./js/ast/commands/function.js":
  2416. /*!*************************************!*\
  2417. !*** ./js/ast/commands/function.js ***!
  2418. \*************************************/
  2419. /*! no static exports found */
  2420. /***/ (function(module, exports, __webpack_require__) {
  2421. "use strict";
  2422. Object.defineProperty(exports, "__esModule", {
  2423. value: true
  2424. });
  2425. exports.Function = undefined;
  2426. 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; }; }();
  2427. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  2428. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2429. var Function = exports.Function = function () {
  2430. function Function(name, returnType, formalParameters, commandBlock) {
  2431. _classCallCheck(this, Function);
  2432. this.name = name;
  2433. this.returnType = returnType;
  2434. this.formalParameters = formalParameters;
  2435. this.commandBlock = commandBlock;
  2436. this._sourceInfo = null;
  2437. }
  2438. _createClass(Function, [{
  2439. key: 'isMain',
  2440. get: function get() {
  2441. return this.name === null && this.returnType.isCompatible(_types.Types.VOID);
  2442. }
  2443. }, {
  2444. key: 'commands',
  2445. get: function get() {
  2446. return this.commandBlock.commands;
  2447. }
  2448. }, {
  2449. key: 'variablesDeclarations',
  2450. get: function get() {
  2451. return this.commandBlock.variables;
  2452. }
  2453. }, {
  2454. key: 'sourceInfo',
  2455. set: function set(sourceInfo) {
  2456. this._sourceInfo = sourceInfo;
  2457. },
  2458. get: function get() {
  2459. return this._sourceInfo;
  2460. }
  2461. }]);
  2462. return Function;
  2463. }();
  2464. /***/ }),
  2465. /***/ "./js/ast/commands/ifThenElse.js":
  2466. /*!***************************************!*\
  2467. !*** ./js/ast/commands/ifThenElse.js ***!
  2468. \***************************************/
  2469. /*! no static exports found */
  2470. /***/ (function(module, exports, __webpack_require__) {
  2471. "use strict";
  2472. Object.defineProperty(exports, "__esModule", {
  2473. value: true
  2474. });
  2475. exports.IfThenElse = undefined;
  2476. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2477. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2478. 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; }
  2479. 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; }
  2480. var IfThenElse = exports.IfThenElse = function (_Command) {
  2481. _inherits(IfThenElse, _Command);
  2482. function IfThenElse(condition, ifTrue, ifFalse) {
  2483. _classCallCheck(this, IfThenElse);
  2484. var _this = _possibleConstructorReturn(this, (IfThenElse.__proto__ || Object.getPrototypeOf(IfThenElse)).call(this));
  2485. _this.condition = condition;
  2486. _this.ifTrue = ifTrue;
  2487. _this.ifFalse = ifFalse;
  2488. return _this;
  2489. }
  2490. return IfThenElse;
  2491. }(_command.Command);
  2492. /***/ }),
  2493. /***/ "./js/ast/commands/index.js":
  2494. /*!**********************************!*\
  2495. !*** ./js/ast/commands/index.js ***!
  2496. \**********************************/
  2497. /*! no static exports found */
  2498. /***/ (function(module, exports, __webpack_require__) {
  2499. "use strict";
  2500. Object.defineProperty(exports, "__esModule", {
  2501. value: true
  2502. });
  2503. 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;
  2504. var _break = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  2505. var _return = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  2506. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  2507. var _arrayAssign = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  2508. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  2509. var _arrayDeclaration = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  2510. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  2511. var _for = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  2512. var _function = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  2513. var _ifThenElse = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  2514. var _commandBlock = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  2515. var _doWhile = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js");
  2516. var _switch = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  2517. var _case = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  2518. var _sysCall = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  2519. var _formalParameter = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  2520. var _functionCall = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  2521. //Proxy to expression since they do exatcly the same thing
  2522. exports.Break = _break.Break;
  2523. exports.Return = _return.Return;
  2524. exports.Assign = _assign.Assign;
  2525. exports.ArrayIndexAssign = _arrayAssign.ArrayIndexAssign;
  2526. exports.Declaration = _declaration.Declaration;
  2527. exports.ArrayDeclaration = _arrayDeclaration.ArrayDeclaration;
  2528. exports.While = _while.While;
  2529. exports.For = _for.For;
  2530. exports.Function = _function.Function;
  2531. exports.IfThenElse = _ifThenElse.IfThenElse;
  2532. exports.CommandBlock = _commandBlock.CommandBlock;
  2533. exports.DoWhile = _doWhile.DoWhile;
  2534. exports.Switch = _switch.Switch;
  2535. exports.Case = _case.Case;
  2536. exports.SysCall = _sysCall.SysCall;
  2537. exports.FormalParameter = _formalParameter.FormalParameter;
  2538. exports.FunctionCall = _functionCall.FunctionCall;
  2539. /***/ }),
  2540. /***/ "./js/ast/commands/return.js":
  2541. /*!***********************************!*\
  2542. !*** ./js/ast/commands/return.js ***!
  2543. \***********************************/
  2544. /*! no static exports found */
  2545. /***/ (function(module, exports, __webpack_require__) {
  2546. "use strict";
  2547. Object.defineProperty(exports, "__esModule", {
  2548. value: true
  2549. });
  2550. exports.Return = undefined;
  2551. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2552. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2553. 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; }
  2554. 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; }
  2555. var Return = exports.Return = function (_Command) {
  2556. _inherits(Return, _Command);
  2557. function Return(expression) {
  2558. _classCallCheck(this, Return);
  2559. var _this = _possibleConstructorReturn(this, (Return.__proto__ || Object.getPrototypeOf(Return)).call(this));
  2560. _this.expression = expression;
  2561. return _this;
  2562. }
  2563. return Return;
  2564. }(_command.Command);
  2565. /***/ }),
  2566. /***/ "./js/ast/commands/switch.js":
  2567. /*!***********************************!*\
  2568. !*** ./js/ast/commands/switch.js ***!
  2569. \***********************************/
  2570. /*! no static exports found */
  2571. /***/ (function(module, exports, __webpack_require__) {
  2572. "use strict";
  2573. Object.defineProperty(exports, "__esModule", {
  2574. value: true
  2575. });
  2576. exports.Switch = undefined;
  2577. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2578. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2579. 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; }
  2580. 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; }
  2581. var Switch = exports.Switch = function (_Command) {
  2582. _inherits(Switch, _Command);
  2583. function Switch(expression, cases) {
  2584. _classCallCheck(this, Switch);
  2585. var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this));
  2586. _this.expression = expression;
  2587. _this.cases = cases;
  2588. return _this;
  2589. }
  2590. return Switch;
  2591. }(_command.Command);
  2592. /***/ }),
  2593. /***/ "./js/ast/commands/sysCall.js":
  2594. /*!************************************!*\
  2595. !*** ./js/ast/commands/sysCall.js ***!
  2596. \************************************/
  2597. /*! no static exports found */
  2598. /***/ (function(module, exports, __webpack_require__) {
  2599. "use strict";
  2600. Object.defineProperty(exports, "__esModule", {
  2601. value: true
  2602. });
  2603. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2604. /**
  2605. * This class represents all the language defined functions.
  2606. * The language processor uses the id provided here to properly execute the desired function.
  2607. * The function is actually implemented inside the language processor.
  2608. * All the functions can be found at: js/processor/definedFunctions.js
  2609. */
  2610. var SysCall = exports.SysCall = function SysCall(langFunc) {
  2611. _classCallCheck(this, SysCall);
  2612. this.langFunc = langFunc;
  2613. };
  2614. /***/ }),
  2615. /***/ "./js/ast/commands/while.js":
  2616. /*!**********************************!*\
  2617. !*** ./js/ast/commands/while.js ***!
  2618. \**********************************/
  2619. /*! no static exports found */
  2620. /***/ (function(module, exports, __webpack_require__) {
  2621. "use strict";
  2622. Object.defineProperty(exports, "__esModule", {
  2623. value: true
  2624. });
  2625. exports.While = undefined;
  2626. 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; }; }();
  2627. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2628. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2629. 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; }
  2630. 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; }
  2631. var While = exports.While = function (_Command) {
  2632. _inherits(While, _Command);
  2633. function While(expression, commandBlock) {
  2634. _classCallCheck(this, While);
  2635. var _this = _possibleConstructorReturn(this, (While.__proto__ || Object.getPrototypeOf(While)).call(this));
  2636. _this.expression = expression;
  2637. _this.commandBlock = commandBlock;
  2638. return _this;
  2639. }
  2640. _createClass(While, [{
  2641. key: 'commands',
  2642. get: function get() {
  2643. return this.commandBlock.commands;
  2644. }
  2645. }, {
  2646. key: 'testFirst',
  2647. get: function get() {
  2648. return true;
  2649. }
  2650. }]);
  2651. return While;
  2652. }(_command.Command);
  2653. /***/ }),
  2654. /***/ "./js/ast/error/syntaxError.js":
  2655. /*!*************************************!*\
  2656. !*** ./js/ast/error/syntaxError.js ***!
  2657. \*************************************/
  2658. /*! no static exports found */
  2659. /***/ (function(module, exports, __webpack_require__) {
  2660. "use strict";
  2661. Object.defineProperty(exports, "__esModule", {
  2662. value: true
  2663. });
  2664. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2665. 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; }
  2666. 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; }
  2667. var SyntaxError = exports.SyntaxError = function (_Error) {
  2668. _inherits(SyntaxError, _Error);
  2669. function SyntaxError() {
  2670. var _ref;
  2671. _classCallCheck(this, SyntaxError);
  2672. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  2673. msg[_key] = arguments[_key];
  2674. }
  2675. var _this = _possibleConstructorReturn(this, (_ref = SyntaxError.__proto__ || Object.getPrototypeOf(SyntaxError)).call.apply(_ref, [this].concat(msg)));
  2676. if (Error.captureStackTrace) Error.captureStackTrace(_this, SyntaxError);
  2677. return _this;
  2678. }
  2679. return SyntaxError;
  2680. }(Error);
  2681. /***/ }),
  2682. /***/ "./js/ast/error/syntaxErrorFactory.js":
  2683. /*!********************************************!*\
  2684. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  2685. \********************************************/
  2686. /*! no static exports found */
  2687. /***/ (function(module, exports, __webpack_require__) {
  2688. "use strict";
  2689. Object.defineProperty(exports, "__esModule", {
  2690. value: true
  2691. });
  2692. exports.SyntaxErrorFactory = undefined;
  2693. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  2694. var _syntaxError = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  2695. var SyntaxErrorFactory = exports.SyntaxErrorFactory = Object.freeze({
  2696. extra_lines: function extra_lines() {
  2697. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("extra_lines"));
  2698. },
  2699. token_missing_one: function token_missing_one(expected, token) {
  2700. var context = [expected, token.text, token.line, token.column];
  2701. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("token_missing_one", context));
  2702. },
  2703. token_missing_list: function token_missing_list(expectedList, token) {
  2704. var line = expectedList.join(_localizedStringsService.LocalizedStrings.getOR());
  2705. return SyntaxErrorFactory.token_missing_one(line, token);
  2706. },
  2707. id_missing: function id_missing(token) {
  2708. var context = [token.text, token.line, token.column];
  2709. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("id_missing", context));
  2710. },
  2711. eos_missing: function eos_missing(token) {
  2712. var context = [token.line, token.column];
  2713. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("eos_missing", context));
  2714. },
  2715. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  2716. var context = [token.line, token.column, typeName];
  2717. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_dimension", context));
  2718. },
  2719. invalid_array_size: function invalid_array_size(token) {
  2720. var context = [token.line];
  2721. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_size", context));
  2722. },
  2723. invalid_main_return: function invalid_main_return(name, typeName, token) {
  2724. var context = [name, typeName, token.line];
  2725. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_main_return", context));
  2726. },
  2727. invalid_var_declaration: function invalid_var_declaration(token) {
  2728. var context = [token.line];
  2729. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_var_declaration", context));
  2730. },
  2731. invalid_break_command: function invalid_break_command(cmdName, token) {
  2732. var context = [token.line, cmdName];
  2733. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_break_command", context));
  2734. },
  2735. invalid_terminal: function invalid_terminal() {
  2736. var context = [token.text, token.line, token.column];
  2737. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError('invalid_terminal', context));
  2738. },
  2739. invalid_type: function invalid_type(list, token) {
  2740. var line = list.join(_localizedStringsService.LocalizedStrings.getOR());
  2741. var context = [token.text, token.line, token.column, line];
  2742. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_type", context));
  2743. },
  2744. const_not_init: function const_not_init(token) {
  2745. var context = [token.line, token.column];
  2746. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("const_not_init", context));
  2747. },
  2748. invalid_id_format: function invalid_id_format(token) {
  2749. var context = [token.text, token.line, token.column];
  2750. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_id_format", context));
  2751. }
  2752. });
  2753. /***/ }),
  2754. /***/ "./js/ast/expressions/arrayAccess.js":
  2755. /*!*******************************************!*\
  2756. !*** ./js/ast/expressions/arrayAccess.js ***!
  2757. \*******************************************/
  2758. /*! no static exports found */
  2759. /***/ (function(module, exports, __webpack_require__) {
  2760. "use strict";
  2761. Object.defineProperty(exports, "__esModule", {
  2762. value: true
  2763. });
  2764. exports.ArrayAccess = undefined;
  2765. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  2766. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2767. 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; }
  2768. 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; }
  2769. var ArrayAccess = exports.ArrayAccess = function (_Expression) {
  2770. _inherits(ArrayAccess, _Expression);
  2771. function ArrayAccess(id, line, column) {
  2772. _classCallCheck(this, ArrayAccess);
  2773. var _this = _possibleConstructorReturn(this, (ArrayAccess.__proto__ || Object.getPrototypeOf(ArrayAccess)).call(this));
  2774. _this.id = id;
  2775. _this.line = line;
  2776. _this.column = column;
  2777. return _this;
  2778. }
  2779. return ArrayAccess;
  2780. }(_expression.Expression);
  2781. /***/ }),
  2782. /***/ "./js/ast/expressions/arrayLiteral.js":
  2783. /*!********************************************!*\
  2784. !*** ./js/ast/expressions/arrayLiteral.js ***!
  2785. \********************************************/
  2786. /*! no static exports found */
  2787. /***/ (function(module, exports, __webpack_require__) {
  2788. "use strict";
  2789. Object.defineProperty(exports, "__esModule", {
  2790. value: true
  2791. });
  2792. exports.ArrayLiteral = undefined;
  2793. 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; }; }();
  2794. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  2795. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2796. 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; }
  2797. 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; }
  2798. var ArrayLiteral = exports.ArrayLiteral = function (_Literal) {
  2799. _inherits(ArrayLiteral, _Literal);
  2800. function ArrayLiteral(type, value) {
  2801. _classCallCheck(this, ArrayLiteral);
  2802. var _this = _possibleConstructorReturn(this, (ArrayLiteral.__proto__ || Object.getPrototypeOf(ArrayLiteral)).call(this, type));
  2803. _this.value = value;
  2804. return _this;
  2805. }
  2806. _createClass(ArrayLiteral, [{
  2807. key: 'validateType',
  2808. value: function validateType() {
  2809. // let valid = true;
  2810. // if(this.columns !== null) {
  2811. // const len = this.columns;
  2812. // const len2 = this.lines;
  2813. // for (let i = len - 1; i >= 0; i--) {
  2814. // for (let j = len2 - 1; j >= 0; j--) {
  2815. // if(this.value[i].value[j].type !== this.subtype) {
  2816. // valid = false;
  2817. // break;
  2818. // }
  2819. // }
  2820. // }
  2821. // } else {
  2822. // const len = this.lines;
  2823. // for (var i = len - 1; i >= 0; i--) {
  2824. // if(this.value[i].type !== this.subtype) {
  2825. // valid = false;
  2826. // break;
  2827. // }
  2828. // }
  2829. // }
  2830. return true; //valid;
  2831. }
  2832. }, {
  2833. key: 'validateSize',
  2834. value: function validateSize() {
  2835. var valid = true;
  2836. if (this.columns !== null) {
  2837. var equalityTest = data.value.map(function (v) {
  2838. return v.length;
  2839. }).reduce(function (old, next) {
  2840. if (old === null) {
  2841. return next;
  2842. } else if (old === next) {
  2843. return old;
  2844. } else {
  2845. return -1;
  2846. }
  2847. }, null);
  2848. valid = equalityTest !== -1;
  2849. }
  2850. return valid;
  2851. }
  2852. }, {
  2853. key: 'subtype',
  2854. get: function get() {
  2855. var element = this.value[0];
  2856. if (element instanceof ArrayLiteral) {
  2857. return element.value[0].type;
  2858. } else {
  2859. return element.type;
  2860. }
  2861. }
  2862. }, {
  2863. key: 'lines',
  2864. get: function get() {
  2865. return this.value.length;
  2866. }
  2867. }, {
  2868. key: 'columns',
  2869. get: function get() {
  2870. var element = this.value[0];
  2871. if (!(element instanceof ArrayLiteral)) {
  2872. return null;
  2873. } else {
  2874. return element.value[0].value.length;
  2875. }
  2876. }
  2877. }, {
  2878. key: 'isVector',
  2879. get: function get() {
  2880. return this.columns === null;
  2881. }
  2882. }, {
  2883. key: 'isValid',
  2884. get: function get() {
  2885. return true; //this.validateType() && this.validateSize();
  2886. }
  2887. }]);
  2888. return ArrayLiteral;
  2889. }(_literal.Literal);
  2890. /***/ }),
  2891. /***/ "./js/ast/expressions/boolLiteral.js":
  2892. /*!*******************************************!*\
  2893. !*** ./js/ast/expressions/boolLiteral.js ***!
  2894. \*******************************************/
  2895. /*! no static exports found */
  2896. /***/ (function(module, exports, __webpack_require__) {
  2897. "use strict";
  2898. Object.defineProperty(exports, "__esModule", {
  2899. value: true
  2900. });
  2901. exports.BoolLiteral = undefined;
  2902. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  2903. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  2904. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2905. 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; }
  2906. 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; }
  2907. var BoolLiteral = exports.BoolLiteral = function (_Literal) {
  2908. _inherits(BoolLiteral, _Literal);
  2909. function BoolLiteral(value) {
  2910. _classCallCheck(this, BoolLiteral);
  2911. var _this = _possibleConstructorReturn(this, (BoolLiteral.__proto__ || Object.getPrototypeOf(BoolLiteral)).call(this, _types.Types.BOOLEAN));
  2912. _this.value = value;
  2913. return _this;
  2914. }
  2915. return BoolLiteral;
  2916. }(_literal.Literal);
  2917. /***/ }),
  2918. /***/ "./js/ast/expressions/expression.js":
  2919. /*!******************************************!*\
  2920. !*** ./js/ast/expressions/expression.js ***!
  2921. \******************************************/
  2922. /*! no static exports found */
  2923. /***/ (function(module, exports, __webpack_require__) {
  2924. "use strict";
  2925. Object.defineProperty(exports, "__esModule", {
  2926. value: true
  2927. });
  2928. 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; }; }();
  2929. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2930. var Expression = exports.Expression = function () {
  2931. function Expression() {
  2932. _classCallCheck(this, Expression);
  2933. this._sourceInfo = null;
  2934. }
  2935. _createClass(Expression, [{
  2936. key: "sourceInfo",
  2937. set: function set(sourceInfo) {
  2938. this._sourceInfo = sourceInfo;
  2939. },
  2940. get: function get() {
  2941. return this._sourceInfo;
  2942. }
  2943. }]);
  2944. return Expression;
  2945. }();
  2946. /***/ }),
  2947. /***/ "./js/ast/expressions/functionCall.js":
  2948. /*!********************************************!*\
  2949. !*** ./js/ast/expressions/functionCall.js ***!
  2950. \********************************************/
  2951. /*! no static exports found */
  2952. /***/ (function(module, exports, __webpack_require__) {
  2953. "use strict";
  2954. Object.defineProperty(exports, "__esModule", {
  2955. value: true
  2956. });
  2957. exports.FunctionCall = undefined;
  2958. 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; }; }();
  2959. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  2960. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2961. 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; }
  2962. 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; }
  2963. var FunctionCall = exports.FunctionCall = function (_Expression) {
  2964. _inherits(FunctionCall, _Expression);
  2965. function FunctionCall(id, actualParameters) {
  2966. _classCallCheck(this, FunctionCall);
  2967. var _this = _possibleConstructorReturn(this, (FunctionCall.__proto__ || Object.getPrototypeOf(FunctionCall)).call(this));
  2968. _this.id = id;
  2969. _this.actualParameters = actualParameters;
  2970. return _this;
  2971. }
  2972. _createClass(FunctionCall, [{
  2973. key: 'parametersSize',
  2974. get: function get() {
  2975. return this.actualParameters.length;
  2976. }
  2977. }]);
  2978. return FunctionCall;
  2979. }(_expression.Expression);
  2980. /***/ }),
  2981. /***/ "./js/ast/expressions/index.js":
  2982. /*!*************************************!*\
  2983. !*** ./js/ast/expressions/index.js ***!
  2984. \*************************************/
  2985. /*! no static exports found */
  2986. /***/ (function(module, exports, __webpack_require__) {
  2987. "use strict";
  2988. Object.defineProperty(exports, "__esModule", {
  2989. value: true
  2990. });
  2991. exports.UnaryApp = exports.InfixApp = exports.VariableLiteral = exports.ArrayLiteral = exports.StringLiteral = exports.BoolLiteral = exports.RealLiteral = exports.IntLiteral = exports.FunctionCall = exports.ArrayAccess = undefined;
  2992. var _arrayAccess = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  2993. var _functionCall = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  2994. var _intLiteral = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  2995. var _realLiteral = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  2996. var _boolLiteral = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  2997. var _stringLiteral = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  2998. var _arrayLiteral = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  2999. var _variableLiteral = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  3000. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  3001. var _unaryApp = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  3002. exports.ArrayAccess = _arrayAccess.ArrayAccess;
  3003. exports.FunctionCall = _functionCall.FunctionCall;
  3004. exports.IntLiteral = _intLiteral.IntLiteral;
  3005. exports.RealLiteral = _realLiteral.RealLiteral;
  3006. exports.BoolLiteral = _boolLiteral.BoolLiteral;
  3007. exports.StringLiteral = _stringLiteral.StringLiteral;
  3008. exports.ArrayLiteral = _arrayLiteral.ArrayLiteral;
  3009. exports.VariableLiteral = _variableLiteral.VariableLiteral;
  3010. exports.InfixApp = _infixApp.InfixApp;
  3011. exports.UnaryApp = _unaryApp.UnaryApp;
  3012. /***/ }),
  3013. /***/ "./js/ast/expressions/infixApp.js":
  3014. /*!****************************************!*\
  3015. !*** ./js/ast/expressions/infixApp.js ***!
  3016. \****************************************/
  3017. /*! no static exports found */
  3018. /***/ (function(module, exports, __webpack_require__) {
  3019. "use strict";
  3020. Object.defineProperty(exports, "__esModule", {
  3021. value: true
  3022. });
  3023. exports.InfixApp = undefined;
  3024. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  3025. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3026. 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; }
  3027. 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; }
  3028. var InfixApp = exports.InfixApp = function (_Expression) {
  3029. _inherits(InfixApp, _Expression);
  3030. function InfixApp(op, left, right) {
  3031. _classCallCheck(this, InfixApp);
  3032. var _this = _possibleConstructorReturn(this, (InfixApp.__proto__ || Object.getPrototypeOf(InfixApp)).call(this));
  3033. _this.op = op;
  3034. _this.left = left;
  3035. _this.right = right;
  3036. return _this;
  3037. }
  3038. return InfixApp;
  3039. }(_expression.Expression);
  3040. /***/ }),
  3041. /***/ "./js/ast/expressions/intLiteral.js":
  3042. /*!******************************************!*\
  3043. !*** ./js/ast/expressions/intLiteral.js ***!
  3044. \******************************************/
  3045. /*! no static exports found */
  3046. /***/ (function(module, exports, __webpack_require__) {
  3047. "use strict";
  3048. Object.defineProperty(exports, "__esModule", {
  3049. value: true
  3050. });
  3051. exports.IntLiteral = undefined;
  3052. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3053. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3054. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3055. 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; }
  3056. 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; }
  3057. var IntLiteral = exports.IntLiteral = function (_Literal) {
  3058. _inherits(IntLiteral, _Literal);
  3059. function IntLiteral(value) {
  3060. _classCallCheck(this, IntLiteral);
  3061. var _this = _possibleConstructorReturn(this, (IntLiteral.__proto__ || Object.getPrototypeOf(IntLiteral)).call(this, _types.Types.INTEGER));
  3062. _this.value = value;
  3063. return _this;
  3064. }
  3065. return IntLiteral;
  3066. }(_literal.Literal);
  3067. /***/ }),
  3068. /***/ "./js/ast/expressions/literal.js":
  3069. /*!***************************************!*\
  3070. !*** ./js/ast/expressions/literal.js ***!
  3071. \***************************************/
  3072. /*! no static exports found */
  3073. /***/ (function(module, exports, __webpack_require__) {
  3074. "use strict";
  3075. Object.defineProperty(exports, "__esModule", {
  3076. value: true
  3077. });
  3078. exports.Literal = undefined;
  3079. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  3080. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3081. 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; }
  3082. 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; }
  3083. var Literal = exports.Literal = function (_Expression) {
  3084. _inherits(Literal, _Expression);
  3085. function Literal(type) {
  3086. _classCallCheck(this, Literal);
  3087. var _this = _possibleConstructorReturn(this, (Literal.__proto__ || Object.getPrototypeOf(Literal)).call(this));
  3088. _this.type = type;
  3089. return _this;
  3090. }
  3091. return Literal;
  3092. }(_expression.Expression);
  3093. /***/ }),
  3094. /***/ "./js/ast/expressions/realLiteral.js":
  3095. /*!*******************************************!*\
  3096. !*** ./js/ast/expressions/realLiteral.js ***!
  3097. \*******************************************/
  3098. /*! no static exports found */
  3099. /***/ (function(module, exports, __webpack_require__) {
  3100. "use strict";
  3101. Object.defineProperty(exports, "__esModule", {
  3102. value: true
  3103. });
  3104. exports.RealLiteral = undefined;
  3105. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3106. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3107. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3108. 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; }
  3109. 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; }
  3110. var RealLiteral = exports.RealLiteral = function (_Literal) {
  3111. _inherits(RealLiteral, _Literal);
  3112. function RealLiteral(value) {
  3113. _classCallCheck(this, RealLiteral);
  3114. var _this = _possibleConstructorReturn(this, (RealLiteral.__proto__ || Object.getPrototypeOf(RealLiteral)).call(this, _types.Types.REAL));
  3115. _this.value = value;
  3116. return _this;
  3117. }
  3118. return RealLiteral;
  3119. }(_literal.Literal);
  3120. /***/ }),
  3121. /***/ "./js/ast/expressions/stringLiteral.js":
  3122. /*!*********************************************!*\
  3123. !*** ./js/ast/expressions/stringLiteral.js ***!
  3124. \*********************************************/
  3125. /*! no static exports found */
  3126. /***/ (function(module, exports, __webpack_require__) {
  3127. "use strict";
  3128. Object.defineProperty(exports, "__esModule", {
  3129. value: true
  3130. });
  3131. exports.StringLiteral = undefined;
  3132. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3133. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3134. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3135. 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; }
  3136. 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; }
  3137. var StringLiteral = exports.StringLiteral = function (_Literal) {
  3138. _inherits(StringLiteral, _Literal);
  3139. function StringLiteral(value) {
  3140. _classCallCheck(this, StringLiteral);
  3141. var _this = _possibleConstructorReturn(this, (StringLiteral.__proto__ || Object.getPrototypeOf(StringLiteral)).call(this, _types.Types.STRING));
  3142. _this.value = value;
  3143. return _this;
  3144. }
  3145. return StringLiteral;
  3146. }(_literal.Literal);
  3147. /***/ }),
  3148. /***/ "./js/ast/expressions/unaryApp.js":
  3149. /*!****************************************!*\
  3150. !*** ./js/ast/expressions/unaryApp.js ***!
  3151. \****************************************/
  3152. /*! no static exports found */
  3153. /***/ (function(module, exports, __webpack_require__) {
  3154. "use strict";
  3155. Object.defineProperty(exports, "__esModule", {
  3156. value: true
  3157. });
  3158. exports.UnaryApp = undefined;
  3159. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  3160. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3161. 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; }
  3162. 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; }
  3163. var UnaryApp = exports.UnaryApp = function (_InfixApp) {
  3164. _inherits(UnaryApp, _InfixApp);
  3165. function UnaryApp(op, left) {
  3166. _classCallCheck(this, UnaryApp);
  3167. return _possibleConstructorReturn(this, (UnaryApp.__proto__ || Object.getPrototypeOf(UnaryApp)).call(this, op, left, null));
  3168. }
  3169. return UnaryApp;
  3170. }(_infixApp.InfixApp);
  3171. /***/ }),
  3172. /***/ "./js/ast/expressions/variableLiteral.js":
  3173. /*!***********************************************!*\
  3174. !*** ./js/ast/expressions/variableLiteral.js ***!
  3175. \***********************************************/
  3176. /*! no static exports found */
  3177. /***/ (function(module, exports, __webpack_require__) {
  3178. "use strict";
  3179. Object.defineProperty(exports, "__esModule", {
  3180. value: true
  3181. });
  3182. exports.VariableLiteral = undefined;
  3183. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3184. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3185. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3186. 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; }
  3187. 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; }
  3188. var VariableLiteral = exports.VariableLiteral = function (_Literal) {
  3189. _inherits(VariableLiteral, _Literal);
  3190. function VariableLiteral(id) {
  3191. _classCallCheck(this, VariableLiteral);
  3192. var _this = _possibleConstructorReturn(this, (VariableLiteral.__proto__ || Object.getPrototypeOf(VariableLiteral)).call(this, _types.Types.UNDEFINED));
  3193. _this.id = id;
  3194. return _this;
  3195. }
  3196. return VariableLiteral;
  3197. }(_literal.Literal);
  3198. /***/ }),
  3199. /***/ "./js/ast/ivprogParser.js":
  3200. /*!********************************!*\
  3201. !*** ./js/ast/ivprogParser.js ***!
  3202. \********************************/
  3203. /*! no static exports found */
  3204. /***/ (function(module, exports, __webpack_require__) {
  3205. "use strict";
  3206. Object.defineProperty(exports, "__esModule", {
  3207. value: true
  3208. });
  3209. exports.IVProgParser = undefined;
  3210. 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; }; }();
  3211. var _index = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  3212. var _expressions = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js");
  3213. var Expressions = _interopRequireWildcard(_expressions);
  3214. var _commands = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js");
  3215. var Commands = _interopRequireWildcard(_commands);
  3216. var _parsers = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  3217. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  3218. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  3219. var _sourceInfo2 = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  3220. var _operators = __webpack_require__(/*! ./operators */ "./js/ast/operators.js");
  3221. var _syntaxErrorFactory = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  3222. var _definedFunctions = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  3223. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  3224. 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; } }
  3225. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3226. var IVProgParser = exports.IVProgParser = function () {
  3227. _createClass(IVProgParser, null, [{
  3228. key: 'createParser',
  3229. value: function createParser(input) {
  3230. var lexerClass = _languageService.LanguageService.getCurrentLexer();
  3231. return new IVProgParser(input, lexerClass);
  3232. }
  3233. // <BEGIN scope consts>
  3234. }, {
  3235. key: 'BASE',
  3236. get: function get() {
  3237. return 0;
  3238. }
  3239. }, {
  3240. key: 'FUNCTION',
  3241. get: function get() {
  3242. return 1;
  3243. }
  3244. }, {
  3245. key: 'COMMAND',
  3246. get: function get() {
  3247. return 2;
  3248. }
  3249. }, {
  3250. key: 'BREAKABLE',
  3251. get: function get() {
  3252. return 4;
  3253. }
  3254. // </ END scope consts>
  3255. }]);
  3256. function IVProgParser(input, lexerClass) {
  3257. _classCallCheck(this, IVProgParser);
  3258. this.lexerClass = lexerClass;
  3259. this.lexer = new lexerClass(new _index.InputStream(input));
  3260. this.tokenStream = new _index.CommonTokenStream(this.lexer);
  3261. this.tokenStream.fill();
  3262. this.pos = 1;
  3263. this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING];
  3264. this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID);
  3265. this.parsingArrayDimension = 0;
  3266. this.scope = [];
  3267. this.langFuncs = _languageService.LanguageService.getCurrentLangFuncs();
  3268. }
  3269. _createClass(IVProgParser, [{
  3270. key: 'parseTree',
  3271. value: function parseTree() {
  3272. return this.parseProgram();
  3273. }
  3274. }, {
  3275. key: 'getToken',
  3276. value: function getToken() {
  3277. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  3278. // if(index === null)
  3279. // index = this.pos;
  3280. return this.tokenStream.LT(index);
  3281. }
  3282. }, {
  3283. key: 'insideScope',
  3284. value: function insideScope(scope) {
  3285. if (this.scope.length <= 0) {
  3286. return IVProgParser.BASE === scope;
  3287. } else {
  3288. return this.scope[this.scope.length - 1] === scope;
  3289. }
  3290. }
  3291. }, {
  3292. key: 'pushScope',
  3293. value: function pushScope(scope) {
  3294. this.scope.push(scope);
  3295. }
  3296. }, {
  3297. key: 'popScope',
  3298. value: function popScope() {
  3299. return this.scope.pop();
  3300. }
  3301. }, {
  3302. key: 'isEOF',
  3303. value: function isEOF() {
  3304. this.getToken(this.pos);
  3305. return this.tokenStream.fetchedEOF;
  3306. }
  3307. }, {
  3308. key: 'parseProgram',
  3309. value: function parseProgram() {
  3310. var token = this.getToken();
  3311. var globalVars = [];
  3312. var functions = [];
  3313. if (this.lexerClass.RK_PROGRAM === token.type) {
  3314. this.pos++;
  3315. this.consumeNewLines();
  3316. this.checkOpenCurly();
  3317. this.pos++;
  3318. while (true) {
  3319. this.consumeNewLines();
  3320. var _token = this.getToken();
  3321. if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) {
  3322. globalVars = globalVars.concat(this.parseGlobalVariables());
  3323. } else if (_token.type === this.lexerClass.RK_FUNCTION) {
  3324. functions = functions.concat(this.parseFunction());
  3325. } else {
  3326. break;
  3327. }
  3328. }
  3329. this.consumeNewLines();
  3330. this.checkCloseCurly();
  3331. this.pos++;
  3332. this.consumeNewLines();
  3333. if (!this.isEOF()) {
  3334. throw _syntaxErrorFactory.SyntaxErrorFactory.extra_lines();
  3335. }
  3336. return { global: globalVars, functions: functions };
  3337. } else {
  3338. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token);
  3339. }
  3340. }
  3341. }, {
  3342. key: 'checkOpenCurly',
  3343. value: function checkOpenCurly() {
  3344. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3345. var token = this.getToken();
  3346. if (this.lexerClass.OPEN_CURLY !== token.type) {
  3347. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('{', token);else return false;
  3348. }
  3349. return true;
  3350. }
  3351. }, {
  3352. key: 'checkCloseCurly',
  3353. value: function checkCloseCurly() {
  3354. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3355. var token = this.getToken();
  3356. if (this.lexerClass.CLOSE_CURLY !== token.type) {
  3357. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('}', token);else return false;
  3358. }
  3359. return true;
  3360. }
  3361. /* It checks if the current token at position pos is a ']'.
  3362. * As a check function it doesn't increment pos.
  3363. *
  3364. * @params bool:attempt, indicates that the token is optional. Defaults: false
  3365. *
  3366. * @returns true if the attempt is true and current token is '[',
  3367. * false is attempt is true and current token is not '['
  3368. **/
  3369. }, {
  3370. key: 'checkOpenBrace',
  3371. value: function checkOpenBrace() {
  3372. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3373. var token = this.getToken();
  3374. if (this.lexerClass.OPEN_BRACE !== token.type) {
  3375. if (!attempt) {
  3376. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('[', token);
  3377. } else {
  3378. return false;
  3379. }
  3380. }
  3381. return true;
  3382. }
  3383. }, {
  3384. key: 'checkCloseBrace',
  3385. value: function checkCloseBrace() {
  3386. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3387. var token = this.getToken();
  3388. if (this.lexerClass.CLOSE_BRACE !== token.type) {
  3389. if (!attempt) {
  3390. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(']', token);
  3391. } else {
  3392. return false;
  3393. }
  3394. }
  3395. return true;
  3396. }
  3397. }, {
  3398. key: 'checkOpenParenthesis',
  3399. value: function checkOpenParenthesis() {
  3400. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3401. var token = this.getToken();
  3402. if (this.lexerClass.OPEN_PARENTHESIS !== token.type) {
  3403. if (!attempt) {
  3404. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('(', token);
  3405. } else {
  3406. return false;
  3407. }
  3408. }
  3409. return true;
  3410. }
  3411. }, {
  3412. key: 'checkCloseParenthesis',
  3413. value: function checkCloseParenthesis() {
  3414. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3415. var token = this.getToken();
  3416. if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) {
  3417. if (!attempt) {
  3418. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(')', token);
  3419. } else {
  3420. return false;
  3421. }
  3422. }
  3423. return true;
  3424. }
  3425. }, {
  3426. key: 'checkEOS',
  3427. value: function checkEOS() {
  3428. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3429. var eosToken = this.getToken();
  3430. if (eosToken.type !== this.lexerClass.EOS) {
  3431. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.eos_missing(eosToken);else return false;
  3432. }
  3433. return true;
  3434. }
  3435. }, {
  3436. key: 'consumeForSemiColon',
  3437. value: function consumeForSemiColon() {
  3438. var eosToken = this.getToken();
  3439. if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
  3440. this.pos++;
  3441. return;
  3442. }
  3443. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(';', eosToken);
  3444. }
  3445. }, {
  3446. key: 'parseGlobalVariables',
  3447. value: function parseGlobalVariables() {
  3448. var decl = this.parseMaybeConst();
  3449. this.checkEOS();
  3450. this.pos++;
  3451. return decl;
  3452. }
  3453. /*
  3454. * Checks if the next token is PR_CONST. It's only available
  3455. * at global variables declaration level
  3456. * @returns Declararion(const, type, id, initVal?)
  3457. **/
  3458. }, {
  3459. key: 'parseMaybeConst',
  3460. value: function parseMaybeConst() {
  3461. var constToken = this.getToken();
  3462. if (constToken.type === this.lexerClass.RK_CONST) {
  3463. this.pos++;
  3464. var typeString = this.parseType();
  3465. return this.parseDeclaration(typeString, true);
  3466. } else if (this.isVariableType(constToken)) {
  3467. var _typeString = this.parseType();
  3468. return this.parseDeclaration(_typeString);
  3469. } else {
  3470. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken);
  3471. }
  3472. }
  3473. /*
  3474. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  3475. * @returns a list of Declararion(const, type, id, initVal?)
  3476. **/
  3477. }, {
  3478. key: 'parseDeclaration',
  3479. value: function parseDeclaration(typeString) {
  3480. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  3481. var initial = null;
  3482. var dim1 = null;
  3483. var dim2 = null;
  3484. var idToken = this.getToken();
  3485. var idString = this.parseID();
  3486. // Check for array or vector
  3487. // ID[int/IDi][int/IDj]
  3488. if (this.checkOpenBrace(true)) {
  3489. this.pos++;
  3490. this.consumeNewLines();
  3491. dim1 = this.parseArrayDimension();
  3492. this.consumeNewLines();
  3493. this.checkCloseBrace();
  3494. this.pos++;
  3495. if (this.checkOpenBrace(true)) {
  3496. this.pos++;
  3497. this.consumeNewLines();
  3498. dim2 = this.parseArrayDimension();
  3499. this.consumeNewLines();
  3500. this.checkCloseBrace();
  3501. this.pos++;
  3502. }
  3503. }
  3504. var equalsToken = this.getToken();
  3505. if (isConst && equalsToken.type !== this.lexerClass.EQUAL) {
  3506. throw _syntaxErrorFactory.SyntaxErrorFactory.const_not_init(idToken);
  3507. }
  3508. if (equalsToken.type === this.lexerClass.EQUAL) {
  3509. this.pos++;
  3510. initial = this.parseExpressionOR();
  3511. }
  3512. var declaration = null;
  3513. var dimensions = 0;
  3514. if (dim1 !== null) {
  3515. dimensions++;
  3516. if (dim2 !== null) {
  3517. dimensions++;
  3518. }
  3519. declaration = new Commands.ArrayDeclaration(idString, new _compoundType.CompoundType(typeString, dimensions), dim1, dim2, initial, isConst);
  3520. } else {
  3521. declaration = new Commands.Declaration(idString, typeString, initial, isConst);
  3522. }
  3523. declaration.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(idToken);
  3524. var commaToken = this.getToken();
  3525. if (commaToken.type === this.lexerClass.COMMA) {
  3526. this.pos++;
  3527. this.consumeNewLines();
  3528. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  3529. } else {
  3530. return [declaration];
  3531. }
  3532. }
  3533. }, {
  3534. key: 'consumeNewLines',
  3535. value: function consumeNewLines() {
  3536. var token = this.getToken();
  3537. while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) {
  3538. this.pos++;
  3539. token = this.getToken();
  3540. }
  3541. }
  3542. }, {
  3543. key: 'isVariableType',
  3544. value: function isVariableType(token) {
  3545. return this.variableTypes.find(function (v) {
  3546. return v === token.type;
  3547. });
  3548. }
  3549. /*
  3550. * Reads the next token of the stream to check if it is a Integer or an ID.
  3551. * @returns Integer | ID
  3552. **/
  3553. }, {
  3554. key: 'parseArrayDimension',
  3555. value: function parseArrayDimension() {
  3556. var dimToken = this.getToken();
  3557. if (dimToken.type === this.lexerClass.INTEGER) {
  3558. //parse as int literal
  3559. this.pos++;
  3560. return this.getIntLiteral(dimToken);
  3561. } else if (dimToken.type === this.lexerClass.ID) {
  3562. //parse as variable
  3563. this.pos++;
  3564. return this.parseVariable(dimToken);
  3565. } else {
  3566. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken);
  3567. }
  3568. }
  3569. /*
  3570. * Returns an object {type: 'int', value: value}.
  3571. * It checks for binary and hexadecimal integers.
  3572. * @returns object with fields type and value
  3573. **/
  3574. }, {
  3575. key: 'getIntLiteral',
  3576. value: function getIntLiteral(token) {
  3577. var text = token.text;
  3578. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  3579. var exp = new Expressions.IntLiteral((0, _parsers.toInt)(text));
  3580. exp.sourceInfo = sourceInfo;
  3581. return exp;
  3582. }
  3583. }, {
  3584. key: 'getRealLiteral',
  3585. value: function getRealLiteral(token) {
  3586. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  3587. var exp = new Expressions.RealLiteral((0, _parsers.toReal)(token.text));
  3588. exp.sourceInfo = sourceInfo;
  3589. return exp;
  3590. }
  3591. }, {
  3592. key: 'getStringLiteral',
  3593. value: function getStringLiteral(token) {
  3594. var text = token.text;
  3595. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  3596. var exp = new Expressions.StringLiteral((0, _parsers.toString)(text));
  3597. exp.sourceInfo = sourceInfo;
  3598. return exp;
  3599. }
  3600. }, {
  3601. key: 'getBoolLiteral',
  3602. value: function getBoolLiteral(token) {
  3603. var val = (0, _parsers.toBool)(token.text);
  3604. var exp = new Expressions.BoolLiteral(val);
  3605. exp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);;
  3606. return exp;
  3607. }
  3608. }, {
  3609. key: 'parseArrayLiteral',
  3610. value: function parseArrayLiteral() {
  3611. this.checkOpenCurly();
  3612. var beginArray = this.getToken();
  3613. if (this.parsingArrayDimension >= 2) {
  3614. // TODO: better error message
  3615. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list('Array dimensions exceed maximum size of 2 at line ' + beginArray.line);
  3616. }
  3617. this.pos++;
  3618. this.parsingArrayDimension++;
  3619. this.consumeNewLines();
  3620. var data = this.parseExpressionList();
  3621. this.consumeNewLines();
  3622. this.checkCloseCurly();
  3623. var endArray = this.getToken();
  3624. this.pos++;
  3625. this.parsingArrayDimension--;
  3626. if (this.parsingArrayDimension === 0) {
  3627. // if (!data.isValid) {
  3628. // // TODO: better error message
  3629. // console.log('invalid array');
  3630. // throw new Error(`Invalid array at line ${beginArray.line}`);
  3631. // }
  3632. }
  3633. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(beginArray, endArray);
  3634. var dataDim = 1;
  3635. if (data[0] instanceof Expressions.ArrayLiteral) {
  3636. dataDim++;
  3637. }
  3638. var type = new _compoundType.CompoundType(_types.Types.UNDEFINED, dataDim);
  3639. var exp = new Expressions.ArrayLiteral(type, data);
  3640. exp.sourceInfo = sourceInfo;
  3641. return exp;
  3642. }
  3643. /*
  3644. * Returns an object {type: 'variable', value: value}.
  3645. * @returns object with fields type and value
  3646. **/
  3647. }, {
  3648. key: 'parseVariable',
  3649. value: function parseVariable(token) {
  3650. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  3651. var exp = new Expressions.VariableLiteral(token.text);
  3652. exp.sourceInfo = sourceInfo;
  3653. return exp;
  3654. }
  3655. /*
  3656. * Returns an object representing a function. It has
  3657. * four attributes: returnType, id, formalParams and block.
  3658. * The block object has two attributes: declarations and commands
  3659. **/
  3660. }, {
  3661. key: 'parseFunction',
  3662. value: function parseFunction() {
  3663. this.pushScope(IVProgParser.FUNCTION);
  3664. var formalParams = [];
  3665. var token = this.getToken();
  3666. if (token.type !== this.lexerClass.RK_FUNCTION) {
  3667. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  3668. return null;
  3669. }
  3670. this.pos++;
  3671. var funType = this.parseType();
  3672. var dimensions = 0;
  3673. if (this.checkOpenBrace(true)) {
  3674. this.pos++;
  3675. this.checkCloseBrace();
  3676. this.pos++;
  3677. dimensions++;
  3678. if (this.checkOpenBrace(true)) {
  3679. this.pos++;
  3680. this.checkCloseBrace();
  3681. this.pos++;
  3682. dimensions++;
  3683. }
  3684. }
  3685. var functionID = this.parseID();
  3686. this.checkOpenParenthesis();
  3687. this.pos++;
  3688. this.consumeNewLines();
  3689. if (!this.checkCloseParenthesis(true)) {
  3690. formalParams = this.parseFormalParameters(); // formal parameters
  3691. this.consumeNewLines();
  3692. this.checkCloseParenthesis();
  3693. this.pos++;
  3694. } else {
  3695. this.pos++;
  3696. }
  3697. this.consumeNewLines();
  3698. var commandsBlock = this.parseCommandBlock();
  3699. var returnType = funType;
  3700. if (dimensions > 0) {
  3701. returnType = new _compoundType.CompoundType(funType, dimensions);
  3702. }
  3703. var func = new Commands.Function(functionID, returnType, formalParams, commandsBlock);
  3704. if (functionID === null && !func.isMain) {
  3705. // TODO: better error message
  3706. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_main_return(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line);
  3707. }
  3708. this.popScope();
  3709. return func;
  3710. }
  3711. /*
  3712. * Parse the formal parameters of a function.
  3713. * @returns a list of objects with the following attributes: type, id and dimensions.
  3714. **/
  3715. }, {
  3716. key: 'parseFormalParameters',
  3717. value: function parseFormalParameters() {
  3718. var list = [];
  3719. while (true) {
  3720. var dimensions = 0;
  3721. var typeString = this.parseType();
  3722. var idString = this.parseID();
  3723. if (this.checkOpenBrace(true)) {
  3724. this.pos++;
  3725. dimensions++;
  3726. this.checkCloseBrace();
  3727. this.pos++;
  3728. if (this.checkOpenBrace(true)) {
  3729. this.pos++;
  3730. dimensions++;
  3731. this.checkCloseBrace();
  3732. this.pos++;
  3733. }
  3734. }
  3735. var type = null;
  3736. if (dimensions > 0) {
  3737. type = new _compoundType.CompoundType(typeString, dimensions);
  3738. } else {
  3739. type = typeString;
  3740. }
  3741. list.push(new Commands.FormalParameter(type, idString));
  3742. var commaToken = this.getToken();
  3743. if (commaToken.type !== this.lexerClass.COMMA) break;
  3744. this.pos++;
  3745. this.consumeNewLines();
  3746. }
  3747. return list;
  3748. }
  3749. }, {
  3750. key: 'parseID',
  3751. value: function parseID() {
  3752. var token = this.getToken();
  3753. if (token.type !== this.lexerClass.ID) {
  3754. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  3755. }
  3756. this.pos++;
  3757. if (this.insideScope(IVProgParser.FUNCTION)) {
  3758. if (token.text === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  3759. return null;
  3760. }
  3761. }
  3762. return token.text;
  3763. }
  3764. }, {
  3765. key: 'parseMaybeLibID',
  3766. value: function parseMaybeLibID() {
  3767. var token = this.getToken();
  3768. if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) {
  3769. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  3770. }
  3771. this.pos++;
  3772. return token.text;
  3773. }
  3774. }, {
  3775. key: 'parseType',
  3776. value: function parseType() {
  3777. var token = this.getToken();
  3778. if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) {
  3779. return _types.Types.VOID;
  3780. } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  3781. this.pos++;
  3782. return _types.Types.VOID;
  3783. } else if (this.isVariableType(token)) {
  3784. this.pos++;
  3785. switch (token.type) {
  3786. case this.lexerClass.RK_INTEGER:
  3787. return _types.Types.INTEGER;
  3788. case this.lexerClass.RK_BOOLEAN:
  3789. return _types.Types.BOOLEAN;
  3790. case this.lexerClass.RK_REAL:
  3791. return _types.Types.REAL;
  3792. case this.lexerClass.RK_STRING:
  3793. return _types.Types.STRING;
  3794. default:
  3795. break;
  3796. }
  3797. }
  3798. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_type(this.getTypeArray(), token);
  3799. }
  3800. }, {
  3801. key: 'parseCommandBlock',
  3802. value: function parseCommandBlock() {
  3803. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3804. var variablesDecl = [];
  3805. var commands = [];
  3806. var hasOpen = false;
  3807. if (this.checkOpenCurly(optionalCurly)) {
  3808. this.pos++;
  3809. hasOpen = true;
  3810. }
  3811. this.consumeNewLines();
  3812. while (true) {
  3813. var cmd = this.parseCommand();
  3814. if (cmd === null) break;
  3815. if (cmd !== -1) {
  3816. if (cmd instanceof Array) {
  3817. variablesDecl = variablesDecl.concat(cmd);
  3818. } else {
  3819. commands.push(cmd);
  3820. }
  3821. }
  3822. }
  3823. this.consumeNewLines();
  3824. if (hasOpen) {
  3825. this.checkCloseCurly();
  3826. this.pos++;
  3827. this.consumeNewLines();
  3828. }
  3829. return new Commands.CommandBlock(variablesDecl, commands);
  3830. }
  3831. }, {
  3832. key: 'parseCommand',
  3833. value: function parseCommand() {
  3834. var token = this.getToken();
  3835. if (this.isVariableType(token)) {
  3836. if (!this.insideScope(IVProgParser.FUNCTION)) {
  3837. // TODO better error message
  3838. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_var_declaration(token.line);
  3839. }
  3840. this.pushScope(IVProgParser.BASE);
  3841. var varType = this.parseType();
  3842. this.popScope();
  3843. var cmd = this.parseDeclaration(varType);
  3844. this.checkEOS();
  3845. this.pos++;
  3846. return cmd;
  3847. } else if (token.type === this.lexerClass.ID) {
  3848. return this.parseIDCommand();
  3849. } else if (token.type === this.lexerClass.LIB_ID) {
  3850. return this.parseIDCommand();
  3851. } else if (token.type === this.lexerClass.RK_RETURN) {
  3852. return this.parseReturn();
  3853. } else if (token.type === this.lexerClass.RK_WHILE) {
  3854. return this.parseWhile();
  3855. } else if (token.type === this.lexerClass.RK_FOR) {
  3856. return this.parseFor();
  3857. } else if (token.type === this.lexerClass.RK_BREAK) {
  3858. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  3859. // TODO better error message
  3860. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token);
  3861. }
  3862. return this.parseBreak();
  3863. } else if (token.type === this.lexerClass.RK_SWITCH) {
  3864. return this.parseSwitchCase();
  3865. } else if (token.type === this.lexerClass.RK_DO) {
  3866. return this.parseDoWhile();
  3867. } else if (token.type === this.lexerClass.RK_IF) {
  3868. return this.parseIfThenElse();
  3869. } else if (this.checkEOS(true)) {
  3870. this.pos++;
  3871. return -1;
  3872. } else {
  3873. return null;
  3874. }
  3875. }
  3876. }, {
  3877. key: 'parseSwitchCase',
  3878. value: function parseSwitchCase() {
  3879. this.pushScope(IVProgParser.BREAKABLE);
  3880. this.pos++;
  3881. this.checkOpenParenthesis();
  3882. this.pos++;
  3883. this.consumeNewLines();
  3884. var exp = this.parseExpressionOR();
  3885. this.consumeNewLines();
  3886. this.checkCloseParenthesis();
  3887. this.pos++;
  3888. this.consumeNewLines();
  3889. this.checkOpenCurly();
  3890. this.pos++;
  3891. this.consumeNewLines();
  3892. var casesList = this.parseCases();
  3893. this.consumeNewLines();
  3894. this.checkCloseCurly();
  3895. this.pos++;
  3896. this.consumeNewLines();
  3897. this.popScope();
  3898. return new Commands.Switch(exp, casesList);
  3899. }
  3900. }, {
  3901. key: 'parseDoWhile',
  3902. value: function parseDoWhile() {
  3903. this.pos++;
  3904. this.consumeNewLines();
  3905. this.pushScope(IVProgParser.BREAKABLE);
  3906. var commandsBlock = this.parseCommandBlock();
  3907. this.consumeNewLines(); //Maybe not...
  3908. var whileToken = this.getToken();
  3909. if (whileToken.type !== this.lexerClass.RK_WHILE) {
  3910. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
  3911. }
  3912. this.pos++;
  3913. this.checkOpenParenthesis();
  3914. this.pos++;
  3915. this.consumeNewLines();
  3916. var condition = this.parseExpressionOR();
  3917. this.consumeNewLines();
  3918. this.checkCloseParenthesis();
  3919. this.pos++;
  3920. this.checkEOS();
  3921. this.popScope();
  3922. return new Commands.DoWhile(condition, commandsBlock);
  3923. }
  3924. }, {
  3925. key: 'parseIfThenElse',
  3926. value: function parseIfThenElse() {
  3927. if (this.insideScope(IVProgParser.BREAKABLE)) {
  3928. this.pushScope(IVProgParser.BREAKABLE);
  3929. } else {
  3930. this.pushScope(IVProgParser.COMMAND);
  3931. }
  3932. this.pos++;
  3933. this.checkOpenParenthesis();
  3934. this.pos++;
  3935. this.consumeNewLines();
  3936. var logicalExpression = this.parseExpressionOR();
  3937. this.consumeNewLines();
  3938. this.checkCloseParenthesis();
  3939. this.pos++;
  3940. this.consumeNewLines();
  3941. var cmdBlocks = this.parseCommandBlock();
  3942. var maybeElse = this.getToken();
  3943. if (maybeElse.type === this.lexerClass.RK_ELSE) {
  3944. this.pos++;
  3945. this.consumeNewLines();
  3946. var maybeIf = this.getToken();
  3947. var elseBlock = null;
  3948. if (this.checkOpenCurly(true)) {
  3949. elseBlock = this.parseCommandBlock();
  3950. } else if (maybeIf.type === this.lexerClass.RK_IF) {
  3951. elseBlock = this.parseIfThenElse();
  3952. } else {
  3953. // TODO better error message
  3954. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf);
  3955. }
  3956. return new Commands.IfThenElse(logicalExpression, cmdBlocks, elseBlock);
  3957. }
  3958. this.popScope();
  3959. return new Commands.IfThenElse(logicalExpression, cmdBlocks, null);
  3960. }
  3961. }, {
  3962. key: 'parseFor',
  3963. value: function parseFor() {
  3964. this.pushScope(IVProgParser.BREAKABLE);
  3965. this.pos++;
  3966. this.checkOpenParenthesis();
  3967. this.pos++;
  3968. this.consumeNewLines();
  3969. var attribution = this.parseForAssign();
  3970. this.consumeNewLines();
  3971. var condition = this.parseExpressionOR();
  3972. this.consumeForSemiColon();
  3973. var increment = this.parseForAssign(true);
  3974. this.checkCloseParenthesis();
  3975. this.pos++;
  3976. this.consumeNewLines();
  3977. var commandsBlock = this.parseCommandBlock();
  3978. this.popScope();
  3979. return new Commands.For(attribution, condition, increment, commandsBlock);
  3980. }
  3981. }, {
  3982. key: 'parseWhile',
  3983. value: function parseWhile() {
  3984. this.pushScope(IVProgParser.BREAKABLE);
  3985. this.pos++;
  3986. this.checkOpenParenthesis();
  3987. this.pos++;
  3988. this.consumeNewLines();
  3989. var logicalExpression = this.parseExpressionOR();
  3990. this.consumeNewLines();
  3991. this.checkCloseParenthesis();
  3992. this.pos++;
  3993. this.consumeNewLines();
  3994. var cmdBlocks = this.parseCommandBlock();
  3995. this.popScope();
  3996. return new Commands.While(logicalExpression, cmdBlocks);
  3997. }
  3998. }, {
  3999. key: 'parseBreak',
  4000. value: function parseBreak() {
  4001. this.pos++;
  4002. this.checkEOS();
  4003. this.pos++;
  4004. return new Commands.Break();
  4005. }
  4006. }, {
  4007. key: 'parseReturn',
  4008. value: function parseReturn() {
  4009. this.pos++;
  4010. var exp = null;
  4011. if (!this.checkEOS(true)) {
  4012. exp = this.parseExpressionOR();
  4013. this.checkEOS();
  4014. }
  4015. this.pos++;
  4016. return new Commands.Return(exp);
  4017. }
  4018. }, {
  4019. key: 'parseIDCommand',
  4020. value: function parseIDCommand() {
  4021. var refToken = this.getToken();
  4022. var isID = refToken.type === this.lexerClass.ID;
  4023. var id = this.parseMaybeLibID();
  4024. if (this.checkOpenBrace(true)) {
  4025. this.pos++;
  4026. var lineExpression = null;
  4027. var columnExpression = null;
  4028. this.consumeNewLines();
  4029. lineExpression = this.parseExpression();
  4030. this.consumeNewLines();
  4031. this.checkCloseBrace();
  4032. this.pos++;
  4033. if (this.checkOpenBrace(true)) {
  4034. this.pos++;
  4035. this.consumeNewLines();
  4036. columnExpression = this.parseExpression();
  4037. this.consumeNewLines();
  4038. this.checkCloseBrace();
  4039. this.pos++;
  4040. }
  4041. var equalToken = this.getToken();
  4042. if (equalToken.type !== this.lexerClass.EQUAL) {
  4043. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equalToken);
  4044. }
  4045. this.pos++;
  4046. var exp = this.parseExpressionOR();
  4047. this.checkEOS();
  4048. this.pos++;
  4049. var cmd = new Commands.ArrayIndexAssign(id, lineExpression, columnExpression, exp);
  4050. cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalToken);
  4051. return cmd;
  4052. }
  4053. var equalOrParenthesis = this.getToken();
  4054. if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) {
  4055. this.pos++;
  4056. var _exp = this.parseExpressionOR();
  4057. this.checkEOS();
  4058. this.pos++;
  4059. var _cmd = new Commands.Assign(id, _exp);
  4060. _cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalOrParenthesis);
  4061. return _cmd;
  4062. } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) {
  4063. var funcCall = this.parseFunctionCallCommand(id);
  4064. this.checkEOS();
  4065. this.pos++;
  4066. return funcCall;
  4067. } else if (isID) {
  4068. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list(['=', '('], equalOrParenthesis);
  4069. } else {
  4070. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(refToken);
  4071. }
  4072. }
  4073. }, {
  4074. key: 'parseForAssign',
  4075. value: function parseForAssign() {
  4076. var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4077. if (!isLast) this.consumeNewLines();
  4078. if (this.checkEOS(true)) {
  4079. return null;
  4080. }
  4081. var id = this.parseID();
  4082. var equal = this.getToken();
  4083. if (equal.type !== this.lexerClass.EQUAL) {
  4084. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equal);
  4085. }
  4086. this.pos++;
  4087. var exp = this.parseExpressionOR();
  4088. if (!isLast) {
  4089. this.consumeForSemiColon();
  4090. }
  4091. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equal);
  4092. var cmd = new Commands.Assign(id, exp);
  4093. cmd.sourceInfo = sourceInfo;
  4094. return cmd;
  4095. }
  4096. }, {
  4097. key: 'parseCases',
  4098. value: function parseCases() {
  4099. var token = this.getToken();
  4100. if (token.type !== this.lexerClass.RK_CASE) {
  4101. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token);
  4102. }
  4103. this.pos++;
  4104. var nextToken = this.getToken();
  4105. if (nextToken.type === this.lexerClass.RK_DEFAULT) {
  4106. this.pos++;
  4107. var colonToken = this.getToken();
  4108. if (colonToken.type !== this.lexerClass.COLON) {
  4109. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', colonToken);
  4110. }
  4111. this.pos++;
  4112. this.consumeNewLines();
  4113. var block = this.parseCommandBlock(true);
  4114. var defaultCase = new Commands.Case(null);
  4115. defaultCase.setCommands(block.commands);
  4116. return [defaultCase];
  4117. } else {
  4118. var exp = this.parseExpressionOR();
  4119. var _colonToken = this.getToken();
  4120. if (_colonToken.type !== this.lexerClass.COLON) {
  4121. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', _colonToken);
  4122. }
  4123. this.pos++;
  4124. this.consumeNewLines();
  4125. var _block = this.parseCommandBlock(true);
  4126. var aCase = new Commands.Case(exp);
  4127. aCase.setCommands(_block.commands);
  4128. var caseToken = this.getToken();
  4129. if (caseToken.type === this.lexerClass.RK_CASE) {
  4130. return [aCase].concat(this.parseCases());
  4131. } else {
  4132. return [aCase];
  4133. }
  4134. }
  4135. }
  4136. /*
  4137. * Parses an Expression following the structure:
  4138. *
  4139. * EOR => EAnd ( 'or' EOR)? #expression and
  4140. *
  4141. * EOR => ENot ('and' EOR)? #expression or
  4142. *
  4143. * ENot => 'not'? ER #expression not
  4144. *
  4145. * ER => E ((>=, <=, ==, >, <) E)? #expression relational
  4146. *
  4147. * E => factor ((+, -) E)? #expression
  4148. *
  4149. * factor=> term ((*, /, %) factor)?
  4150. *
  4151. * term => literal || arrayAccess || FuncCall || ID || '('EAnd')'
  4152. **/
  4153. }, {
  4154. key: 'parseExpressionOR',
  4155. value: function parseExpressionOR() {
  4156. var exp1 = this.parseExpressionAND();
  4157. while (this.getToken().type === this.lexerClass.OR_OPERATOR) {
  4158. var opToken = this.getToken();
  4159. this.pos++;
  4160. var or = (0, _operators.convertFromString)('or');
  4161. this.consumeNewLines();
  4162. var exp2 = this.parseExpressionAND();
  4163. var _finalExp = new Expressions.InfixApp(or, exp1, exp2);
  4164. _finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  4165. exp1 = _finalExp;
  4166. }
  4167. return exp1;
  4168. }
  4169. }, {
  4170. key: 'parseExpressionAND',
  4171. value: function parseExpressionAND() {
  4172. var exp1 = this.parseExpressionNot();
  4173. while (this.getToken().type === this.lexerClass.AND_OPERATOR) {
  4174. var opToken = this.getToken();
  4175. this.pos++;
  4176. var and = (0, _operators.convertFromString)('and');
  4177. this.consumeNewLines();
  4178. var exp2 = this.parseExpressionNot();
  4179. var _finalExp2 = new Expressions.InfixApp(and, exp1, exp2);
  4180. _finalExp2.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  4181. exp1 = _finalExp2;
  4182. }
  4183. return exp1;
  4184. }
  4185. }, {
  4186. key: 'parseExpressionNot',
  4187. value: function parseExpressionNot() {
  4188. var maybeNotToken = this.getToken();
  4189. if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) {
  4190. var opToken = this.getToken();
  4191. this.pos++;
  4192. var not = (0, _operators.convertFromString)('not');
  4193. var exp1 = this.parseExpressionRel();
  4194. finalExp = new Expressions.UnaryApp(not, exp1);
  4195. finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  4196. return finalExp;
  4197. } else {
  4198. return this.parseExpressionRel();
  4199. }
  4200. }
  4201. }, {
  4202. key: 'parseExpressionRel',
  4203. value: function parseExpressionRel() {
  4204. var exp1 = this.parseExpression();
  4205. while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) {
  4206. var relToken = this.getToken();
  4207. this.pos++;
  4208. var rel = (0, _operators.convertFromString)(relToken.text);
  4209. var exp2 = this.parseExpression();
  4210. var _finalExp3 = new Expressions.InfixApp(rel, exp1, exp2);
  4211. _finalExp3.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(relToken);
  4212. exp1 = _finalExp3;
  4213. }
  4214. return exp1;
  4215. }
  4216. }, {
  4217. key: 'parseExpression',
  4218. value: function parseExpression() {
  4219. var factor = this.parseFactor();
  4220. while (this.getToken().type === this.lexerClass.SUM_OP) {
  4221. var sumOpToken = this.getToken();
  4222. this.pos++;
  4223. var op = (0, _operators.convertFromString)(sumOpToken.text);
  4224. var factor2 = this.parseFactor();
  4225. var _finalExp4 = new Expressions.InfixApp(op, factor, factor2);
  4226. _finalExp4.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(sumOpToken);
  4227. factor = _finalExp4;
  4228. }
  4229. return factor;
  4230. }
  4231. }, {
  4232. key: 'parseFactor',
  4233. value: function parseFactor() {
  4234. var term = this.parseTerm();
  4235. while (this.getToken().type === this.lexerClass.MULTI_OP) {
  4236. var multOpToken = this.getToken();
  4237. this.pos++;
  4238. var op = (0, _operators.convertFromString)(multOpToken.text);
  4239. var term2 = this.parseTerm();
  4240. var _finalExp5 = new Expressions.InfixApp(op, term, term2);
  4241. _finalExp5.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(multOpToken);
  4242. term = _finalExp5;
  4243. }
  4244. return term;
  4245. }
  4246. }, {
  4247. key: 'parseTerm',
  4248. value: function parseTerm() {
  4249. var token = this.getToken();
  4250. var sourceInfo = null;
  4251. switch (token.type) {
  4252. case this.lexerClass.SUM_OP:
  4253. this.pos++;
  4254. sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4255. var exp = new Expressions.UnaryApp((0, _operators.convertFromString)(token.text), this.parseTerm());
  4256. exp.sourceInfo = sourceInfo;
  4257. return exp;
  4258. case this.lexerClass.INTEGER:
  4259. this.pos++;
  4260. return this.getIntLiteral(token);
  4261. case this.lexerClass.REAL:
  4262. this.pos++;
  4263. return this.getRealLiteral(token);
  4264. case this.lexerClass.STRING:
  4265. this.pos++;
  4266. return this.getStringLiteral(token);
  4267. case this.lexerClass.RK_TRUE:
  4268. case this.lexerClass.RK_FALSE:
  4269. this.pos++;
  4270. return this.getBoolLiteral(token);
  4271. case this.lexerClass.OPEN_CURLY:
  4272. return this.parseArrayLiteral();
  4273. case this.lexerClass.ID:
  4274. case this.lexerClass.LIB_ID:
  4275. return this.parseIDTerm();
  4276. case this.lexerClass.OPEN_PARENTHESIS:
  4277. return this.parseParenthesisExp();
  4278. default:
  4279. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_terminal(token);
  4280. }
  4281. }
  4282. }, {
  4283. key: 'parseIDTerm',
  4284. value: function parseIDTerm() {
  4285. var tokenA = this.getToken();
  4286. var id = this.parseMaybeLibID();
  4287. var isID = tokenA.type === this.lexerClass.ID;
  4288. if (isID && this.checkOpenBrace(true)) {
  4289. var tokenB = null;
  4290. this.pos++;
  4291. var firstIndex = this.parseExpression();
  4292. var secondIndex = null;
  4293. this.consumeNewLines();
  4294. this.checkCloseBrace();
  4295. tokenB = this.getToken();
  4296. this.pos++;
  4297. if (this.checkOpenBrace(true)) {
  4298. this.pos++;
  4299. secondIndex = this.parseExpression();
  4300. this.consumeNewLines();
  4301. this.checkCloseBrace();
  4302. tokenB = this.getToken();
  4303. this.pos++;
  4304. }
  4305. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  4306. var exp = new Expressions.ArrayAccess(id, firstIndex, secondIndex);
  4307. exp.sourceInfo = sourceInfo;
  4308. return exp;
  4309. } else if (this.checkOpenParenthesis(true)) {
  4310. return this.parseFunctionCallExpression(id);
  4311. } else if (isID) {
  4312. var _sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(tokenA);
  4313. var _exp2 = new Expressions.VariableLiteral(id);
  4314. _exp2.sourceInfo = _sourceInfo;
  4315. return _exp2;
  4316. } else {
  4317. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(tokenA);
  4318. }
  4319. }
  4320. }, {
  4321. key: 'getFunctionName',
  4322. value: function getFunctionName(id) {
  4323. var name = _definedFunctions.LanguageDefinedFunction.getInternalName(id);
  4324. if (name === null) {
  4325. return id;
  4326. } else {
  4327. return name;
  4328. }
  4329. }
  4330. }, {
  4331. key: 'parseFunctionCallExpression',
  4332. value: function parseFunctionCallExpression(id) {
  4333. var tokenA = this.getToken(this.pos - 1);
  4334. var actualParameters = this.parseActualParameters();
  4335. var tokenB = this.getToken(this.pos - 1);
  4336. var funcName = this.getFunctionName(id);
  4337. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  4338. var cmd = new Expressions.FunctionCall(funcName, actualParameters);
  4339. cmd.sourceInfo = sourceInfo;
  4340. return cmd;
  4341. }
  4342. }, {
  4343. key: 'parseFunctionCallCommand',
  4344. value: function parseFunctionCallCommand(id) {
  4345. return this.parseFunctionCallExpression(id);
  4346. }
  4347. }, {
  4348. key: 'parseParenthesisExp',
  4349. value: function parseParenthesisExp() {
  4350. this.checkOpenParenthesis();
  4351. var tokenA = this.getToken();
  4352. this.pos++;
  4353. this.consumeNewLines();
  4354. var exp = this.parseExpressionOR();
  4355. this.consumeNewLines();
  4356. this.checkCloseParenthesis();
  4357. var tokenB = this.getToken();
  4358. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  4359. this.pos++;
  4360. exp.sourceInfo = sourceInfo;
  4361. return exp;
  4362. }
  4363. }, {
  4364. key: 'parseActualParameters',
  4365. value: function parseActualParameters() {
  4366. this.checkOpenParenthesis();
  4367. this.pos++;
  4368. if (this.checkCloseParenthesis(true)) {
  4369. this.pos++;
  4370. return [];
  4371. }
  4372. this.consumeNewLines();
  4373. var list = this.parseExpressionList();
  4374. this.consumeNewLines();
  4375. this.checkCloseParenthesis();
  4376. this.pos++;
  4377. return list;
  4378. }
  4379. }, {
  4380. key: 'parseExpressionList',
  4381. value: function parseExpressionList() {
  4382. var list = [];
  4383. while (true) {
  4384. var exp = this.parseExpressionOR();
  4385. list.push(exp);
  4386. var maybeToken = this.getToken();
  4387. if (maybeToken.type !== this.lexerClass.COMMA) {
  4388. break;
  4389. } else {
  4390. this.pos++;
  4391. this.consumeNewLines();
  4392. }
  4393. }
  4394. return list;
  4395. }
  4396. }, {
  4397. key: 'getTypeArray',
  4398. value: function getTypeArray() {
  4399. var _this = this;
  4400. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  4401. return types.map(function (x) {
  4402. return _this.lexer.literalNames[x];
  4403. });
  4404. }
  4405. }]);
  4406. return IVProgParser;
  4407. }();
  4408. /***/ }),
  4409. /***/ "./js/ast/operators.js":
  4410. /*!*****************************!*\
  4411. !*** ./js/ast/operators.js ***!
  4412. \*****************************/
  4413. /*! no static exports found */
  4414. /***/ (function(module, exports, __webpack_require__) {
  4415. "use strict";
  4416. Object.defineProperty(exports, "__esModule", {
  4417. value: true
  4418. });
  4419. exports.convertFromString = convertFromString;
  4420. var Operators = exports.Operators = Object.freeze({
  4421. ADD: { ord: 0, value: "+" },
  4422. SUB: { ord: 1, value: "-" },
  4423. MULT: { ord: 2, value: '*' },
  4424. DIV: { ord: 3, value: '/' },
  4425. MOD: { ord: 4, value: '%' },
  4426. GT: { ord: 5, value: '>' },
  4427. GE: { ord: 6, value: '>=' },
  4428. LT: { ord: 7, value: '<' },
  4429. LE: { ord: 8, value: '<=' },
  4430. EQ: { ord: 9, value: '==' },
  4431. NEQ: { ord: 10, value: '!=' },
  4432. AND: { ord: 11, value: 'and' },
  4433. OR: { ord: 12, value: 'or' },
  4434. NOT: { ord: 13, value: 'not' }
  4435. });
  4436. function convertFromString(op) {
  4437. switch (op) {
  4438. case '+':
  4439. return Operators.ADD;
  4440. case '-':
  4441. return Operators.SUB;
  4442. case '*':
  4443. return Operators.MULT;
  4444. case '/':
  4445. return Operators.DIV;
  4446. case '%':
  4447. return Operators.MOD;
  4448. case '>':
  4449. return Operators.GT;
  4450. case '>=':
  4451. return Operators.GE;
  4452. case '<':
  4453. return Operators.LT;
  4454. case '<=':
  4455. return Operators.LE;
  4456. case '==':
  4457. return Operators.EQ;
  4458. case '!=':
  4459. return Operators.NEQ;
  4460. case 'and':
  4461. return Operators.AND;
  4462. case 'or':
  4463. return Operators.OR;
  4464. case 'not':
  4465. return Operators.NOT;
  4466. }
  4467. }
  4468. /***/ }),
  4469. /***/ "./js/ast/sourceInfo.js":
  4470. /*!******************************!*\
  4471. !*** ./js/ast/sourceInfo.js ***!
  4472. \******************************/
  4473. /*! no static exports found */
  4474. /***/ (function(module, exports, __webpack_require__) {
  4475. "use strict";
  4476. Object.defineProperty(exports, "__esModule", {
  4477. value: true
  4478. });
  4479. 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; }; }();
  4480. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4481. var SourceInfo = exports.SourceInfo = function () {
  4482. _createClass(SourceInfo, null, [{
  4483. key: "createSourceInfo",
  4484. value: function createSourceInfo(token) {
  4485. return new SourceInfo(token.line, token.column, token.text.length);
  4486. }
  4487. }, {
  4488. key: "createSourceInfoFromList",
  4489. value: function createSourceInfoFromList(tokenA, tokenB) {
  4490. var line = tokenA.line;
  4491. var column = tokenA.column;
  4492. // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  4493. // No idea why...
  4494. var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex;
  4495. return new SourceInfo(line, column, size);
  4496. }
  4497. }]);
  4498. function SourceInfo(line, column, size) {
  4499. _classCallCheck(this, SourceInfo);
  4500. this.line = line;
  4501. this.column = column;
  4502. this.size = size;
  4503. }
  4504. return SourceInfo;
  4505. }();
  4506. /***/ }),
  4507. /***/ "./js/io/domConsole.js":
  4508. /*!*****************************!*\
  4509. !*** ./js/io/domConsole.js ***!
  4510. \*****************************/
  4511. /*! no static exports found */
  4512. /***/ (function(module, exports, __webpack_require__) {
  4513. "use strict";
  4514. Object.defineProperty(exports, "__esModule", {
  4515. value: true
  4516. });
  4517. exports.DOMConsole = undefined;
  4518. 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; }; }();
  4519. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  4520. var _jquery2 = _interopRequireDefault(_jquery);
  4521. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4522. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4523. var DOMConsole = exports.DOMConsole = function () {
  4524. _createClass(DOMConsole, null, [{
  4525. key: 'USER',
  4526. get: function get() {
  4527. return 0;
  4528. }
  4529. }, {
  4530. key: 'INFO',
  4531. get: function get() {
  4532. return 1;
  4533. }
  4534. }, {
  4535. key: 'ERR',
  4536. get: function get() {
  4537. return 2;
  4538. }
  4539. }]);
  4540. function DOMConsole(elementID) {
  4541. _classCallCheck(this, DOMConsole);
  4542. this.input = null;
  4543. this.needInput = false;
  4544. this.termDiv = null;
  4545. this.anyKey = false;
  4546. this.parent = (0, _jquery2.default)(elementID);
  4547. this.setup();
  4548. this.inputListeners = [];
  4549. }
  4550. _createClass(DOMConsole, [{
  4551. key: 'setup',
  4552. value: function setup() {
  4553. this._setupDom();
  4554. this._setupEvents();
  4555. }
  4556. }, {
  4557. key: '_setupEvents',
  4558. value: function _setupEvents() {
  4559. var _this = this;
  4560. this.input.on("keydown", function (event) {
  4561. if (!_this.needInput) {
  4562. event.preventDefault();
  4563. return;
  4564. }
  4565. var keyCode = event.which;
  4566. if (keyCode === 13 || _this.anyKey) {
  4567. var text = _this.input.val();
  4568. text = text.replace('[\n\r]+', '');
  4569. _this.notifyListeners(text);
  4570. _this.write(text);
  4571. _this.input.val("");
  4572. }
  4573. });
  4574. }
  4575. }, {
  4576. key: '_setupDom',
  4577. value: function _setupDom() {
  4578. this.termDiv = (0, _jquery2.default)("<div></div>");
  4579. this.termDiv.addClass("ivprog-term-div");
  4580. this.input = (0, _jquery2.default)('<input text="type">');
  4581. this.input.addClass("ivprog-term-input");
  4582. this.termDiv.append(this.input);
  4583. this.parent.append(this.termDiv);
  4584. }
  4585. }, {
  4586. key: 'notifyListeners',
  4587. value: function notifyListeners(text) {
  4588. this.inputListeners.forEach(function (resolve) {
  4589. return resolve(text);
  4590. });
  4591. this.inputListeners.splice(0, this.inputListeners.length);
  4592. this.hideInput();
  4593. this.anyKey = false;
  4594. }
  4595. }, {
  4596. key: 'write',
  4597. value: function write(text) {
  4598. this._appendText(text, DOMConsole.USER);
  4599. }
  4600. }, {
  4601. key: 'info',
  4602. value: function info(text) {
  4603. this._appendText(text, DOMConsole.INFO);
  4604. }
  4605. }, {
  4606. key: 'err',
  4607. value: function err(text) {
  4608. this._appendText(text, DOMConsole.ERR);
  4609. }
  4610. }, {
  4611. key: '_appendText',
  4612. value: function _appendText(text, type) {
  4613. var divClass = this.getClassForType(type);
  4614. var textDiv = (0, _jquery2.default)("<div></div>");
  4615. textDiv.addClass(divClass);
  4616. textDiv.append(text);
  4617. textDiv.insertBefore(this.input);
  4618. this.scrollTerm();
  4619. }
  4620. }, {
  4621. key: 'scrollTerm',
  4622. value: function scrollTerm() {
  4623. this.termDiv.animate({
  4624. scrollTop: this.termDiv.prop('scrollHeight')
  4625. }, 0);
  4626. }
  4627. }, {
  4628. key: 'getClassForType',
  4629. value: function getClassForType(type) {
  4630. switch (type) {
  4631. case DOMConsole.USER:
  4632. return "ivprog-term-userText";
  4633. case DOMConsole.INFO:
  4634. return "ivprog-term-info";
  4635. case DOMConsole.ERR:
  4636. return "ivprog-term-error";
  4637. }
  4638. }
  4639. }, {
  4640. key: 'dispose',
  4641. value: function dispose() {
  4642. this.parent.off();
  4643. this.input.off();
  4644. this.input = null;
  4645. this.parent.empty();
  4646. }
  4647. }, {
  4648. key: 'showInput',
  4649. value: function showInput() {
  4650. this.needInput = true;
  4651. this.input.show();
  4652. this.input.focus();
  4653. }
  4654. }, {
  4655. key: 'hideInput',
  4656. value: function hideInput() {
  4657. this.needInput = false;
  4658. this.input.hide();
  4659. }
  4660. }, {
  4661. key: 'requestInput',
  4662. value: function requestInput(callback) {
  4663. var anyKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4664. this.inputListeners.push(callback);
  4665. this.anyKey = anyKey;
  4666. this.showInput();
  4667. }
  4668. }, {
  4669. key: 'sendOutput',
  4670. value: function sendOutput(text) {
  4671. var _this2 = this;
  4672. text.split("\n").forEach(function (t) {
  4673. t = t.replace(/\t/g, '&#9;');
  4674. _this2.write(t);
  4675. });
  4676. }
  4677. }, {
  4678. key: 'clear',
  4679. value: function clear() {
  4680. this.input.parent().children().not(this.input).remove();
  4681. this.input.val("");
  4682. }
  4683. }]);
  4684. return DOMConsole;
  4685. }();
  4686. /***/ }),
  4687. /***/ "./js/io/input.js":
  4688. /*!************************!*\
  4689. !*** ./js/io/input.js ***!
  4690. \************************/
  4691. /*! no static exports found */
  4692. /***/ (function(module, exports, __webpack_require__) {
  4693. "use strict";
  4694. Object.defineProperty(exports, "__esModule", {
  4695. value: true
  4696. });
  4697. 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; }; }();
  4698. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4699. var Input = exports.Input = function () {
  4700. function Input() {
  4701. _classCallCheck(this, Input);
  4702. }
  4703. _createClass(Input, [{
  4704. key: "requestInput",
  4705. value: function requestInput(callback) {
  4706. throw new Error("Must be implemented");
  4707. }
  4708. }]);
  4709. return Input;
  4710. }();
  4711. /***/ }),
  4712. /***/ "./js/io/output.js":
  4713. /*!*************************!*\
  4714. !*** ./js/io/output.js ***!
  4715. \*************************/
  4716. /*! no static exports found */
  4717. /***/ (function(module, exports, __webpack_require__) {
  4718. "use strict";
  4719. Object.defineProperty(exports, "__esModule", {
  4720. value: true
  4721. });
  4722. 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; }; }();
  4723. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4724. var Output = exports.Output = function () {
  4725. function Output() {
  4726. _classCallCheck(this, Output);
  4727. }
  4728. _createClass(Output, [{
  4729. key: "sendOutput",
  4730. value: function sendOutput(text) {
  4731. throw new Error("Must be implemented");
  4732. }
  4733. }]);
  4734. return Output;
  4735. }();
  4736. /***/ }),
  4737. /***/ "./js/main.js":
  4738. /*!********************!*\
  4739. !*** ./js/main.js ***!
  4740. \********************/
  4741. /*! no static exports found */
  4742. /***/ (function(module, exports, __webpack_require__) {
  4743. "use strict";
  4744. Object.defineProperty(exports, "__esModule", {
  4745. value: true
  4746. });
  4747. exports.i18n = exports.LocalizedStrings = exports.initVisualUI = exports.runner = undefined;
  4748. var _runner = __webpack_require__(/*! ./runner */ "./js/runner.js");
  4749. var _functions = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js");
  4750. var _localizedStringsService = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  4751. var _i18nHelper = __webpack_require__(/*! ./services/i18nHelper */ "./js/services/i18nHelper.js");
  4752. var i18n = _i18nHelper.i18nHelper.i18n;
  4753. exports.runner = _runner.runner;
  4754. exports.initVisualUI = _functions.initVisualUI;
  4755. exports.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  4756. exports.i18n = i18n;
  4757. /***/ }),
  4758. /***/ "./js/processor/compatibilityTable.js":
  4759. /*!********************************************!*\
  4760. !*** ./js/processor/compatibilityTable.js ***!
  4761. \********************************************/
  4762. /*! no static exports found */
  4763. /***/ (function(module, exports, __webpack_require__) {
  4764. "use strict";
  4765. Object.defineProperty(exports, "__esModule", {
  4766. value: true
  4767. });
  4768. exports.resultTypeAfterInfixOp = resultTypeAfterInfixOp;
  4769. exports.resultTypeAfterUnaryOp = resultTypeAfterUnaryOp;
  4770. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  4771. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  4772. var _multiType = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  4773. function buildInfixAddTable() {
  4774. var table = [[], [], [], []];
  4775. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  4776. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  4777. table[_types.Types.INTEGER.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  4778. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  4779. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  4780. table[_types.Types.REAL.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  4781. table[_types.Types.STRING.ord][_types.Types.INTEGER.ord] = _types.Types.STRING;
  4782. table[_types.Types.STRING.ord][_types.Types.REAL.ord] = _types.Types.STRING;
  4783. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  4784. table[_types.Types.STRING.ord][_types.Types.BOOLEAN.ord] = _types.Types.STRING;
  4785. return table;
  4786. }
  4787. function buildInfixMultiDivSubTable() {
  4788. var table = [[], [], [], []];
  4789. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  4790. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  4791. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  4792. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  4793. return table;
  4794. }
  4795. function buildInfixEqualityInequalityTable() {
  4796. var table = [[], [], [], []];
  4797. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  4798. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  4799. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  4800. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  4801. return table;
  4802. }
  4803. function buildInfixRelationalTable() {
  4804. var table = [[], [], [], []];
  4805. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  4806. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  4807. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  4808. return table;
  4809. }
  4810. function buildInfixAndOrTable() {
  4811. var table = [[], [], [], []];
  4812. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  4813. return table;
  4814. }
  4815. function buildInfixModTable() {
  4816. var table = [[], [], [], []];
  4817. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  4818. return table;
  4819. }
  4820. function buildUnarySumSubList() {
  4821. var list = [];
  4822. list[_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  4823. list[_types.Types.REAL.ord] = _types.Types.REAL;
  4824. return list;
  4825. }
  4826. function buildUnaryNegList() {
  4827. var list = [];
  4828. list[_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  4829. return list;
  4830. }
  4831. function buildInfixCompatibilityTable() {
  4832. var compatibilityMap = new WeakMap();
  4833. compatibilityMap.set(_operators.Operators.ADD, buildInfixAddTable());
  4834. compatibilityMap.set(_operators.Operators.SUB, buildInfixMultiDivSubTable());
  4835. compatibilityMap.set(_operators.Operators.MULT, buildInfixMultiDivSubTable());
  4836. compatibilityMap.set(_operators.Operators.DIV, buildInfixMultiDivSubTable());
  4837. compatibilityMap.set(_operators.Operators.EQ, buildInfixEqualityInequalityTable());
  4838. compatibilityMap.set(_operators.Operators.NEQ, buildInfixEqualityInequalityTable());
  4839. compatibilityMap.set(_operators.Operators.GE, buildInfixRelationalTable());
  4840. compatibilityMap.set(_operators.Operators.GT, buildInfixRelationalTable());
  4841. compatibilityMap.set(_operators.Operators.LE, buildInfixRelationalTable());
  4842. compatibilityMap.set(_operators.Operators.LT, buildInfixRelationalTable());
  4843. compatibilityMap.set(_operators.Operators.OR, buildInfixAndOrTable());
  4844. compatibilityMap.set(_operators.Operators.AND, buildInfixAndOrTable());
  4845. compatibilityMap.set(_operators.Operators.MOD, buildInfixModTable());
  4846. return compatibilityMap;
  4847. }
  4848. function buildUnaryCompatibilityTable() {
  4849. var compatibilityMap = new WeakMap();
  4850. compatibilityMap.set(_operators.Operators.ADD, buildUnarySumSubList());
  4851. compatibilityMap.set(_operators.Operators.SUB, buildUnarySumSubList());
  4852. compatibilityMap.set(_operators.Operators.NOT, buildUnaryNegList());
  4853. return compatibilityMap;
  4854. }
  4855. var infixMap = buildInfixCompatibilityTable();
  4856. var unaryMap = buildUnaryCompatibilityTable();
  4857. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  4858. try {
  4859. if (leftExpressionType instanceof _multiType.MultiType && rightExpressionType instanceof _multiType.MultiType) {
  4860. var newMulti = [];
  4861. for (var i = 0; i < leftExpressionType.types.length; i++) {
  4862. var element = leftExpressionType.types[i];
  4863. if (rightExpressionType.types.indexOf(element) !== -1) {
  4864. newMulti.push(element);
  4865. }
  4866. }
  4867. if (newMulti.length <= 0) {
  4868. return _types.Types.UNDEFINED;
  4869. } else {
  4870. return new _multiType.MultiType(newMulti);
  4871. }
  4872. } else if (leftExpressionType instanceof _multiType.MultiType) {
  4873. if (leftExpressionType.isCompatible(rightExpressionType)) {
  4874. return rightExpressionType;
  4875. } else {
  4876. return _types.Types.UNDEFINED;
  4877. }
  4878. } else if (rightExpressionType instanceof _multiType.MultiType) {
  4879. if (rightExpressionType.isCompatible(leftExpressionType)) {
  4880. return leftExpressionType;
  4881. } else {
  4882. return _types.Types.UNDEFINED;
  4883. }
  4884. }
  4885. var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
  4886. if (resultType === null || resultType === undefined) {
  4887. return _types.Types.UNDEFINED;
  4888. }
  4889. return resultType;
  4890. } catch (e) {
  4891. if (e instanceof TypeError) {
  4892. return _types.Types.UNDEFINED;
  4893. } else {
  4894. throw e;
  4895. }
  4896. }
  4897. }
  4898. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  4899. try {
  4900. if (leftExpressionType instanceof _multiType.MultiType) {
  4901. return leftExpressionType;
  4902. }
  4903. return unaryMap.get(operator)[leftExpressionType.ord];
  4904. } catch (e) {
  4905. if (e instanceof TypeError) {
  4906. return _types.Types.UNDEFINED;
  4907. } else {
  4908. throw e;
  4909. }
  4910. }
  4911. }
  4912. /***/ }),
  4913. /***/ "./js/processor/context.js":
  4914. /*!*********************************!*\
  4915. !*** ./js/processor/context.js ***!
  4916. \*********************************/
  4917. /*! no static exports found */
  4918. /***/ (function(module, exports, __webpack_require__) {
  4919. "use strict";
  4920. Object.defineProperty(exports, "__esModule", {
  4921. value: true
  4922. });
  4923. var Context = exports.Context = Object.freeze({
  4924. BASE: Symbol('context:base'),
  4925. BREAKABLE: Symbol('context:breakable'),
  4926. FUNCTION: Symbol('context:function')
  4927. });
  4928. /***/ }),
  4929. /***/ "./js/processor/definedFunctions.js":
  4930. /*!******************************************!*\
  4931. !*** ./js/processor/definedFunctions.js ***!
  4932. \******************************************/
  4933. /*! no static exports found */
  4934. /***/ (function(module, exports, __webpack_require__) {
  4935. "use strict";
  4936. Object.defineProperty(exports, "__esModule", {
  4937. value: true
  4938. });
  4939. exports.LanguageDefinedFunction = undefined;
  4940. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  4941. var _io = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  4942. var _strings = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  4943. var _arrays = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  4944. var _lang = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  4945. var _math = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  4946. function valueToKey(value, object) {
  4947. for (var key in object) {
  4948. if (object.hasOwnProperty(key)) {
  4949. if (object[key] === value) {
  4950. return key;
  4951. }
  4952. }
  4953. }
  4954. return null;
  4955. }
  4956. function concatObjects() {
  4957. var result = {};
  4958. for (var _len = arguments.length, objs = Array(_len), _key = 0; _key < _len; _key++) {
  4959. objs[_key] = arguments[_key];
  4960. }
  4961. for (var i = 0; i < objs.length; i++) {
  4962. var obj = objs[i];
  4963. for (var key in obj) {
  4964. if (obj.hasOwnProperty(key)) {
  4965. result[key] = obj[key];
  4966. }
  4967. }
  4968. }
  4969. return result;
  4970. }
  4971. var libsObject = {
  4972. $mathLib: {
  4973. $sin: (0, _math.createSinFun)(),
  4974. $cos: (0, _math.createCosFun)(),
  4975. $tan: (0, _math.createTanFun)(),
  4976. $sqrt: (0, _math.createSqrtFun)(),
  4977. $pow: (0, _math.createPowFun)(),
  4978. $log: (0, _math.createLogFun)(),
  4979. $abs: (0, _math.createAbsFun)(),
  4980. $negate: (0, _math.createNegateFun)(),
  4981. $invert: (0, _math.createInvertFun)(),
  4982. $max: (0, _math.createMaxFun)(),
  4983. $min: (0, _math.createMinFun)()
  4984. },
  4985. $ioLib: {
  4986. $read: (0, _io.createInputFun)(),
  4987. $write: (0, _io.createOutputFun)()
  4988. },
  4989. $strLib: {
  4990. $substring: (0, _strings.createSubstringFun)(),
  4991. $length: (0, _strings.createLengthFun)(),
  4992. $uppercase: (0, _strings.createUppercaseFun)(),
  4993. $lowercase: (0, _strings.createLowercaseFun)(),
  4994. $charAt: (0, _strings.createrCharAtFun)()
  4995. },
  4996. $arrayLib: {
  4997. $numElements: (0, _arrays.createNumElementsFun)(),
  4998. $matrixLines: (0, _arrays.createMatrixLinesFun)(),
  4999. $matrixColumns: (0, _arrays.createMatrixColumnsFun)()
  5000. },
  5001. $langLib: {
  5002. $isReal: (0, _lang.createIsRealFun)(),
  5003. $isInt: (0, _lang.createIsIntFun)(),
  5004. $isBool: (0, _lang.createIsBoolFun)(),
  5005. $castReal: (0, _lang.createCastRealFun)(),
  5006. $castInt: (0, _lang.createCastIntFun)(),
  5007. $castBool: (0, _lang.createCastBoolFun)(),
  5008. $castString: (0, _lang.createCastStringFun)()
  5009. }
  5010. };
  5011. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  5012. var LanguageDefinedFunction = exports.LanguageDefinedFunction = Object.freeze({
  5013. getMainFunctionName: function getMainFunctionName() {
  5014. return _languageService.LanguageService.getCurrentLangFuncs().main_function;
  5015. },
  5016. getInternalName: function getInternalName(localName) {
  5017. if (localName.indexOf(".") !== -1) {
  5018. var names = localName.split(".");
  5019. var lib = valueToKey(names[0], _languageService.LanguageService.getCurrentLangLibs());
  5020. var internalName = valueToKey(names[1], _languageService.LanguageService.getCurrentLangFuncs());
  5021. if (lib === null || internalName === null) {
  5022. return null;
  5023. }
  5024. return lib + "." + internalName;
  5025. }
  5026. var funcName = valueToKey(localName, _languageService.LanguageService.getCurrentLangFuncs());
  5027. if (funcName !== null) {
  5028. if (funcsObject[funcName]) {
  5029. return funcName;
  5030. }
  5031. }
  5032. return null;
  5033. },
  5034. getFunction: function getFunction(internalName) {
  5035. if (internalName.indexOf(".") !== -1) {
  5036. var names = internalName.split(".");
  5037. var libName = names[0];
  5038. var funName = names[1];
  5039. return libsObject[libName][funName];
  5040. }
  5041. return funcsObject[internalName];
  5042. }
  5043. });
  5044. /***/ }),
  5045. /***/ "./js/processor/error/processorErrorFactory.js":
  5046. /*!*****************************************************!*\
  5047. !*** ./js/processor/error/processorErrorFactory.js ***!
  5048. \*****************************************************/
  5049. /*! no static exports found */
  5050. /***/ (function(module, exports, __webpack_require__) {
  5051. "use strict";
  5052. Object.defineProperty(exports, "__esModule", {
  5053. value: true
  5054. });
  5055. exports.ProcessorErrorFactory = undefined;
  5056. var _runtimeError = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  5057. var _semanticError = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  5058. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  5059. var ProcessorErrorFactory = exports.ProcessorErrorFactory = Object.freeze({});
  5060. /***/ }),
  5061. /***/ "./js/processor/error/runtimeError.js":
  5062. /*!********************************************!*\
  5063. !*** ./js/processor/error/runtimeError.js ***!
  5064. \********************************************/
  5065. /*! no static exports found */
  5066. /***/ (function(module, exports, __webpack_require__) {
  5067. "use strict";
  5068. Object.defineProperty(exports, "__esModule", {
  5069. value: true
  5070. });
  5071. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5072. 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; }
  5073. 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; }
  5074. var RuntimeError = exports.RuntimeError = function (_Error) {
  5075. _inherits(RuntimeError, _Error);
  5076. function RuntimeError() {
  5077. var _ref;
  5078. _classCallCheck(this, RuntimeError);
  5079. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  5080. msg[_key] = arguments[_key];
  5081. }
  5082. var _this = _possibleConstructorReturn(this, (_ref = RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).call.apply(_ref, [this].concat(msg)));
  5083. if (Error.captureStackTrace) Error.captureStackTrace(_this, RuntimeError);
  5084. return _this;
  5085. }
  5086. return RuntimeError;
  5087. }(Error);
  5088. /***/ }),
  5089. /***/ "./js/processor/error/semanticError.js":
  5090. /*!*********************************************!*\
  5091. !*** ./js/processor/error/semanticError.js ***!
  5092. \*********************************************/
  5093. /*! no static exports found */
  5094. /***/ (function(module, exports, __webpack_require__) {
  5095. "use strict";
  5096. Object.defineProperty(exports, "__esModule", {
  5097. value: true
  5098. });
  5099. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5100. 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; }
  5101. 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; }
  5102. var SemanticError = exports.SemanticError = function (_Error) {
  5103. _inherits(SemanticError, _Error);
  5104. function SemanticError() {
  5105. var _ref;
  5106. _classCallCheck(this, SemanticError);
  5107. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  5108. msg[_key] = arguments[_key];
  5109. }
  5110. var _this = _possibleConstructorReturn(this, (_ref = SemanticError.__proto__ || Object.getPrototypeOf(SemanticError)).call.apply(_ref, [this].concat(msg)));
  5111. if (Error.captureStackTrace) Error.captureStackTrace(_this, SemanticError);
  5112. return _this;
  5113. }
  5114. return SemanticError;
  5115. }(Error);
  5116. /***/ }),
  5117. /***/ "./js/processor/ivprogProcessor.js":
  5118. /*!*****************************************!*\
  5119. !*** ./js/processor/ivprogProcessor.js ***!
  5120. \*****************************************/
  5121. /*! no static exports found */
  5122. /***/ (function(module, exports, __webpack_require__) {
  5123. "use strict";
  5124. Object.defineProperty(exports, "__esModule", {
  5125. value: true
  5126. });
  5127. exports.IVProgProcessor = undefined;
  5128. 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; }; }();
  5129. var _store = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js");
  5130. var _storeObject = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js");
  5131. var _storeObjectArray = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  5132. var _storeObjectRef = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js");
  5133. var _modes = __webpack_require__(/*! ./modes */ "./js/processor/modes.js");
  5134. var _context = __webpack_require__(/*! ./context */ "./js/processor/context.js");
  5135. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  5136. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  5137. var _definedFunctions = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  5138. var _compatibilityTable = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js");
  5139. var _commands = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  5140. var Commands = _interopRequireWildcard(_commands);
  5141. var _expressions = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  5142. var Expressions = _interopRequireWildcard(_expressions);
  5143. var _storeObjectArrayAddress = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js");
  5144. var _storeObjectArrayAddressRef = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js");
  5145. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  5146. var _parsers = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  5147. 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; } }
  5148. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5149. var loopTimeoutMs = 10000;
  5150. var IVProgProcessor = exports.IVProgProcessor = function () {
  5151. _createClass(IVProgProcessor, null, [{
  5152. key: 'LOOP_TIMEOUT',
  5153. get: function get() {
  5154. return loopTimeoutMs;
  5155. },
  5156. set: function set(ms) {
  5157. loopTimeoutMs = ms;
  5158. }
  5159. }]);
  5160. function IVProgProcessor(ast) {
  5161. _classCallCheck(this, IVProgProcessor);
  5162. this.ast = ast;
  5163. this.globalStore = null;
  5164. this.stores = null;
  5165. this.context = null;
  5166. this.input = null;
  5167. this.forceKill = false;
  5168. this.loopTimers = [];
  5169. this.output = null;
  5170. }
  5171. _createClass(IVProgProcessor, [{
  5172. key: 'registerInput',
  5173. value: function registerInput(input) {
  5174. if (this.input !== null) this.input = null;
  5175. this.input = input;
  5176. }
  5177. }, {
  5178. key: 'registerOutput',
  5179. value: function registerOutput(output) {
  5180. if (this.output !== null) this.output = null;
  5181. this.output = output;
  5182. }
  5183. }, {
  5184. key: 'checkContext',
  5185. value: function checkContext(context) {
  5186. return this.context[this.context.length - 1] === context;
  5187. }
  5188. }, {
  5189. key: 'ignoreSwitchCases',
  5190. value: function ignoreSwitchCases(store) {
  5191. if (store.mode === _modes.Modes.RETURN) {
  5192. return true;
  5193. } else if (store.mode === _modes.Modes.BREAK) {
  5194. return true;
  5195. } else {
  5196. return false;
  5197. }
  5198. }
  5199. }, {
  5200. key: 'prepareState',
  5201. value: function prepareState() {
  5202. if (this.stores !== null) {
  5203. for (var i = 0; i < this.stores.length; i++) {
  5204. delete this.stores[i];
  5205. }
  5206. this.stores = null;
  5207. }
  5208. if (this.globalStore !== null) this.globalStore = null;
  5209. this.globalStore = new _store.Store();
  5210. this.stores = [this.globalStore];
  5211. this.context = [_context.Context.BASE];
  5212. }
  5213. }, {
  5214. key: 'interpretAST',
  5215. value: function interpretAST() {
  5216. this.prepareState();
  5217. this.initGlobal();
  5218. var mainFunc = this.findMainFunction();
  5219. if (mainFunc === null) {
  5220. // TODO: Better error message
  5221. throw new Error("Missing main funciton.");
  5222. }
  5223. return this.runFunction(mainFunc, [], this.globalStore);
  5224. }
  5225. }, {
  5226. key: 'initGlobal',
  5227. value: function initGlobal() {
  5228. var _this = this;
  5229. if (!this.checkContext(_context.Context.BASE)) {
  5230. throw new Error("!!!CRITICAL: Invalid call to initGlobal outside BASE context!!!");
  5231. }
  5232. this.ast.global.forEach(function (decl) {
  5233. _this.executeCommand(_this.globalStore, decl).then(function (sto) {
  5234. return _this.globalStore = sto;
  5235. });
  5236. });
  5237. }
  5238. }, {
  5239. key: 'findMainFunction',
  5240. value: function findMainFunction() {
  5241. return this.ast.functions.find(function (v) {
  5242. return v.isMain;
  5243. });
  5244. }
  5245. }, {
  5246. key: 'findFunction',
  5247. value: function findFunction(name) {
  5248. if (name.match(/^\$.+$/)) {
  5249. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  5250. if (!!!fun) {
  5251. throw new Error("!!!Internal Error. Language defined function not implemented -> " + name + "!!!");
  5252. }
  5253. return fun;
  5254. } else {
  5255. var val = this.ast.functions.find(function (v) {
  5256. return v.name === name;
  5257. });
  5258. if (!!!val) {
  5259. // TODO: better error message;
  5260. throw new Error('Function ' + name + ' is not defined.');
  5261. }
  5262. return val;
  5263. }
  5264. }
  5265. }, {
  5266. key: 'runFunction',
  5267. value: function runFunction(func, actualParameters, store) {
  5268. var _this2 = this;
  5269. var funcStore = new _store.Store();
  5270. funcStore.extendStore(this.globalStore);
  5271. var returnStoreObject = null;
  5272. if (func.returnType instanceof _compoundType.CompoundType) {
  5273. if (func.returnType.dimensions > 1) {
  5274. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, -1, [[]]);
  5275. } else {
  5276. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, null, []);
  5277. }
  5278. } else {
  5279. returnStoreObject = new _storeObject.StoreObject(func.returnType, null);
  5280. }
  5281. var funcName = func.isMain ? 'main' : func.name;
  5282. var funcNameStoreObject = new _storeObject.StoreObject(_types.Types.STRING, funcName, true);
  5283. funcStore.insertStore('$', returnStoreObject);
  5284. funcStore.insertStore('$name', funcNameStoreObject);
  5285. var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  5286. return newFuncStore$.then(function (sto) {
  5287. _this2.context.push(_context.Context.FUNCTION);
  5288. _this2.stores.push(sto);
  5289. return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) {
  5290. return _this2.executeCommands(stoWithVars, func.commands);
  5291. }).then(function (finalSto) {
  5292. _this2.stores.pop();
  5293. _this2.context.pop();
  5294. return finalSto;
  5295. });
  5296. });
  5297. }
  5298. }, {
  5299. key: 'associateParameters',
  5300. value: function associateParameters(formalList, actualList, callerStore, calleeStore) {
  5301. var _this3 = this;
  5302. if (formalList.length != actualList.length) {
  5303. // TODO: Better error message
  5304. throw new Error("Numbers of parameters doesn't match");
  5305. }
  5306. var promises$ = actualList.map(function (actualParameter) {
  5307. return _this3.evaluateExpression(callerStore, actualParameter);
  5308. });
  5309. return Promise.all(promises$).then(function (values) {
  5310. for (var i = 0; i < values.length; i++) {
  5311. var stoObj = values[i];
  5312. var formalParameter = formalList[i];
  5313. if (formalParameter.type.isCompatible(stoObj.type)) {
  5314. if (formalParameter.byRef && !stoObj.inStore) {
  5315. throw new Error('You must inform a variable as parameter');
  5316. }
  5317. if (formalParameter.byRef) {
  5318. var ref = null;
  5319. if (stoObj instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  5320. ref = new _storeObjectArrayAddressRef.StoreObjectArrayAddressRef(stoObj);
  5321. } else {
  5322. ref = new _storeObjectRef.StoreObjectRef(stoObj.id, callerStore);
  5323. }
  5324. calleeStore.insertStore(formalParameter.id, ref);
  5325. } else {
  5326. var realValue = _this3.parseStoreObjectValue(stoObj);
  5327. calleeStore.insertStore(formalParameter.id, realValue);
  5328. }
  5329. } else {
  5330. throw new Error('Parameter ' + formalParameter.id + ' is not compatible with the value given.');
  5331. }
  5332. }
  5333. return calleeStore;
  5334. });
  5335. }
  5336. }, {
  5337. key: 'executeCommands',
  5338. value: function executeCommands(store, cmds) {
  5339. // helper to partially apply a function, in this case executeCommand
  5340. var outerRef = this;
  5341. var partial = function partial(fun, cmd) {
  5342. return function (sto) {
  5343. return fun(sto, cmd);
  5344. };
  5345. };
  5346. return cmds.reduce(function (lastCommand, next) {
  5347. var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
  5348. return lastCommand.then(nextCommand);
  5349. }, Promise.resolve(store));
  5350. }
  5351. }, {
  5352. key: 'executeCommand',
  5353. value: function executeCommand(store, cmd) {
  5354. if (this.forceKill) {
  5355. return Promise.reject("Interrupção forçada do programa!");
  5356. } else if (store.mode === _modes.Modes.PAUSE) {
  5357. return Promise.resolve(this.executeCommand(store, cmd));
  5358. } else if (store.mode === _modes.Modes.RETURN) {
  5359. return Promise.resolve(store);
  5360. } else if (this.checkContext(_context.Context.BREAKABLE) && store.mode === _modes.Modes.BREAK) {
  5361. return Promise.resolve(store);
  5362. }
  5363. if (cmd instanceof Commands.Declaration) {
  5364. return this.executeDeclaration(store, cmd);
  5365. } else if (cmd instanceof Commands.ArrayIndexAssign) {
  5366. return this.executeArrayIndexAssign(store, cmd);
  5367. } else if (cmd instanceof Commands.Assign) {
  5368. return this.executeAssign(store, cmd);
  5369. } else if (cmd instanceof Commands.Break) {
  5370. return this.executeBreak(store, cmd);
  5371. } else if (cmd instanceof Commands.Return) {
  5372. return this.executeReturn(store, cmd);
  5373. } else if (cmd instanceof Commands.IfThenElse) {
  5374. return this.executeIfThenElse(store, cmd);
  5375. } else if (cmd instanceof Commands.While) {
  5376. return this.executeWhile(store, cmd);
  5377. } else if (cmd instanceof Commands.DoWhile) {
  5378. return this.executeDoWhile(store, cmd);
  5379. } else if (cmd instanceof Commands.For) {
  5380. return this.executeFor(store, cmd);
  5381. } else if (cmd instanceof Commands.Switch) {
  5382. return this.executeSwitch(store, cmd);
  5383. } else if (cmd instanceof Commands.FunctionCall) {
  5384. return this.executeFunctionCall(store, cmd);
  5385. } else if (cmd instanceof Commands.SysCall) {
  5386. return this.executeSysCall(store, cmd);
  5387. } else {
  5388. throw new Error("!!!CRITICAL A unknown command was found!!!\n" + cmd);
  5389. }
  5390. }
  5391. }, {
  5392. key: 'executeSysCall',
  5393. value: function executeSysCall(store, cmd) {
  5394. var func = cmd.langFunc.bind(this);
  5395. return func(store, cmd);
  5396. }
  5397. }, {
  5398. key: 'executeFunctionCall',
  5399. value: function executeFunctionCall(store, cmd) {
  5400. var func = this.findFunction(cmd.id);
  5401. return this.runFunction(func, cmd.actualParameters, store).then(function (sto) {
  5402. if (!_types.Types.VOID.isCompatible(func.returnType) && sto.mode !== _modes.Modes.RETURN) {
  5403. // TODO: better error message
  5404. return Promise.reject(new Error('Function ' + func.name + ' must have a return command'));
  5405. } else {
  5406. return store;
  5407. }
  5408. });
  5409. }
  5410. }, {
  5411. key: 'executeSwitch',
  5412. value: function executeSwitch(store, cmd) {
  5413. var _this4 = this;
  5414. this.context.push(_context.Context.BREAKABLE);
  5415. var auxCaseFun = function auxCaseFun(promise, switchExp, aCase) {
  5416. return promise.then(function (result) {
  5417. var sto = result.sto;
  5418. if (_this4.ignoreSwitchCases(sto)) {
  5419. return Promise.resolve(result);
  5420. } else if (result.wasTrue || aCase.isDefault) {
  5421. var $newSto = _this4.executeCommands(result.sto, aCase.commands);
  5422. return $newSto.then(function (nSto) {
  5423. return Promise.resolve({ wasTrue: true, sto: nSto });
  5424. });
  5425. } else {
  5426. var $value = _this4.evaluateExpression(sto, new Expressions.InfixApp(_operators.Operators.EQ, switchExp, aCase.expression));
  5427. return $value.then(function (vl) {
  5428. if (vl.value) {
  5429. var _$newSto = _this4.executeCommands(result.sto, aCase.commands);
  5430. return _$newSto.then(function (nSto) {
  5431. return Promise.resolve({ wasTrue: true, sto: nSto });
  5432. });
  5433. } else {
  5434. return Promise.resolve({ wasTrue: false, sto: sto });
  5435. }
  5436. });
  5437. }
  5438. });
  5439. };
  5440. try {
  5441. var breakLoop = false;
  5442. var $result = Promise.resolve({ wasTrue: false, sto: store });
  5443. for (var index = 0; index < cmd.cases.length && !breakLoop; index++) {
  5444. var aCase = cmd.cases[index];
  5445. $result = auxCaseFun($result, cmd.expression, aCase);
  5446. $result.then(function (r) {
  5447. return breakLoop = _this4.ignoreSwitchCases(r.sto);
  5448. });
  5449. }
  5450. return $result.then(function (r) {
  5451. _this4.context.pop();
  5452. if (r.sto.mode === _modes.Modes.BREAK) {
  5453. r.sto.mode = _modes.Modes.RUN;
  5454. }
  5455. return r.sto;
  5456. });
  5457. } catch (error) {
  5458. return Promise.reject(error);
  5459. }
  5460. }
  5461. }, {
  5462. key: 'executeFor',
  5463. value: function executeFor(store, cmd) {
  5464. try {
  5465. //BEGIN for -> while rewrite
  5466. var initCmd = cmd.assignment;
  5467. var condition = cmd.condition;
  5468. var increment = cmd.increment;
  5469. var whileBlock = new Commands.CommandBlock([], cmd.commands.concat(increment));
  5470. var forAsWhile = new Commands.While(condition, whileBlock);
  5471. //END for -> while rewrite
  5472. var newCmdList = [initCmd, forAsWhile];
  5473. return this.executeCommands(store, newCmdList);
  5474. } catch (error) {
  5475. return Promise.reject(error);
  5476. }
  5477. }
  5478. }, {
  5479. key: 'executeDoWhile',
  5480. value: function executeDoWhile(store, cmd) {
  5481. var outerRef = this;
  5482. try {
  5483. outerRef.loopTimers.push(Date.now());
  5484. outerRef.context.push(_context.Context.BREAKABLE);
  5485. var $newStore = outerRef.executeCommands(store, cmd.commands);
  5486. return $newStore.then(function (sto) {
  5487. if (sto.mode === _modes.Modes.BREAK) {
  5488. outerRef.context.pop();
  5489. sto.mode = _modes.Modes.RUN;
  5490. outerRef.loopTimers.pop();
  5491. return sto;
  5492. }
  5493. var $value = outerRef.evaluateExpression(sto, cmd.expression);
  5494. return $value.then(function (vl) {
  5495. if (!vl.type.isCompatible(_types.Types.BOOLEAN)) {
  5496. // TODO: Better error message -- Inform line and column from token!!!!
  5497. // THIS IF SHOULD BE IN A SEMANTIC ANALYSER
  5498. return Promise.reject(new Error('DoWhile expression must be of type boolean'));
  5499. }
  5500. if (vl.value) {
  5501. outerRef.context.pop();
  5502. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  5503. var time = outerRef.loopTimers[i];
  5504. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  5505. console.log("Kill by Timeout...");
  5506. outerRef.forceKill = true;
  5507. return Promise.reject(new Error("Potential endless loop detected."));
  5508. }
  5509. }
  5510. return outerRef.executeCommand(sto, cmd);
  5511. } else {
  5512. outerRef.context.pop();
  5513. outerRef.loopTimers.pop();
  5514. console.log("Clear Timeout...");
  5515. return sto;
  5516. }
  5517. });
  5518. });
  5519. } catch (error) {
  5520. return Promise.reject(error);
  5521. }
  5522. }
  5523. }, {
  5524. key: 'executeWhile',
  5525. value: function executeWhile(store, cmd) {
  5526. var outerRef = this;
  5527. try {
  5528. outerRef.loopTimers.push(Date.now());
  5529. outerRef.context.push(_context.Context.BREAKABLE);
  5530. var $value = outerRef.evaluateExpression(store, cmd.expression);
  5531. return $value.then(function (vl) {
  5532. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  5533. if (vl.value) {
  5534. var $newStore = outerRef.executeCommands(store, cmd.commands);
  5535. return $newStore.then(function (sto) {
  5536. outerRef.context.pop();
  5537. if (sto.mode === _modes.Modes.BREAK) {
  5538. outerRef.loopTimers.pop();
  5539. sto.mode = _modes.Modes.RUN;
  5540. return sto;
  5541. }
  5542. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  5543. var time = outerRef.loopTimers[i];
  5544. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  5545. console.log("Kill by Timeout...");
  5546. outerRef.forceKill = true;
  5547. return Promise.reject(new Error("Potential endless loop detected."));
  5548. }
  5549. }
  5550. return outerRef.executeCommand(sto, cmd);
  5551. });
  5552. } else {
  5553. outerRef.context.pop();
  5554. outerRef.loopTimers.pop();
  5555. console.log("Clear Timeout...");
  5556. return store;
  5557. }
  5558. } else {
  5559. // TODO: Better error message -- Inform line and column from token!!!!
  5560. // THIS IF SHOULD BE IN A SEMANTIC ANALYSER
  5561. return Promise.reject(new Error('Loop condition must be of type boolean'));
  5562. }
  5563. });
  5564. } catch (error) {
  5565. return Promise.reject(error);
  5566. }
  5567. }
  5568. }, {
  5569. key: 'executeIfThenElse',
  5570. value: function executeIfThenElse(store, cmd) {
  5571. var _this5 = this;
  5572. try {
  5573. var $value = this.evaluateExpression(store, cmd.condition);
  5574. return $value.then(function (vl) {
  5575. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  5576. if (vl.value) {
  5577. return _this5.executeCommands(store, cmd.ifTrue.commands);
  5578. } else if (cmd.ifFalse !== null) {
  5579. if (cmd.ifFalse instanceof Commands.IfThenElse) {
  5580. return _this5.executeCommand(store, cmd.ifFalse);
  5581. } else {
  5582. return _this5.executeCommands(store, cmd.ifFalse.commands);
  5583. }
  5584. } else {
  5585. return Promise.resolve(store);
  5586. }
  5587. } else {
  5588. // TODO: Better error message -- Inform line and column from token!!!!
  5589. // THIS IF SHOULD BE IN A SEMANTIC ANALYSER
  5590. return Promise.reject(new Error('If expression must be of type boolean'));
  5591. }
  5592. });
  5593. } catch (error) {
  5594. return Promise.reject(error);
  5595. }
  5596. }
  5597. }, {
  5598. key: 'executeReturn',
  5599. value: function executeReturn(store, cmd) {
  5600. var _this6 = this;
  5601. try {
  5602. var funcType = store.applyStore('$');
  5603. var $value = this.evaluateExpression(store, cmd.expression);
  5604. var funcName = store.applyStore('$name');
  5605. return $value.then(function (vl) {
  5606. if (vl === null && funcType.isCompatible(_types.Types.VOID)) {
  5607. return Promise.resolve(store);
  5608. }
  5609. if (vl === null || !funcType.type.isCompatible(vl.type)) {
  5610. // TODO: Better error message -- Inform line and column from token!!!!
  5611. // THIS IF SHOULD BE IN A SEMANTIC ANALYSER
  5612. return Promise.reject(new Error('Function ' + funcName.value + ' must return ' + funcType.type + ' instead of ' + vl.type + '.'));
  5613. } else {
  5614. var realValue = _this6.parseStoreObjectValue(vl);
  5615. store.updateStore('$', realValue);
  5616. store.mode = _modes.Modes.RETURN;
  5617. return Promise.resolve(store);
  5618. }
  5619. });
  5620. } catch (error) {
  5621. return Promise.reject(error);
  5622. }
  5623. }
  5624. }, {
  5625. key: 'executeBreak',
  5626. value: function executeBreak(store, _) {
  5627. if (this.checkContext(_context.Context.BREAKABLE)) {
  5628. store.mode = _modes.Modes.BREAK;
  5629. return Promise.resolve(store);
  5630. } else {
  5631. return Promise.reject(new Error("!!!CRITIAL: Break command outside Loop/Switch scope!!!"));
  5632. }
  5633. }
  5634. }, {
  5635. key: 'executeAssign',
  5636. value: function executeAssign(store, cmd) {
  5637. var _this7 = this;
  5638. try {
  5639. var $value = this.evaluateExpression(store, cmd.expression);
  5640. return $value.then(function (vl) {
  5641. var realValue = _this7.parseStoreObjectValue(vl);
  5642. store.updateStore(cmd.id, realValue);
  5643. return store;
  5644. });
  5645. } catch (error) {
  5646. return Promise.reject(error);
  5647. }
  5648. }
  5649. }, {
  5650. key: 'executeArrayIndexAssign',
  5651. value: function executeArrayIndexAssign(store, cmd) {
  5652. var _this8 = this;
  5653. var mustBeArray = store.applyStore(cmd.id);
  5654. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  5655. return Promise.reject(new Error(cmd.id + " is not a vector/matrix"));
  5656. }
  5657. var line$ = this.evaluateExpression(store, cmd.line);
  5658. var column$ = this.evaluateExpression(store, cmd.column);
  5659. var value$ = this.evaluateExpression(store, cmd.expression);
  5660. return Promise.all([line$, column$, value$]).then(function (results) {
  5661. var lineSO = results[0];
  5662. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  5663. // TODO: better error message
  5664. //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS
  5665. return Promise.reject(new Error("Array dimension must be of type int"));
  5666. }
  5667. var line = lineSO.number;
  5668. var columnSO = results[1];
  5669. var column = null;
  5670. if (columnSO !== null) {
  5671. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  5672. // TODO: better error message
  5673. //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS
  5674. return Promise.reject(new Error("Array dimension must be of type int"));
  5675. }
  5676. column = columnSO.number;
  5677. }
  5678. var value = _this8.parseStoreObjectValue(results[2]);
  5679. if (line >= mustBeArray.lines) {
  5680. // TODO: better error message
  5681. return Promise.reject(new Error(exp.id + ': index out of bounds: ' + lines));
  5682. }
  5683. if (column !== null && mustBeArray.columns === null) {
  5684. // TODO: better error message
  5685. return Promise.reject(new Error(exp.id + ': index out of bounds: ' + column));
  5686. }
  5687. if (column !== null && column >= mustBeArray.columns) {
  5688. // TODO: better error message
  5689. return Promise.reject(new Error(exp.id + ': index out of bounds: ' + column));
  5690. }
  5691. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), mustBeArray);
  5692. if (column !== null) {
  5693. if (value.type instanceof _compoundType.CompoundType) {
  5694. return Promise.reject(new Error("Invalid operation. This must be a value: line " + cmd.sourceInfo.line));
  5695. }
  5696. newArray.value[line].value[column] = value;
  5697. store.updateStore(cmd.id, newArray);
  5698. } else {
  5699. if (mustBeArray.columns !== null && value.type instanceof _compoundType.CompoundType) {
  5700. return Promise.reject(new Error("Invalid operation. This must be a vector: line " + cmd.sourceInfo.line));
  5701. }
  5702. newArray.value[line] = value;
  5703. store.updateStore(cmd.id, newArray);
  5704. }
  5705. return store;
  5706. });
  5707. }
  5708. }, {
  5709. key: 'executeDeclaration',
  5710. value: function executeDeclaration(store, cmd) {
  5711. try {
  5712. var $value = this.evaluateExpression(store, cmd.initial);
  5713. if (cmd instanceof Commands.ArrayDeclaration) {
  5714. var $lines = this.evaluateExpression(store, cmd.lines);
  5715. var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns);
  5716. return Promise.all([$lines, $columns, $value]).then(function (values) {
  5717. var lineSO = values[0];
  5718. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  5719. // TODO: better error message
  5720. //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS
  5721. return Promise.reject(new Error("Array dimension must be of type int"));
  5722. }
  5723. var line = lineSO.number;
  5724. var columnSO = values[1];
  5725. var column = null;
  5726. if (columnSO !== null) {
  5727. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  5728. // TODO: better error message
  5729. //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS
  5730. return Promise.reject(new Error("Array dimension must be of type int"));
  5731. }
  5732. column = columnSO.number;
  5733. }
  5734. var value = values[2];
  5735. var temp = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, null);
  5736. store.insertStore(cmd.id, temp);
  5737. var realValue = value;
  5738. if (value !== null) {
  5739. if (value instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  5740. if (value.type instanceof _compoundType.CompoundType) {
  5741. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), value.refValue);
  5742. } else {
  5743. realValue = Object.assign(new _storeObject.StoreObject(null, null), value.refValue);
  5744. }
  5745. }
  5746. } else {
  5747. realValue = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, []);
  5748. if (column !== null) {
  5749. for (var i = 0; i < line; i++) {
  5750. realValue.value.push(new _storeObjectArray.StoreObjectArray(new _compoundType.CompoundType(cmd.type.innerType, 1), column, null, []));
  5751. }
  5752. }
  5753. }
  5754. realValue.readOnly = cmd.isConst;
  5755. store.updateStore(cmd.id, realValue);
  5756. return store;
  5757. });
  5758. } else {
  5759. var temp = new _storeObject.StoreObject(cmd.type, null);
  5760. store.insertStore(cmd.id, temp);
  5761. return $value.then(function (vl) {
  5762. var realValue = vl;
  5763. if (vl !== null) {
  5764. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  5765. if (vl.type instanceof _compoundType.CompoundType) {
  5766. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), vl.refValue);
  5767. } else {
  5768. realValue = Object.assign(new _storeObject.StoreObject(null, null), vl.refValue);
  5769. }
  5770. }
  5771. } else {
  5772. realValue = new _storeObject.StoreObject(cmd.type, 0);
  5773. }
  5774. realValue.readOnly = cmd.isConst;
  5775. store.updateStore(cmd.id, realValue);
  5776. return store;
  5777. });
  5778. }
  5779. } catch (e) {
  5780. return Promise.reject(e);
  5781. }
  5782. }
  5783. }, {
  5784. key: 'evaluateExpression',
  5785. value: function evaluateExpression(store, exp) {
  5786. if (exp instanceof Expressions.UnaryApp) {
  5787. return this.evaluateUnaryApp(store, exp);
  5788. } else if (exp instanceof Expressions.InfixApp) {
  5789. return this.evaluateInfixApp(store, exp);
  5790. } else if (exp instanceof Expressions.ArrayAccess) {
  5791. return this.evaluateArrayAccess(store, exp);
  5792. } else if (exp instanceof Expressions.VariableLiteral) {
  5793. return this.evaluateVariableLiteral(store, exp);
  5794. } else if (exp instanceof Expressions.IntLiteral) {
  5795. return this.evaluateLiteral(store, exp);
  5796. } else if (exp instanceof Expressions.RealLiteral) {
  5797. return this.evaluateLiteral(store, exp);
  5798. } else if (exp instanceof Expressions.BoolLiteral) {
  5799. return this.evaluateLiteral(store, exp);
  5800. } else if (exp instanceof Expressions.StringLiteral) {
  5801. return this.evaluateLiteral(store, exp);
  5802. } else if (exp instanceof Expressions.ArrayLiteral) {
  5803. return this.evaluateArrayLiteral(store, exp);
  5804. } else if (exp instanceof Expressions.FunctionCall) {
  5805. return this.evaluateFunctionCall(store, exp);
  5806. }
  5807. return Promise.resolve(null);
  5808. }
  5809. }, {
  5810. key: 'evaluateFunctionCall',
  5811. value: function evaluateFunctionCall(store, exp) {
  5812. var func = this.findFunction(exp.id);
  5813. if (_types.Types.VOID.isCompatible(func.returnType)) {
  5814. // TODO: better error message
  5815. return Promise.reject(new Error('Function ' + exp.id + ' cannot be used inside an expression'));
  5816. }
  5817. var $newStore = this.runFunction(func, exp.actualParameters, store);
  5818. return $newStore.then(function (sto) {
  5819. if (sto.mode !== _modes.Modes.RETURN) {
  5820. return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id));
  5821. }
  5822. var val = sto.applyStore('$');
  5823. if (val instanceof _storeObjectArray.StoreObjectArray) {
  5824. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null, null), val));
  5825. } else {
  5826. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  5827. }
  5828. });
  5829. }
  5830. }, {
  5831. key: 'evaluateArrayLiteral',
  5832. value: function evaluateArrayLiteral(store, exp) {
  5833. if (!exp.isVector) {
  5834. var $matrix = this.evaluateMatrix(store, exp.value);
  5835. return $matrix.then(function (list) {
  5836. var type = new _compoundType.CompoundType(list[0].type.innerType, 2);
  5837. var arr = new _storeObjectArray.StoreObjectArray(type, list.length, list[0].lines, list);
  5838. if (arr.isValid) return Promise.resolve(arr);else return Promise.reject(new Error('Invalid array'));
  5839. });
  5840. } else {
  5841. return this.evaluateVector(store, exp.value).then(function (list) {
  5842. var type = new _compoundType.CompoundType(list[0].type, 1);
  5843. var stoArray = new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  5844. if (stoArray.isValid) return Promise.resolve(stoArray);else return Promise.reject(new Error('Invalid array'));
  5845. });
  5846. }
  5847. }
  5848. }, {
  5849. key: 'evaluateVector',
  5850. value: function evaluateVector(store, exps) {
  5851. var _this9 = this;
  5852. return Promise.all(exps.map(function (exp) {
  5853. return _this9.evaluateExpression(store, exp);
  5854. }));
  5855. }
  5856. }, {
  5857. key: 'evaluateMatrix',
  5858. value: function evaluateMatrix(store, exps) {
  5859. var _this10 = this;
  5860. return Promise.all(exps.map(function (vector) {
  5861. var $vector = _this10.evaluateVector(store, vector.value);
  5862. return $vector.then(function (list) {
  5863. var type = new _compoundType.CompoundType(list[0].type, 1);
  5864. return new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  5865. });
  5866. }));
  5867. }
  5868. }, {
  5869. key: 'evaluateLiteral',
  5870. value: function evaluateLiteral(_, exp) {
  5871. return Promise.resolve(new _storeObject.StoreObject(exp.type, exp.value));
  5872. }
  5873. }, {
  5874. key: 'evaluateVariableLiteral',
  5875. value: function evaluateVariableLiteral(store, exp) {
  5876. try {
  5877. var val = store.applyStore(exp.id);
  5878. if (val instanceof _storeObjectArray.StoreObjectArray) {
  5879. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null), val));
  5880. } else {
  5881. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  5882. }
  5883. } catch (error) {
  5884. return Promise.reject(error);
  5885. }
  5886. }
  5887. }, {
  5888. key: 'evaluateArrayAccess',
  5889. value: function evaluateArrayAccess(store, exp) {
  5890. var mustBeArray = store.applyStore(exp.id);
  5891. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  5892. // TODO: better error message
  5893. console.log(mustBeArray.type);
  5894. return Promise.reject(new Error(exp.id + ' is not of type array'));
  5895. }
  5896. var $line = this.evaluateExpression(store, exp.line);
  5897. var $column = this.evaluateExpression(store, exp.column);
  5898. return Promise.all([$line, $column]).then(function (values) {
  5899. var lineSO = values[0];
  5900. var columnSO = values[1];
  5901. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  5902. // TODO: better error message
  5903. //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS
  5904. return Promise.reject(new Error("Array dimension must be of type int"));
  5905. }
  5906. var line = lineSO.number;
  5907. var column = null;
  5908. if (columnSO !== null) {
  5909. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  5910. // TODO: better error message
  5911. //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS
  5912. return Promise.reject(new Error("Array dimension must be of type int"));
  5913. }
  5914. column = columnSO.number;
  5915. }
  5916. if (line >= mustBeArray.lines) {
  5917. // TODO: better error message
  5918. return Promise.reject(new Error(exp.id + ': index out of bounds: ' + lines));
  5919. }
  5920. if (column !== null && mustBeArray.columns === null) {
  5921. // TODO: better error message
  5922. return Promise.reject(new Error(exp.id + ': index out of bounds: ' + column));
  5923. }
  5924. if (column !== null && column >= mustBeArray.columns) {
  5925. // TODO: better error message
  5926. return Promise.reject(new Error(exp.id + ': index out of bounds: ' + column));
  5927. }
  5928. return Promise.resolve(new _storeObjectArrayAddress.StoreObjectArrayAddress(mustBeArray.id, line, column, store));
  5929. });
  5930. }
  5931. }, {
  5932. key: 'evaluateUnaryApp',
  5933. value: function evaluateUnaryApp(store, unaryApp) {
  5934. var $left = this.evaluateExpression(store, unaryApp.left);
  5935. return $left.then(function (left) {
  5936. var resultType = (0, _compatibilityTable.resultTypeAfterUnaryOp)(unaryApp.op, left.type);
  5937. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  5938. // TODO: better urgent error message
  5939. return Promise.reject(new Error('Cannot use this op to ' + left.type));
  5940. }
  5941. switch (unaryApp.op.ord) {
  5942. case _operators.Operators.ADD.ord:
  5943. return new _storeObject.StoreObject(resultType, left.value);
  5944. case _operators.Operators.SUB.ord:
  5945. return new _storeObject.StoreObject(resultType, left.value.negated());
  5946. case _operators.Operators.NOT.ord:
  5947. return new _storeObject.StoreObject(resultType, !left.value);
  5948. default:
  5949. return Promise.reject(new Error('!!!Critical Invalid UnaryApp ' + unaryApp.op));
  5950. }
  5951. });
  5952. }
  5953. }, {
  5954. key: 'evaluateInfixApp',
  5955. value: function evaluateInfixApp(store, infixApp) {
  5956. var $left = this.evaluateExpression(store, infixApp.left);
  5957. var $right = this.evaluateExpression(store, infixApp.right);
  5958. return Promise.all([$left, $right]).then(function (values) {
  5959. var left = values[0];
  5960. var right = values[1];
  5961. var resultType = (0, _compatibilityTable.resultTypeAfterInfixOp)(infixApp.op, left.type, right.type);
  5962. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  5963. // TODO: better urgent error message
  5964. return Promise.reject(new Error('Cannot use this ' + infixApp.op + ' to ' + left.type + ' and ' + right.type));
  5965. }
  5966. var result = null;
  5967. switch (infixApp.op.ord) {
  5968. case _operators.Operators.ADD.ord:
  5969. {
  5970. if (_types.Types.STRING.isCompatible(left.type)) {
  5971. var rightStr = (0, _parsers.convertToString)(right.value, right.type);
  5972. return new _storeObject.StoreObject(resultType, left.value + rightStr);
  5973. } else if (_types.Types.STRING.isCompatible(right.type)) {
  5974. var leftStr = (0, _parsers.convertToString)(left.value, left.type);
  5975. return new _storeObject.StoreObject(resultType, leftStr + right.value);
  5976. } else {
  5977. return new _storeObject.StoreObject(resultType, left.value.plus(right.value));
  5978. }
  5979. }
  5980. case _operators.Operators.SUB.ord:
  5981. return new _storeObject.StoreObject(resultType, left.value.minus(right.value));
  5982. case _operators.Operators.MULT.ord:
  5983. return new _storeObject.StoreObject(resultType, left.value.times(right.value));
  5984. case _operators.Operators.DIV.ord:
  5985. {
  5986. result = left.value / right.value;
  5987. if (_types.Types.INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value);
  5988. return new _storeObject.StoreObject(resultType, result);
  5989. }
  5990. case _operators.Operators.MOD.ord:
  5991. return new _storeObject.StoreObject(resultType, left.value.modulo(right.value));
  5992. case _operators.Operators.GT.ord:
  5993. {
  5994. if (_types.Types.STRING.isCompatible(left.type)) {
  5995. result = left.value.length > right.value.length;
  5996. } else {
  5997. result = left.value.gt(right.value);
  5998. }
  5999. return new _storeObject.StoreObject(resultType, result);
  6000. }
  6001. case _operators.Operators.GE.ord:
  6002. {
  6003. if (_types.Types.STRING.isCompatible(left.type)) {
  6004. result = left.value.length >= right.value.length;
  6005. } else {
  6006. result = left.value.gte(right.value);
  6007. }
  6008. return new _storeObject.StoreObject(resultType, result);
  6009. }
  6010. case _operators.Operators.LT.ord:
  6011. {
  6012. if (_types.Types.STRING.isCompatible(left.type)) {
  6013. result = left.value.length < right.value.length;
  6014. } else {
  6015. result = left.value.lt(right.value);
  6016. }
  6017. return new _storeObject.StoreObject(resultType, result);
  6018. }
  6019. case _operators.Operators.LE.ord:
  6020. {
  6021. if (_types.Types.STRING.isCompatible(left.type)) {
  6022. result = left.value.length <= right.value.length;
  6023. } else {
  6024. result = left.value.lte(right.value);
  6025. }
  6026. return new _storeObject.StoreObject(resultType, result);
  6027. }
  6028. case _operators.Operators.EQ.ord:
  6029. {
  6030. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  6031. result = left.value.eq(right.value);
  6032. } else {
  6033. result = left.value === right.value;
  6034. }
  6035. return new _storeObject.StoreObject(resultType, result);
  6036. }
  6037. case _operators.Operators.NEQ.ord:
  6038. {
  6039. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  6040. result = !left.value.eq(right.value);
  6041. } else {
  6042. result = left.value !== right.value;
  6043. }
  6044. return new _storeObject.StoreObject(resultType, result);
  6045. }
  6046. case _operators.Operators.AND.ord:
  6047. return new _storeObject.StoreObject(resultType, left.value && right.value);
  6048. case _operators.Operators.OR.ord:
  6049. return new _storeObject.StoreObject(resultType, left.value || right.value);
  6050. default:
  6051. return Promise.reject(new Error('!!!Critical Invalid InfixApp ' + infixApp.op));
  6052. }
  6053. });
  6054. }
  6055. }, {
  6056. key: 'parseStoreObjectValue',
  6057. value: function parseStoreObjectValue(vl) {
  6058. var realValue = vl;
  6059. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  6060. if (vl.type instanceof _compoundType.CompoundType) {
  6061. switch (vl.type.dimensions) {
  6062. case 1:
  6063. {
  6064. realValue = new _storeObjectArray.StoreObjectArray(vl.type, vl.value);
  6065. break;
  6066. }
  6067. default:
  6068. {
  6069. throw new Error("Three dimensional array address...");
  6070. }
  6071. }
  6072. } else {
  6073. realValue = new _storeObject.StoreObject(vl.type, vl.value);
  6074. }
  6075. }
  6076. return realValue;
  6077. }
  6078. }]);
  6079. return IVProgProcessor;
  6080. }();
  6081. /***/ }),
  6082. /***/ "./js/processor/lib/arrays.js":
  6083. /*!************************************!*\
  6084. !*** ./js/processor/lib/arrays.js ***!
  6085. \************************************/
  6086. /*! no static exports found */
  6087. /***/ (function(module, exports, __webpack_require__) {
  6088. "use strict";
  6089. Object.defineProperty(exports, "__esModule", {
  6090. value: true
  6091. });
  6092. exports.createNumElementsFun = createNumElementsFun;
  6093. exports.createMatrixLinesFun = createMatrixLinesFun;
  6094. exports.createMatrixColumnsFun = createMatrixColumnsFun;
  6095. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  6096. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  6097. var Commands = _interopRequireWildcard(_commands);
  6098. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  6099. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6100. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6101. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  6102. 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; } }
  6103. /**
  6104. * num_elements
  6105. * matrix_lines
  6106. * matrix_columns
  6107. */
  6108. function createNumElementsFun() {
  6109. var numElementsFun = function numElementsFun(sto, _) {
  6110. var vector = sto.applyStore("vector");
  6111. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(vector.lines));
  6112. sto.mode = _modes.Modes.RETURN;
  6113. return Promise.resolve(sto.updateStore("$", temp));
  6114. };
  6115. var block = new Commands.CommandBlock([], [new Commands.SysCall(numElementsFun)]);
  6116. var func = new Commands.Function('$numElements', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 1), 'vector', false)], block);
  6117. return func;
  6118. }
  6119. function createMatrixLinesFun() {
  6120. var matrixLinesFun = function matrixLinesFun(sto, _) {
  6121. var matrix = sto.applyStore("matrix");
  6122. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.lines));
  6123. sto.mode = _modes.Modes.RETURN;
  6124. return Promise.resolve(sto.updateStore("$", temp));
  6125. };
  6126. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixLinesFun)]);
  6127. var func = new Commands.Function('$matrixLines', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  6128. return func;
  6129. }
  6130. function createMatrixColumnsFun() {
  6131. var matrixColumnsFun = function matrixColumnsFun(sto, _) {
  6132. var matrix = sto.applyStore("matrix");
  6133. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.columns));
  6134. sto.mode = _modes.Modes.RETURN;
  6135. return Promise.resolve(sto.updateStore("$", temp));
  6136. };
  6137. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixColumnsFun)]);
  6138. var func = new Commands.Function('$matrixColumns', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  6139. return func;
  6140. }
  6141. /***/ }),
  6142. /***/ "./js/processor/lib/io.js":
  6143. /*!********************************!*\
  6144. !*** ./js/processor/lib/io.js ***!
  6145. \********************************/
  6146. /*! no static exports found */
  6147. /***/ (function(module, exports, __webpack_require__) {
  6148. "use strict";
  6149. Object.defineProperty(exports, "__esModule", {
  6150. value: true
  6151. });
  6152. exports.createOutputFun = createOutputFun;
  6153. exports.createInputFun = createInputFun;
  6154. var _storeObject = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js");
  6155. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  6156. var Commands = _interopRequireWildcard(_commands);
  6157. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6158. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  6159. 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; } }
  6160. function createOutputFun() {
  6161. var writeFunction = function writeFunction(store, _) {
  6162. var val = store.applyStore('p1');
  6163. if (val.type.isCompatible(_types.Types.INTEGER)) {
  6164. this.output.sendOutput(val.value.toString());
  6165. } else if (val.type.isCompatible(_types.Types.REAL)) {
  6166. if (val.value.dp() <= 0) {
  6167. this.output.sendOutput(val.value.toFixed(1));
  6168. } else {
  6169. this.output.sendOutput(val.value.toString());
  6170. }
  6171. } else {
  6172. this.output.sendOutput(val.value);
  6173. }
  6174. return Promise.resolve(store);
  6175. };
  6176. var block = new Commands.CommandBlock([], [new Commands.SysCall(writeFunction)]);
  6177. var func = new Commands.Function('$write', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', false)], block);
  6178. return func;
  6179. }
  6180. function createInputFun() {
  6181. var readFunction = function readFunction(store, _) {
  6182. var _this = this;
  6183. var request = new Promise(function (resolve, _) {
  6184. _this.input.requestInput(resolve);
  6185. });
  6186. return request.then(function (text) {
  6187. var typeToConvert = store.applyStore('p1').type;
  6188. var stoObj = null;
  6189. if (typeToConvert.isCompatible(_types.Types.INTEGER)) {
  6190. var val = (0, _parsers.toInt)(text);
  6191. stoObj = new _storeObject.StoreObject(_types.Types.INTEGER, val);
  6192. } else if (typeToConvert.isCompatible(_types.Types.REAL)) {
  6193. stoObj = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(text));
  6194. } else if (typeToConvert.isCompatible(_types.Types.BOOLEAN)) {
  6195. stoObj = new _storeObject.StoreObject(_types.Types.BOOLEAN, (0, _parsers.toBool)(text));
  6196. } else if (typeToConvert.isCompatible(_types.Types.STRING)) {
  6197. stoObj = new _storeObject.StoreObject(_types.Types.STRING, (0, _parsers.toString)(text));
  6198. }
  6199. _this.loopTimers.splice(0, _this.loopTimers.length);
  6200. store.updateStore('p1', stoObj);
  6201. return Promise.resolve(store);
  6202. });
  6203. };
  6204. var block = new Commands.CommandBlock([], [new Commands.SysCall(readFunction)]);
  6205. var func = new Commands.Function('$read', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', true)], block);
  6206. return func;
  6207. }
  6208. /***/ }),
  6209. /***/ "./js/processor/lib/lang.js":
  6210. /*!**********************************!*\
  6211. !*** ./js/processor/lib/lang.js ***!
  6212. \**********************************/
  6213. /*! no static exports found */
  6214. /***/ (function(module, exports, __webpack_require__) {
  6215. "use strict";
  6216. Object.defineProperty(exports, "__esModule", {
  6217. value: true
  6218. });
  6219. exports.createIsRealFun = createIsRealFun;
  6220. exports.createIsIntFun = createIsIntFun;
  6221. exports.createIsBoolFun = createIsBoolFun;
  6222. exports.createCastRealFun = createCastRealFun;
  6223. exports.createCastIntFun = createCastIntFun;
  6224. exports.createCastBoolFun = createCastBoolFun;
  6225. exports.createCastStringFun = createCastStringFun;
  6226. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  6227. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  6228. var Commands = _interopRequireWildcard(_commands);
  6229. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  6230. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6231. var _ivprogParser = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  6232. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  6233. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  6234. 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; } }
  6235. /**
  6236. *
  6237. * is_real
  6238. * is_int
  6239. * is_bool
  6240. * cast_real
  6241. * cast_int
  6242. * cast_bool
  6243. * cast_string
  6244. */
  6245. function createIsRealFun() {
  6246. var isRealFun = function isRealFun(sto, _) {
  6247. var str = sto.applyStore("str");
  6248. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  6249. var result = false;
  6250. try {
  6251. var val = parser.parseTerm();
  6252. if (val instanceof _expressions.RealLiteral) {
  6253. result = true;
  6254. }
  6255. } catch (error) {}
  6256. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  6257. sto.mode = _modes.Modes.RETURN;
  6258. return Promise.resolve(sto.updateStore("$", temp));
  6259. };
  6260. var block = new Commands.CommandBlock([], [new Commands.SysCall(isRealFun)]);
  6261. var func = new Commands.Function('$isReal', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6262. return func;
  6263. }
  6264. function createIsIntFun() {
  6265. var isIntFun = function isIntFun(sto, _) {
  6266. var str = sto.applyStore("str");
  6267. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  6268. var result = false;
  6269. try {
  6270. var val = parser.parseTerm();
  6271. if (val instanceof _expressions.IntLiteral) {
  6272. result = true;
  6273. }
  6274. } catch (error) {}
  6275. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  6276. sto.mode = _modes.Modes.RETURN;
  6277. return Promise.resolve(sto.updateStore("$", temp));
  6278. };
  6279. var block = new Commands.CommandBlock([], [new Commands.SysCall(isIntFun)]);
  6280. var func = new Commands.Function('$isInt', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6281. return func;
  6282. }
  6283. function createIsBoolFun() {
  6284. var isBoolFun = function isBoolFun(sto, _) {
  6285. var str = sto.applyStore("str");
  6286. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  6287. var result = false;
  6288. try {
  6289. var val = parser.parseTerm();
  6290. if (val instanceof _expressions.BoolLiteral) {
  6291. result = true;
  6292. }
  6293. } catch (error) {}
  6294. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  6295. sto.mode = _modes.Modes.RETURN;
  6296. return Promise.resolve(sto.updateStore("$", temp));
  6297. };
  6298. var block = new Commands.CommandBlock([], [new Commands.SysCall(isBoolFun)]);
  6299. var func = new Commands.Function('$isBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6300. return func;
  6301. }
  6302. function createCastRealFun() {
  6303. var castRealFun = function castRealFun(sto, _) {
  6304. var val = sto.applyStore("val");
  6305. switch (val.type.ord) {
  6306. case _types.Types.INTEGER.ord:
  6307. {
  6308. var temp = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(val.number));
  6309. sto.mode = _modes.Modes.RETURN;
  6310. return Promise.resolve(sto.updateStore("$", temp));
  6311. }
  6312. case _types.Types.STRING.ord:
  6313. {
  6314. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  6315. try {
  6316. var result = parser.parseTerm();
  6317. if (result instanceof _expressions.RealLiteral) {
  6318. var _temp = new _storeObject.StoreObject(_types.Types.REAL, result.value);
  6319. sto.mode = _modes.Modes.RETURN;
  6320. return Promise.resolve(sto.updateStore("$", _temp));
  6321. }
  6322. } catch (error) {
  6323. return Promise.reject("cannot convert string to real");
  6324. }
  6325. }
  6326. }
  6327. };
  6328. var block = new Commands.CommandBlock([], [new Commands.SysCall(castRealFun)]);
  6329. var func = new Commands.Function('$castReal', _types.Types.REAL, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  6330. return func;
  6331. }
  6332. function createCastIntFun() {
  6333. var castIntFun = function castIntFun(sto, _) {
  6334. var val = sto.applyStore("val");
  6335. switch (val.type.ord) {
  6336. case _types.Types.REAL.ord:
  6337. {
  6338. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, Math.floor(val.number));
  6339. sto.mode = _modes.Modes.RETURN;
  6340. return Promise.resolve(sto.updateStore("$", temp));
  6341. }
  6342. case _types.Types.STRING.ord:
  6343. {
  6344. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  6345. try {
  6346. var result = parser.parseTerm();
  6347. if (result instanceof _expressions.IntLiteral) {
  6348. var _temp2 = new _storeObject.StoreObject(_types.Types.INTEGER, result.value);
  6349. sto.mode = _modes.Modes.RETURN;
  6350. return Promise.resolve(sto.updateStore("$", _temp2));
  6351. }
  6352. } catch (error) {
  6353. return Promise.reject("cannot convert string to real");
  6354. }
  6355. }
  6356. }
  6357. };
  6358. var block = new Commands.CommandBlock([], [new Commands.SysCall(castIntFun)]);
  6359. var func = new Commands.Function('$castInt', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  6360. return func;
  6361. }
  6362. function createCastBoolFun() {
  6363. var castBoolFun = function castBoolFun(sto, _) {
  6364. var str = sto.applyStore("str");
  6365. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  6366. try {
  6367. var val = parser.parseTerm();
  6368. if (val instanceof _expressions.BoolLiteral) {
  6369. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, val.value);
  6370. sto.mode = _modes.Modes.RETURN;
  6371. return Promise.resolve(sto.updateStore("$", temp));
  6372. }
  6373. } catch (error) {}
  6374. return Promise.reject("cannot convert " + str.value + " to boolean");
  6375. };
  6376. var block = new Commands.CommandBlock([], [new Commands.SysCall(castBoolFun)]);
  6377. var func = new Commands.Function('$castBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6378. return func;
  6379. }
  6380. function createCastStringFun() {
  6381. var castStringFun = function castStringFun(store, _) {
  6382. var val = store.applyStore('str');
  6383. var result = (0, _parsers.convertToString)(val);
  6384. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  6385. sto.mode = _modes.Modes.RETURN;
  6386. return Promise.resolve(sto.updateStore("$", temp));
  6387. };
  6388. var block = new Commands.CommandBlock([], [new Commands.SysCall(castStringFun)]);
  6389. var func = new Commands.Function('$castString', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.ALL, 'str', false)], block);
  6390. return func;
  6391. }
  6392. /***/ }),
  6393. /***/ "./js/processor/lib/math.js":
  6394. /*!**********************************!*\
  6395. !*** ./js/processor/lib/math.js ***!
  6396. \**********************************/
  6397. /*! no static exports found */
  6398. /***/ (function(module, exports, __webpack_require__) {
  6399. "use strict";
  6400. Object.defineProperty(exports, "__esModule", {
  6401. value: true
  6402. });
  6403. exports.createSinFun = createSinFun;
  6404. exports.createCosFun = createCosFun;
  6405. exports.createTanFun = createTanFun;
  6406. exports.createSqrtFun = createSqrtFun;
  6407. exports.createPowFun = createPowFun;
  6408. exports.createLogFun = createLogFun;
  6409. exports.createAbsFun = createAbsFun;
  6410. exports.createNegateFun = createNegateFun;
  6411. exports.createInvertFun = createInvertFun;
  6412. exports.createMaxFun = createMaxFun;
  6413. exports.createMinFun = createMinFun;
  6414. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  6415. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  6416. var Commands = _interopRequireWildcard(_commands);
  6417. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  6418. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6419. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  6420. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6421. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6422. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  6423. 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; } }
  6424. 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); } }
  6425. /**
  6426. * sin
  6427. * cos
  6428. * tan
  6429. * sqrt
  6430. * pow
  6431. * log
  6432. * abs
  6433. * negate
  6434. * invert
  6435. * max
  6436. * min
  6437. */
  6438. function convertToRadians(degrees) {
  6439. return degrees.times(_decimal.Decimal.acos(-1)).div(180);
  6440. }
  6441. function createSinFun() {
  6442. var sinFun = function sinFun(sto, _) {
  6443. var x = sto.applyStore('x');
  6444. var result = _decimal.Decimal.sin(convertToRadians(x.value));
  6445. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6446. sto.mode = _modes.Modes.RETURN;
  6447. return Promise.resolve(sto.updateStore('$', temp));
  6448. };
  6449. var block = new Commands.CommandBlock([], [new Commands.SysCall(sinFun)]);
  6450. var func = new Commands.Function('$sin', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6451. return func;
  6452. }
  6453. function createCosFun() {
  6454. var cosFun = function cosFun(sto, _) {
  6455. var x = sto.applyStore('x');
  6456. var result = _decimal.Decimal.cos(convertToRadians(x.value));
  6457. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6458. sto.mode = _modes.Modes.RETURN;
  6459. return Promise.resolve(sto.updateStore('$', temp));
  6460. };
  6461. var block = new Commands.CommandBlock([], [new Commands.SysCall(cosFun)]);
  6462. var func = new Commands.Function('$cos', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6463. return func;
  6464. }
  6465. function createTanFun() {
  6466. var tanFun = function tanFun(sto, _) {
  6467. var x = sto.applyStore('x');
  6468. var result = _decimal.Decimal.tan(convertToRadians(x.value));
  6469. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6470. sto.mode = _modes.Modes.RETURN;
  6471. return Promise.resolve(sto.updateStore('$', temp));
  6472. };
  6473. var block = new Commands.CommandBlock([], [new Commands.SysCall(tanFun)]);
  6474. var func = new Commands.Function('$tan', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6475. return func;
  6476. }
  6477. function createSqrtFun() {
  6478. var sqrtFun = function sqrtFun(sto, _) {
  6479. var x = sto.applyStore('x');
  6480. var result = x.value.sqrt();
  6481. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6482. sto.mode = _modes.Modes.RETURN;
  6483. return Promise.resolve(sto.updateStore('$', temp));
  6484. };
  6485. var block = new Commands.CommandBlock([], [new Commands.SysCall(sqrtFun)]);
  6486. var func = new Commands.Function('$sqrt', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6487. return func;
  6488. }
  6489. function createPowFun() {
  6490. var powFun = function powFun(sto, _) {
  6491. var x = sto.applyStore('x');
  6492. var y = sto.applyStore('y');
  6493. var result = x.value.pow(y.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(powFun)]);
  6499. 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);
  6500. return func;
  6501. }
  6502. function createLogFun() {
  6503. var logFun = function logFun(sto, _) {
  6504. var x = sto.applyStore('x');
  6505. if (x.value.isNegative()) {
  6506. return Promise.reject("the value passed to log function cannot be negative");
  6507. }
  6508. var result = _decimal.Decimal.log10(x.value);
  6509. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6510. sto.mode = _modes.Modes.RETURN;
  6511. return Promise.resolve(sto.updateStore('$', temp));
  6512. };
  6513. var block = new Commands.CommandBlock([], [new Commands.SysCall(logFun)]);
  6514. var func = new Commands.Function('$log', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6515. return func;
  6516. }
  6517. function createAbsFun() {
  6518. var absFun = function absFun(sto, _) {
  6519. var x = sto.applyStore('x');
  6520. var result = x.value.abs();
  6521. var temp = new _storeObject.StoreObject(x.type, result);
  6522. sto.mode = _modes.Modes.RETURN;
  6523. return Promise.resolve(sto.updateStore('$', temp));
  6524. };
  6525. var block = new Commands.CommandBlock([], [new Commands.SysCall(absFun)]);
  6526. 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);
  6527. return func;
  6528. }
  6529. function createNegateFun() {
  6530. var negateFun = function negateFun(sto, _) {
  6531. var x = sto.applyStore('x');
  6532. var result = x.value.negated();
  6533. var temp = new _storeObject.StoreObject(x.type, result);
  6534. sto.mode = _modes.Modes.RETURN;
  6535. return Promise.resolve(sto.updateStore('$', temp));
  6536. };
  6537. var block = new Commands.CommandBlock([], [new Commands.SysCall(negateFun)]);
  6538. 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);
  6539. return func;
  6540. }
  6541. function createInvertFun() {
  6542. var invertFun = function invertFun(sto, _) {
  6543. var x = sto.applyStore('x');
  6544. var result = (0, _parsers.toReal)(1).dividedBy(x.value);
  6545. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6546. sto.mode = _modes.Modes.RETURN;
  6547. return Promise.resolve(sto.updateStore('$', temp));
  6548. };
  6549. var block = new Commands.CommandBlock([], [new Commands.SysCall(invertFun)]);
  6550. var func = new Commands.Function('$invert', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6551. return func;
  6552. }
  6553. function createMaxFun() {
  6554. var maxFun = function maxFun(sto, _) {
  6555. var x = sto.applyStore('x');
  6556. var numbers = x.value.map(function (stoObj) {
  6557. return stoObj.value;
  6558. });
  6559. var result = _decimal.Decimal.max.apply(_decimal.Decimal, _toConsumableArray(numbers));
  6560. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  6561. sto.mode = _modes.Modes.RETURN;
  6562. return Promise.resolve(sto.updateStore('$', temp));
  6563. };
  6564. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  6565. var block = new Commands.CommandBlock([], [new Commands.SysCall(maxFun)]);
  6566. var func = new Commands.Function('$max', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  6567. return func;
  6568. }
  6569. function createMinFun() {
  6570. var minFun = function minFun(sto, _) {
  6571. var x = sto.applyStore('x');
  6572. var numbers = x.value.map(function (stoObj) {
  6573. return stoObj.value;
  6574. });
  6575. var result = _decimal.Decimal.min.apply(_decimal.Decimal, _toConsumableArray(numbers));
  6576. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  6577. sto.mode = _modes.Modes.RETURN;
  6578. return Promise.resolve(sto.updateStore('$', temp));
  6579. };
  6580. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  6581. var block = new Commands.CommandBlock([], [new Commands.SysCall(minFun)]);
  6582. var func = new Commands.Function('$min', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  6583. return func;
  6584. }
  6585. /***/ }),
  6586. /***/ "./js/processor/lib/strings.js":
  6587. /*!*************************************!*\
  6588. !*** ./js/processor/lib/strings.js ***!
  6589. \*************************************/
  6590. /*! no static exports found */
  6591. /***/ (function(module, exports, __webpack_require__) {
  6592. "use strict";
  6593. Object.defineProperty(exports, "__esModule", {
  6594. value: true
  6595. });
  6596. exports.createSubstringFun = createSubstringFun;
  6597. exports.createLengthFun = createLengthFun;
  6598. exports.createUppercaseFun = createUppercaseFun;
  6599. exports.createLowercaseFun = createLowercaseFun;
  6600. exports.createrCharAtFun = createrCharAtFun;
  6601. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  6602. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  6603. var Commands = _interopRequireWildcard(_commands);
  6604. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  6605. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6606. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  6607. 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; } }
  6608. /*
  6609. * substring
  6610. * length
  6611. * uppercase
  6612. * lowercase
  6613. * charAt
  6614. **/
  6615. function createSubstringFun() {
  6616. var substringFun = function substringFun(sto, _) {
  6617. var str = sto.applyStore("str");
  6618. var start = sto.applyStore("start");
  6619. var end = sto.applyStore("end");
  6620. var result = str.value.substring(start.value, end.value);
  6621. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  6622. sto.mode = _modes.Modes.RETURN;
  6623. return Promise.resolve(sto.updateStore("$", temp));
  6624. };
  6625. var block = new Commands.CommandBlock([], [new Commands.SysCall(substringFun)]);
  6626. 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);
  6627. return func;
  6628. }
  6629. function createLengthFun() {
  6630. var lengthFun = function lengthFun(sto, _) {
  6631. var str = sto.applyStore("str");
  6632. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(str.value.length));
  6633. sto.mode = _modes.Modes.RETURN;
  6634. return Promise.resolve(sto.updateStore("$", temp));
  6635. };
  6636. var block = new Commands.CommandBlock([], [new Commands.SysCall(lengthFun)]);
  6637. var func = new Commands.Function('$length', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6638. return func;
  6639. }
  6640. function createUppercaseFun() {
  6641. var uppercaseFun = function uppercaseFun(sto, _) {
  6642. var str = sto.applyStore("str");
  6643. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toUpperCase());
  6644. sto.mode = _modes.Modes.RETURN;
  6645. return Promise.resolve(sto.updateStore("$", temp));
  6646. };
  6647. var block = new Commands.CommandBlock([], [new Commands.SysCall(uppercaseFun)]);
  6648. var func = new Commands.Function('$uppercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6649. return func;
  6650. }
  6651. function createLowercaseFun() {
  6652. var lowercaseFun = function lowercaseFun(sto, _) {
  6653. var str = sto.applyStore("str");
  6654. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toLowerCase());
  6655. sto.mode = _modes.Modes.RETURN;
  6656. return Promise.resolve(sto.updateStore("$", temp));
  6657. };
  6658. var block = new Commands.CommandBlock([], [new Commands.SysCall(lowercaseFun)]);
  6659. var func = new Commands.Function('$lowercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6660. return func;
  6661. }
  6662. function createrCharAtFun() {
  6663. var charAtFun = function charAtFun(sto, _) {
  6664. var str = sto.applyStore("str");
  6665. var idx = sto.applyStore("index");
  6666. if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
  6667. return Promise.reject(new Error("invalid string position"));
  6668. }
  6669. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.charAt(idx.value.toNumber()));
  6670. sto.mode = _modes.Modes.RETURN;
  6671. return Promise.resolve(sto.updateStore("$", temp));
  6672. };
  6673. var block = new Commands.CommandBlock([], [new Commands.SysCall(charAtFun)]);
  6674. 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);
  6675. return func;
  6676. }
  6677. /***/ }),
  6678. /***/ "./js/processor/modes.js":
  6679. /*!*******************************!*\
  6680. !*** ./js/processor/modes.js ***!
  6681. \*******************************/
  6682. /*! no static exports found */
  6683. /***/ (function(module, exports, __webpack_require__) {
  6684. "use strict";
  6685. Object.defineProperty(exports, "__esModule", {
  6686. value: true
  6687. });
  6688. var Modes = exports.Modes = Object.freeze({
  6689. RETURN: Symbol('mode:return'),
  6690. BREAK: Symbol('mode:break'),
  6691. PAUSE: Symbol('mode:pause'),
  6692. RUN: Symbol('mode:run')
  6693. });
  6694. /***/ }),
  6695. /***/ "./js/processor/semantic/semanticAnalyser.js":
  6696. /*!***************************************************!*\
  6697. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  6698. \***************************************************/
  6699. /*! no static exports found */
  6700. /***/ (function(module, exports, __webpack_require__) {
  6701. "use strict";
  6702. Object.defineProperty(exports, "__esModule", {
  6703. value: true
  6704. });
  6705. exports.SemanticAnalyser = undefined;
  6706. 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; }; }();
  6707. var _processorErrorFactory = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  6708. var _definedFunctions = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  6709. var _languageService = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js");
  6710. var _commands = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  6711. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  6712. var _literal = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  6713. var _compatibilityTable = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js");
  6714. var _types = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js");
  6715. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6716. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6717. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6718. var SemanticAnalyser = exports.SemanticAnalyser = function () {
  6719. function SemanticAnalyser(ast) {
  6720. _classCallCheck(this, SemanticAnalyser);
  6721. this.ast = ast;
  6722. this.lexerClass = _languageService.LanguageService.getCurrentLexer();
  6723. var lexer = new this.lexerClass(null);
  6724. this.literalNames = lexer.literalNames;
  6725. this.symbolMap = null;
  6726. }
  6727. _createClass(SemanticAnalyser, [{
  6728. key: 'pushMap',
  6729. value: function pushMap() {
  6730. if (this.symbolMap === null) {
  6731. this.symbolMap = { map: {}, next: null };
  6732. } else {
  6733. var n = { map: {}, next: this.symbolMap };
  6734. this.symbolMap = n;
  6735. }
  6736. }
  6737. }, {
  6738. key: 'popMap',
  6739. value: function popMap() {
  6740. if (this.symbolMap !== null) {
  6741. this.symbolMap = this.symbolMap.next;
  6742. }
  6743. }
  6744. }, {
  6745. key: 'insertSymbol',
  6746. value: function insertSymbol(id, typeInfo) {
  6747. this.symbolMap.map[id] = typeInfo;
  6748. }
  6749. }, {
  6750. key: 'findSymbol',
  6751. value: function findSymbol(id, symMap) {
  6752. if (!symMap.map[id]) {
  6753. if (symMap.next) {
  6754. return this.findSymbol(id, symMap.next);
  6755. }
  6756. throw new Error("variable not defined " + id);
  6757. } else {
  6758. return symMap.map[id];
  6759. }
  6760. }
  6761. }, {
  6762. key: 'findFunction',
  6763. value: function findFunction(name) {
  6764. if (name.match(/^\$.+$/)) {
  6765. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  6766. if (!!!fun) {
  6767. throw new Error("!!!Internal Error. Language defined function not implemented -> " + name + "!!!");
  6768. }
  6769. return fun;
  6770. } else {
  6771. var val = this.ast.functions.find(function (v) {
  6772. return v.name === name;
  6773. });
  6774. if (!!!val) {
  6775. // TODO: better error message;
  6776. throw new Error('Function ' + name + ' is not defined.');
  6777. }
  6778. return val;
  6779. }
  6780. }
  6781. }, {
  6782. key: 'analyseTree',
  6783. value: function analyseTree() {
  6784. var globalVars = this.ast.global;
  6785. this.pushMap();
  6786. this.assertDeclarations(globalVars);
  6787. var functions = this.ast.functions;
  6788. var mainFunc = functions.filter(function (f) {
  6789. return f.name === null;
  6790. });
  6791. if (mainFunc.length <= 0) {
  6792. throw new Error("no main func...");
  6793. } else if (mainFunc.length > 1) {
  6794. throw new Error("only one main func...");
  6795. }
  6796. for (var i = 0; i < functions.length; i++) {
  6797. var fun = functions[i];
  6798. this.assertFunction(fun);
  6799. }
  6800. return this.ast;
  6801. }
  6802. }, {
  6803. key: 'assertDeclarations',
  6804. value: function assertDeclarations(list) {
  6805. for (var i = 0; i < list.length; i++) {
  6806. this.assertDeclaration(list[i]);
  6807. }
  6808. }
  6809. }, {
  6810. key: 'assertDeclaration',
  6811. value: function assertDeclaration(declaration) {
  6812. if (declaration instanceof _commands.ArrayDeclaration) {
  6813. if (declaration.initial === null) {
  6814. var lineType = this.evaluateExpressionType(declaration.lines);
  6815. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  6816. throw new Error("dim must be int");
  6817. }
  6818. if (declaration.columns !== null) {
  6819. var columnType = this.evaluateExpressionType(declaration.columns);
  6820. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  6821. throw new Error("dim must be int");
  6822. }
  6823. }
  6824. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  6825. return;
  6826. }
  6827. this.evaluateArrayLiteral(declaration.lines, declaration.columns, declaration.type, declaration.initial);
  6828. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  6829. } else {
  6830. if (declaration.initial === null) {
  6831. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  6832. return;
  6833. }
  6834. var resultType = this.evaluateExpressionType(declaration.initial);
  6835. if (resultType instanceof _multiType.MultiType) {
  6836. if (!resultType.isCompatible(declaration.type)) {
  6837. throw new Error('Invalid type');
  6838. }
  6839. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  6840. } else if (!declaration.type.isCompatible(resultType)) {
  6841. throw new Error('Invalid type');
  6842. } else {
  6843. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  6844. }
  6845. }
  6846. }
  6847. }, {
  6848. key: 'evaluateExpressionType',
  6849. value: function evaluateExpressionType(expression) {
  6850. if (expression instanceof _expressions.UnaryApp) {
  6851. var op = expression.op;
  6852. var resultType = this.evaluateExpressionType(expression.left);
  6853. return (0, _compatibilityTable.resultTypeAfterUnaryOp)(op, resultType);
  6854. } else if (expression instanceof _expressions.InfixApp) {
  6855. var _op = expression.op;
  6856. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  6857. var resultTypeRight = this.evaluateExpressionType(expression.right);
  6858. return (0, _compatibilityTable.resultTypeAfterInfixOp)(_op, resultTypeLeft, resultTypeRight);
  6859. } else if (expression instanceof _literal.Literal) {
  6860. return this.evaluateLiteralType(expression);
  6861. } else if (expression instanceof _expressions.FunctionCall) {
  6862. var fun = this.findFunction(expression.id);
  6863. if (fun.returnType.isCompatible(_types.Types.VOID)) {
  6864. throw new Error("void return");
  6865. }
  6866. this.assertParameters(fun, expression.actualParameters);
  6867. return fun.returnType;
  6868. } else if (expression instanceof _expressions.ArrayAccess) {
  6869. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  6870. if (!(arrayTypeInfo.type instanceof _compoundType.CompoundType)) {
  6871. throw new Error("it's not an array");
  6872. }
  6873. var lineType = this.evaluateExpressionType(expression.line);
  6874. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  6875. throw new Error("line must be integer");
  6876. }
  6877. if (expression.column !== null) {
  6878. if (arrayTypeInfo.columns === null) {
  6879. throw new Error("it's not a matrix");
  6880. }
  6881. var columnType = this.evaluateExpressionType(expression.column);
  6882. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  6883. throw new Error("column must be integer");
  6884. }
  6885. }
  6886. var arrType = arrayTypeInfo.type;
  6887. if (expression.column !== null) {
  6888. // indexing matrix
  6889. return arrType.innerType;
  6890. } else {
  6891. if (arrayTypeInfo.columns === null) {
  6892. return arrType.innerType;
  6893. }
  6894. return new _compoundType.CompoundType(arrType.innerType, 1);
  6895. }
  6896. }
  6897. }
  6898. }, {
  6899. key: 'evaluateLiteralType',
  6900. value: function evaluateLiteralType(literal) {
  6901. if (literal instanceof _expressions.IntLiteral) {
  6902. return literal.type;
  6903. } else if (literal instanceof _expressions.RealLiteral) {
  6904. return literal.type;
  6905. } else if (literal instanceof _expressions.StringLiteral) {
  6906. return literal.type;
  6907. } else if (literal instanceof _expressions.BoolLiteral) {
  6908. return literal.type;
  6909. } else if (literal instanceof _expressions.VariableLiteral) {
  6910. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  6911. if (typeInfo.type instanceof _compoundType.CompoundType) {
  6912. return typeInfo.type;
  6913. }
  6914. return typeInfo.type;
  6915. } else {
  6916. console.warn("Evaluating type only for an array literal...");
  6917. var last = null;
  6918. if (literal.value.length === 1) {
  6919. last = this.evaluateExpressionType(literal.value[0]);
  6920. } else {
  6921. for (var i = 0; i < literal.value.length; i++) {
  6922. var e = this.evaluateExpressionType(literal.value[i]);
  6923. if (last === null) {
  6924. last = e;
  6925. } else if (!last.isCompatible(e)) {
  6926. throw new Error("invalid value type for array");
  6927. } else {
  6928. last = e;
  6929. }
  6930. }
  6931. }
  6932. if (last instanceof _compoundType.CompoundType) {
  6933. return new _compoundType.CompoundType(last.innerType, last.dimensions + 1);
  6934. }
  6935. return new _compoundType.CompoundType(last, 1);
  6936. }
  6937. }
  6938. }, {
  6939. key: 'evaluateArrayLiteral',
  6940. value: function evaluateArrayLiteral(lines, columns, type, literal) {
  6941. var _this = this;
  6942. if (literal instanceof _expressions.ArrayLiteral) {
  6943. if (columns === null) {
  6944. // it's a vector...
  6945. var dimType = this.evaluateExpressionType(lines);
  6946. if (!dimType.isCompatible(_types.Types.INTEGER)) {
  6947. throw new Error("dim must be int");
  6948. }
  6949. if (lines instanceof _expressions.IntLiteral && !lines.value.eq(literal.value.length)) {
  6950. throw new Error("invalid array size");
  6951. }
  6952. literal.value.reduce(function (last, next) {
  6953. var eType = _this.evaluateExpressionType(next);
  6954. if (!last.canAccept(eType)) {
  6955. throw new Error("invalid value type for array");
  6956. }
  6957. return last;
  6958. }, type);
  6959. return true;
  6960. } else {
  6961. var _dimType = this.evaluateExpressionType(columns);
  6962. if (!_dimType.isCompatible(_types.Types.INTEGER)) {
  6963. throw new Error("dim must be int");
  6964. }
  6965. if (columns instanceof _expressions.IntLiteral && !columns.value.eq(literal.value.length)) {
  6966. throw new Error("invalid array size");
  6967. }
  6968. for (var i = 0; i < columns; i++) {
  6969. var anotherArray = literal.value[i];
  6970. this.evaluateArrayLiteral(lines, null, type, anotherArray);
  6971. }
  6972. }
  6973. } else {
  6974. var resultType = this.evaluateExpressionType(literal);
  6975. if (!(resultType instanceof _compoundType.CompoundType)) {
  6976. throw new Error("initial must be of type array");
  6977. }
  6978. if (!type.isCompatible(resultType)) {
  6979. throw new Error("invalid array type");
  6980. }
  6981. return true;
  6982. }
  6983. }
  6984. }, {
  6985. key: 'assertFunction',
  6986. value: function assertFunction(fun) {
  6987. var _this2 = this;
  6988. this.pushMap();
  6989. fun.formalParameters.forEach(function (formalParam) {
  6990. if (formalParam.type instanceof _compoundType.CompoundType) {
  6991. if (formalParam.type.dimensions > 1) {
  6992. _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: -1, type: formalParam.type });
  6993. } else {
  6994. _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: null, type: formalParam.type });
  6995. }
  6996. } else {
  6997. _this2.insertSymbol(formalParam.id, { id: formalParam.id, type: formalParam.type });
  6998. }
  6999. });
  7000. this.assertDeclarations(fun.variablesDeclarations);
  7001. var optional = fun.returnType.isCompatible(_types.Types.VOID);
  7002. var valid = this.assertReturn(fun, optional);
  7003. if (!valid) {
  7004. throw new Error("function has no accessible return");
  7005. }
  7006. this.popMap();
  7007. }
  7008. }, {
  7009. key: 'assertReturn',
  7010. value: function assertReturn(fun, optional) {
  7011. var _this3 = this;
  7012. return fun.commands.reduce(function (last, next) {
  7013. return _this3.checkCommand(fun.returnType, next, optional) || last;
  7014. }, optional);
  7015. }
  7016. }, {
  7017. key: 'checkCommand',
  7018. value: function checkCommand(type, cmd, optional) {
  7019. if (cmd instanceof _commands.While) {
  7020. var resultType = this.evaluateExpressionType(cmd.expression);
  7021. if (!resultType.isCompatible(_types.Types.BOOLEAN)) {
  7022. throw new Error("condition not boolean");
  7023. }
  7024. this.checkCommands(type, cmd.commands, optional);
  7025. return false;
  7026. } else if (cmd instanceof _commands.For) {
  7027. this.checkCommand(type, cmd.assignment, optional);
  7028. var _resultType = this.evaluateExpressionType(cmd.condition);
  7029. if (!_resultType.isCompatible(_types.Types.BOOLEAN)) {
  7030. throw new Error("condition not boolean");
  7031. }
  7032. this.checkCommand(type, cmd.increment, optional);
  7033. this.checkCommands(type, cmd.commands, optional);
  7034. return false;
  7035. } else if (cmd instanceof _commands.Switch) {
  7036. var sType = this.evaluateExpressionType(cmd.expression);
  7037. var result = optional;
  7038. var hasDefault = false;
  7039. for (var i = 0; i < cmd.cases.length; i++) {
  7040. var aCase = cmd.cases[i];
  7041. if (aCase.expression !== null) {
  7042. var caseType = this.evaluateExpressionType(aCase.expression);
  7043. if (!sType.isCompatible(caseType)) {
  7044. throw new Error("invalid type in case");
  7045. }
  7046. } else {
  7047. hasDefault = true;
  7048. }
  7049. result = result && this.checkCommands(type, aCase.commands, result);
  7050. }
  7051. return result && hasDefault;
  7052. } else if (cmd instanceof _commands.ArrayIndexAssign) {
  7053. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  7054. if (!(typeInfo.type instanceof _compoundType.CompoundType)) {
  7055. throw new Error(cmd.id + " is not an array.");
  7056. }
  7057. var exp = cmd.expression;
  7058. var lineExp = cmd.line;
  7059. var lineType = this.evaluateExpressionType(lineExp);
  7060. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  7061. throw new Error("array dimension must be of type int");
  7062. }
  7063. var columnExp = cmd.column;
  7064. if (typeInfo.columns === null && columnExp !== null) {
  7065. throw new Error(cmd.id + " is not a matrix");
  7066. } else if (columnExp !== null) {
  7067. var columnType = this.evaluateExpressionType(columnExp);
  7068. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  7069. throw new Error("array dimension must be of type int");
  7070. }
  7071. }
  7072. // exp can be a arrayLiteral, a single value exp or an array access
  7073. if (exp instanceof _expressions.ArrayLiteral) {
  7074. this.evaluateArrayLiteral(typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp);
  7075. } else {
  7076. // cannot properly evaluate since type system is poorly constructed
  7077. }
  7078. return optional;
  7079. } else if (cmd instanceof _commands.Assign) {
  7080. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  7081. var _exp = cmd.expression;
  7082. if (_exp instanceof _expressions.ArrayLiteral) {
  7083. if (!(_typeInfo.type instanceof _compoundType.CompoundType)) {
  7084. throw new Error("type not compatible");
  7085. }
  7086. this.evaluateArrayLiteral(_typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp);
  7087. } else {
  7088. var _resultType2 = this.evaluateExpressionType(_exp);
  7089. if (!_resultType2.isCompatible(_typeInfo.type)) {
  7090. throw new Error("type not compatible");
  7091. }
  7092. }
  7093. return optional;
  7094. } else if (cmd instanceof _commands.Break) {
  7095. return optional;
  7096. } else if (cmd instanceof _commands.IfThenElse) {
  7097. var _resultType3 = this.evaluateExpressionType(cmd.condition);
  7098. if (!_resultType3.isCompatible(_types.Types.BOOLEAN)) {
  7099. throw new Error("condition not boolean");
  7100. }
  7101. if (cmd.ifFalse instanceof _commands.IfThenElse) {
  7102. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  7103. } else {
  7104. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  7105. }
  7106. } else if (cmd instanceof _expressions.FunctionCall) {
  7107. var fun = this.findFunction(cmd.id);
  7108. this.assertParameters(fun, cmd.actualParameters);
  7109. return optional;
  7110. } else if (cmd instanceof _commands.Return) {
  7111. if (cmd.expression === null && !type.isCompatible(_types.Types.VOID)) {
  7112. throw new Error('invalid return type');
  7113. } else if (cmd.expression !== null) {
  7114. var _resultType4 = this.evaluateExpressionType(cmd.expression);
  7115. if (!type.isCompatible(_resultType4)) {
  7116. console.log(_resultType4);
  7117. throw new Error('invalid return type');
  7118. } else {
  7119. return true;
  7120. }
  7121. } else {
  7122. return true;
  7123. }
  7124. }
  7125. }
  7126. }, {
  7127. key: 'checkCommands',
  7128. value: function checkCommands(type, cmds, optional) {
  7129. var _this4 = this;
  7130. return cmds.reduce(function (last, next) {
  7131. return _this4.checkCommand(type, next, optional) || last;
  7132. }, optional);
  7133. }
  7134. }, {
  7135. key: 'assertParameters',
  7136. value: function assertParameters(fun, actualParametersList) {
  7137. if (fun.formalParameters.length !== actualParametersList.length) {
  7138. throw new Error("wrong number of parameters...");
  7139. }
  7140. for (var i = 0; i < actualParametersList.length; i++) {
  7141. var param = actualParametersList[i];
  7142. var formalParam = fun.formalParameters[i];
  7143. if (formalParam.byRef) {
  7144. if (!(param instanceof _expressions.VariableLiteral || param instanceof _expressions.ArrayAccess)) {
  7145. throw new Error("Invalid param type for ref");
  7146. }
  7147. }
  7148. var resultType = this.evaluateExpressionType(param);
  7149. if (resultType instanceof _multiType.MultiType && formalParam.type instanceof _multiType.MultiType) {
  7150. var shared = 0;
  7151. for (var j = 0; j < resultType.types.length; j++) {
  7152. var element = resultType.types[j];
  7153. if (formalParam.type.types.indexOf(element) !== -1) {
  7154. shared++;
  7155. }
  7156. }
  7157. if (shared <= 0) {
  7158. throw new Error('Parameter ' + formalParam.id + ' is not compatible with the value given.');
  7159. }
  7160. } else if (resultType instanceof _multiType.MultiType) {
  7161. if (!resultType.isCompatible(formalParam.type)) {
  7162. throw new Error('Parameter ' + formalParam.id + ' is not compatible with the value given.');
  7163. }
  7164. } else if (!formalParam.type.isCompatible(resultType)) {
  7165. console.log("####");
  7166. console.log(resultType);
  7167. console.log("####");
  7168. console.log(formalParam.type);
  7169. throw new Error('Parameter ' + formalParam.id + ' is not compatible with the value given.');
  7170. }
  7171. }
  7172. }
  7173. }]);
  7174. return SemanticAnalyser;
  7175. }();
  7176. /***/ }),
  7177. /***/ "./js/processor/store/store.js":
  7178. /*!*************************************!*\
  7179. !*** ./js/processor/store/store.js ***!
  7180. \*************************************/
  7181. /*! no static exports found */
  7182. /***/ (function(module, exports, __webpack_require__) {
  7183. "use strict";
  7184. Object.defineProperty(exports, "__esModule", {
  7185. value: true
  7186. });
  7187. exports.Store = undefined;
  7188. 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; }; }();
  7189. var _modes = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js");
  7190. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7191. var Store = exports.Store = function () {
  7192. function Store() {
  7193. _classCallCheck(this, Store);
  7194. this.store = {};
  7195. this.nextStore = null;
  7196. this.mode = _modes.Modes.RUN;
  7197. }
  7198. _createClass(Store, [{
  7199. key: "extendStore",
  7200. value: function extendStore(nextStore) {
  7201. this.nextStore = nextStore;
  7202. }
  7203. }, {
  7204. key: "applyStore",
  7205. value: function applyStore(id) {
  7206. if (!this.store[id]) {
  7207. if (this.nextStore !== null) {
  7208. return this.nextStore.applyStore(id);
  7209. } else {
  7210. // TODO: better error message
  7211. throw new Error("Variable " + id + " not found.");
  7212. }
  7213. }
  7214. var val = this.store[id];
  7215. if (val.isRef) {
  7216. return val.getRefObj();
  7217. }
  7218. return this.store[id];
  7219. }
  7220. }, {
  7221. key: "updateStore",
  7222. value: function updateStore(id, stoObj) {
  7223. if (!this.store[id]) {
  7224. if (this.nextStore !== null) {
  7225. this.nextStore.updateStore(id, stoObj);
  7226. return this;
  7227. } else {
  7228. // TODO: better error message
  7229. throw new Error("Variable " + id + " not found.");
  7230. }
  7231. } else {
  7232. var oldObj = this.store[id];
  7233. if (oldObj.readOnly) {
  7234. // TODO: better error message
  7235. throw new Error("Cannot change value of a read only variable: " + id);
  7236. }
  7237. if (oldObj.isRef) {
  7238. oldObj.updateRef(stoObj);
  7239. return this;
  7240. } else if (oldObj.isCompatible(stoObj)) {
  7241. stoObj.setID(id);
  7242. this.store[id] = Object.freeze(stoObj);
  7243. return this;
  7244. } else {
  7245. var oldType = oldObj.type;
  7246. var stoType = stoObj.type;
  7247. // TODO: better error message
  7248. throw new Error(oldType + " is not compatible with type " + stoType + " given");
  7249. }
  7250. }
  7251. }
  7252. //In case of future use of ref, it needs to have a special function to update the storeRefObject
  7253. // and no the StoreObject refferenced by it
  7254. // updateStoreRef(id, stoObjAddress) {...}
  7255. }, {
  7256. key: "insertStore",
  7257. value: function insertStore(id, stoObj) {
  7258. if (this.store[id]) {
  7259. // TODO: better error message
  7260. throw new Error(id + " is already defined");
  7261. }
  7262. stoObj.setID(id);
  7263. this.store[id] = Object.freeze(stoObj);
  7264. return this;
  7265. }
  7266. }]);
  7267. return Store;
  7268. }();
  7269. /***/ }),
  7270. /***/ "./js/processor/store/storeObject.js":
  7271. /*!*******************************************!*\
  7272. !*** ./js/processor/store/storeObject.js ***!
  7273. \*******************************************/
  7274. /*! no static exports found */
  7275. /***/ (function(module, exports, __webpack_require__) {
  7276. "use strict";
  7277. Object.defineProperty(exports, "__esModule", {
  7278. value: true
  7279. });
  7280. exports.StoreObject = undefined;
  7281. 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; }; }();
  7282. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  7283. var _decimal2 = _interopRequireDefault(_decimal);
  7284. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7285. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7286. var StoreObject = exports.StoreObject = function () {
  7287. function StoreObject(type, value) {
  7288. var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  7289. _classCallCheck(this, StoreObject);
  7290. this._type = type;
  7291. this._value = value;
  7292. this._readOnly = readOnly;
  7293. this._id = null;
  7294. }
  7295. _createClass(StoreObject, [{
  7296. key: 'setID',
  7297. value: function setID(id) {
  7298. this._id = id;
  7299. }
  7300. }, {
  7301. key: 'isCompatible',
  7302. value: function isCompatible(another) {
  7303. if (another instanceof StoreObject) {
  7304. return this.type.isCompatible(another.type);
  7305. }
  7306. return false;
  7307. }
  7308. }, {
  7309. key: 'id',
  7310. get: function get() {
  7311. return this._id;
  7312. }
  7313. }, {
  7314. key: 'inStore',
  7315. get: function get() {
  7316. return this.id !== null;
  7317. }
  7318. }, {
  7319. key: 'type',
  7320. get: function get() {
  7321. return this._type;
  7322. }
  7323. }, {
  7324. key: 'value',
  7325. get: function get() {
  7326. return this._value;
  7327. }
  7328. }, {
  7329. key: 'number',
  7330. get: function get() {
  7331. if (this._value instanceof _decimal2.default) {
  7332. return this._value.toNumber();
  7333. } else {
  7334. return null;
  7335. }
  7336. }
  7337. }, {
  7338. key: 'readOnly',
  7339. get: function get() {
  7340. return this._readOnly;
  7341. },
  7342. set: function set(value) {
  7343. this._readOnly = value;
  7344. }
  7345. }]);
  7346. return StoreObject;
  7347. }();
  7348. /***/ }),
  7349. /***/ "./js/processor/store/storeObjectArray.js":
  7350. /*!************************************************!*\
  7351. !*** ./js/processor/store/storeObjectArray.js ***!
  7352. \************************************************/
  7353. /*! no static exports found */
  7354. /***/ (function(module, exports, __webpack_require__) {
  7355. "use strict";
  7356. Object.defineProperty(exports, "__esModule", {
  7357. value: true
  7358. });
  7359. exports.StoreObjectArray = undefined;
  7360. 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; }; }();
  7361. 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); } };
  7362. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  7363. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7364. 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; }
  7365. 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; }
  7366. var StoreObjectArray = exports.StoreObjectArray = function (_StoreObject) {
  7367. _inherits(StoreObjectArray, _StoreObject);
  7368. function StoreObjectArray(type, lines, columns) {
  7369. var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  7370. var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  7371. _classCallCheck(this, StoreObjectArray);
  7372. var _this = _possibleConstructorReturn(this, (StoreObjectArray.__proto__ || Object.getPrototypeOf(StoreObjectArray)).call(this, type, value, readOnly));
  7373. _this._lines = lines;
  7374. _this._columns = columns;
  7375. return _this;
  7376. }
  7377. _createClass(StoreObjectArray, [{
  7378. key: 'isCompatible',
  7379. value: function isCompatible(another) {
  7380. if (another instanceof _storeObject.StoreObject) {
  7381. if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) {
  7382. if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) {
  7383. return _get(StoreObjectArray.prototype.__proto__ || Object.getPrototypeOf(StoreObjectArray.prototype), 'isCompatible', this).call(this, another);
  7384. }
  7385. }
  7386. }
  7387. return false;
  7388. }
  7389. }, {
  7390. key: 'lines',
  7391. get: function get() {
  7392. return this._lines;
  7393. }
  7394. }, {
  7395. key: 'columns',
  7396. get: function get() {
  7397. return this._columns;
  7398. }
  7399. }, {
  7400. key: 'isVector',
  7401. get: function get() {
  7402. return this.type.dimensions === 1;
  7403. }
  7404. }, {
  7405. key: 'isValid',
  7406. get: function get() {
  7407. var _this2 = this;
  7408. if (this.value !== null) {
  7409. if (this.isVector) {
  7410. if (this.value.length !== this.lines) {
  7411. return false;
  7412. }
  7413. var mustBeNull = this.value.find(function (v) {
  7414. return !_this2.type.canAccept(v.type);
  7415. });
  7416. if (!!mustBeNull) {
  7417. return false;
  7418. }
  7419. }
  7420. return true;
  7421. } else {
  7422. if (this.lines !== this.value.length) {
  7423. return false;
  7424. }
  7425. for (var i = 0; i < this.lines; i++) {
  7426. for (var j = 0; j < this.columns; j++) {
  7427. var arr = this.value[i];
  7428. if (arr.length !== this.columns) {
  7429. return false;
  7430. }
  7431. var _mustBeNull = arr.find(function (v) {
  7432. return !_this2.type.canAccept(v.type);
  7433. });
  7434. if (!!_mustBeNull) {
  7435. return false;
  7436. }
  7437. }
  7438. }
  7439. return true;
  7440. }
  7441. }
  7442. }]);
  7443. return StoreObjectArray;
  7444. }(_storeObject.StoreObject);
  7445. /***/ }),
  7446. /***/ "./js/processor/store/storeObjectArrayAddress.js":
  7447. /*!*******************************************************!*\
  7448. !*** ./js/processor/store/storeObjectArrayAddress.js ***!
  7449. \*******************************************************/
  7450. /*! no static exports found */
  7451. /***/ (function(module, exports, __webpack_require__) {
  7452. "use strict";
  7453. Object.defineProperty(exports, "__esModule", {
  7454. value: true
  7455. });
  7456. exports.StoreObjectArrayAddress = undefined;
  7457. 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; }; }();
  7458. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  7459. var _storeObjectArray = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  7460. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  7461. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7462. 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; }
  7463. 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; }
  7464. var StoreObjectArrayAddress = exports.StoreObjectArrayAddress = function (_StoreObject) {
  7465. _inherits(StoreObjectArrayAddress, _StoreObject);
  7466. function StoreObjectArrayAddress(refID, line, column, store) {
  7467. _classCallCheck(this, StoreObjectArrayAddress);
  7468. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddress.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddress)).call(this, null, null, false));
  7469. _this.refID = refID;
  7470. _this.store = store;
  7471. _this.line = line;
  7472. _this.column = column;
  7473. return _this;
  7474. }
  7475. _createClass(StoreObjectArrayAddress, [{
  7476. key: 'getArrayObject',
  7477. value: function getArrayObject() {
  7478. return this.store.applyStore(this.refID);
  7479. }
  7480. }, {
  7481. key: 'updateArrayObject',
  7482. value: function updateArrayObject(stoObj) {
  7483. var anArray = this.getArrayObject();
  7484. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), anArray);
  7485. if (!stoObj.type.isCompatible(this.type)) {
  7486. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  7487. } else if (this.type instanceof _compoundType.CompoundType && this.type.canAccept(stoObj.type)) {
  7488. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  7489. }
  7490. if (this.column !== null) {
  7491. newArray.value[this.line].value[this.column] = stoObj;
  7492. return newArray;
  7493. } else {
  7494. newArray.value[this.line] = stoObj;
  7495. return newArray;
  7496. }
  7497. }
  7498. }, {
  7499. key: 'isCompatible',
  7500. value: function isCompatible(another) {
  7501. if (this.type.isCompatible(another.type)) {
  7502. if (another.type instanceof _compoundType.CompoundType) {
  7503. return this.lines === another.lines && this.columns === another.columns;
  7504. } else {
  7505. this.refValue.isCompatible(another);
  7506. }
  7507. }
  7508. }
  7509. }, {
  7510. key: 'isRef',
  7511. get: function get() {
  7512. return false;
  7513. }
  7514. }, {
  7515. key: 'inStore',
  7516. get: function get() {
  7517. return true;
  7518. }
  7519. }, {
  7520. key: 'refValue',
  7521. get: function get() {
  7522. var refLine = this.store.applyStore(this.refID).value[this.line];
  7523. if (this.column !== null) {
  7524. var refColumn = refLine.value[this.column];
  7525. return refColumn;
  7526. }
  7527. return refLine;
  7528. }
  7529. }, {
  7530. key: 'value',
  7531. get: function get() {
  7532. return this.refValue.value;
  7533. }
  7534. }, {
  7535. key: 'type',
  7536. get: function get() {
  7537. return this.refValue.type;
  7538. }
  7539. }, {
  7540. key: 'lines',
  7541. get: function get() {
  7542. if (!(this.type instanceof _compoundType.CompoundType)) {
  7543. return null;
  7544. }
  7545. return this.refValue.value.length;
  7546. }
  7547. }, {
  7548. key: 'columns',
  7549. get: function get() {
  7550. switch (this.type.dimensions) {
  7551. case 2:
  7552. return this.refValue.value[0].value.length;
  7553. default:
  7554. return null;
  7555. }
  7556. }
  7557. }]);
  7558. return StoreObjectArrayAddress;
  7559. }(_storeObject.StoreObject);
  7560. /***/ }),
  7561. /***/ "./js/processor/store/storeObjectArrayAddressRef.js":
  7562. /*!**********************************************************!*\
  7563. !*** ./js/processor/store/storeObjectArrayAddressRef.js ***!
  7564. \**********************************************************/
  7565. /*! no static exports found */
  7566. /***/ (function(module, exports, __webpack_require__) {
  7567. "use strict";
  7568. Object.defineProperty(exports, "__esModule", {
  7569. value: true
  7570. });
  7571. exports.StoreObjectArrayAddressRef = undefined;
  7572. 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; }; }();
  7573. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  7574. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  7575. var _decimal2 = _interopRequireDefault(_decimal);
  7576. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7577. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7578. 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; }
  7579. 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; }
  7580. var StoreObjectArrayAddressRef = exports.StoreObjectArrayAddressRef = function (_StoreObject) {
  7581. _inherits(StoreObjectArrayAddressRef, _StoreObject);
  7582. function StoreObjectArrayAddressRef(address) {
  7583. _classCallCheck(this, StoreObjectArrayAddressRef);
  7584. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddressRef.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddressRef)).call(this, null, null, false));
  7585. _this.address = address;
  7586. return _this;
  7587. }
  7588. _createClass(StoreObjectArrayAddressRef, [{
  7589. key: 'getRefObj',
  7590. value: function getRefObj() {
  7591. return this.address.refValue;
  7592. }
  7593. }, {
  7594. key: 'updateRef',
  7595. value: function updateRef(stoObj) {
  7596. var newArray = this.address.updateArrayObject(stoObj);
  7597. this.address.store.updateStore(this.address.refID, newArray);
  7598. }
  7599. }, {
  7600. key: 'isCompatible',
  7601. value: function isCompatible(another) {
  7602. return this.address.isCompatible(another);
  7603. }
  7604. }, {
  7605. key: 'isRef',
  7606. get: function get() {
  7607. return true;
  7608. }
  7609. }, {
  7610. key: 'type',
  7611. get: function get() {
  7612. return this.address.type;
  7613. }
  7614. }, {
  7615. key: 'value',
  7616. get: function get() {
  7617. return this.address.value;
  7618. }
  7619. }, {
  7620. key: 'number',
  7621. get: function get() {
  7622. if (this.value instanceof _decimal2.default) {
  7623. return this.value.toNumber();
  7624. } else {
  7625. return null;
  7626. }
  7627. }
  7628. }]);
  7629. return StoreObjectArrayAddressRef;
  7630. }(_storeObject.StoreObject);
  7631. /***/ }),
  7632. /***/ "./js/processor/store/storeObjectRef.js":
  7633. /*!**********************************************!*\
  7634. !*** ./js/processor/store/storeObjectRef.js ***!
  7635. \**********************************************/
  7636. /*! no static exports found */
  7637. /***/ (function(module, exports, __webpack_require__) {
  7638. "use strict";
  7639. Object.defineProperty(exports, "__esModule", {
  7640. value: true
  7641. });
  7642. exports.StoreObjectRef = undefined;
  7643. 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; }; }();
  7644. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  7645. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  7646. var _decimal2 = _interopRequireDefault(_decimal);
  7647. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7648. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7649. 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; }
  7650. 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; }
  7651. var StoreObjectRef = exports.StoreObjectRef = function (_StoreObject) {
  7652. _inherits(StoreObjectRef, _StoreObject);
  7653. function StoreObjectRef(refID, store) {
  7654. _classCallCheck(this, StoreObjectRef);
  7655. var _this = _possibleConstructorReturn(this, (StoreObjectRef.__proto__ || Object.getPrototypeOf(StoreObjectRef)).call(this, null, null, false));
  7656. _this.refID = refID;
  7657. _this.store = store;
  7658. return _this;
  7659. }
  7660. _createClass(StoreObjectRef, [{
  7661. key: 'getRefObj',
  7662. value: function getRefObj() {
  7663. return this.store.applyStore(this.refID);
  7664. }
  7665. }, {
  7666. key: 'updateRef',
  7667. value: function updateRef(stoObj) {
  7668. this.store.updateStore(this.refID, stoObj);
  7669. }
  7670. }, {
  7671. key: 'isCompatible',
  7672. value: function isCompatible(another) {
  7673. return this.store.applyStore(this.refID).isCompatible(another);
  7674. }
  7675. }, {
  7676. key: 'isRef',
  7677. get: function get() {
  7678. return true;
  7679. }
  7680. }, {
  7681. key: 'type',
  7682. get: function get() {
  7683. return this.store.applyStore(this.refID).type;
  7684. }
  7685. }, {
  7686. key: 'value',
  7687. get: function get() {
  7688. return this.store.applyStore(this.refID).value;
  7689. }
  7690. }, {
  7691. key: 'number',
  7692. get: function get() {
  7693. if (this.value instanceof _decimal2.default) {
  7694. return this.value.toNumber();
  7695. } else {
  7696. return null;
  7697. }
  7698. }
  7699. }]);
  7700. return StoreObjectRef;
  7701. }(_storeObject.StoreObject);
  7702. /***/ }),
  7703. /***/ "./js/runner.js":
  7704. /*!**********************!*\
  7705. !*** ./js/runner.js ***!
  7706. \**********************/
  7707. /*! no static exports found */
  7708. /***/ (function(module, exports, __webpack_require__) {
  7709. "use strict";
  7710. Object.defineProperty(exports, "__esModule", {
  7711. value: true
  7712. });
  7713. exports.runner = runner;
  7714. var _ivprogParser = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  7715. var _ivprogProcessor = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  7716. var _domConsole = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
  7717. var _languageService = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js");
  7718. var _semanticAnalyser = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  7719. function runner() {
  7720. var ivprogLexer = _languageService.LanguageService.getCurrentLexer();
  7721. // const lexer = new ivprogLexer(new InputStream(input));
  7722. // const stream = new CommonTokenStream(lexer);
  7723. // stream.fill();
  7724. // let i = 1;
  7725. // let token = null;
  7726. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  7727. // console.log(`${token.type}-${token.text}`);
  7728. // console.log('\n')
  7729. // i++;
  7730. // }
  7731. // const anaSin = new IVProgParser(input, ivprogLexer);
  7732. var editor = new JsonEditor('#json-renderer', {});
  7733. var domConsole = new _domConsole.DOMConsole("#console");
  7734. // proc.interpretAST().then( sto => {
  7735. // console.log(sto.applyStore('a'));
  7736. // }).catch(e => console.log(e));
  7737. try {
  7738. $('#btn').click(function () {
  7739. var input = $('#input').val();
  7740. var analiser = new _ivprogParser.IVProgParser(input, ivprogLexer);
  7741. try {
  7742. var data = analiser.parseTree();
  7743. var semAna = new _semanticAnalyser.SemanticAnalyser(data);
  7744. var proc = new _ivprogProcessor.IVProgProcessor(semAna.analyseTree());
  7745. proc.registerInput(domConsole);
  7746. domConsole.clear();
  7747. proc.registerOutput(domConsole);
  7748. proc.interpretAST().then(function (sto) {
  7749. return editor.load(sto.store);
  7750. }).catch(function (e) {
  7751. alert(e);console.log(e);
  7752. });
  7753. } catch (error) {
  7754. alert(error);
  7755. console.log(error);
  7756. }
  7757. });
  7758. } catch (a) {
  7759. console.log(a);
  7760. }
  7761. }
  7762. /***/ }),
  7763. /***/ "./js/semantic/semantic.min.js":
  7764. /*!*************************************!*\
  7765. !*** ./js/semantic/semantic.min.js ***!
  7766. \*************************************/
  7767. /*! no static exports found */
  7768. /***/ (function(module, exports, __webpack_require__) {
  7769. "use strict";
  7770. 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; };
  7771. /*
  7772. * # Semantic UI - 2.3.3
  7773. * https://github.com/Semantic-Org/Semantic-UI
  7774. * http://www.semantic-ui.com/
  7775. *
  7776. * Copyright 2014 Contributors
  7777. * Released under the MIT license
  7778. * http://opensource.org/licenses/MIT
  7779. *
  7780. */
  7781. !function (e, t, n, i) {
  7782. e.site = e.fn.site = function (o) {
  7783. var a,
  7784. r,
  7785. s = new Date().getTime(),
  7786. l = [],
  7787. c = arguments[0],
  7788. u = "string" == typeof c,
  7789. d = [].slice.call(arguments, 1),
  7790. f = e.isPlainObject(o) ? e.extend(!0, {}, e.site.settings, o) : e.extend({}, e.site.settings),
  7791. m = f.namespace,
  7792. g = f.error,
  7793. p = "module-" + m,
  7794. h = e(n),
  7795. v = this,
  7796. b = h.data(p);return a = { initialize: function initialize() {
  7797. a.instantiate();
  7798. }, instantiate: function instantiate() {
  7799. a.verbose("Storing instance of site", a), b = a, h.data(p, a);
  7800. }, normalize: function normalize() {
  7801. a.fix.console(), a.fix.requestAnimationFrame();
  7802. }, fix: { console: function (_console) {
  7803. function console() {
  7804. return _console.apply(this, arguments);
  7805. }
  7806. console.toString = function () {
  7807. return _console.toString();
  7808. };
  7809. return console;
  7810. }(function () {
  7811. 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 () {});
  7812. }), consoleClear: function consoleClear() {
  7813. a.debug("Disabling programmatic console clearing"), t.console.clear = function () {};
  7814. }, requestAnimationFrame: function requestAnimationFrame() {
  7815. 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) {
  7816. setTimeout(e, 0);
  7817. });
  7818. } }, moduleExists: function moduleExists(t) {
  7819. return e.fn[t] !== i && e.fn[t].settings !== i;
  7820. }, enabled: { modules: function modules(t) {
  7821. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  7822. a.moduleExists(t) && n.push(t);
  7823. }), n;
  7824. } }, disabled: { modules: function modules(t) {
  7825. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  7826. a.moduleExists(t) || n.push(t);
  7827. }), n;
  7828. } }, change: { setting: function setting(t, n, o, r) {
  7829. o = "string" == typeof o ? "all" === o ? f.modules : [o] : o || f.modules, r = r === i || r, e.each(o, function (i, o) {
  7830. var s,
  7831. 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)));
  7832. });
  7833. }, settings: function settings(t, n, o) {
  7834. n = "string" == typeof n ? [n] : n || f.modules, o = o === i || o, e.each(n, function (n, i) {
  7835. 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)));
  7836. });
  7837. } }, enable: { console: function console() {
  7838. a.console(!0);
  7839. }, debug: function debug(e, t) {
  7840. e = e || f.modules, a.debug("Enabling debug for modules", e), a.change.setting("debug", !0, e, t);
  7841. }, verbose: function verbose(e, t) {
  7842. e = e || f.modules, a.debug("Enabling verbose debug for modules", e), a.change.setting("verbose", !0, e, t);
  7843. } }, disable: { console: function console() {
  7844. a.console(!1);
  7845. }, debug: function debug(e, t) {
  7846. e = e || f.modules, a.debug("Disabling debug for modules", e), a.change.setting("debug", !1, e, t);
  7847. }, verbose: function verbose(e, t) {
  7848. e = e || f.modules, a.debug("Disabling verbose debug for modules", e), a.change.setting("verbose", !1, e, t);
  7849. } }, console: function console(e) {
  7850. if (e) {
  7851. if (b.cache.console === i) return void a.error(g.console);a.debug("Restoring console function"), t.console = b.cache.console;
  7852. } 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() {} };
  7853. }, destroy: function destroy() {
  7854. a.verbose("Destroying previous site for", h), h.removeData(p);
  7855. }, cache: {}, setting: function setting(t, n) {
  7856. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  7857. if (n === i) return f[t];f[t] = n;
  7858. }
  7859. }, internal: function internal(t, n) {
  7860. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  7861. if (n === i) return a[t];a[t] = n;
  7862. }
  7863. }, debug: function debug() {
  7864. f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  7865. }, verbose: function verbose() {
  7866. 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)));
  7867. }, error: function error() {
  7868. a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments);
  7869. }, performance: { log: function log(e) {
  7870. 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);
  7871. }, display: function display() {
  7872. var t = f.name + ":",
  7873. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  7874. n += t["Execution Time"];
  7875. }), 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) {
  7876. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  7877. }), console.groupEnd()), l = [];
  7878. } }, invoke: function invoke(t, n, o) {
  7879. var s,
  7880. l,
  7881. c,
  7882. 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) {
  7883. 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 {
  7884. 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];
  7885. }
  7886. })), 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;
  7887. } }, u ? (b === i && a.initialize(), a.invoke(c)) : (b !== i && a.destroy(), a.initialize()), r !== i ? r : this;
  7888. }, 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) {
  7889. return function (n) {
  7890. return !!e.data(n, t);
  7891. };
  7892. }) : function (t, n, i) {
  7893. return !!e.data(t, i[3]);
  7894. } });
  7895. }(jQuery, window, document), function (e, t, n, i) {
  7896. "use strict";
  7897. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.form = function (t) {
  7898. var o,
  7899. a = e(this),
  7900. r = a.selector || "",
  7901. s = new Date().getTime(),
  7902. l = [],
  7903. c = arguments[0],
  7904. u = arguments[1],
  7905. d = "string" == typeof c,
  7906. f = [].slice.call(arguments, 1);return a.each(function () {
  7907. var m,
  7908. g,
  7909. p,
  7910. h,
  7911. v,
  7912. b,
  7913. y,
  7914. x,
  7915. C,
  7916. w,
  7917. S,
  7918. k,
  7919. T,
  7920. A,
  7921. R,
  7922. P,
  7923. E = e(this),
  7924. F = this,
  7925. O = [],
  7926. D = !1;(P = { initialize: function initialize() {
  7927. 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());
  7928. }, instantiate: function instantiate() {
  7929. P.verbose("Storing instance of module", P), R = P, E.data(T, P);
  7930. }, destroy: function destroy() {
  7931. P.verbose("Destroying previous module", R), P.removeEvents(), E.removeData(T);
  7932. }, refresh: function refresh() {
  7933. 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);
  7934. }, submit: function submit() {
  7935. P.verbose("Submitting form", E), E.submit();
  7936. }, attachEvents: function attachEvents(t, n) {
  7937. n = n || "submit", e(t).on("click" + A, function (e) {
  7938. P[n](), e.preventDefault();
  7939. });
  7940. }, bindEvents: function bindEvents() {
  7941. 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 () {
  7942. var t = e(this),
  7943. n = t.prop("type"),
  7944. i = P.get.changeEvent(n, t);e(this).on(i + A, P.event.field.change);
  7945. });
  7946. }, clear: function clear() {
  7947. m.each(function () {
  7948. var t = e(this),
  7949. n = t.parent(),
  7950. i = t.closest(g),
  7951. o = i.find(x.prompt),
  7952. a = t.data(y.defaultValue) || "",
  7953. r = n.is(x.uiCheckbox),
  7954. 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(""));
  7955. });
  7956. }, reset: function reset() {
  7957. m.each(function () {
  7958. var t = e(this),
  7959. n = t.parent(),
  7960. o = t.closest(g),
  7961. a = o.find(x.prompt),
  7962. r = t.data(y.defaultValue),
  7963. s = n.is(x.uiCheckbox),
  7964. l = n.is(x.uiDropdown),
  7965. 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)));
  7966. });
  7967. }, determine: { isValid: function isValid() {
  7968. var t = !0;return e.each(b, function (e, n) {
  7969. P.validate.field(n, e, !0) || (t = !1);
  7970. }), t;
  7971. } }, is: { bracketedRule: function bracketedRule(e) {
  7972. return e.type && e.type.match(v.regExp.bracket);
  7973. }, shorthandFields: function shorthandFields(e) {
  7974. var t = e[Object.keys(e)[0]];return P.is.shorthandRules(t);
  7975. }, shorthandRules: function shorthandRules(t) {
  7976. return "string" == typeof t || e.isArray(t);
  7977. }, empty: function empty(e) {
  7978. return !e || 0 === e.length || (e.is('input[type="checkbox"]') ? !e.is(":checked") : P.is.blank(e));
  7979. }, blank: function blank(t) {
  7980. return "" === e.trim(t.val());
  7981. }, valid: function valid(t) {
  7982. 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) {
  7983. P.is.valid(e) || (n = !1);
  7984. }), n);
  7985. } }, removeEvents: function removeEvents() {
  7986. E.off(A), m.off(A), h.off(A), m.off(A);
  7987. }, event: { field: { keydown: function keydown(t) {
  7988. var n = e(this),
  7989. i = t.which,
  7990. o = n.is(x.input),
  7991. a = n.is(x.checkbox),
  7992. r = n.closest(x.uiDropdown).length > 0,
  7993. 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);
  7994. }, keyup: function keyup() {
  7995. D = !1;
  7996. }, blur: function blur(t) {
  7997. var n = e(this),
  7998. i = n.closest(g),
  7999. 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);
  8000. }, change: function change(t) {
  8001. var n = e(this),
  8002. i = n.closest(g),
  8003. o = P.get.validation(n);o && ("change" == v.on || i.hasClass(C.error) && v.revalidate) && (clearTimeout(P.timer), P.timer = setTimeout(function () {
  8004. P.debug("Revalidating field", n, P.get.validation(n)), P.validate.field(o);
  8005. }, v.delay));
  8006. } } }, get: { ancillaryValue: function ancillaryValue(e) {
  8007. return !(!e.type || !e.value && !P.is.bracketedRule(e)) && (e.value !== i ? e.value : e.type.match(v.regExp.bracket)[1] + "");
  8008. }, ruleName: function ruleName(e) {
  8009. return P.is.bracketedRule(e) ? e.type.replace(e.type.match(v.regExp.bracket)[0], "") : e.type;
  8010. }, changeEvent: function changeEvent(e, t) {
  8011. return "checkbox" == e || "radio" == e || "hidden" == e || t.is("select") ? "change" : P.get.inputEvent();
  8012. }, inputEvent: function inputEvent() {
  8013. return n.createElement("input").oninput !== i ? "input" : n.createElement("input").onpropertychange !== i ? "propertychange" : "keyup";
  8014. }, fieldsFromShorthand: function fieldsFromShorthand(t) {
  8015. var n = {};return e.each(t, function (t, i) {
  8016. "string" == typeof i && (i = [i]), n[t] = { rules: [] }, e.each(i, function (e, i) {
  8017. n[t].rules.push({ type: i });
  8018. });
  8019. }), n;
  8020. }, prompt: function prompt(t, n) {
  8021. var i,
  8022. o,
  8023. a = P.get.ruleName(t),
  8024. r = P.get.ancillaryValue(t),
  8025. s = P.get.field(n.identifier),
  8026. l = s.val(),
  8027. c = e.isFunction(t.prompt) ? t.prompt(l) : t.prompt || v.prompt[a] || v.text.unspecifiedRule,
  8028. u = -1 !== c.search("{value}"),
  8029. 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;
  8030. }, settings: function settings() {
  8031. if (e.isPlainObject(t)) {
  8032. 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));
  8033. } 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();
  8034. }, field: function field(t) {
  8035. 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/>");
  8036. }, fields: function fields(t) {
  8037. var n = e();return e.each(t, function (e, t) {
  8038. n = n.add(P.get.field(t));
  8039. }), n;
  8040. }, validation: function validation(t) {
  8041. var n, i;return !!b && (e.each(b, function (e, o) {
  8042. i = o.identifier || e, P.get.field(i)[0] == t[0] && (o.identifier = i, n = o);
  8043. }), n || !1);
  8044. }, value: function value(e) {
  8045. var t = [];return t.push(e), P.get.values.call(F, t)[e];
  8046. }, values: function values(t) {
  8047. var n = {};return (e.isArray(t) ? P.get.fields(t) : m).each(function (t, o) {
  8048. var a = e(o),
  8049. r = (a.prop("type"), a.prop("name")),
  8050. s = a.val(),
  8051. l = a.is(x.checkbox),
  8052. c = a.is(x.radio),
  8053. u = -1 !== r.indexOf("[]"),
  8054. 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);
  8055. }), n;
  8056. } }, has: { field: function field(e) {
  8057. 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;
  8058. } }, escape: { string: function string(e) {
  8059. return (e = String(e)).replace(w.escape, "\\$&");
  8060. } }, add: { rule: function rule(e, t) {
  8061. P.add.field(e, t);
  8062. }, field: function field(t, n) {
  8063. var i = {};P.is.shorthandRules(n) ? (n = e.isArray(n) ? n : [n], i[t] = { rules: [] }, e.each(n, function (e, n) {
  8064. i[t].rules.push({ type: n });
  8065. })) : i[t] = n, b = e.extend({}, b, i), P.debug("Adding rules", i, b);
  8066. }, fields: function fields(t) {
  8067. var n;n = t && P.is.shorthandFields(t) ? P.get.fieldsFromShorthand(t) : t, b = e.extend({}, b, n);
  8068. }, prompt: function prompt(t, n) {
  8069. var o = P.get.field(t).closest(g),
  8070. a = o.children(x.prompt),
  8071. 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)));
  8072. }, errors: function errors(e) {
  8073. P.debug("Adding form error messages", e), P.set.error(), p.html(v.templates.error(e));
  8074. } }, remove: { rule: function rule(t, n) {
  8075. 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) {
  8076. -1 !== o.indexOf(n.type) && (P.debug("Removed rule", n.type), b[t].rules.splice(e, 1));
  8077. });
  8078. }, field: function field(t) {
  8079. var n = e.isArray(t) ? t : [t];e.each(n, function (e, t) {
  8080. P.remove.rule(t);
  8081. });
  8082. }, rules: function rules(t, n) {
  8083. e.isArray(t) ? e.each(fields, function (e, t) {
  8084. P.remove.rule(t, n);
  8085. }) : P.remove.rule(t, n);
  8086. }, fields: function fields(e) {
  8087. P.remove.field(e);
  8088. }, prompt: function prompt(t) {
  8089. var n = P.get.field(t).closest(g),
  8090. 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 () {
  8091. o.remove();
  8092. }) : o.fadeOut(v.duration, function () {
  8093. o.remove();
  8094. }));
  8095. } }, set: { success: function success() {
  8096. E.removeClass(C.error).addClass(C.success);
  8097. }, defaults: function defaults() {
  8098. m.each(function () {
  8099. var t = e(this),
  8100. n = t.filter(x.checkbox).length > 0 ? t.is(":checked") : t.val();t.data(y.defaultValue, n);
  8101. });
  8102. }, error: function error() {
  8103. E.removeClass(C.success).addClass(C.error);
  8104. }, value: function value(e, t) {
  8105. var n = {};return n[e] = t, P.set.values.call(F, n);
  8106. }, values: function values(t) {
  8107. e.isEmptyObject(t) || e.each(t, function (t, n) {
  8108. var i,
  8109. o = P.get.field(t),
  8110. a = o.parent(),
  8111. r = e.isArray(n),
  8112. s = a.is(x.uiCheckbox),
  8113. l = a.is(x.uiDropdown),
  8114. 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) {
  8115. i = o.filter('[value="' + t + '"]'), a = i.parent(), i.length > 0 && a.checkbox("check");
  8116. })) : 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)));
  8117. });
  8118. } }, validate: { form: function form(e, t) {
  8119. var n = P.get.values();if (D) return !1;if (O = [], P.determine.isValid()) {
  8120. if (P.debug("Form has no validation errors, submitting"), P.set.success(), !0 !== t) return v.onSuccess.call(F, e, n);
  8121. } 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);
  8122. }, field: function field(t, n, o) {
  8123. o = o === i || o, "string" == typeof t && (P.verbose("Validating field", t), n = t, t = b[t]);var a = t.identifier || n,
  8124. r = P.get.field(a),
  8125. s = !!t.depends && P.get.field(t.depends),
  8126. l = !0,
  8127. 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) {
  8128. 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);
  8129. }), 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);
  8130. }, rule: function rule(t, n) {
  8131. var o = P.get.field(t.identifier),
  8132. a = (n.type, o.val()),
  8133. r = P.get.ancillaryValue(n),
  8134. s = P.get.ruleName(n),
  8135. 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);
  8136. } }, setting: function setting(t, n) {
  8137. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  8138. if (n === i) return v[t];v[t] = n;
  8139. }
  8140. }, internal: function internal(t, n) {
  8141. if (e.isPlainObject(t)) e.extend(!0, P, t);else {
  8142. if (n === i) return P[t];P[t] = n;
  8143. }
  8144. }, debug: function debug() {
  8145. !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)));
  8146. }, verbose: function verbose() {
  8147. !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)));
  8148. }, error: function error() {
  8149. v.silent || (P.error = Function.prototype.bind.call(console.error, console, v.name + ":"), P.error.apply(console, arguments));
  8150. }, performance: { log: function log(e) {
  8151. 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);
  8152. }, display: function display() {
  8153. var t = v.name + ":",
  8154. n = 0;s = !1, clearTimeout(P.performance.timer), e.each(l, function (e, t) {
  8155. n += t["Execution Time"];
  8156. }), 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) {
  8157. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  8158. }), console.groupEnd()), l = [];
  8159. } }, invoke: function invoke(t, n, a) {
  8160. var r,
  8161. s,
  8162. l,
  8163. 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) {
  8164. 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 {
  8165. 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];
  8166. }
  8167. })), 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;
  8168. } }).initialize();
  8169. }), o !== i ? o : this;
  8170. }, 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() {
  8171. return !0;
  8172. }, onFailure: function onFailure() {
  8173. return !1;
  8174. }, 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) {
  8175. var n = '<ul class="list">';return e.each(t, function (e, t) {
  8176. n += "<li>" + t + "</li>";
  8177. }), e(n += "</ul>");
  8178. }, prompt: function prompt(t) {
  8179. return e("<div/>").addClass("ui basic red pointing prompt label").html(t[0]);
  8180. } }, rules: { empty: function empty(t) {
  8181. return !(t === i || "" === t || e.isArray(t) && 0 === t.length);
  8182. }, checked: function checked() {
  8183. return e(this).filter(":checked").length > 0;
  8184. }, email: function email(t) {
  8185. return e.fn.form.settings.regExp.email.test(t);
  8186. }, url: function url(t) {
  8187. return e.fn.form.settings.regExp.url.test(t);
  8188. }, regExp: function regExp(t, n) {
  8189. if (n instanceof RegExp) return t.match(n);var i,
  8190. 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));
  8191. }, integer: function integer(t, n) {
  8192. var o,
  8193. a,
  8194. r,
  8195. 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);
  8196. }, decimal: function decimal(t) {
  8197. return e.fn.form.settings.regExp.decimal.test(t);
  8198. }, number: function number(t) {
  8199. return e.fn.form.settings.regExp.number.test(t);
  8200. }, is: function is(e, t) {
  8201. return t = "string" == typeof t ? t.toLowerCase() : t, (e = "string" == typeof e ? e.toLowerCase() : e) == t;
  8202. }, isExactly: function isExactly(e, t) {
  8203. return e == t;
  8204. }, not: function not(e, t) {
  8205. return (e = "string" == typeof e ? e.toLowerCase() : e) != (t = "string" == typeof t ? t.toLowerCase() : t);
  8206. }, notExactly: function notExactly(e, t) {
  8207. return e != t;
  8208. }, contains: function contains(t, n) {
  8209. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n, "i"));
  8210. }, containsExactly: function containsExactly(t, n) {
  8211. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n));
  8212. }, doesntContain: function doesntContain(t, n) {
  8213. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n, "i"));
  8214. }, doesntContainExactly: function doesntContainExactly(t, n) {
  8215. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n));
  8216. }, minLength: function minLength(e, t) {
  8217. return e !== i && e.length >= t;
  8218. }, length: function length(e, t) {
  8219. return e !== i && e.length >= t;
  8220. }, exactLength: function exactLength(e, t) {
  8221. return e !== i && e.length == t;
  8222. }, maxLength: function maxLength(e, t) {
  8223. return e !== i && e.length <= t;
  8224. }, match: function match(t, n) {
  8225. 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();
  8226. }, different: function different(t, n) {
  8227. 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();
  8228. }, creditCard: function creditCard(t, n) {
  8229. var i,
  8230. o,
  8231. 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] } },
  8232. r = {},
  8233. s = !1,
  8234. l = "string" == typeof n && n.split(",");if ("string" == typeof t && 0 !== t.length) {
  8235. if (t = t.replace(/[\-]/g, ""), l && (e.each(l, function (n, i) {
  8236. (o = a[i]) && (r = { length: -1 !== e.inArray(t.length, o.length), pattern: -1 !== t.search(o.pattern) }).length && r.pattern && (s = !0);
  8237. }), !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--;) {
  8238. f += d[u][parseInt(t.charAt(c), 10)], u ^= 1;
  8239. }return f % 10 == 0 && f > 0;
  8240. }
  8241. }, minCount: function minCount(e, t) {
  8242. return 0 == t || (1 == t ? "" !== e : e.split(",").length >= t);
  8243. }, exactCount: function exactCount(e, t) {
  8244. return 0 == t ? "" === e : 1 == t ? "" !== e && -1 === e.search(",") : e.split(",").length == t;
  8245. }, maxCount: function maxCount(e, t) {
  8246. return 0 != t && (1 == t ? -1 === e.search(",") : e.split(",").length <= t);
  8247. } } };
  8248. }(jQuery, window, document), function (e, t, n, i) {
  8249. "use strict";
  8250. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.accordion = function (n) {
  8251. var o,
  8252. a = e(this),
  8253. r = new Date().getTime(),
  8254. s = [],
  8255. l = arguments[0],
  8256. c = "string" == typeof l,
  8257. u = [].slice.call(arguments, 1);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function () {
  8258. var d,
  8259. f,
  8260. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.accordion.settings, n) : e.extend({}, e.fn.accordion.settings),
  8261. g = m.className,
  8262. p = m.namespace,
  8263. h = m.selector,
  8264. v = m.error,
  8265. b = "." + p,
  8266. y = "module-" + p,
  8267. x = a.selector || "",
  8268. C = e(this),
  8269. w = C.find(h.title),
  8270. S = C.find(h.content),
  8271. k = this,
  8272. T = C.data(y);f = { initialize: function initialize() {
  8273. f.debug("Initializing", C), f.bind.events(), m.observeChanges && f.observeChanges(), f.instantiate();
  8274. }, instantiate: function instantiate() {
  8275. T = f, C.data(y, f);
  8276. }, destroy: function destroy() {
  8277. f.debug("Destroying previous instance", C), C.off(b).removeData(y);
  8278. }, refresh: function refresh() {
  8279. w = C.find(h.title), S = C.find(h.content);
  8280. }, observeChanges: function observeChanges() {
  8281. "MutationObserver" in t && ((d = new MutationObserver(function (e) {
  8282. f.debug("DOM tree modified, updating selector cache"), f.refresh();
  8283. })).observe(k, { childList: !0, subtree: !0 }), f.debug("Setting up mutation observer", d));
  8284. }, bind: { events: function events() {
  8285. f.debug("Binding delegated events"), C.on(m.on + b, h.trigger, f.event.click);
  8286. } }, event: { click: function click() {
  8287. f.toggle.call(this);
  8288. } }, toggle: function toggle(t) {
  8289. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  8290. o = n.next(S),
  8291. a = o.hasClass(g.animating),
  8292. r = o.hasClass(g.active),
  8293. s = r && !a,
  8294. 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);
  8295. }, open: function open(t) {
  8296. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  8297. o = n.next(S),
  8298. 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 () {
  8299. o.removeClass(g.animating).addClass(g.active), f.reset.display.call(this), m.onOpen.call(this), m.onChange.call(this);
  8300. }));
  8301. }, close: function close(t) {
  8302. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  8303. o = n.next(S),
  8304. a = o.hasClass(g.animating),
  8305. 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 () {
  8306. o.removeClass(g.animating).removeClass(g.active), f.reset.display.call(this), m.onClose.call(this), m.onChange.call(this);
  8307. }));
  8308. }, closeOthers: function closeOthers(t) {
  8309. var n,
  8310. o,
  8311. a,
  8312. r = t !== i ? w.eq(t) : e(this).closest(h.title),
  8313. s = r.parents(h.content).prev(h.title),
  8314. l = r.closest(h.accordion),
  8315. c = h.title + "." + g.active + ":visible",
  8316. 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 () {
  8317. e(this).removeClass(g.active), f.reset.display.call(this);
  8318. }));
  8319. }, reset: { display: function display() {
  8320. f.verbose("Removing inline display from element", this), e(this).css("display", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  8321. }, opacity: function opacity() {
  8322. f.verbose("Removing inline opacity from element", this), e(this).css("opacity", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  8323. } }, setting: function setting(t, n) {
  8324. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  8325. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  8326. }
  8327. }, internal: function internal(t, n) {
  8328. if (f.debug("Changing internal", t, n), n === i) return f[t];e.isPlainObject(t) ? e.extend(!0, f, t) : f[t] = n;
  8329. }, debug: function debug() {
  8330. !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)));
  8331. }, verbose: function verbose() {
  8332. !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)));
  8333. }, error: function error() {
  8334. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  8335. }, performance: { log: function log(e) {
  8336. 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);
  8337. }, display: function display() {
  8338. var t = m.name + ":",
  8339. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  8340. n += t["Execution Time"];
  8341. }), 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) {
  8342. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  8343. }), console.groupEnd()), s = [];
  8344. } }, invoke: function invoke(t, n, a) {
  8345. var r,
  8346. s,
  8347. l,
  8348. 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) {
  8349. 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 {
  8350. 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];
  8351. }
  8352. })), 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;
  8353. } }, c ? (T === i && f.initialize(), f.invoke(l)) : (T !== i && T.invoke("destroy"), f.initialize());
  8354. }), o !== i ? o : this;
  8355. }, 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) {
  8356. return -i * (t /= o) * (t - 2) + n;
  8357. } });
  8358. }(jQuery, window, document), function (e, t, n, i) {
  8359. "use strict";
  8360. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.checkbox = function (o) {
  8361. var a,
  8362. r = e(this),
  8363. s = r.selector || "",
  8364. l = new Date().getTime(),
  8365. c = [],
  8366. u = arguments[0],
  8367. d = "string" == typeof u,
  8368. f = [].slice.call(arguments, 1);return r.each(function () {
  8369. var r,
  8370. m,
  8371. g = e.extend(!0, {}, e.fn.checkbox.settings, o),
  8372. p = g.className,
  8373. h = g.namespace,
  8374. v = g.selector,
  8375. b = g.error,
  8376. y = "." + h,
  8377. x = "module-" + h,
  8378. C = e(this),
  8379. w = e(this).children(v.label),
  8380. S = e(this).children(v.input),
  8381. k = S[0],
  8382. T = !1,
  8383. A = !1,
  8384. R = C.data(x),
  8385. P = this;m = { initialize: function initialize() {
  8386. m.verbose("Initializing checkbox", g), m.create.label(), m.bind.events(), m.set.tabbable(), m.hide.input(), m.observeChanges(), m.instantiate(), m.setup();
  8387. }, instantiate: function instantiate() {
  8388. m.verbose("Storing instance of module", m), R = m, C.data(x, m);
  8389. }, destroy: function destroy() {
  8390. m.verbose("Destroying module"), m.unbind.events(), m.show.input(), C.removeData(x);
  8391. }, fix: { reference: function reference() {
  8392. C.is(v.input) && (m.debug("Behavior called on <input> adjusting invoked element"), C = C.closest(v.checkbox), m.refresh());
  8393. } }, setup: function setup() {
  8394. 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();
  8395. }, refresh: function refresh() {
  8396. w = C.children(v.label), S = C.children(v.input), k = S[0];
  8397. }, hide: { input: function input() {
  8398. m.verbose("Modifying <input> z-index to be unselectable"), S.addClass(p.hidden);
  8399. } }, show: { input: function input() {
  8400. m.verbose("Modifying <input> z-index to be selectable"), S.removeClass(p.hidden);
  8401. } }, observeChanges: function observeChanges() {
  8402. "MutationObserver" in t && ((r = new MutationObserver(function (e) {
  8403. m.debug("DOM tree modified, updating selector cache"), m.refresh();
  8404. })).observe(P, { childList: !0, subtree: !0 }), m.debug("Setting up mutation observer", r));
  8405. }, attachEvents: function attachEvents(t, n) {
  8406. 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);
  8407. }, event: { click: function click(t) {
  8408. 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());
  8409. }, keydown: function keydown(e) {
  8410. var t = e.which,
  8411. n = 13,
  8412. 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);
  8413. }, keyup: function keyup(e) {
  8414. A && e.preventDefault();
  8415. } }, check: function check() {
  8416. m.should.allowCheck() && (m.debug("Checking checkbox", S), m.set.checked(), m.should.ignoreCallbacks() || (g.onChecked.call(k), g.onChange.call(k)));
  8417. }, uncheck: function uncheck() {
  8418. m.should.allowUncheck() && (m.debug("Unchecking checkbox"), m.set.unchecked(), m.should.ignoreCallbacks() || (g.onUnchecked.call(k), g.onChange.call(k)));
  8419. }, indeterminate: function indeterminate() {
  8420. 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)));
  8421. }, determinate: function determinate() {
  8422. 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)));
  8423. }, enable: function enable() {
  8424. m.is.enabled() ? m.debug("Checkbox is already enabled") : (m.debug("Enabling checkbox"), m.set.enabled(), g.onEnable.call(k), g.onEnabled.call(k));
  8425. }, disable: function disable() {
  8426. m.is.disabled() ? m.debug("Checkbox is already disabled") : (m.debug("Disabling checkbox"), m.set.disabled(), g.onDisable.call(k), g.onDisabled.call(k));
  8427. }, get: { radios: function radios() {
  8428. var t = m.get.name();return e('input[name="' + t + '"]').closest(v.checkbox);
  8429. }, otherRadios: function otherRadios() {
  8430. return m.get.radios().not(C);
  8431. }, name: function name() {
  8432. return S.attr("name");
  8433. } }, is: { initialLoad: function initialLoad() {
  8434. return T;
  8435. }, radio: function radio() {
  8436. return S.hasClass(p.radio) || "radio" == S.attr("type");
  8437. }, indeterminate: function indeterminate() {
  8438. return S.prop("indeterminate") !== i && S.prop("indeterminate");
  8439. }, checked: function checked() {
  8440. return S.prop("checked") !== i && S.prop("checked");
  8441. }, disabled: function disabled() {
  8442. return S.prop("disabled") !== i && S.prop("disabled");
  8443. }, enabled: function enabled() {
  8444. return !m.is.disabled();
  8445. }, determinate: function determinate() {
  8446. return !m.is.indeterminate();
  8447. }, unchecked: function unchecked() {
  8448. return !m.is.checked();
  8449. } }, should: { allowCheck: function allowCheck() {
  8450. 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);
  8451. }, allowUncheck: function allowUncheck() {
  8452. 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);
  8453. }, allowIndeterminate: function allowIndeterminate() {
  8454. 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);
  8455. }, allowDeterminate: function allowDeterminate() {
  8456. 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);
  8457. }, forceCallbacks: function forceCallbacks() {
  8458. return m.is.initialLoad() && g.fireOnInit;
  8459. }, ignoreCallbacks: function ignoreCallbacks() {
  8460. return T && !g.fireOnInit;
  8461. } }, can: { change: function change() {
  8462. return !(C.hasClass(p.disabled) || C.hasClass(p.readOnly) || S.prop("disabled") || S.prop("readonly"));
  8463. }, uncheck: function uncheck() {
  8464. return "boolean" == typeof g.uncheckable ? g.uncheckable : !m.is.radio();
  8465. } }, set: { initialLoad: function initialLoad() {
  8466. T = !0;
  8467. }, checked: function checked() {
  8468. 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");
  8469. }, unchecked: function unchecked() {
  8470. 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");
  8471. }, indeterminate: function indeterminate() {
  8472. 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());
  8473. }, determinate: function determinate() {
  8474. 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));
  8475. }, disabled: function disabled() {
  8476. 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());
  8477. }, enabled: function enabled() {
  8478. 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());
  8479. }, tabbable: function tabbable() {
  8480. m.verbose("Adding tabindex to checkbox"), S.attr("tabindex") === i && S.attr("tabindex", 0);
  8481. } }, remove: { initialLoad: function initialLoad() {
  8482. T = !1;
  8483. } }, trigger: { change: function change() {
  8484. var e = n.createEvent("HTMLEvents"),
  8485. t = S[0];t && (m.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  8486. } }, create: { label: function label() {
  8487. 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));
  8488. } }, has: { label: function label() {
  8489. return w.length > 0;
  8490. } }, bind: { events: function events() {
  8491. 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);
  8492. } }, unbind: { events: function events() {
  8493. m.debug("Removing events"), C.off(y);
  8494. } }, uncheckOthers: function uncheckOthers() {
  8495. var e = m.get.otherRadios();m.debug("Unchecking other radios", e), e.removeClass(p.checked);
  8496. }, toggle: function toggle() {
  8497. 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");
  8498. }, setting: function setting(t, n) {
  8499. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  8500. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  8501. }
  8502. }, internal: function internal(t, n) {
  8503. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  8504. if (n === i) return m[t];m[t] = n;
  8505. }
  8506. }, debug: function debug() {
  8507. !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)));
  8508. }, verbose: function verbose() {
  8509. !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)));
  8510. }, error: function error() {
  8511. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  8512. }, performance: { log: function log(e) {
  8513. 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);
  8514. }, display: function display() {
  8515. var t = g.name + ":",
  8516. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  8517. n += t["Execution Time"];
  8518. }), 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) {
  8519. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  8520. }), console.groupEnd()), c = [];
  8521. } }, invoke: function invoke(t, n, o) {
  8522. var r,
  8523. s,
  8524. l,
  8525. 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) {
  8526. 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 {
  8527. 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];
  8528. }
  8529. })), 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;
  8530. } }, d ? (R === i && m.initialize(), m.invoke(u)) : (R !== i && R.invoke("destroy"), m.initialize());
  8531. }), a !== i ? a : this;
  8532. }, 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]" } };
  8533. }(jQuery, window, document), function (e, t, n, i) {
  8534. "use strict";
  8535. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dimmer = function (t) {
  8536. var o,
  8537. a = e(this),
  8538. r = new Date().getTime(),
  8539. s = [],
  8540. l = arguments[0],
  8541. c = "string" == typeof l,
  8542. u = [].slice.call(arguments, 1);return a.each(function () {
  8543. var d,
  8544. f,
  8545. m,
  8546. g = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.dimmer.settings, t) : e.extend({}, e.fn.dimmer.settings),
  8547. p = g.selector,
  8548. h = g.namespace,
  8549. v = g.className,
  8550. b = g.error,
  8551. y = "." + h,
  8552. x = "module-" + h,
  8553. C = a.selector || "",
  8554. w = "ontouchstart" in n.documentElement ? "touchstart" : "click",
  8555. S = e(this),
  8556. k = this,
  8557. T = S.data(x);(m = { preinitialize: function preinitialize() {
  8558. 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());
  8559. }, initialize: function initialize() {
  8560. m.debug("Initializing dimmer", g), m.bind.events(), m.set.dimmable(), m.instantiate();
  8561. }, instantiate: function instantiate() {
  8562. m.verbose("Storing instance of module", m), T = m, S.data(x, T);
  8563. }, destroy: function destroy() {
  8564. m.verbose("Destroying previous module", d), m.unbind.events(), m.remove.variation(), f.off(y);
  8565. }, bind: { events: function events() {
  8566. 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));
  8567. } }, unbind: { events: function events() {
  8568. m.is.page() && f.get(0).removeEventListener("touchmove", m.event.preventScroll, { passive: !1 }), S.removeData(x), f.off(y);
  8569. } }, event: { click: function click(t) {
  8570. 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());
  8571. }, preventScroll: function preventScroll(e) {
  8572. e.preventDefault();
  8573. } }, addContent: function addContent(t) {
  8574. var n = e(t);m.debug("Add content to dimmer", n), n.parent()[0] !== d[0] && n.detach().appendTo(d);
  8575. }, create: function create() {
  8576. var t = e(g.template.dimmer());return g.dimmerName && (m.debug("Creating named dimmer", g.dimmerName), t.addClass(g.dimmerName)), t.appendTo(f), t;
  8577. }, show: function show(t) {
  8578. 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));
  8579. }, hide: function hide(t) {
  8580. 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");
  8581. }, toggle: function toggle() {
  8582. m.verbose("Toggling dimmer visibility", d), m.is.dimmed() ? m.hide() : m.show();
  8583. }, animate: { show: function show(t) {
  8584. 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() {
  8585. m.set.dimmed();
  8586. }, onComplete: function onComplete() {
  8587. m.set.active(), t();
  8588. } })) : (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 () {
  8589. d.removeAttr("style"), m.set.active(), t();
  8590. }));
  8591. }, hide: function hide(t) {
  8592. 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() {
  8593. m.remove.dimmed();
  8594. }, onComplete: function onComplete() {
  8595. m.remove.active(), t();
  8596. } })) : (m.verbose("Hiding dimmer with javascript"), m.remove.dimmed(), d.stop().fadeOut(m.get.duration(), function () {
  8597. m.remove.active(), d.removeAttr("style"), t();
  8598. }));
  8599. } }, get: { dimmer: function dimmer() {
  8600. return d;
  8601. }, duration: function duration() {
  8602. return "object" == _typeof(g.duration) ? m.is.active() ? g.duration.hide : g.duration.show : g.duration;
  8603. } }, has: { dimmer: function dimmer() {
  8604. return g.dimmerName ? S.find(p.dimmer).filter("." + g.dimmerName).length > 0 : S.find(p.dimmer).length > 0;
  8605. } }, is: { active: function active() {
  8606. return d.hasClass(v.active);
  8607. }, animating: function animating() {
  8608. return d.is(":animated") || d.hasClass(v.animating);
  8609. }, closable: function closable() {
  8610. return "auto" == g.closable ? "hover" != g.on : g.closable;
  8611. }, dimmer: function dimmer() {
  8612. return S.hasClass(v.dimmer);
  8613. }, dimmable: function dimmable() {
  8614. return S.hasClass(v.dimmable);
  8615. }, dimmed: function dimmed() {
  8616. return f.hasClass(v.dimmed);
  8617. }, disabled: function disabled() {
  8618. return f.hasClass(v.disabled);
  8619. }, enabled: function enabled() {
  8620. return !m.is.disabled();
  8621. }, page: function page() {
  8622. return f.is("body");
  8623. }, pageDimmer: function pageDimmer() {
  8624. return d.hasClass(v.pageDimmer);
  8625. } }, can: { show: function show() {
  8626. return !d.hasClass(v.disabled);
  8627. } }, set: { opacity: function opacity(e) {
  8628. var t = d.css("background-color"),
  8629. n = t.split(","),
  8630. i = n && 3 == n.length,
  8631. 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);
  8632. }, active: function active() {
  8633. d.addClass(v.active);
  8634. }, dimmable: function dimmable() {
  8635. f.addClass(v.dimmable);
  8636. }, dimmed: function dimmed() {
  8637. f.addClass(v.dimmed);
  8638. }, pageDimmer: function pageDimmer() {
  8639. d.addClass(v.pageDimmer);
  8640. }, disabled: function disabled() {
  8641. d.addClass(v.disabled);
  8642. }, variation: function variation(e) {
  8643. (e = e || g.variation) && d.addClass(e);
  8644. } }, remove: { active: function active() {
  8645. d.removeClass(v.active);
  8646. }, dimmed: function dimmed() {
  8647. f.removeClass(v.dimmed);
  8648. }, disabled: function disabled() {
  8649. d.removeClass(v.disabled);
  8650. }, variation: function variation(e) {
  8651. (e = e || g.variation) && d.removeClass(e);
  8652. } }, setting: function setting(t, n) {
  8653. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  8654. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  8655. }
  8656. }, internal: function internal(t, n) {
  8657. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  8658. if (n === i) return m[t];m[t] = n;
  8659. }
  8660. }, debug: function debug() {
  8661. !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)));
  8662. }, verbose: function verbose() {
  8663. !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)));
  8664. }, error: function error() {
  8665. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  8666. }, performance: { log: function log(e) {
  8667. 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);
  8668. }, display: function display() {
  8669. var t = g.name + ":",
  8670. n = 0;r = !1, clearTimeout(m.performance.timer), e.each(s, function (e, t) {
  8671. n += t["Execution Time"];
  8672. }), 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) {
  8673. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  8674. }), console.groupEnd()), s = [];
  8675. } }, invoke: function invoke(t, n, a) {
  8676. var r,
  8677. s,
  8678. l,
  8679. 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) {
  8680. 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 {
  8681. 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];
  8682. }
  8683. })), 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;
  8684. } }).preinitialize(), c ? (T === i && m.initialize(), m.invoke(l)) : (T !== i && T.invoke("destroy"), m.initialize());
  8685. }), o !== i ? o : this;
  8686. }, 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() {
  8687. return e("<div />").attr("class", "ui dimmer");
  8688. } } };
  8689. }(jQuery, window, document), function (e, t, n, i) {
  8690. "use strict";
  8691. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dropdown = function (o) {
  8692. var a,
  8693. r = e(this),
  8694. s = e(n),
  8695. l = r.selector || "",
  8696. c = "ontouchstart" in n.documentElement,
  8697. u = new Date().getTime(),
  8698. d = [],
  8699. f = arguments[0],
  8700. m = "string" == typeof f,
  8701. g = [].slice.call(arguments, 1);return r.each(function (p) {
  8702. var h,
  8703. v,
  8704. b,
  8705. y,
  8706. x,
  8707. C,
  8708. w,
  8709. S,
  8710. k = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.dropdown.settings, o) : e.extend({}, e.fn.dropdown.settings),
  8711. T = k.className,
  8712. A = k.message,
  8713. R = k.fields,
  8714. P = k.keys,
  8715. E = k.metadata,
  8716. F = k.namespace,
  8717. O = k.regExp,
  8718. D = k.selector,
  8719. q = k.error,
  8720. j = k.templates,
  8721. z = "." + F,
  8722. I = "module-" + F,
  8723. M = e(this),
  8724. L = e(k.context),
  8725. V = M.find(D.text),
  8726. N = M.find(D.search),
  8727. H = M.find(D.sizer),
  8728. U = M.find(D.input),
  8729. W = M.find(D.icon),
  8730. B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(),
  8731. Q = M.children(D.menu),
  8732. X = Q.find(D.item),
  8733. $ = !1,
  8734. Y = !1,
  8735. Z = !1,
  8736. K = this,
  8737. J = M.data(I);S = { initialize: function initialize() {
  8738. 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());
  8739. }, instantiate: function instantiate() {
  8740. S.verbose("Storing instance of dropdown", S), J = S, M.data(I, S);
  8741. }, destroy: function destroy() {
  8742. 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();
  8743. }, observeChanges: function observeChanges() {
  8744. "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());
  8745. }, disconnect: { menuObserver: function menuObserver() {
  8746. w && w.disconnect();
  8747. }, selectObserver: function selectObserver() {
  8748. C && C.disconnect();
  8749. } }, observe: { select: function select() {
  8750. S.has.input() && C.observe(M[0], { childList: !0, subtree: !0 });
  8751. }, menu: function menu() {
  8752. S.has.menu() && w.observe(Q[0], { childList: !0, subtree: !0 });
  8753. } }, create: { id: function id() {
  8754. x = (Math.random().toString(16) + "000000000").substr(2, 8), y = "." + x, S.verbose("Creating unique id for element", x);
  8755. }, userChoice: function userChoice(t) {
  8756. var n, o, a;return !!(t = t || S.get.userValues()) && (t = e.isArray(t) ? t : [t], e.each(t, function (t, r) {
  8757. !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));
  8758. }), n);
  8759. }, userLabels: function userLabels(t) {
  8760. var n = S.get.userValues();n && (S.debug("Adding user labels", n), e.each(n, function (e, t) {
  8761. S.verbose("Adding custom user value"), S.add.label(t, t);
  8762. }));
  8763. }, menu: function menu() {
  8764. Q = e("<div />").addClass(T.menu).appendTo(M);
  8765. }, sizer: function sizer() {
  8766. H = e("<span />").addClass(T.sizer).insertAfter(N);
  8767. } }, search: function search(e) {
  8768. e = e !== i ? e : S.get.query(), S.verbose("Searching for query", e), S.has.minCharacters(e) ? S.filter(e) : S.hide();
  8769. }, select: { firstUnfiltered: function firstUnfiltered() {
  8770. S.verbose("Selecting first non-filtered element"), S.remove.selectedItem(), X.not(D.unselectable).not(D.addition + D.hidden).eq(0).addClass(T.selected);
  8771. }, nextAvailable: function nextAvailable(e) {
  8772. var t = (e = e.eq(0)).nextAll(D.item).not(D.unselectable).eq(0),
  8773. 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));
  8774. } }, setup: { api: function api() {
  8775. 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);
  8776. }, layout: function layout() {
  8777. 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();
  8778. }, select: function select() {
  8779. 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();
  8780. }, menu: function menu(e) {
  8781. Q.html(j.menu(e, R)), X = Q.find(D.item);
  8782. }, reference: function reference() {
  8783. 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();
  8784. }, returnedObject: function returnedObject() {
  8785. var e = r.slice(0, p),
  8786. t = r.slice(p + 1);r = e.add(M).add(t);
  8787. } }, refresh: function refresh() {
  8788. S.refreshSelectors(), S.refreshData();
  8789. }, refreshItems: function refreshItems() {
  8790. X = Q.find(D.item);
  8791. }, refreshSelectors: function refreshSelectors() {
  8792. 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);
  8793. }, refreshData: function refreshData() {
  8794. S.verbose("Refreshing cached metadata"), X.removeData(E.text).removeData(E.value);
  8795. }, clearData: function clearData() {
  8796. S.verbose("Clearing metadata"), X.removeData(E.text).removeData(E.value), M.removeData(E.defaultText).removeData(E.defaultValue).removeData(E.placeholderText);
  8797. }, toggle: function toggle() {
  8798. S.verbose("Toggling menu visibility"), S.is.active() ? S.hide() : S.show();
  8799. }, show: function show(t) {
  8800. 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()) {
  8801. 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 () {
  8802. S.can.click() && S.bind.intent(), S.has.menuSearch() && S.focusSearch(), S.set.visible(), t.call(K);
  8803. });
  8804. }
  8805. }, hide: function hide(t) {
  8806. 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 () {
  8807. S.remove.visible(), t.call(K);
  8808. }));
  8809. }, hideOthers: function hideOthers() {
  8810. S.verbose("Finding other dropdowns to hide"), r.not(M).has(D.menu + "." + T.visible).dropdown("hide");
  8811. }, hideMenu: function hideMenu() {
  8812. S.verbose("Hiding menu instantaneously"), S.remove.active(), S.remove.visible(), Q.transition("hide");
  8813. }, hideSubMenus: function hideSubMenus() {
  8814. var e = Q.children(D.item).find(D.menu);S.verbose("Hiding sub menus", e), e.transition("hide");
  8815. }, bind: { events: function events() {
  8816. c && S.bind.touchEvents(), S.bind.keyboardEvents(), S.bind.inputEvents(), S.bind.mouseEvents();
  8817. }, touchEvents: function touchEvents() {
  8818. 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);
  8819. }, keyboardEvents: function keyboardEvents() {
  8820. 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);
  8821. }, inputEvents: function inputEvents() {
  8822. S.verbose("Binding input change events"), M.on("change" + z, D.input, S.event.change);
  8823. }, mouseEvents: function mouseEvents() {
  8824. 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);
  8825. }, intent: function intent() {
  8826. 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);
  8827. } }, unbind: { intent: function intent() {
  8828. S.verbose("Removing hide intent event from document"), c && s.off("touchstart" + y).off("touchmove" + y), s.off("click" + y);
  8829. } }, filter: function filter(e) {
  8830. var t = e !== i ? e : S.get.query(),
  8831. n = function n() {
  8832. 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();
  8833. };k.useLabels && S.has.maxSelections() || (k.apiSettings ? S.can.useAPI() ? S.queryRemote(t, function () {
  8834. k.filterRemoteData && S.filterItems(t), n();
  8835. }) : S.error(q.noAPI) : (S.filterItems(t), n()));
  8836. }, queryRemote: function queryRemote(t, n) {
  8837. var i = { errorDuration: !1, cache: "local", throttle: k.throttle, urlData: { query: t }, onError: function onError() {
  8838. S.add.message(A.serverError), n();
  8839. }, onFailure: function onFailure() {
  8840. S.add.message(A.serverError), n();
  8841. }, onSuccess: function onSuccess(t) {
  8842. 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();
  8843. } };M.api("get request") || S.setup.api(), i = e.extend(!0, {}, i, k.apiSettings), M.api("setting", i).api("query");
  8844. }, filterItems: function filterItems(t) {
  8845. var n = t !== i ? t : S.get.query(),
  8846. o = null,
  8847. a = S.escape.string(n),
  8848. r = new RegExp("^" + a, "igm");S.has.query() && (o = [], S.verbose("Searching for matching values", n), X.each(function () {
  8849. var t,
  8850. i,
  8851. a = e(this);if ("both" == k.match || "text" == k.match) {
  8852. 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;
  8853. }if ("both" == k.match || "value" == k.match) {
  8854. 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;
  8855. }
  8856. })), S.debug("Showing only matched items", n), S.remove.filteredItem(), o && X.not(o).addClass(T.filtered);
  8857. }, fuzzySearch: function fuzzySearch(e, t) {
  8858. var n = t.length,
  8859. 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++) {
  8860. for (var r = e.charCodeAt(o); a < n;) {
  8861. if (t.charCodeAt(a++) === r) continue e;
  8862. }return !1;
  8863. }return !0;
  8864. }, exactSearch: function exactSearch(e, t) {
  8865. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  8866. }, filterActive: function filterActive() {
  8867. k.useLabels && X.filter("." + T.active).addClass(T.filtered);
  8868. }, focusSearch: function focusSearch(e) {
  8869. 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());
  8870. }, forceSelection: function forceSelection() {
  8871. var e = X.not(T.filtered).filter("." + T.selected).eq(0),
  8872. t = X.not(T.filtered).filter("." + T.active).eq(0),
  8873. 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();
  8874. }, change: { values: function values(t) {
  8875. k.allowAdditions || S.clear(), S.debug("Creating dropdown with specified values", t), S.setup.menu({ values: t }), e.each(t, function (e, t) {
  8876. if (1 == t.selected) return S.debug("Setting initial selection to", t.value), S.set.selected(t.value), !0;
  8877. });
  8878. } }, event: { change: function change() {
  8879. Z || (S.debug("Input changed, updating selection"), S.set.selected());
  8880. }, focus: function focus() {
  8881. k.showOnFocus && !$ && S.is.hidden() && !v && S.show();
  8882. }, blur: function blur(e) {
  8883. v = n.activeElement === this, $ || v || (S.remove.activeLabel(), S.hide());
  8884. }, mousedown: function mousedown() {
  8885. S.is.searchSelection() ? b = !0 : $ = !0;
  8886. }, mouseup: function mouseup() {
  8887. S.is.searchSelection() ? b = !1 : $ = !1;
  8888. }, click: function click(t) {
  8889. e(t.target).is(M) && (S.is.focusedOnSearch() ? S.show() : S.focusSearch());
  8890. }, search: { focus: function focus() {
  8891. $ = !0, S.is.multiple() && S.remove.activeLabel(), k.showOnFocus && S.search();
  8892. }, blur: function blur(e) {
  8893. v = n.activeElement === this, S.is.searchSelection() && !b && (Y || v || (k.forceSelection && S.forceSelection(), S.hide())), b = !1;
  8894. } }, icon: { click: function click(e) {
  8895. S.toggle();
  8896. } }, text: { focus: function focus(e) {
  8897. $ = !0, S.focusSearch();
  8898. } }, input: function input(e) {
  8899. (S.is.multiple() || S.is.searchSelection()) && S.set.filtered(), clearTimeout(S.timer), S.timer = setTimeout(S.search, k.delay.search);
  8900. }, label: { click: function click(t) {
  8901. var n = e(this),
  8902. i = M.find(D.label),
  8903. o = i.filter("." + T.active),
  8904. a = n.nextAll("." + T.active),
  8905. r = n.prevAll("." + T.active),
  8906. 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));
  8907. } }, remove: { click: function click() {
  8908. var t = e(this).parent();t.hasClass(T.active) ? S.remove.activeLabels() : S.remove.activeLabels(t);
  8909. } }, test: { toggle: function toggle(e) {
  8910. var t = S.is.multiple() ? S.show : S.toggle;S.is.bubbledLabelClick(e) || S.is.bubbledIconClick(e) || S.determine.eventOnElement(e, t) && e.preventDefault();
  8911. }, touch: function touch(e) {
  8912. S.determine.eventOnElement(e, function () {
  8913. "touchstart" == e.type ? S.timer = setTimeout(function () {
  8914. S.hide();
  8915. }, k.delay.touch) : "touchmove" == e.type && clearTimeout(S.timer);
  8916. }), e.stopPropagation();
  8917. }, hide: function hide(e) {
  8918. S.determine.eventInModule(e, S.hide);
  8919. } }, select: { mutation: function mutation(t) {
  8920. S.debug("<select> modified, recreating menu");var n = !1;e.each(t, function (t, i) {
  8921. if (e(i.target).is("select") || e(i.addedNodes).is("select")) return n = !0, !0;
  8922. }), n && (S.disconnect.selectObserver(), S.refresh(), S.setup.select(), S.set.selected(), S.observe.select());
  8923. } }, menu: { mutation: function mutation(t) {
  8924. var n = t[0],
  8925. i = n.addedNodes ? e(n.addedNodes[0]) : e(!1),
  8926. o = n.removedNodes ? e(n.removedNodes[0]) : e(!1),
  8927. a = i.add(o),
  8928. r = a.is(D.addition) || a.closest(D.addition).length > 0,
  8929. 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());
  8930. }, mousedown: function mousedown() {
  8931. Y = !0;
  8932. }, mouseup: function mouseup() {
  8933. Y = !1;
  8934. } }, item: { mouseenter: function mouseenter(t) {
  8935. var n = e(t.target),
  8936. i = e(this),
  8937. o = i.children(D.menu),
  8938. a = i.siblings(D.item).children(D.menu),
  8939. r = o.length > 0;!(o.find(n).length > 0) && r && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  8940. S.verbose("Showing sub-menu", o), e.each(a, function () {
  8941. S.animate.hide(!1, e(this));
  8942. }), S.animate.show(!1, o);
  8943. }, k.delay.show), t.preventDefault());
  8944. }, mouseleave: function mouseleave(t) {
  8945. var n = e(this).children(D.menu);n.length > 0 && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  8946. S.verbose("Hiding sub-menu", n), S.animate.hide(!1, n);
  8947. }, k.delay.hide));
  8948. }, click: function click(t, i) {
  8949. var o = e(this),
  8950. a = e(t ? t.target : ""),
  8951. r = o.find(D.menu),
  8952. s = S.get.choiceText(o),
  8953. l = S.get.choiceValue(o, s),
  8954. c = r.length > 0,
  8955. 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));
  8956. } }, document: { keydown: function keydown(e) {
  8957. var t = e.which;if (S.is.inObject(t, P)) {
  8958. var n = M.find(D.label),
  8959. i = n.filter("." + T.active),
  8960. o = (i.data(E.value), n.index(i)),
  8961. a = n.length,
  8962. r = i.length > 0,
  8963. s = i.length > 1,
  8964. l = 0 === o,
  8965. c = o + 1 == a,
  8966. u = S.is.searchSelection(),
  8967. d = S.is.focusedOnSearch(),
  8968. f = S.is.focused(),
  8969. 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);
  8970. }
  8971. } }, keydown: function keydown(e) {
  8972. var t = e.which;if (S.is.inObject(t, P)) {
  8973. var n,
  8974. i = X.not(D.unselectable).filter("." + T.selected).eq(0),
  8975. o = Q.children("." + T.active).eq(0),
  8976. a = i.length > 0 ? i : o,
  8977. r = a.length > 0 ? a.siblings(":not(." + T.filtered + ")").addBack() : Q.children(":not(." + T.filtered + ")"),
  8978. s = a.children(D.menu),
  8979. l = a.closest(D.menu),
  8980. c = l.hasClass(T.visible) || l.hasClass(T.animating) || l.parent(D.menu).length > 0,
  8981. u = s.length > 0,
  8982. d = a.length > 0,
  8983. f = a.not(D.unselectable).length > 0,
  8984. 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()) {
  8985. 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) {
  8986. 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();
  8987. }if (t == P.downArrow) {
  8988. 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();
  8989. }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());
  8990. } else m && e.preventDefault(), t != P.downArrow || S.is.visible() || (S.verbose("Down key pressed, showing dropdown"), S.show(), e.preventDefault());
  8991. } else S.has.search() || S.set.selectedLetter(String.fromCharCode(t));
  8992. } }, trigger: { change: function change() {
  8993. var e = n.createEvent("HTMLEvents"),
  8994. t = U[0];t && (S.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  8995. } }, determine: { selectAction: function selectAction(t, n) {
  8996. 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);
  8997. }, eventInModule: function eventInModule(t, i) {
  8998. var o = e(t.target),
  8999. a = o.closest(n.documentElement).length > 0,
  9000. 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);
  9001. }, eventOnElement: function eventOnElement(t, i) {
  9002. var o = e(t.target),
  9003. a = o.closest(D.siblingLabel),
  9004. r = n.body.contains(t.target),
  9005. s = 0 === M.find(a).length,
  9006. 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);
  9007. } }, action: { nothing: function nothing() {}, activate: function activate(t, n, o) {
  9008. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  9009. if (S.set.selected(n, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  9010. }
  9011. }, select: function select(t, n, o) {
  9012. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  9013. if (S.set.value(n, t, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  9014. }
  9015. }, combo: function combo(t, n, o) {
  9016. n = n !== i ? n : t, S.set.selected(n, e(o)), S.hideAndClear();
  9017. }, hide: function hide(e, t, n) {
  9018. S.set.value(t, e), S.hideAndClear();
  9019. } }, get: { id: function id() {
  9020. return x;
  9021. }, defaultText: function defaultText() {
  9022. return M.data(E.defaultText);
  9023. }, defaultValue: function defaultValue() {
  9024. return M.data(E.defaultValue);
  9025. }, placeholderText: function placeholderText() {
  9026. return "auto" != k.placeholder && "string" == typeof k.placeholder ? k.placeholder : M.data(E.placeholderText) || "";
  9027. }, text: function text() {
  9028. return V.text();
  9029. }, query: function query() {
  9030. return e.trim(N.val());
  9031. }, searchWidth: function searchWidth(e) {
  9032. return e = e !== i ? e : N.val(), H.text(e), Math.ceil(H.width() + 1);
  9033. }, selectionCount: function selectionCount() {
  9034. var t = S.get.values();return S.is.multiple() ? e.isArray(t) ? t.length : 0 : "" !== S.get.value() ? 1 : 0;
  9035. }, transition: function transition(e) {
  9036. return "auto" == k.transition ? S.is.upward(e) ? "slide up" : "slide down" : k.transition;
  9037. }, userValues: function userValues() {
  9038. var t = S.get.values();return !!t && (t = e.isArray(t) ? t : [t], e.grep(t, function (e) {
  9039. return !1 === S.get.item(e);
  9040. }));
  9041. }, uniqueArray: function uniqueArray(t) {
  9042. return e.grep(t, function (n, i) {
  9043. return e.inArray(n, t) === i;
  9044. });
  9045. }, caretPosition: function caretPosition() {
  9046. var e,
  9047. t,
  9048. 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;
  9049. }, value: function value() {
  9050. var t = U.length > 0 ? U.val() : M.data(E.value),
  9051. n = e.isArray(t) && 1 === t.length && "" === t[0];return t === i || n ? "" : t;
  9052. }, values: function values() {
  9053. var e = S.get.value();return "" === e ? "" : !S.has.selectInput() && S.is.multiple() ? "string" == typeof e ? e.split(k.delimiter) : "" : e;
  9054. }, remoteValues: function remoteValues() {
  9055. var t = S.get.values(),
  9056. n = !1;return t && ("string" == typeof t && (t = [t]), e.each(t, function (e, t) {
  9057. var i = S.read.remoteData(t);S.verbose("Restoring value from session data", i, t), i && (n || (n = {}), n[t] = i);
  9058. })), n;
  9059. }, choiceText: function choiceText(t, n) {
  9060. 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());
  9061. }, choiceValue: function choiceValue(t, n) {
  9062. 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));
  9063. }, inputEvent: function inputEvent() {
  9064. var e = N[0];return !!e && (e.oninput !== i ? "input" : e.onpropertychange !== i ? "propertychange" : "keyup");
  9065. }, selectValues: function selectValues() {
  9066. var t = { values: [] };return M.find("option").each(function () {
  9067. var n = e(this),
  9068. o = n.html(),
  9069. a = n.attr("disabled"),
  9070. 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 });
  9071. }), 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) {
  9072. return e.name > t.name ? 1 : -1;
  9073. }), S.debug("Retrieved and sorted values from select", t)) : S.debug("Retrieved values from select", t), t;
  9074. }, activeItem: function activeItem() {
  9075. return X.filter("." + T.active);
  9076. }, selectedItem: function selectedItem() {
  9077. var e = X.not(D.unselectable).filter("." + T.selected);return e.length > 0 ? e : X.eq(0);
  9078. }, itemWithAdditions: function itemWithAdditions(e) {
  9079. var t = S.get.item(e),
  9080. n = S.create.userChoice(e);return n && n.length > 0 && (t = t.length > 0 ? t.add(n) : n), t;
  9081. }, item: function item(t, n) {
  9082. var o,
  9083. a,
  9084. 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 () {
  9085. var o = e(this),
  9086. s = S.get.choiceText(o),
  9087. 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) {
  9088. if (S.verbose("Ambiguous dropdown value using strict type check", o, t), l === t || s === t) return r = o, !0;
  9089. } else if (String(l) == String(t) || s == t) return S.verbose("Found select item by value", l, t), r = o, !0;
  9090. }), r;
  9091. } }, check: { maxSelections: function maxSelections(e) {
  9092. 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));
  9093. } }, restore: { defaults: function defaults() {
  9094. S.clear(), S.restore.defaultText(), S.restore.defaultValue();
  9095. }, defaultText: function defaultText() {
  9096. 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));
  9097. }, placeholderText: function placeholderText() {
  9098. S.set.placeholderText();
  9099. }, defaultValue: function defaultValue() {
  9100. 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()));
  9101. }, labels: function labels() {
  9102. k.allowAdditions && (k.useLabels || (S.error(q.labels), k.useLabels = !0), S.debug("Restoring selected values"), S.create.userLabels()), S.check.maxSelections();
  9103. }, selected: function selected() {
  9104. S.restore.values(), S.is.multiple() ? (S.debug("Restoring previously selected values and labels"), S.restore.labels()) : S.debug("Restoring previously selected values");
  9105. }, values: function values() {
  9106. S.set.initialLoad(), k.apiSettings && k.saveRemoteData && S.get.remoteValues() ? S.restore.remoteValues() : S.set.selected(), S.remove.initialLoad();
  9107. }, remoteValues: function remoteValues() {
  9108. var t = S.get.remoteValues();S.debug("Recreating selected from session data", t), t && (S.is.single() ? e.each(t, function (e, t) {
  9109. S.set.text(t);
  9110. }) : e.each(t, function (e, t) {
  9111. S.add.label(e, t);
  9112. }));
  9113. } }, read: { remoteData: function remoteData(e) {
  9114. var n;if (t.Storage !== i) return (n = sessionStorage.getItem(e)) !== i && n;S.error(q.noStorage);
  9115. } }, save: { defaults: function defaults() {
  9116. S.save.defaultText(), S.save.placeholderText(), S.save.defaultValue();
  9117. }, defaultValue: function defaultValue() {
  9118. var e = S.get.value();S.verbose("Saving default value as", e), M.data(E.defaultValue, e);
  9119. }, defaultText: function defaultText() {
  9120. var e = S.get.text();S.verbose("Saving default text as", e), M.data(E.defaultText, e);
  9121. }, placeholderText: function placeholderText() {
  9122. 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));
  9123. }, remoteData: function remoteData(e, n) {
  9124. t.Storage !== i ? (S.verbose("Saving remote data to session storage", n, e), sessionStorage.setItem(n, e)) : S.error(q.noStorage);
  9125. } }, clear: function clear() {
  9126. S.is.multiple() && k.useLabels ? S.remove.labels() : (S.remove.activeItem(), S.remove.selectedItem()), S.set.placeholderText(), S.clearValue();
  9127. }, clearValue: function clearValue() {
  9128. S.set.value("");
  9129. }, scrollPage: function scrollPage(e, t) {
  9130. var n,
  9131. i,
  9132. o = t || S.get.selectedItem(),
  9133. a = o.closest(D.menu),
  9134. r = a.outerHeight(),
  9135. s = a.scrollTop(),
  9136. l = X.eq(0).outerHeight(),
  9137. c = Math.floor(r / l),
  9138. u = (a.prop("scrollHeight"), "up" == e ? s - l * c : s + l * c),
  9139. 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));
  9140. }, set: { filtered: function filtered() {
  9141. var e = S.is.multiple(),
  9142. t = S.is.searchSelection(),
  9143. n = e && t,
  9144. i = t ? S.get.query() : "",
  9145. o = "string" == typeof i && i.length > 0,
  9146. a = S.get.searchWidth(),
  9147. 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));
  9148. }, empty: function empty() {
  9149. M.addClass(T.empty);
  9150. }, loading: function loading() {
  9151. M.addClass(T.loading);
  9152. }, placeholderText: function placeholderText(e) {
  9153. e = e || S.get.placeholderText(), S.debug("Setting placeholder text", e), S.set.text(e), V.addClass(T.placeholder);
  9154. }, tabbable: function tabbable() {
  9155. 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)));
  9156. }, initialLoad: function initialLoad() {
  9157. S.verbose("Setting initial load"), h = !0;
  9158. }, activeItem: function activeItem(e) {
  9159. k.allowAdditions && e.filter(D.addition).length > 0 ? e.addClass(T.filtered) : e.addClass(T.active);
  9160. }, partialSearch: function partialSearch(e) {
  9161. var t = S.get.query().length;N.val(e.substr(0, t));
  9162. }, scrollPosition: function scrollPosition(e, t) {
  9163. 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));
  9164. }, text: function text(e) {
  9165. "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)));
  9166. }, selectedItem: function selectedItem(e) {
  9167. var t = S.get.choiceValue(e),
  9168. n = S.get.choiceText(e, !1),
  9169. 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);
  9170. }, selectedLetter: function selectedLetter(t) {
  9171. var n,
  9172. i = X.filter("." + T.selected),
  9173. 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 () {
  9174. if (S.has.firstLetter(e(this), t)) return o = e(this), !1;
  9175. }), 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));
  9176. }, direction: function direction(e) {
  9177. "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);
  9178. }, upward: function upward(e) {
  9179. (e || M).addClass(T.upward);
  9180. }, leftward: function leftward(e) {
  9181. (e || Q).addClass(T.leftward);
  9182. }, value: function value(e, t, n) {
  9183. var o = S.escape.value(e),
  9184. a = U.length > 0,
  9185. r = S.get.values(),
  9186. s = e !== i ? String(e) : e;if (a) {
  9187. 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;
  9188. } 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);
  9189. }, active: function active() {
  9190. M.addClass(T.active);
  9191. }, multiple: function multiple() {
  9192. M.addClass(T.multiple);
  9193. }, visible: function visible() {
  9194. M.addClass(T.visible);
  9195. }, exactly: function exactly(e, t) {
  9196. S.debug("Setting selected to exact values"), S.clear(), S.set.selected(e, t);
  9197. }, selected: function selected(t, n) {
  9198. 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 () {
  9199. var t = e(this),
  9200. o = S.get.choiceText(t),
  9201. a = S.get.choiceValue(t, o),
  9202. r = t.hasClass(T.filtered),
  9203. s = t.hasClass(T.active),
  9204. l = t.hasClass(T.addition),
  9205. 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));
  9206. }));
  9207. } }, add: { label: function label(t, n, i) {
  9208. var o,
  9209. a = S.is.searchSelection() ? N : V,
  9210. 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)));
  9211. }, message: function message(t) {
  9212. var n = Q.children(D.message),
  9213. i = k.templates.message(S.add.variables(t));n.length > 0 ? n.html(i) : n = e("<div/>").html(i).addClass(T.message).appendTo(Q);
  9214. }, optionValue: function optionValue(t) {
  9215. 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());
  9216. }, userSuggestion: function userSuggestion(e) {
  9217. var t,
  9218. n = Q.children(D.addition),
  9219. i = S.get.item(e),
  9220. o = i && i.not(D.addition).length,
  9221. 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()));
  9222. }, variables: function variables(e, t) {
  9223. var n,
  9224. i,
  9225. o = -1 !== e.search("{count}"),
  9226. a = -1 !== e.search("{maxCount}"),
  9227. 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;
  9228. }, value: function value(t, n, i) {
  9229. var o,
  9230. 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");
  9231. } }, remove: { active: function active() {
  9232. M.removeClass(T.active);
  9233. }, activeLabel: function activeLabel() {
  9234. M.find(D.label).removeClass(T.active);
  9235. }, empty: function empty() {
  9236. M.removeClass(T.empty);
  9237. }, loading: function loading() {
  9238. M.removeClass(T.loading);
  9239. }, initialLoad: function initialLoad() {
  9240. h = !1;
  9241. }, upward: function upward(e) {
  9242. (e || M).removeClass(T.upward);
  9243. }, leftward: function leftward(e) {
  9244. (e || Q).removeClass(T.leftward);
  9245. }, visible: function visible() {
  9246. M.removeClass(T.visible);
  9247. }, activeItem: function activeItem() {
  9248. X.removeClass(T.active);
  9249. }, filteredItem: function filteredItem() {
  9250. k.useLabels && S.has.maxSelections() || (k.useLabels && S.is.multiple() ? X.not("." + T.active).removeClass(T.filtered) : X.removeClass(T.filtered), S.remove.empty());
  9251. }, optionValue: function optionValue(e) {
  9252. var t = S.escape.value(e),
  9253. 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 }));
  9254. }, message: function message() {
  9255. Q.children(D.message).remove();
  9256. }, searchWidth: function searchWidth() {
  9257. N.css("width", "");
  9258. }, searchTerm: function searchTerm() {
  9259. S.verbose("Cleared search term"), N.val(""), S.set.filtered();
  9260. }, userAddition: function userAddition() {
  9261. X.filter(D.addition).remove();
  9262. }, selected: function selected(t, n) {
  9263. if (!(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t))) return !1;n.each(function () {
  9264. var t = e(this),
  9265. n = S.get.choiceText(t),
  9266. 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);
  9267. });
  9268. }, selectedItem: function selectedItem() {
  9269. X.removeClass(T.selected);
  9270. }, value: function value(e, t, n) {
  9271. var i,
  9272. 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();
  9273. }, arrayValue: function arrayValue(t, n) {
  9274. return e.isArray(n) || (n = [n]), n = e.grep(n, function (e) {
  9275. return t != e;
  9276. }), S.verbose("Removed value from delimited string", t, n), n;
  9277. }, label: function label(e, t) {
  9278. var n = M.find(D.label).filter("[data-" + E.value + '="' + S.escape.string(e) + '"]');S.verbose("Removing label", n), n.remove();
  9279. }, activeLabels: function activeLabels(e) {
  9280. e = e || M.find(D.label).filter("." + T.active), S.verbose("Removing active label selections", e), S.remove.labels(e);
  9281. }, labels: function labels(t) {
  9282. t = t || M.find(D.label), S.verbose("Removing labels", t), t.each(function () {
  9283. var t = e(this),
  9284. n = t.data(E.value),
  9285. o = n !== i ? String(n) : n,
  9286. 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");
  9287. });
  9288. }, tabbable: function tabbable() {
  9289. 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"));
  9290. } }, has: { menuSearch: function menuSearch() {
  9291. return S.has.search() && N.closest(Q).length > 0;
  9292. }, search: function search() {
  9293. return N.length > 0;
  9294. }, sizer: function sizer() {
  9295. return H.length > 0;
  9296. }, selectInput: function selectInput() {
  9297. return U.is("select");
  9298. }, minCharacters: function minCharacters(e) {
  9299. return !k.minCharacters || (e = e !== i ? String(e) : String(S.get.query())).length >= k.minCharacters;
  9300. }, firstLetter: function firstLetter(e, t) {
  9301. var n;return !(!e || 0 === e.length || "string" != typeof t) && (n = S.get.choiceText(e, !1), (t = t.toLowerCase()) == String(n).charAt(0).toLowerCase());
  9302. }, input: function input() {
  9303. return U.length > 0;
  9304. }, items: function items() {
  9305. return X.length > 0;
  9306. }, menu: function menu() {
  9307. return Q.length > 0;
  9308. }, message: function message() {
  9309. return 0 !== Q.children(D.message).length;
  9310. }, label: function label(e) {
  9311. var t = S.escape.value(e),
  9312. n = M.find(D.label);return k.ignoreCase && (t = t.toLowerCase()), n.filter("[data-" + E.value + '="' + S.escape.string(t) + '"]').length > 0;
  9313. }, maxSelections: function maxSelections() {
  9314. return k.maxSelections && S.get.selectionCount() >= k.maxSelections;
  9315. }, allResultsFiltered: function allResultsFiltered() {
  9316. var e = X.not(D.addition);return e.filter(D.unselectable).length === e.length;
  9317. }, userSuggestion: function userSuggestion() {
  9318. return Q.children(D.addition).length > 0;
  9319. }, query: function query() {
  9320. return "" !== S.get.query();
  9321. }, value: function value(e) {
  9322. return k.ignoreCase ? S.has.valueIgnoringCase(e) : S.has.valueMatchingCase(e);
  9323. }, valueMatchingCase: function valueMatchingCase(t) {
  9324. var n = S.get.values();return !!(e.isArray(n) ? n && -1 !== e.inArray(t, n) : n == t);
  9325. }, valueIgnoringCase: function valueIgnoringCase(t) {
  9326. var n = S.get.values(),
  9327. i = !1;return e.isArray(n) || (n = [n]), e.each(n, function (e, n) {
  9328. if (String(t).toLowerCase() == String(n).toLowerCase()) return i = !0, !1;
  9329. }), i;
  9330. } }, is: { active: function active() {
  9331. return M.hasClass(T.active);
  9332. }, animatingInward: function animatingInward() {
  9333. return Q.transition("is inward");
  9334. }, animatingOutward: function animatingOutward() {
  9335. return Q.transition("is outward");
  9336. }, bubbledLabelClick: function bubbledLabelClick(t) {
  9337. return e(t.target).is("select, input") && M.closest("label").length > 0;
  9338. }, bubbledIconClick: function bubbledIconClick(t) {
  9339. return e(t.target).closest(W).length > 0;
  9340. }, alreadySetup: function alreadySetup() {
  9341. return M.is("select") && M.parent(D.dropdown).data(I) !== i && 0 === M.prev().length;
  9342. }, animating: function animating(e) {
  9343. return e ? e.transition && e.transition("is animating") : Q.transition && Q.transition("is animating");
  9344. }, leftward: function leftward(e) {
  9345. return (e || Q).hasClass(T.leftward);
  9346. }, disabled: function disabled() {
  9347. return M.hasClass(T.disabled);
  9348. }, focused: function focused() {
  9349. return n.activeElement === M[0];
  9350. }, focusedOnSearch: function focusedOnSearch() {
  9351. return n.activeElement === N[0];
  9352. }, allFiltered: function allFiltered() {
  9353. return (S.is.multiple() || S.has.search()) && !(0 == k.hideAdditions && S.has.userSuggestion()) && !S.has.message() && S.has.allResultsFiltered();
  9354. }, hidden: function hidden(e) {
  9355. return !S.is.visible(e);
  9356. }, initialLoad: function initialLoad() {
  9357. return h;
  9358. }, inObject: function inObject(t, n) {
  9359. var i = !1;return e.each(n, function (e, n) {
  9360. if (n == t) return i = !0, !0;
  9361. }), i;
  9362. }, multiple: function multiple() {
  9363. return M.hasClass(T.multiple);
  9364. }, remote: function remote() {
  9365. return k.apiSettings && S.can.useAPI();
  9366. }, single: function single() {
  9367. return !S.is.multiple();
  9368. }, selectMutation: function selectMutation(t) {
  9369. var n = !1;return e.each(t, function (t, i) {
  9370. if (i.target && e(i.target).is("select")) return n = !0, !0;
  9371. }), n;
  9372. }, search: function search() {
  9373. return M.hasClass(T.search);
  9374. }, searchSelection: function searchSelection() {
  9375. return S.has.search() && 1 === N.parent(D.dropdown).length;
  9376. }, selection: function selection() {
  9377. return M.hasClass(T.selection);
  9378. }, userValue: function userValue(t) {
  9379. return -1 !== e.inArray(t, S.get.userValues());
  9380. }, upward: function upward(e) {
  9381. return (e || M).hasClass(T.upward);
  9382. }, visible: function visible(e) {
  9383. return e ? e.hasClass(T.visible) : Q.hasClass(T.visible);
  9384. }, verticallyScrollableContext: function verticallyScrollableContext() {
  9385. var e = L.get(0) !== t && L.css("overflow-y");return "auto" == e || "scroll" == e;
  9386. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  9387. var e = L.get(0) !== t && L.css("overflow-X");return "auto" == e || "scroll" == e;
  9388. } }, can: { activate: function activate(e) {
  9389. return !!k.useLabels || !S.has.maxSelections() || !(!S.has.maxSelections() || !e.hasClass(T.active));
  9390. }, openDownward: function openDownward(e) {
  9391. var n,
  9392. i,
  9393. o = e || Q,
  9394. 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;
  9395. }, openRightward: function openRightward(e) {
  9396. var n,
  9397. i,
  9398. o = e || Q,
  9399. 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;
  9400. }, click: function click() {
  9401. return c || "click" == k.on;
  9402. }, extendSelect: function extendSelect() {
  9403. return k.allowAdditions || k.apiSettings;
  9404. }, show: function show() {
  9405. return !S.is.disabled() && (S.has.items() || S.has.message());
  9406. }, useAPI: function useAPI() {
  9407. return e.fn.api !== i;
  9408. } }, animate: { show: function show(t, n) {
  9409. var o,
  9410. a = n || Q,
  9411. r = n ? function () {} : function () {
  9412. S.hideSubMenus(), S.hideOthers(), S.set.active();
  9413. };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() {
  9414. t.call(K);
  9415. } }) : S.error(q.noTransition, o));
  9416. }, hide: function hide(t, n) {
  9417. var o = n || Q,
  9418. a = (n ? k.duration : k.duration, n ? function () {} : function () {
  9419. S.can.click() && S.unbind.intent(), S.remove.active();
  9420. }),
  9421. 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() {
  9422. t.call(K);
  9423. } }) : S.error(q.transition));
  9424. } }, hideAndClear: function hideAndClear() {
  9425. S.remove.searchTerm(), S.has.maxSelections() || (S.has.search() ? S.hide(function () {
  9426. S.remove.filteredItem();
  9427. }) : S.hide());
  9428. }, delay: { show: function show() {
  9429. S.verbose("Delaying show event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.show, k.delay.show);
  9430. }, hide: function hide() {
  9431. S.verbose("Delaying hide event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.hide, k.delay.hide);
  9432. } }, escape: { value: function value(t) {
  9433. var n = e.isArray(t),
  9434. i = "string" == typeof t,
  9435. o = !i && !n,
  9436. a = i && -1 !== t.search(O.quote),
  9437. r = [];return o || !a ? t : (S.debug("Encoding quote values for use in select", t), n ? (e.each(t, function (e, t) {
  9438. r.push(t.replace(O.quote, "&quot;"));
  9439. }), r) : t.replace(O.quote, "&quot;"));
  9440. }, string: function string(e) {
  9441. return (e = String(e)).replace(O.escape, "\\$&");
  9442. } }, setting: function setting(t, n) {
  9443. if (S.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, k, t);else {
  9444. if (n === i) return k[t];e.isPlainObject(k[t]) ? e.extend(!0, k[t], n) : k[t] = n;
  9445. }
  9446. }, internal: function internal(t, n) {
  9447. if (e.isPlainObject(t)) e.extend(!0, S, t);else {
  9448. if (n === i) return S[t];S[t] = n;
  9449. }
  9450. }, debug: function debug() {
  9451. !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)));
  9452. }, verbose: function verbose() {
  9453. !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)));
  9454. }, error: function error() {
  9455. k.silent || (S.error = Function.prototype.bind.call(console.error, console, k.name + ":"), S.error.apply(console, arguments));
  9456. }, performance: { log: function log(e) {
  9457. 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);
  9458. }, display: function display() {
  9459. var t = k.name + ":",
  9460. n = 0;u = !1, clearTimeout(S.performance.timer), e.each(d, function (e, t) {
  9461. n += t["Execution Time"];
  9462. }), 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) {
  9463. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9464. }), console.groupEnd()), d = [];
  9465. } }, invoke: function invoke(t, n, o) {
  9466. var r,
  9467. s,
  9468. l,
  9469. 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) {
  9470. 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 {
  9471. 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];
  9472. }
  9473. })), 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;
  9474. } }, m ? (J === i && S.initialize(), S.invoke(f)) : (J !== i && J.invoke("destroy"), S.initialize());
  9475. }), a !== i ? a : r;
  9476. }, 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) {
  9477. return e(this);
  9478. }, onLabelRemove: function onLabelRemove(e) {
  9479. return !0;
  9480. }, onNoResults: function onNoResults(e) {
  9481. return !0;
  9482. }, 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) {
  9483. var n = t.placeholder || !1,
  9484. 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) {
  9485. i += t.disabled ? '<div class="disabled item" data-value="' + t.value + '">' + t.name + "</div>" : '<div class="item" data-value="' + t.value + '">' + t.name + "</div>";
  9486. }), i += "</div>";
  9487. }, menu: function menu(t, n) {
  9488. var i = t[n.values] || {},
  9489. o = "";return e.each(i, function (e, t) {
  9490. var i = t[n.text] ? 'data-text="' + t[n.text] + '"' : "",
  9491. a = t[n.disabled] ? "disabled " : "";o += '<div class="' + a + 'item" data-value="' + t[n.value] + '"' + i + ">", o += t[n.name], o += "</div>";
  9492. }), o;
  9493. }, label: function label(e, t) {
  9494. return t + '<i class="delete icon"></i>';
  9495. }, message: function message(e) {
  9496. return e;
  9497. }, addition: function addition(e) {
  9498. return e;
  9499. } };
  9500. }(jQuery, window, document), function (e, t, n, i) {
  9501. "use strict";
  9502. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.embed = function (n) {
  9503. var o,
  9504. a = e(this),
  9505. r = a.selector || "",
  9506. s = new Date().getTime(),
  9507. l = [],
  9508. c = arguments[0],
  9509. u = "string" == typeof c,
  9510. d = [].slice.call(arguments, 1);return a.each(function () {
  9511. var f,
  9512. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.embed.settings, n) : e.extend({}, e.fn.embed.settings),
  9513. g = m.selector,
  9514. p = m.className,
  9515. h = m.sources,
  9516. v = m.error,
  9517. b = m.metadata,
  9518. y = m.namespace,
  9519. x = m.templates,
  9520. C = "." + y,
  9521. w = "module-" + y,
  9522. S = (e(t), e(this)),
  9523. k = (S.find(g.placeholder), S.find(g.icon), S.find(g.embed)),
  9524. T = this,
  9525. A = S.data(w);f = { initialize: function initialize() {
  9526. f.debug("Initializing embed"), f.determine.autoplay(), f.create(), f.bind.events(), f.instantiate();
  9527. }, instantiate: function instantiate() {
  9528. f.verbose("Storing instance of module", f), A = f, S.data(w, f);
  9529. }, destroy: function destroy() {
  9530. f.verbose("Destroying previous instance of embed"), f.reset(), S.removeData(w).off(C);
  9531. }, refresh: function refresh() {
  9532. f.verbose("Refreshing selector cache"), S.find(g.placeholder), S.find(g.icon), k = S.find(g.embed);
  9533. }, bind: { events: function events() {
  9534. f.has.placeholder() && (f.debug("Adding placeholder events"), S.on("click" + C, g.placeholder, f.createAndShow).on("click" + C, g.icon, f.createAndShow));
  9535. } }, create: function create() {
  9536. f.get.placeholder() ? f.createPlaceholder() : f.createAndShow();
  9537. }, createPlaceholder: function createPlaceholder(e) {
  9538. var t = f.get.icon(),
  9539. 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);
  9540. }, createEmbed: function createEmbed(t) {
  9541. 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);
  9542. }, changeEmbed: function changeEmbed(e) {
  9543. k.html(f.generate.embed(e));
  9544. }, createAndShow: function createAndShow() {
  9545. f.createEmbed(), f.show();
  9546. }, change: function change(e, t, n) {
  9547. 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();
  9548. }, reset: function reset() {
  9549. f.debug("Clearing embed and showing placeholder"), f.remove.active(), f.remove.embed(), f.showPlaceholder(), m.onReset.call(T);
  9550. }, show: function show() {
  9551. f.debug("Showing embed"), f.set.active(), m.onDisplay.call(T);
  9552. }, hide: function hide() {
  9553. f.debug("Hiding embed"), f.showPlaceholder();
  9554. }, showPlaceholder: function showPlaceholder() {
  9555. f.debug("Showing placeholder image"), f.remove.active(), m.onPlaceholderDisplay.call(T);
  9556. }, get: { id: function id() {
  9557. return m.id || S.data(b.id);
  9558. }, placeholder: function placeholder() {
  9559. return m.placeholder || S.data(b.placeholder);
  9560. }, icon: function icon() {
  9561. return m.icon ? m.icon : S.data(b.icon) !== i ? S.data(b.icon) : f.determine.icon();
  9562. }, source: function source(e) {
  9563. return m.source ? m.source : S.data(b.source) !== i ? S.data(b.source) : f.determine.source();
  9564. }, type: function type() {
  9565. var e = f.get.source();return h[e] !== i && h[e].type;
  9566. }, url: function url() {
  9567. return m.url ? m.url : S.data(b.url) !== i ? S.data(b.url) : f.determine.url();
  9568. } }, determine: { autoplay: function autoplay() {
  9569. f.should.autoplay() && (m.autoplay = !0);
  9570. }, source: function source(t) {
  9571. var n = !1;return (t = t || f.get.url()) && e.each(h, function (e, i) {
  9572. if (-1 !== t.search(i.domain)) return n = e, !1;
  9573. }), n;
  9574. }, icon: function icon() {
  9575. var e = f.get.source();return h[e] !== i && h[e].icon;
  9576. }, url: function url() {
  9577. var e,
  9578. t = m.id || S.data(b.id),
  9579. n = m.source || S.data(b.source);return (e = h[n] !== i && h[n].url.replace("{id}", t)) && S.data(b.url, e), e;
  9580. } }, set: { active: function active() {
  9581. S.addClass(p.active);
  9582. } }, remove: { active: function active() {
  9583. S.removeClass(p.active);
  9584. }, embed: function embed() {
  9585. k.empty();
  9586. } }, encode: { parameters: function parameters(e) {
  9587. var t,
  9588. n = [];for (t in e) {
  9589. n.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t]));
  9590. }return n.join("&amp;");
  9591. } }, generate: { embed: function embed(e) {
  9592. f.debug("Generating embed html");var t,
  9593. n,
  9594. 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;
  9595. }, parameters: function parameters(t, n) {
  9596. 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);
  9597. } }, has: { embed: function embed() {
  9598. return k.length > 0;
  9599. }, placeholder: function placeholder() {
  9600. return m.placeholder || S.data(b.placeholder);
  9601. } }, should: { autoplay: function autoplay() {
  9602. return "auto" === m.autoplay ? m.placeholder || S.data(b.placeholder) !== i : m.autoplay;
  9603. } }, is: { video: function video() {
  9604. return "video" == f.get.type();
  9605. } }, setting: function setting(t, n) {
  9606. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  9607. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  9608. }
  9609. }, internal: function internal(t, n) {
  9610. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  9611. if (n === i) return f[t];f[t] = n;
  9612. }
  9613. }, debug: function debug() {
  9614. !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)));
  9615. }, verbose: function verbose() {
  9616. !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)));
  9617. }, error: function error() {
  9618. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  9619. }, performance: { log: function log(e) {
  9620. 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);
  9621. }, display: function display() {
  9622. var t = m.name + ":",
  9623. n = 0;s = !1, clearTimeout(f.performance.timer), e.each(l, function (e, t) {
  9624. n += t["Execution Time"];
  9625. }), 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) {
  9626. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9627. }), console.groupEnd()), l = [];
  9628. } }, invoke: function invoke(t, n, a) {
  9629. var r,
  9630. s,
  9631. l,
  9632. 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) {
  9633. 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 {
  9634. 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];
  9635. }
  9636. })), 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;
  9637. } }, u ? (A === i && f.initialize(), f.invoke(c)) : (A !== i && A.invoke("destroy"), f.initialize());
  9638. }), o !== i ? o : this;
  9639. }, 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) {
  9640. return e;
  9641. }, 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) {
  9642. return { autohide: !e.brandedUI, autoplay: e.autoplay, color: e.color || i, hq: e.hd, jsapi: e.api, modestbranding: !e.brandedUI };
  9643. } }, vimeo: { name: "vimeo", type: "video", icon: "video play", domain: "vimeo.com", url: "//player.vimeo.com/video/{id}", parameters: function parameters(e) {
  9644. return { api: e.api, autoplay: e.autoplay, byline: e.brandedUI, color: e.color || i, portrait: e.brandedUI, title: e.brandedUI };
  9645. } } }, templates: { iframe: function iframe(e, t) {
  9646. var n = e;return t && (n += "?" + t), '<iframe src="' + n + '" width="100%" height="100%" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  9647. }, placeholder: function placeholder(e, t) {
  9648. var n = "";return t && (n += '<i class="' + t + ' icon"></i>'), e && (n += '<img class="placeholder" src="' + e + '">'), n;
  9649. } }, api: !1, onPause: function onPause() {}, onPlay: function onPlay() {}, onStop: function onStop() {} };
  9650. }(jQuery, window, document), function (e, t, n, i) {
  9651. "use strict";
  9652. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.modal = function (o) {
  9653. var a,
  9654. r = e(this),
  9655. s = e(t),
  9656. l = e(n),
  9657. c = e("body"),
  9658. u = r.selector || "",
  9659. d = new Date().getTime(),
  9660. f = [],
  9661. m = arguments[0],
  9662. g = "string" == typeof m,
  9663. p = [].slice.call(arguments, 1),
  9664. h = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  9665. setTimeout(e, 0);
  9666. };return r.each(function () {
  9667. var r,
  9668. v,
  9669. b,
  9670. y,
  9671. x,
  9672. C,
  9673. w,
  9674. S,
  9675. k,
  9676. T = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.modal.settings, o) : e.extend({}, e.fn.modal.settings),
  9677. A = T.selector,
  9678. R = T.className,
  9679. P = T.namespace,
  9680. E = T.error,
  9681. F = "." + P,
  9682. O = "module-" + P,
  9683. D = e(this),
  9684. q = e(T.context),
  9685. j = D.find(A.close),
  9686. z = this,
  9687. I = D.data(O),
  9688. M = !1;k = { initialize: function initialize() {
  9689. k.verbose("Initializing dimmer", q), k.create.id(), k.create.dimmer(), k.refreshModals(), k.bind.events(), T.observeChanges && k.observeChanges(), k.instantiate();
  9690. }, instantiate: function instantiate() {
  9691. k.verbose("Storing instance of modal"), I = k, D.data(O, I);
  9692. }, create: { dimmer: function dimmer() {
  9693. var t = { debug: T.debug, variation: !T.centered && "top aligned", dimmerName: "modals" },
  9694. 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);
  9695. }, id: function id() {
  9696. w = (Math.random().toString(16) + "000000000").substr(2, 8), C = "." + w, k.verbose("Creating unique id for element", w);
  9697. } }, destroy: function destroy() {
  9698. k.verbose("Destroying previous modal"), D.removeData(O).off(F), s.off(C), x.off(C), j.off(F), q.dimmer("destroy");
  9699. }, observeChanges: function observeChanges() {
  9700. "MutationObserver" in t && ((S = new MutationObserver(function (e) {
  9701. k.debug("DOM tree modified, refreshing"), k.refresh();
  9702. })).observe(z, { childList: !0, subtree: !0 }), k.debug("Setting up mutation observer", S));
  9703. }, refresh: function refresh() {
  9704. k.remove.scrolling(), k.cacheSizes(), k.set.screenHeight(), k.set.type();
  9705. }, refreshModals: function refreshModals() {
  9706. v = D.siblings(A.modal), r = v.add(D);
  9707. }, attachEvents: function attachEvents(t, n) {
  9708. 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);
  9709. }, bind: { events: function events() {
  9710. 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);
  9711. } }, get: { id: function id() {
  9712. return (Math.random().toString(16) + "000000000").substr(2, 8);
  9713. } }, event: { approve: function approve() {
  9714. M || !1 === T.onApprove.call(z, e(this)) ? k.verbose("Approve callback returned false cancelling hide") : (M = !0, k.hide(function () {
  9715. M = !1;
  9716. }));
  9717. }, deny: function deny() {
  9718. M || !1 === T.onDeny.call(z, e(this)) ? k.verbose("Deny callback returned false cancelling hide") : (M = !0, k.hide(function () {
  9719. M = !1;
  9720. }));
  9721. }, close: function close() {
  9722. k.hide();
  9723. }, click: function click(t) {
  9724. if (T.closable) {
  9725. var i = e(t.target).closest(A.modal).length > 0,
  9726. 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());
  9727. } else k.verbose("Dimmer clicked but closable setting is disabled");
  9728. }, debounce: function debounce(e, t) {
  9729. clearTimeout(k.timer), k.timer = setTimeout(e, t);
  9730. }, keyboard: function keyboard(e) {
  9731. 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());
  9732. }, resize: function resize() {
  9733. y.dimmer("is active") && (k.is.animating() || k.is.active()) && h(k.refresh);
  9734. } }, toggle: function toggle() {
  9735. k.is.active() || k.is.animating() ? k.hide() : k.show();
  9736. }, show: function show(t) {
  9737. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.set.dimmerSettings(), k.showModal(t);
  9738. }, hide: function hide(t) {
  9739. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.hideModal(t);
  9740. }, showModal: function showModal(t) {
  9741. 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() {
  9742. T.onVisible.apply(z), T.keyboardShortcuts && k.add.keyboardShortcuts(), k.save.focus(), k.set.active(), T.autofocus && k.set.autofocus(), t();
  9743. } })) : k.error(E.noTransition))) : k.debug("Modal is already visible");
  9744. }, hideModal: function hideModal(t, n) {
  9745. 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() {
  9746. k.others.active() || n || k.hideDimmer(), T.keyboardShortcuts && k.remove.keyboardShortcuts();
  9747. }, onComplete: function onComplete() {
  9748. T.onHidden.call(z), k.restore.focus(), t();
  9749. } })) : k.error(E.noTransition)) : k.verbose("Hide callback returned false cancelling hide");
  9750. }, showDimmer: function showDimmer() {
  9751. y.dimmer("is animating") || !y.dimmer("is active") ? (k.debug("Showing dimmer"), y.dimmer("show")) : k.debug("Dimmer already visible");
  9752. }, hideDimmer: function hideDimmer() {
  9753. y.dimmer("is animating") || y.dimmer("is active") ? y.dimmer("hide", function () {
  9754. k.remove.clickaway(), k.remove.screenHeight();
  9755. }) : k.debug("Dimmer is not visible cannot hide");
  9756. }, hideAll: function hideAll(t) {
  9757. 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));
  9758. }, hideOthers: function hideOthers(t) {
  9759. 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));
  9760. }, others: { active: function active() {
  9761. return v.filter("." + R.active).length > 0;
  9762. }, animating: function animating() {
  9763. return v.filter("." + R.animating).length > 0;
  9764. } }, add: { keyboardShortcuts: function keyboardShortcuts() {
  9765. k.verbose("Adding keyboard shortcuts"), l.on("keyup" + F, k.event.keyboard);
  9766. } }, save: { focus: function focus() {
  9767. e(n.activeElement).closest(D).length > 0 || (b = e(n.activeElement).blur());
  9768. } }, restore: { focus: function focus() {
  9769. b && b.length > 0 && b.focus();
  9770. } }, remove: { active: function active() {
  9771. D.removeClass(R.active);
  9772. }, clickaway: function clickaway() {
  9773. x.off("click" + C);
  9774. }, bodyStyle: function bodyStyle() {
  9775. "" === c.attr("style") && (k.verbose("Removing style attribute"), c.removeAttr("style"));
  9776. }, screenHeight: function screenHeight() {
  9777. k.debug("Removing page height"), c.css("height", "");
  9778. }, keyboardShortcuts: function keyboardShortcuts() {
  9779. k.verbose("Removing keyboard shortcuts"), l.off("keyup" + F);
  9780. }, scrolling: function scrolling() {
  9781. y.removeClass(R.scrolling), D.removeClass(R.scrolling);
  9782. } }, cacheSizes: function cacheSizes() {
  9783. D.addClass(R.loading);var o = D.prop("scrollHeight"),
  9784. 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);
  9785. }, can: { fit: function fit() {
  9786. var e = k.cache.contextHeight,
  9787. t = k.cache.contextHeight / 2,
  9788. n = k.cache.topOffset,
  9789. i = k.cache.scrollHeight,
  9790. o = k.cache.height,
  9791. a = T.padding;return i > o ? t + n + i + a < e : o + 2 * a < e;
  9792. } }, is: { active: function active() {
  9793. return D.hasClass(R.active);
  9794. }, animating: function animating() {
  9795. return D.transition("is supported") ? D.transition("is animating") : D.is(":visible");
  9796. }, scrolling: function scrolling() {
  9797. return y.hasClass(R.scrolling);
  9798. }, modernBrowser: function modernBrowser() {
  9799. return !(t.ActiveXObject || "ActiveXObject" in t);
  9800. } }, set: { autofocus: function autofocus() {
  9801. var e = D.find("[tabindex], :input").filter(":visible"),
  9802. t = e.filter("[autofocus]"),
  9803. n = t.length > 0 ? t.first() : e.first();n.length > 0 && n.focus();
  9804. }, clickaway: function clickaway() {
  9805. x.on("click" + C, k.event.click);
  9806. }, dimmerSettings: function dimmerSettings() {
  9807. if (e.fn.dimmer !== i) {
  9808. var t = { debug: T.debug, dimmerName: "modals", closable: "auto", variation: !T.centered && "top aligned", duration: { show: T.duration, hide: T.duration } },
  9809. 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);
  9810. } else k.error(E.dimmer);
  9811. }, screenHeight: function screenHeight() {
  9812. 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));
  9813. }, active: function active() {
  9814. D.addClass(R.active);
  9815. }, scrolling: function scrolling() {
  9816. y.addClass(R.scrolling), D.addClass(R.scrolling);
  9817. }, type: function type() {
  9818. 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());
  9819. }, undetached: function undetached() {
  9820. y.addClass(R.undetached);
  9821. } }, setting: function setting(t, n) {
  9822. if (k.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, T, t);else {
  9823. if (n === i) return T[t];e.isPlainObject(T[t]) ? e.extend(!0, T[t], n) : T[t] = n;
  9824. }
  9825. }, internal: function internal(t, n) {
  9826. if (e.isPlainObject(t)) e.extend(!0, k, t);else {
  9827. if (n === i) return k[t];k[t] = n;
  9828. }
  9829. }, debug: function debug() {
  9830. !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)));
  9831. }, verbose: function verbose() {
  9832. !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)));
  9833. }, error: function error() {
  9834. T.silent || (k.error = Function.prototype.bind.call(console.error, console, T.name + ":"), k.error.apply(console, arguments));
  9835. }, performance: { log: function log(e) {
  9836. 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);
  9837. }, display: function display() {
  9838. var t = T.name + ":",
  9839. n = 0;d = !1, clearTimeout(k.performance.timer), e.each(f, function (e, t) {
  9840. n += t["Execution Time"];
  9841. }), 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) {
  9842. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9843. }), console.groupEnd()), f = [];
  9844. } }, invoke: function invoke(t, n, o) {
  9845. var r,
  9846. s,
  9847. l,
  9848. 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) {
  9849. 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 {
  9850. 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];
  9851. }
  9852. })), 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;
  9853. } }, g ? (I === i && k.initialize(), k.invoke(m)) : (I !== i && I.invoke("destroy"), k.initialize());
  9854. }), a !== i ? a : this;
  9855. }, 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() {
  9856. return !0;
  9857. }, onHidden: function onHidden() {}, onApprove: function onApprove() {
  9858. return !0;
  9859. }, onDeny: function onDeny() {
  9860. return !0;
  9861. }, 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" } };
  9862. }(jQuery, window, document), function (e, t, n, i) {
  9863. "use strict";
  9864. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.nag = function (n) {
  9865. var o,
  9866. a = e(this),
  9867. r = a.selector || "",
  9868. s = new Date().getTime(),
  9869. l = [],
  9870. c = arguments[0],
  9871. u = "string" == typeof c,
  9872. d = [].slice.call(arguments, 1);return a.each(function () {
  9873. var a,
  9874. f = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.nag.settings, n) : e.extend({}, e.fn.nag.settings),
  9875. m = (f.className, f.selector),
  9876. g = f.error,
  9877. p = f.namespace,
  9878. h = "." + p,
  9879. v = p + "-module",
  9880. b = e(this),
  9881. y = (b.find(m.close), f.context ? e(f.context) : e("body")),
  9882. x = this,
  9883. C = b.data(v);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;a = { initialize: function initialize() {
  9884. 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();
  9885. }, destroy: function destroy() {
  9886. a.verbose("Destroying instance"), b.removeData(v).off(h);
  9887. }, show: function show() {
  9888. 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));
  9889. }, hide: function hide() {
  9890. a.debug("Showing nag", f.animation.hide), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideUp(f.duration, f.easing);
  9891. }, onHide: function onHide() {
  9892. a.debug("Removing nag", f.animation.hide), b.remove(), f.onHide && f.onHide();
  9893. }, dismiss: function dismiss(e) {
  9894. f.storageMethod && a.storage.set(f.key, f.value), a.hide(), e.stopImmediatePropagation(), e.preventDefault();
  9895. }, should: { show: function show() {
  9896. 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);
  9897. } }, get: { storageOptions: function storageOptions() {
  9898. var e = {};return f.expires && (e.expires = f.expires), f.domain && (e.domain = f.domain), f.path && (e.path = f.path), e;
  9899. } }, clear: function clear() {
  9900. a.storage.remove(f.key);
  9901. }, storage: { set: function set(n, o) {
  9902. 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 {
  9903. if (e.cookie === i) return void a.error(g.noCookieStorage);e.cookie(n, o, r), a.debug("Value stored using cookie", n, o, r);
  9904. }
  9905. }, get: function get(n, o) {
  9906. 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;
  9907. }, remove: function remove(n) {
  9908. 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);
  9909. } }, setting: function setting(t, n) {
  9910. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  9911. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  9912. }
  9913. }, internal: function internal(t, n) {
  9914. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  9915. if (n === i) return a[t];a[t] = n;
  9916. }
  9917. }, debug: function debug() {
  9918. !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)));
  9919. }, verbose: function verbose() {
  9920. !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)));
  9921. }, error: function error() {
  9922. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  9923. }, performance: { log: function log(e) {
  9924. 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);
  9925. }, display: function display() {
  9926. var t = f.name + ":",
  9927. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  9928. n += t["Execution Time"];
  9929. }), 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) {
  9930. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9931. }), console.groupEnd()), l = [];
  9932. } }, invoke: function invoke(t, n, r) {
  9933. var s,
  9934. l,
  9935. c,
  9936. 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) {
  9937. 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 {
  9938. 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];
  9939. }
  9940. })), 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;
  9941. } }, u ? (C === i && a.initialize(), a.invoke(c)) : (C !== i && C.invoke("destroy"), a.initialize());
  9942. }), o !== i ? o : this;
  9943. }, 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) {
  9944. return -i * (t /= o) * (t - 2) + n;
  9945. } });
  9946. }(jQuery, window, document), function (e, t, n, i) {
  9947. "use strict";
  9948. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.popup = function (o) {
  9949. var a,
  9950. r = e(this),
  9951. s = e(n),
  9952. l = e(t),
  9953. c = e("body"),
  9954. u = r.selector || "",
  9955. d = new Date().getTime(),
  9956. f = [],
  9957. m = arguments[0],
  9958. g = "string" == typeof m,
  9959. p = [].slice.call(arguments, 1);return r.each(function () {
  9960. var r,
  9961. h,
  9962. v,
  9963. b,
  9964. y,
  9965. x,
  9966. C = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.popup.settings, o) : e.extend({}, e.fn.popup.settings),
  9967. w = C.selector,
  9968. S = C.className,
  9969. k = C.error,
  9970. T = C.metadata,
  9971. A = C.namespace,
  9972. R = "." + C.namespace,
  9973. P = "module-" + A,
  9974. E = e(this),
  9975. F = e(C.context),
  9976. O = e(C.scrollContext),
  9977. D = e(C.boundary),
  9978. q = C.target ? e(C.target) : E,
  9979. j = 0,
  9980. z = !1,
  9981. I = !1,
  9982. M = this,
  9983. L = E.data(P);x = { initialize: function initialize() {
  9984. x.debug("Initializing", E), x.createID(), x.bind.events(), !x.exists() && C.preserve && x.create(), C.observeChanges && x.observeChanges(), x.instantiate();
  9985. }, instantiate: function instantiate() {
  9986. x.verbose("Storing instance", x), L = x, E.data(P, L);
  9987. }, observeChanges: function observeChanges() {
  9988. "MutationObserver" in t && ((v = new MutationObserver(x.event.documentChanged)).observe(n, { childList: !0, subtree: !0 }), x.debug("Setting up mutation observer", v));
  9989. }, refresh: function refresh() {
  9990. 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();
  9991. }, reposition: function reposition() {
  9992. x.refresh(), x.set.position();
  9993. }, destroy: function destroy() {
  9994. 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);
  9995. }, event: { start: function start(t) {
  9996. var n = e.isPlainObject(C.delay) ? C.delay.show : C.delay;clearTimeout(x.hideTimer), I || (x.showTimer = setTimeout(x.show, n));
  9997. }, end: function end() {
  9998. var t = e.isPlainObject(C.delay) ? C.delay.hide : C.delay;clearTimeout(x.showTimer), x.hideTimer = setTimeout(x.hide, t);
  9999. }, touchstart: function touchstart(e) {
  10000. I = !0, x.show();
  10001. }, resize: function resize() {
  10002. x.is.visible() && x.set.position();
  10003. }, documentChanged: function documentChanged(t) {
  10004. [].forEach.call(t, function (t) {
  10005. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  10006. (t == M || e(t).find(M).length > 0) && (x.debug("Element removed from DOM, tearing down events"), x.destroy());
  10007. });
  10008. });
  10009. }, hideGracefully: function hideGracefully(t) {
  10010. var i = e(t.target),
  10011. o = e.contains(n.documentElement, t.target),
  10012. 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");
  10013. } }, create: function create() {
  10014. var t = x.get.html(),
  10015. n = x.get.title(),
  10016. 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);
  10017. }, createID: function createID() {
  10018. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, x.verbose("Creating unique id for element", y);
  10019. }, toggle: function toggle() {
  10020. 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());
  10021. }, show: function show(e) {
  10022. if (e = e || function () {}, x.debug("Showing pop-up", C.transition), x.is.hidden() && (!x.is.active() || !x.is.dropdown())) {
  10023. 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));
  10024. }
  10025. }, hide: function hide(e) {
  10026. if (e = e || function () {}, x.is.visible() || x.is.animating()) {
  10027. 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);
  10028. }
  10029. }, hideAll: function hideAll() {
  10030. e(w.popup).filter("." + S.popupVisible).each(function () {
  10031. e(this).data(T.activator).popup("hide");
  10032. });
  10033. }, exists: function exists() {
  10034. return !!r && (C.inline || C.popup ? x.has.popup() : r.closest(F).length >= 1);
  10035. }, removePopup: function removePopup() {
  10036. x.has.popup() && !C.popup && (x.debug("Removing popup", r), r.remove(), r = i, C.onRemove.call(r, M));
  10037. }, save: { conditions: function conditions() {
  10038. x.cache = { title: E.attr("title") }, x.cache.title && E.removeAttr("title"), x.verbose("Saving original attributes", x.cache.title);
  10039. } }, restore: { conditions: function conditions() {
  10040. return x.cache && x.cache.title && (E.attr("title", x.cache.title), x.verbose("Restoring original attributes", x.cache.title)), !0;
  10041. } }, supports: { svg: function svg() {
  10042. return "undefined" == typeof SVGGraphicsElement;
  10043. } }, animate: { show: function show(t) {
  10044. 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() {
  10045. x.bind.close(), t.call(r, M), C.onVisible.call(r, M);
  10046. } })) : x.error(k.noTransition);
  10047. }, hide: function hide(t) {
  10048. 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() {
  10049. x.reset(), t.call(r, M), C.onHidden.call(r, M);
  10050. } }) : x.error(k.noTransition) : x.debug("onHide callback returned false, cancelling popup animation");
  10051. } }, change: { content: function content(e) {
  10052. r.html(e);
  10053. } }, get: { html: function html() {
  10054. return E.removeData(T.html), E.data(T.html) || C.html;
  10055. }, title: function title() {
  10056. return E.removeData(T.title), E.data(T.title) || C.title;
  10057. }, content: function content() {
  10058. return E.removeData(T.content), E.data(T.content) || C.content || E.attr("title");
  10059. }, variation: function variation() {
  10060. return E.removeData(T.variation), E.data(T.variation) || C.variation;
  10061. }, popup: function popup() {
  10062. return r;
  10063. }, popupOffset: function popupOffset() {
  10064. return r.offset();
  10065. }, calculations: function calculations() {
  10066. var e,
  10067. n = x.get.offsetParent(r),
  10068. i = q[0],
  10069. o = D[0] == t,
  10070. a = C.inline || C.popup && C.movePopup ? q.position() : q.offset(),
  10071. s = o ? { top: 0, left: 0 } : D.offset(),
  10072. c = {},
  10073. 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)) {
  10074. var d = n.offset();c.target.top -= d.top, c.target.left -= d.left, c.parent.width = n.outerWidth(), c.parent.height = n.outerHeight();
  10075. }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;
  10076. }, id: function id() {
  10077. return y;
  10078. }, startEvent: function startEvent() {
  10079. return "hover" == C.on ? "mouseenter" : "focus" == C.on && "focus";
  10080. }, scrollEvent: function scrollEvent() {
  10081. return "scroll";
  10082. }, endEvent: function endEvent() {
  10083. return "hover" == C.on ? "mouseleave" : "focus" == C.on && "blur";
  10084. }, distanceFromBoundary: function distanceFromBoundary(e, t) {
  10085. var n,
  10086. i,
  10087. 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;
  10088. }, offsetParent: function offsetParent(t) {
  10089. var n = (t !== i ? t[0] : q[0]).parentNode,
  10090. 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;) {
  10091. n = n.parentNode, a = "none" === (o = e(n)).css("transform"), r = "static" === o.css("position"), s = o.is("body");
  10092. }return o && o.length > 0 ? o : e();
  10093. }, positions: function positions() {
  10094. 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 };
  10095. }, nextPosition: function nextPosition(e) {
  10096. var t = e.split(" "),
  10097. n = t[0],
  10098. i = t[1],
  10099. o = "top" == n || "bottom" == n,
  10100. a = !1,
  10101. r = !1,
  10102. 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;
  10103. } }, set: { position: function position(e, t) {
  10104. if (0 !== q.length && 0 !== r.length) {
  10105. 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) {
  10106. return "left" == e ? "right" : "left";
  10107. }), x.debug("RTL: Popup position updated", e)), j == C.maxSearchDepth && "string" == typeof C.lastResort && (e = C.lastResort), e) {case "top left":
  10108. c = { top: "auto", bottom: l.height - a.top + o, left: a.left + n, right: "auto" };break;case "top center":
  10109. 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":
  10110. c = { bottom: l.height - a.top + o, right: l.width - a.left - a.width - n, top: "auto", left: "auto" };break;case "left center":
  10111. 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":
  10112. 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":
  10113. c = { top: a.top + a.height + o, left: a.left + n, bottom: "auto", right: "auto" };break;case "bottom center":
  10114. 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":
  10115. 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)) {
  10116. 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");
  10117. }return x.debug("Position is on stage", e), x.remove.attempts(), x.remove.loading(), C.setFluidWidth && x.is.fluid() && x.set.fluidWidth(t), !0;
  10118. }x.error(k.notFound);
  10119. }, fluidWidth: function fluidWidth(e) {
  10120. e = e || x.get.calculations(), x.debug("Automatically setting element width to parent width", e.parent.width), r.css("width", e.container.width);
  10121. }, variation: function variation(e) {
  10122. (e = e || x.get.variation()) && x.has.popup() && (x.verbose("Adding variation to popup", e), r.addClass(e));
  10123. }, visible: function visible() {
  10124. E.addClass(S.visible);
  10125. } }, remove: { loading: function loading() {
  10126. r.removeClass(S.loading);
  10127. }, variation: function variation(e) {
  10128. (e = e || x.get.variation()) && (x.verbose("Removing variation", e), r.removeClass(e));
  10129. }, visible: function visible() {
  10130. E.removeClass(S.visible);
  10131. }, attempts: function attempts() {
  10132. x.verbose("Resetting all searched positions"), j = 0, z = !1;
  10133. } }, bind: { events: function events() {
  10134. 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);
  10135. }, popup: function popup() {
  10136. 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);
  10137. }, close: function close() {
  10138. (!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();
  10139. }, closeOnScroll: function closeOnScroll() {
  10140. x.verbose("Binding scroll close event to document"), O.one(x.get.scrollEvent() + b, x.event.hideGracefully);
  10141. }, touchClose: function touchClose() {
  10142. x.verbose("Binding popup touchclose event to document"), s.on("touchstart" + b, function (e) {
  10143. x.verbose("Touched away from popup"), x.event.hideGracefully.call(M, e);
  10144. });
  10145. }, clickaway: function clickaway() {
  10146. x.verbose("Binding popup close event to document"), s.on("click" + b, function (e) {
  10147. x.verbose("Clicked away from popup"), x.event.hideGracefully.call(M, e);
  10148. });
  10149. } }, unbind: { events: function events() {
  10150. l.off(b), E.off(R);
  10151. }, close: function close() {
  10152. s.off(b), O.off(b);
  10153. } }, has: { popup: function popup() {
  10154. return r && r.length > 0;
  10155. } }, should: { centerArrow: function centerArrow(e) {
  10156. return !x.is.basic() && e.target.width <= 2 * C.arrowPixelsFromEdge;
  10157. } }, is: { offstage: function offstage(t, n) {
  10158. var i = [];return e.each(t, function (e, t) {
  10159. t < -C.jitter && (x.debug("Position exceeds allowable distance from edge", e, t, n), i.push(e));
  10160. }), i.length > 0;
  10161. }, svg: function svg(e) {
  10162. return x.supports.svg() && e instanceof SVGGraphicsElement;
  10163. }, basic: function basic() {
  10164. return E.hasClass(S.basic);
  10165. }, active: function active() {
  10166. return E.hasClass(S.active);
  10167. }, animating: function animating() {
  10168. return r !== i && r.hasClass(S.animating);
  10169. }, fluid: function fluid() {
  10170. return r !== i && r.hasClass(S.fluid);
  10171. }, visible: function visible() {
  10172. return r !== i && r.hasClass(S.popupVisible);
  10173. }, dropdown: function dropdown() {
  10174. return E.hasClass(S.dropdown);
  10175. }, hidden: function hidden() {
  10176. return !x.is.visible();
  10177. }, rtl: function rtl() {
  10178. return "rtl" == E.css("direction");
  10179. } }, reset: function reset() {
  10180. x.remove.visible(), C.preserve ? e.fn.transition !== i && r.transition("remove transition") : x.removePopup();
  10181. }, setting: function setting(t, n) {
  10182. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  10183. if (n === i) return C[t];C[t] = n;
  10184. }
  10185. }, internal: function internal(t, n) {
  10186. if (e.isPlainObject(t)) e.extend(!0, x, t);else {
  10187. if (n === i) return x[t];x[t] = n;
  10188. }
  10189. }, debug: function debug() {
  10190. !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)));
  10191. }, verbose: function verbose() {
  10192. !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)));
  10193. }, error: function error() {
  10194. C.silent || (x.error = Function.prototype.bind.call(console.error, console, C.name + ":"), x.error.apply(console, arguments));
  10195. }, performance: { log: function log(e) {
  10196. 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);
  10197. }, display: function display() {
  10198. var t = C.name + ":",
  10199. n = 0;d = !1, clearTimeout(x.performance.timer), e.each(f, function (e, t) {
  10200. n += t["Execution Time"];
  10201. }), 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) {
  10202. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10203. }), console.groupEnd()), f = [];
  10204. } }, invoke: function invoke(t, n, o) {
  10205. var r,
  10206. s,
  10207. l,
  10208. 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) {
  10209. 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 {
  10210. 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];
  10211. }
  10212. })), 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;
  10213. } }, g ? (L === i && x.initialize(), x.invoke(m)) : (L !== i && L.invoke("destroy"), x.initialize());
  10214. }), a !== i ? a : this;
  10215. }, 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) {
  10216. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  10217. return t[e];
  10218. }) : e
  10219. );
  10220. }, popup: function popup(t) {
  10221. var n = "",
  10222. 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;
  10223. } } };
  10224. }(jQuery, window, document), function (e, t, n, i) {
  10225. "use strict";
  10226. 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) {
  10227. var o,
  10228. a = e(this),
  10229. r = a.selector || "",
  10230. s = new Date().getTime(),
  10231. l = [],
  10232. c = arguments[0],
  10233. u = "string" == typeof c,
  10234. d = [].slice.call(arguments, 1);return a.each(function () {
  10235. var a,
  10236. f = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.progress.settings, t) : e.extend({}, e.fn.progress.settings),
  10237. m = f.className,
  10238. g = f.metadata,
  10239. p = f.namespace,
  10240. h = f.selector,
  10241. v = f.error,
  10242. b = "." + p,
  10243. y = "module-" + p,
  10244. x = e(this),
  10245. C = e(this).find(h.bar),
  10246. w = e(this).find(h.progress),
  10247. S = e(this).find(h.label),
  10248. k = this,
  10249. T = x.data(y),
  10250. A = !1;a = { initialize: function initialize() {
  10251. a.debug("Initializing progress bar", f), a.set.duration(), a.set.transitionEvent(), a.read.metadata(), a.read.settings(), a.instantiate();
  10252. }, instantiate: function instantiate() {
  10253. a.verbose("Storing instance of progress", a), T = a, x.data(y, a);
  10254. }, destroy: function destroy() {
  10255. a.verbose("Destroying previous progress for", x), clearInterval(T.interval), a.remove.state(), x.removeData(y), T = i;
  10256. }, reset: function reset() {
  10257. a.remove.nextValue(), a.update.progress(0);
  10258. }, complete: function complete() {
  10259. (a.percent === i || a.percent < 100) && (a.remove.progressPoll(), a.set.percent(100));
  10260. }, read: { metadata: function metadata() {
  10261. 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));
  10262. }, settings: function settings() {
  10263. !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));
  10264. } }, bind: { transitionEnd: function transitionEnd(e) {
  10265. var t = a.get.transitionEnd();C.one(t + b, function (t) {
  10266. clearTimeout(a.failSafeTimer), e.call(this, t);
  10267. }), a.failSafeTimer = setTimeout(function () {
  10268. C.triggerHandler(t);
  10269. }, f.duration + f.failSafeDelay), a.verbose("Adding fail safe timer", a.timer);
  10270. } }, increment: function increment(e) {
  10271. 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);
  10272. }, decrement: function decrement(e) {
  10273. 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);
  10274. }, has: { progressPoll: function progressPoll() {
  10275. return a.progressPoll;
  10276. }, total: function total() {
  10277. return !1 !== a.get.total();
  10278. } }, get: { text: function text(e) {
  10279. var t = a.value || 0,
  10280. n = a.total || 0,
  10281. i = A ? a.get.displayPercent() : a.percent || 0,
  10282. 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;
  10283. }, normalizedValue: function normalizedValue(e) {
  10284. if (e < 0) return a.debug("Value cannot decrement below 0"), 0;if (a.has.total()) {
  10285. if (e > a.total) return a.debug("Value cannot increment above total", a.total), a.total;
  10286. } else if (e > 100) return a.debug("Value cannot increment above 100 percent"), 100;return e;
  10287. }, updateInterval: function updateInterval() {
  10288. return "auto" == f.updateInterval ? f.duration : f.updateInterval;
  10289. }, randomValue: function randomValue() {
  10290. return a.debug("Generating random increment percentage"), Math.floor(Math.random() * f.random.max + f.random.min);
  10291. }, numericValue: function numericValue(e) {
  10292. return "string" == typeof e ? "" !== e.replace(/[^\d.]/g, "") && +e.replace(/[^\d.]/g, "") : e;
  10293. }, transitionEnd: function transitionEnd() {
  10294. var e,
  10295. t = n.createElement("element"),
  10296. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  10297. if (t.style[e] !== i) return o[e];
  10298. }
  10299. }, displayPercent: function displayPercent() {
  10300. var e = C.width(),
  10301. t = x.width(),
  10302. 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);
  10303. }, percent: function percent() {
  10304. return a.percent || 0;
  10305. }, value: function value() {
  10306. return a.nextValue || a.value || 0;
  10307. }, total: function total() {
  10308. return a.total || !1;
  10309. } }, create: { progressPoll: function progressPoll() {
  10310. a.progressPoll = setTimeout(function () {
  10311. a.update.toNextValue(), a.remove.progressPoll();
  10312. }, a.get.updateInterval());
  10313. } }, is: { complete: function complete() {
  10314. return a.is.success() || a.is.warning() || a.is.error();
  10315. }, success: function success() {
  10316. return x.hasClass(m.success);
  10317. }, warning: function warning() {
  10318. return x.hasClass(m.warning);
  10319. }, error: function error() {
  10320. return x.hasClass(m.error);
  10321. }, active: function active() {
  10322. return x.hasClass(m.active);
  10323. }, visible: function visible() {
  10324. return x.is(":visible");
  10325. } }, remove: { progressPoll: function progressPoll() {
  10326. a.verbose("Removing progress poll timer"), a.progressPoll && (clearTimeout(a.progressPoll), delete a.progressPoll);
  10327. }, nextValue: function nextValue() {
  10328. a.verbose("Removing progress value stored for next update"), delete a.nextValue;
  10329. }, state: function state() {
  10330. a.verbose("Removing stored state"), delete a.total, delete a.percent, delete a.value;
  10331. }, active: function active() {
  10332. a.verbose("Removing active state"), x.removeClass(m.active);
  10333. }, success: function success() {
  10334. a.verbose("Removing success state"), x.removeClass(m.success);
  10335. }, warning: function warning() {
  10336. a.verbose("Removing warning state"), x.removeClass(m.warning);
  10337. }, error: function error() {
  10338. a.verbose("Removing error state"), x.removeClass(m.error);
  10339. } }, set: { barWidth: function barWidth(e) {
  10340. 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)));
  10341. }, duration: function duration(e) {
  10342. e = "number" == typeof (e = e || f.duration) ? e + "ms" : e, a.verbose("Setting progress bar transition duration", e), C.css({ "transition-duration": e });
  10343. }, percent: function percent(e) {
  10344. 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);
  10345. }, labelInterval: function labelInterval() {
  10346. clearInterval(a.interval), a.bind.transitionEnd(function () {
  10347. a.verbose("Bar finished animating, removing continuous label updates"), clearInterval(a.interval), A = !1, a.set.labels();
  10348. }), A = !0, a.interval = setInterval(function () {
  10349. e.contains(n.documentElement, k) || (clearInterval(a.interval), A = !1), a.set.labels();
  10350. }, f.framerate);
  10351. }, labels: function labels() {
  10352. a.verbose("Setting both bar progress and outer label text"), a.set.barLabel(), a.set.state();
  10353. }, label: function label(e) {
  10354. (e = e || "") && (e = a.get.text(e), a.verbose("Setting label to text", e), S.text(e));
  10355. }, state: function state(e) {
  10356. 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));
  10357. }, barLabel: function barLabel(e) {
  10358. 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)));
  10359. }, active: function active(e) {
  10360. 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 () {
  10361. f.onActive.call(k, a.value, a.total);
  10362. });
  10363. }, success: function success(e) {
  10364. 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 () {
  10365. f.onSuccess.call(k, a.total);
  10366. });
  10367. }, warning: function warning(e) {
  10368. 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 () {
  10369. f.onWarning.call(k, a.value, a.total);
  10370. });
  10371. }, error: function error(e) {
  10372. 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 () {
  10373. f.onError.call(k, a.value, a.total);
  10374. });
  10375. }, transitionEvent: function transitionEvent() {
  10376. a.get.transitionEnd();
  10377. }, total: function total(e) {
  10378. a.total = e;
  10379. }, value: function value(e) {
  10380. a.value = e;
  10381. }, progress: function progress(e) {
  10382. 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());
  10383. }, nextValue: function nextValue(e) {
  10384. a.nextValue = e;
  10385. } }, update: { toNextValue: function toNextValue() {
  10386. var e = a.nextValue;e && (a.debug("Update interval complete using last updated value", e), a.update.progress(e), a.remove.nextValue());
  10387. }, progress: function progress(e) {
  10388. 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));
  10389. } }, setting: function setting(t, n) {
  10390. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  10391. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  10392. }
  10393. }, internal: function internal(t, n) {
  10394. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  10395. if (n === i) return a[t];a[t] = n;
  10396. }
  10397. }, debug: function debug() {
  10398. !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)));
  10399. }, verbose: function verbose() {
  10400. !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)));
  10401. }, error: function error() {
  10402. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  10403. }, performance: { log: function log(e) {
  10404. 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);
  10405. }, display: function display() {
  10406. var t = f.name + ":",
  10407. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  10408. n += t["Execution Time"];
  10409. }), 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) {
  10410. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10411. }), console.groupEnd()), l = [];
  10412. } }, invoke: function invoke(t, n, r) {
  10413. var s,
  10414. l,
  10415. c,
  10416. 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) {
  10417. 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 {
  10418. 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];
  10419. }
  10420. })), 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;
  10421. } }, u ? (T === i && a.initialize(), a.invoke(c)) : (T !== i && T.invoke("destroy"), a.initialize());
  10422. }), o !== i ? o : this;
  10423. }, 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) {
  10424. return t;
  10425. }, 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" } };
  10426. }(jQuery, window, document), function (e, t, n, i) {
  10427. "use strict";
  10428. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.rating = function (t) {
  10429. var n,
  10430. o = e(this),
  10431. a = o.selector || "",
  10432. r = new Date().getTime(),
  10433. s = [],
  10434. l = arguments[0],
  10435. c = "string" == typeof l,
  10436. u = [].slice.call(arguments, 1);return o.each(function () {
  10437. var d,
  10438. f,
  10439. m = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.rating.settings, t) : e.extend({}, e.fn.rating.settings),
  10440. g = m.namespace,
  10441. p = m.className,
  10442. h = m.metadata,
  10443. v = m.selector,
  10444. b = (m.error, "." + g),
  10445. y = "module-" + g,
  10446. x = this,
  10447. C = e(this).data(y),
  10448. w = e(this),
  10449. S = w.find(v.icon);f = { initialize: function initialize() {
  10450. 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();
  10451. }, instantiate: function instantiate() {
  10452. f.verbose("Instantiating module", m), C = f, w.data(y, f);
  10453. }, destroy: function destroy() {
  10454. f.verbose("Destroying previous instance", C), f.remove.events(), w.removeData(y);
  10455. }, refresh: function refresh() {
  10456. S = w.find(v.icon);
  10457. }, setup: { layout: function layout() {
  10458. var t = f.get.maxRating(),
  10459. n = e.fn.rating.settings.templates.icon(t);f.debug("Generating icon html dynamically"), w.html(n), f.refresh();
  10460. } }, event: { mouseenter: function mouseenter() {
  10461. var t = e(this);t.nextAll().removeClass(p.selected), w.addClass(p.selected), t.addClass(p.selected).prevAll().addClass(p.selected);
  10462. }, mouseleave: function mouseleave() {
  10463. w.removeClass(p.selected), S.removeClass(p.selected);
  10464. }, click: function click() {
  10465. var t = e(this),
  10466. n = f.get.rating(),
  10467. i = S.index(t) + 1;("auto" == m.clearable ? 1 === S.length : m.clearable) && n == i ? f.clearRating() : f.set.rating(i);
  10468. } }, clearRating: function clearRating() {
  10469. f.debug("Clearing current rating"), f.set.rating(0);
  10470. }, bind: { events: function events() {
  10471. 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);
  10472. } }, remove: { events: function events() {
  10473. f.verbose("Removing events"), w.off(b);
  10474. }, initialLoad: function initialLoad() {
  10475. d = !1;
  10476. } }, enable: function enable() {
  10477. f.debug("Setting rating to interactive mode"), f.bind.events(), w.removeClass(p.disabled);
  10478. }, disable: function disable() {
  10479. f.debug("Setting rating to read-only mode"), f.remove.events(), w.addClass(p.disabled);
  10480. }, is: { initialLoad: function initialLoad() {
  10481. return d;
  10482. } }, get: { initialRating: function initialRating() {
  10483. return w.data(h.rating) !== i ? (w.removeData(h.rating), w.data(h.rating)) : m.initialRating;
  10484. }, maxRating: function maxRating() {
  10485. return w.data(h.maxRating) !== i ? (w.removeData(h.maxRating), w.data(h.maxRating)) : m.maxRating;
  10486. }, rating: function rating() {
  10487. var e = S.filter("." + p.active).length;return f.verbose("Current rating retrieved", e), e;
  10488. } }, set: { rating: function rating(e) {
  10489. var t = e - 1 >= 0 ? e - 1 : 0,
  10490. 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);
  10491. }, initialLoad: function initialLoad() {
  10492. d = !0;
  10493. } }, setting: function setting(t, n) {
  10494. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  10495. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  10496. }
  10497. }, internal: function internal(t, n) {
  10498. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  10499. if (n === i) return f[t];f[t] = n;
  10500. }
  10501. }, debug: function debug() {
  10502. !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)));
  10503. }, verbose: function verbose() {
  10504. !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)));
  10505. }, error: function error() {
  10506. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  10507. }, performance: { log: function log(e) {
  10508. 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);
  10509. }, display: function display() {
  10510. var t = m.name + ":",
  10511. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  10512. n += t["Execution Time"];
  10513. }), 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) {
  10514. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10515. }), console.groupEnd()), s = [];
  10516. } }, invoke: function invoke(t, o, a) {
  10517. var r,
  10518. s,
  10519. l,
  10520. 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) {
  10521. 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 {
  10522. 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];
  10523. }
  10524. })), 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;
  10525. } }, c ? (C === i && f.initialize(), f.invoke(l)) : (C !== i && C.invoke("destroy"), f.initialize());
  10526. }), n !== i ? n : this;
  10527. }, 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) {
  10528. for (var t = 1, n = ""; t <= e;) {
  10529. n += '<i class="icon"></i>', t++;
  10530. }return n;
  10531. } } };
  10532. }(jQuery, window, document), function (e, t, n, i) {
  10533. "use strict";
  10534. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.search = function (o) {
  10535. var a,
  10536. r = e(this),
  10537. s = r.selector || "",
  10538. l = new Date().getTime(),
  10539. c = [],
  10540. u = arguments[0],
  10541. d = "string" == typeof u,
  10542. f = [].slice.call(arguments, 1);return e(this).each(function () {
  10543. var m,
  10544. g = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.search.settings, o) : e.extend({}, e.fn.search.settings),
  10545. p = g.className,
  10546. h = g.metadata,
  10547. v = g.regExp,
  10548. b = g.fields,
  10549. y = g.selector,
  10550. x = g.error,
  10551. C = g.namespace,
  10552. w = "." + C,
  10553. S = C + "-module",
  10554. k = e(this),
  10555. T = k.find(y.prompt),
  10556. A = k.find(y.searchButton),
  10557. R = k.find(y.results),
  10558. P = k.find(y.result),
  10559. E = (k.find(y.category), this),
  10560. F = k.data(S),
  10561. O = !1,
  10562. D = !1;m = { initialize: function initialize() {
  10563. m.verbose("Initializing module"), m.get.settings(), m.determine.searchFields(), m.bind.events(), m.set.type(), m.create.results(), m.instantiate();
  10564. }, instantiate: function instantiate() {
  10565. m.verbose("Storing instance of module", m), F = m, k.data(S, m);
  10566. }, destroy: function destroy() {
  10567. m.verbose("Destroying instance"), k.off(w).removeData(S);
  10568. }, refresh: function refresh() {
  10569. 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);
  10570. }, refreshResults: function refreshResults() {
  10571. R = k.find(y.results), P = k.find(y.result);
  10572. }, bind: { events: function events() {
  10573. 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);
  10574. } }, determine: { searchFields: function searchFields() {
  10575. o && o.searchFields !== i && (g.searchFields = o.searchFields);
  10576. } }, event: { input: function input() {
  10577. g.searchDelay ? (clearTimeout(m.timer), m.timer = setTimeout(function () {
  10578. m.is.focused() && m.query();
  10579. }, g.searchDelay)) : m.query();
  10580. }, focus: function focus() {
  10581. m.set.focus(), g.searchOnFocus && m.has.minimumCharacters() && m.query(function () {
  10582. m.can.show() && m.showResults();
  10583. });
  10584. }, blur: function blur(e) {
  10585. var t = function t() {
  10586. m.cancel.query(), m.remove.focus(), m.timer = setTimeout(m.hideResults, g.hideDelay);
  10587. };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) {
  10588. m.is.inMessage(e) || O ? T.focus() : (O = !1, m.is.animating() || m.is.hidden() || t());
  10589. })) : (m.debug("Input blurred without user action, closing results"), t()));
  10590. }, result: { mousedown: function mousedown() {
  10591. m.resultsClicked = !0;
  10592. }, mouseup: function mouseup() {
  10593. m.resultsClicked = !1;
  10594. }, click: function click(n) {
  10595. m.debug("Search result selected");var i = e(this),
  10596. o = i.find(y.title).eq(0),
  10597. a = i.is("a[href]") ? i : i.find("a[href]").eq(0),
  10598. r = a.attr("href") || !1,
  10599. s = a.attr("target") || !1,
  10600. l = (o.html(), o.length > 0 && o.text()),
  10601. c = m.get.results(),
  10602. 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);
  10603. } } }, handleKeyboard: function handleKeyboard(e) {
  10604. var t,
  10605. n = k.find(y.result),
  10606. i = k.find(y.category),
  10607. o = n.filter("." + p.active),
  10608. a = n.index(o),
  10609. r = n.length,
  10610. s = o.length > 0,
  10611. l = e.which,
  10612. c = 13,
  10613. u = 38,
  10614. d = 40;if (l == 27 && (m.verbose("Escape key pressed, blurring search field"), m.hideResults(), D = !0), m.is.visible()) {
  10615. if (l == c) {
  10616. 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;
  10617. } 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());
  10618. } else l == c && (m.verbose("Enter key pressed, executing query"), m.query(), m.set.buttonPressed(), T.one("keyup", m.remove.buttonFocus));
  10619. }, setup: { api: function api(t, n) {
  10620. var i = { debug: g.debug, on: !1, cache: g.cache, action: "search", urlData: { query: t }, onSuccess: function onSuccess(e) {
  10621. m.parse.response.call(E, e, t), n();
  10622. }, onFailure: function onFailure() {
  10623. m.displayMessage(x.serverError), n();
  10624. }, onAbort: function onAbort(e) {}, onError: m.error };e.extend(!0, i, g.apiSettings), m.verbose("Setting up API request", i), k.api(i);
  10625. } }, can: { useAPI: function useAPI() {
  10626. return e.fn.api !== i;
  10627. }, show: function show() {
  10628. return m.is.focused() && !m.is.visible() && !m.is.empty();
  10629. }, transition: function transition() {
  10630. return g.transition && e.fn.transition !== i && k.transition("is supported");
  10631. } }, is: { animating: function animating() {
  10632. return R.hasClass(p.animating);
  10633. }, hidden: function hidden() {
  10634. return R.hasClass(p.hidden);
  10635. }, inMessage: function inMessage(t) {
  10636. if (t.target) {
  10637. var i = e(t.target);return e.contains(n.documentElement, t.target) && i.closest(y.message).length > 0;
  10638. }
  10639. }, empty: function empty() {
  10640. return "" === R.html();
  10641. }, visible: function visible() {
  10642. return R.filter(":visible").length > 0;
  10643. }, focused: function focused() {
  10644. return T.filter(":focus").length > 0;
  10645. } }, get: { settings: function settings() {
  10646. e.isPlainObject(o) && o.searchFullText && (g.fullTextSearch = o.searchFullText, m.error(g.error.oldSearchSyntax, E));
  10647. }, inputEvent: function inputEvent() {
  10648. var e = T[0];return e !== i && e.oninput !== i ? "input" : e !== i && e.onpropertychange !== i ? "propertychange" : "keyup";
  10649. }, value: function value() {
  10650. return T.val();
  10651. }, results: function results() {
  10652. return k.data(h.results);
  10653. }, result: function result(t, n) {
  10654. var o = ["title", "id"],
  10655. 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) {
  10656. if (e.isArray(i.results) && (a = m.search.object(t, i.results, o)[0])) return !1;
  10657. })) : (m.debug("Finding result in results object", t), a = m.search.object(t, n, o)[0]), a || !1;
  10658. } }, select: { firstResult: function firstResult() {
  10659. m.verbose("Selecting first result"), P.first().addClass(p.active);
  10660. } }, set: { focus: function focus() {
  10661. k.addClass(p.focus);
  10662. }, loading: function loading() {
  10663. k.addClass(p.loading);
  10664. }, value: function value(e) {
  10665. m.verbose("Setting search input value", e), T.val(e);
  10666. }, type: function type(e) {
  10667. e = e || g.type, "category" == g.type && k.addClass(g.type);
  10668. }, buttonPressed: function buttonPressed() {
  10669. A.addClass(p.pressed);
  10670. } }, remove: { loading: function loading() {
  10671. k.removeClass(p.loading);
  10672. }, focus: function focus() {
  10673. k.removeClass(p.focus);
  10674. }, buttonPressed: function buttonPressed() {
  10675. A.removeClass(p.pressed);
  10676. } }, query: function query(t) {
  10677. t = e.isFunction(t) ? t : function () {};var n = m.get.value(),
  10678. 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();
  10679. }, search: { local: function local(e) {
  10680. var t,
  10681. 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 });
  10682. }, remote: function remote(t, n) {
  10683. n = e.isFunction(n) ? n : function () {}, k.api("is loading") && k.api("abort"), m.setup.api(t, n), k.api("query");
  10684. }, object: function object(t, n, o) {
  10685. var a = [],
  10686. r = [],
  10687. s = [],
  10688. l = t.toString().replace(v.escape, "\\$&"),
  10689. c = new RegExp(v.beginsWith + l, "i"),
  10690. u = function u(t, n) {
  10691. var i = -1 == e.inArray(n, a),
  10692. o = -1 == e.inArray(n, s),
  10693. l = -1 == e.inArray(n, r);i && o && l && t.push(n);
  10694. };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) {
  10695. e.each(n, function (e, n) {
  10696. "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));
  10697. });
  10698. }), e.merge(r, s), e.merge(a, r), a);
  10699. } }, exactSearch: function exactSearch(e, t) {
  10700. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  10701. }, fuzzySearch: function fuzzySearch(e, t) {
  10702. var n = t.length,
  10703. 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++) {
  10704. for (var r = e.charCodeAt(o); a < n;) {
  10705. if (t.charCodeAt(a++) === r) continue e;
  10706. }return !1;
  10707. }return !0;
  10708. }, parse: { response: function response(e, t) {
  10709. 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]));
  10710. } }, cancel: { query: function query() {
  10711. m.can.useAPI() && k.api("abort");
  10712. } }, has: { minimumCharacters: function minimumCharacters() {
  10713. return m.get.value().length >= g.minCharacters;
  10714. }, results: function results() {
  10715. return 0 !== R.length && "" != R.html();
  10716. } }, clear: { cache: function cache(e) {
  10717. 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));
  10718. } }, read: { cache: function cache(e) {
  10719. 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]);
  10720. } }, create: { categoryResults: function categoryResults(t) {
  10721. var n = {};return e.each(t, function (e, t) {
  10722. 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));
  10723. }), n;
  10724. }, id: function id(e, t) {
  10725. var n,
  10726. 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;
  10727. }, results: function results() {
  10728. 0 === R.length && (R = e("<div />").addClass(p.results).appendTo(k));
  10729. } }, inject: { result: function result(e, t, n) {
  10730. 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);
  10731. }, id: function id(t) {
  10732. m.debug("Injecting unique ids into results");var n = 0,
  10733. o = 0;return "category" === g.type ? e.each(t, function (t, a) {
  10734. o = 0, e.each(a.results, function (e, t) {
  10735. var r = a.results[e];r.id === i && (r.id = m.create.id(o, n)), m.inject.result(r, o, n), o++;
  10736. }), n++;
  10737. }) : e.each(t, function (e, n) {
  10738. var a = t[e];a.id === i && (a.id = m.create.id(o)), m.inject.result(a, o), o++;
  10739. }), t;
  10740. } }, save: { results: function results(e) {
  10741. m.verbose("Saving current search results to metadata", e), k.data(h.results, e);
  10742. } }, write: { cache: function cache(e, t) {
  10743. 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));
  10744. } }, addResults: function addResults(t) {
  10745. 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 () {
  10746. R.empty();
  10747. });
  10748. }, showResults: function showResults(t) {
  10749. 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() {
  10750. t();
  10751. }, queue: !0 })) : (m.debug("Showing results with javascript"), R.stop().fadeIn(g.duration, g.easing)), g.onResultsOpen.call(R));
  10752. }, hideResults: function hideResults(t) {
  10753. 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() {
  10754. t();
  10755. }, queue: !0 })) : (m.debug("Hiding results with javascript"), R.stop().fadeOut(g.duration, g.easing)), g.onResultsClose.call(R));
  10756. }, generateResults: function generateResults(t) {
  10757. m.debug("Generating html from response", t);var n = g.templates[g.type],
  10758. i = e.isPlainObject(t[b.results]) && !e.isEmptyObject(t[b.results]),
  10759. o = e.isArray(t[b.results]) && t[b.results].length > 0,
  10760. 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;
  10761. }, displayMessage: function displayMessage(e, t) {
  10762. return t = t || "standard", m.debug("Displaying message", e, t), m.addResults(g.templates.message(e, t)), g.templates.message(e, t);
  10763. }, setting: function setting(t, n) {
  10764. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  10765. if (n === i) return g[t];g[t] = n;
  10766. }
  10767. }, internal: function internal(t, n) {
  10768. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10769. if (n === i) return m[t];m[t] = n;
  10770. }
  10771. }, debug: function debug() {
  10772. !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)));
  10773. }, verbose: function verbose() {
  10774. !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)));
  10775. }, error: function error() {
  10776. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10777. }, performance: { log: function log(e) {
  10778. 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);
  10779. }, display: function display() {
  10780. var t = g.name + ":",
  10781. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  10782. n += t["Execution Time"];
  10783. }), 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) {
  10784. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10785. }), console.groupEnd()), c = [];
  10786. } }, invoke: function invoke(t, n, o) {
  10787. var r,
  10788. s,
  10789. l,
  10790. 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) {
  10791. 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 {
  10792. 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];
  10793. }
  10794. })), 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;
  10795. } }, d ? (F === i && m.initialize(), m.invoke(u)) : (F !== i && F.invoke("destroy"), m.initialize());
  10796. }), a !== i ? a : this;
  10797. }, 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) {
  10798. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  10799. return t[e];
  10800. }) : e
  10801. );
  10802. }, message: function message(e, t) {
  10803. 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;
  10804. }, category: function category(t, n) {
  10805. var o = "";e.fn.search.settings.templates.escape;return t[n.categoryResults] !== i && (e.each(t[n.categoryResults], function (t, a) {
  10806. 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) {
  10807. 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>";
  10808. }), o += "</div>", o += "</div>");
  10809. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  10810. }, standard: function standard(t, n) {
  10811. var o = "";return t[n.results] !== i && (e.each(t[n.results], function (e, t) {
  10812. 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>";
  10813. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  10814. } } };
  10815. }(jQuery, window, document), function (e, t, n, i) {
  10816. "use strict";
  10817. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.shape = function (o) {
  10818. var a,
  10819. r = e(this),
  10820. s = (e("body"), new Date().getTime()),
  10821. l = [],
  10822. c = arguments[0],
  10823. u = "string" == typeof c,
  10824. d = [].slice.call(arguments, 1),
  10825. f = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  10826. setTimeout(e, 0);
  10827. };return r.each(function () {
  10828. var t,
  10829. m,
  10830. g,
  10831. p = r.selector || "",
  10832. h = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.shape.settings, o) : e.extend({}, e.fn.shape.settings),
  10833. v = h.namespace,
  10834. b = h.selector,
  10835. y = h.error,
  10836. x = h.className,
  10837. C = "." + v,
  10838. w = "module-" + v,
  10839. S = e(this),
  10840. k = S.find(b.sides),
  10841. T = S.find(b.side),
  10842. A = !1,
  10843. R = this,
  10844. P = S.data(w);g = { initialize: function initialize() {
  10845. g.verbose("Initializing module for", R), g.set.defaultSide(), g.instantiate();
  10846. }, instantiate: function instantiate() {
  10847. g.verbose("Storing instance of module", g), P = g, S.data(w, P);
  10848. }, destroy: function destroy() {
  10849. g.verbose("Destroying previous module for", R), S.removeData(w).off(C);
  10850. }, refresh: function refresh() {
  10851. g.verbose("Refreshing selector cache for", R), S = e(R), k = e(this).find(b.shape), T = e(this).find(b.side);
  10852. }, repaint: function repaint() {
  10853. g.verbose("Forcing repaint event");(k[0] || n.createElement("div")).offsetWidth;
  10854. }, animate: function animate(e, n) {
  10855. g.verbose("Animating box with properties", e), n = n || function (e) {
  10856. g.verbose("Executing animation callback"), e !== i && e.stopPropagation(), g.reset(), g.set.active();
  10857. }, 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 () {
  10858. S.addClass(x.animating), t.addClass(x.hidden);
  10859. })) : n();
  10860. }, queue: function queue(e) {
  10861. g.debug("Queueing animation of", e), k.one(g.get.transitionEvent(), function () {
  10862. g.debug("Executing queued animation"), setTimeout(function () {
  10863. S.shape(e);
  10864. }, 0);
  10865. });
  10866. }, reset: function reset() {
  10867. 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");
  10868. }, is: { complete: function complete() {
  10869. return T.filter("." + x.active)[0] == m[0];
  10870. }, animating: function animating() {
  10871. return S.hasClass(x.animating);
  10872. } }, set: { defaultSide: function defaultSide() {
  10873. 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);
  10874. }, duration: function duration(e) {
  10875. 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 });
  10876. }, currentStageSize: function currentStageSize() {
  10877. var e = S.find("." + h.className.active),
  10878. t = e.outerWidth(!0),
  10879. n = e.outerHeight(!0);S.css({ width: t, height: n });
  10880. }, stageSize: function stageSize() {
  10881. var e = S.clone().addClass(x.loading),
  10882. t = e.find("." + h.className.active),
  10883. n = A ? e.find(b.side).eq(A) : t.next(b.side).length > 0 ? t.next(b.side) : e.find(b.side).first(),
  10884. i = "next" == h.width ? n.outerWidth(!0) : "initial" == h.width ? S.width() : h.width,
  10885. 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));
  10886. }, nextSide: function nextSide(e) {
  10887. 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);
  10888. }, active: function active() {
  10889. g.verbose("Setting new side to active", m), T.removeClass(x.active), m.addClass(x.active), h.onChange.call(m[0]), g.set.defaultSide();
  10890. } }, flip: { up: function up() {
  10891. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  10892. if (g.is.animating()) g.queue("flip up");else {
  10893. g.debug("Flipping up", m);var e = g.get.transform.up();g.set.stageSize(), g.stage.above(), g.animate(e);
  10894. }
  10895. } else g.debug("Side already visible", m);
  10896. }, down: function down() {
  10897. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  10898. if (g.is.animating()) g.queue("flip down");else {
  10899. g.debug("Flipping down", m);var e = g.get.transform.down();g.set.stageSize(), g.stage.below(), g.animate(e);
  10900. }
  10901. } else g.debug("Side already visible", m);
  10902. }, left: function left() {
  10903. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  10904. if (g.is.animating()) g.queue("flip left");else {
  10905. g.debug("Flipping left", m);var e = g.get.transform.left();g.set.stageSize(), g.stage.left(), g.animate(e);
  10906. }
  10907. } else g.debug("Side already visible", m);
  10908. }, right: function right() {
  10909. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  10910. if (g.is.animating()) g.queue("flip right");else {
  10911. g.debug("Flipping right", m);var e = g.get.transform.right();g.set.stageSize(), g.stage.right(), g.animate(e);
  10912. }
  10913. } else g.debug("Side already visible", m);
  10914. }, over: function over() {
  10915. !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);
  10916. }, back: function back() {
  10917. !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);
  10918. } }, get: { transform: { up: function up() {
  10919. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(-90deg)" };
  10920. }, down: function down() {
  10921. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(90deg)" };
  10922. }, left: function left() {
  10923. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(90deg)" };
  10924. }, right: function right() {
  10925. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(-90deg)" };
  10926. }, over: function over() {
  10927. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(180deg)" };
  10928. }, back: function back() {
  10929. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(-180deg)" };
  10930. } }, transitionEvent: function transitionEvent() {
  10931. var e,
  10932. t = n.createElement("element"),
  10933. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  10934. if (t.style[e] !== i) return o[e];
  10935. }
  10936. }, nextSide: function nextSide() {
  10937. return t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first();
  10938. } }, stage: { above: function above() {
  10939. 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)" });
  10940. }, below: function below() {
  10941. 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)" });
  10942. }, left: function left() {
  10943. var e = t.outerWidth(!0),
  10944. n = m.outerWidth(!0),
  10945. 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)" });
  10946. }, right: function right() {
  10947. var e = t.outerWidth(!0),
  10948. n = m.outerWidth(!0),
  10949. 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)" });
  10950. }, behind: function behind() {
  10951. var e = t.outerWidth(!0),
  10952. n = m.outerWidth(!0),
  10953. 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)" });
  10954. } }, setting: function setting(t, n) {
  10955. if (g.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, h, t);else {
  10956. if (n === i) return h[t];e.isPlainObject(h[t]) ? e.extend(!0, h[t], n) : h[t] = n;
  10957. }
  10958. }, internal: function internal(t, n) {
  10959. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  10960. if (n === i) return g[t];g[t] = n;
  10961. }
  10962. }, debug: function debug() {
  10963. !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)));
  10964. }, verbose: function verbose() {
  10965. !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)));
  10966. }, error: function error() {
  10967. h.silent || (g.error = Function.prototype.bind.call(console.error, console, h.name + ":"), g.error.apply(console, arguments));
  10968. }, performance: { log: function log(e) {
  10969. 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);
  10970. }, display: function display() {
  10971. var t = h.name + ":",
  10972. n = 0;s = !1, clearTimeout(g.performance.timer), e.each(l, function (e, t) {
  10973. n += t["Execution Time"];
  10974. }), 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) {
  10975. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10976. }), console.groupEnd()), l = [];
  10977. } }, invoke: function invoke(t, n, o) {
  10978. var r,
  10979. s,
  10980. l,
  10981. 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) {
  10982. 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 {
  10983. 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];
  10984. }
  10985. })), 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;
  10986. } }, u ? (P === i && g.initialize(), g.invoke(c)) : (P !== i && P.invoke("destroy"), g.initialize());
  10987. }), a !== i ? a : this;
  10988. }, 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" } };
  10989. }(jQuery, window, document), function (e, t, n, i) {
  10990. "use strict";
  10991. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sidebar = function (o) {
  10992. var a,
  10993. r = e(this),
  10994. s = e(t),
  10995. l = e(n),
  10996. c = e("html"),
  10997. u = e("head"),
  10998. d = r.selector || "",
  10999. f = new Date().getTime(),
  11000. m = [],
  11001. g = arguments[0],
  11002. p = "string" == typeof g,
  11003. h = [].slice.call(arguments, 1),
  11004. v = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  11005. setTimeout(e, 0);
  11006. };return r.each(function () {
  11007. var r,
  11008. b,
  11009. y,
  11010. x,
  11011. C,
  11012. w,
  11013. S = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sidebar.settings, o) : e.extend({}, e.fn.sidebar.settings),
  11014. k = S.selector,
  11015. T = S.className,
  11016. A = S.namespace,
  11017. R = S.regExp,
  11018. P = S.error,
  11019. E = "." + A,
  11020. F = "module-" + A,
  11021. O = e(this),
  11022. D = e(S.context),
  11023. q = O.children(k.sidebar),
  11024. j = (D.children(k.fixed), D.children(k.pusher)),
  11025. z = this,
  11026. I = O.data(F);w = { initialize: function initialize() {
  11027. w.debug("Initializing sidebar", o), w.create.id(), C = w.get.transitionEvent(), S.delaySetup ? v(w.setup.layout) : w.setup.layout(), v(function () {
  11028. w.setup.cache();
  11029. }), w.instantiate();
  11030. }, instantiate: function instantiate() {
  11031. w.verbose("Storing instance of module", w), I = w, O.data(F, w);
  11032. }, create: { id: function id() {
  11033. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, w.verbose("Creating unique id for element", y);
  11034. } }, destroy: function destroy() {
  11035. 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);
  11036. }, event: { clickaway: function clickaway(e) {
  11037. var t = j.find(e.target).length > 0 || j.is(e.target),
  11038. 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());
  11039. }, touch: function touch(e) {}, containScroll: function containScroll(e) {
  11040. z.scrollTop <= 0 && (z.scrollTop = 1), z.scrollTop + z.offsetHeight >= z.scrollHeight && (z.scrollTop = z.scrollHeight - z.offsetHeight - 1);
  11041. }, scroll: function scroll(t) {
  11042. 0 === e(t.target).closest(k.sidebar).length && t.preventDefault();
  11043. } }, bind: { clickaway: function clickaway() {
  11044. w.verbose("Adding clickaway events to context", D), S.closable && D.on("click" + b, w.event.clickaway).on("touchend" + b, w.event.clickaway);
  11045. }, scrollLock: function scrollLock() {
  11046. 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);
  11047. } }, unbind: { clickaway: function clickaway() {
  11048. w.verbose("Removing clickaway events from context", D), D.off(b);
  11049. }, scrollLock: function scrollLock() {
  11050. w.verbose("Removing scroll lock from page"), l.off(b), s.off(b), O.off("scroll" + E);
  11051. } }, add: { inlineCSS: function inlineCSS() {
  11052. var t,
  11053. n = w.cache.width || O.outerWidth(),
  11054. i = w.cache.height || O.outerHeight(),
  11055. o = w.is.rtl(),
  11056. a = w.get.direction(),
  11057. 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);
  11058. } }, refresh: function refresh() {
  11059. 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();
  11060. }, refreshSidebars: function refreshSidebars() {
  11061. w.verbose("Refreshing other sidebars"), q = D.children(k.sidebar);
  11062. }, repaint: function repaint() {
  11063. w.verbose("Forcing repaint event"), z.style.display = "none";z.offsetHeight;z.scrollTop = z.scrollTop, z.style.display = "";
  11064. }, setup: { cache: function cache() {
  11065. w.cache = { width: O.outerWidth(), height: O.outerHeight(), rtl: "rtl" == O.css("direction") };
  11066. }, layout: function layout() {
  11067. 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();
  11068. } }, attachEvents: function attachEvents(t, n) {
  11069. 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);
  11070. }, show: function show(t) {
  11071. if (t = e.isFunction(t) ? t : function () {}, w.is.hidden()) {
  11072. 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) {
  11073. if ("overlay" != S.transition) return void w.hideOthers(w.show);w.hideOthers();
  11074. } else S.transition = "overlay";w.pushPage(function () {
  11075. t.call(z), S.onShow.call(z);
  11076. }), S.onChange.call(z), S.onVisible.call(z);
  11077. } else w.debug("Sidebar is already visible");
  11078. }, hide: function hide(t) {
  11079. t = e.isFunction(t) ? t : function () {}, (w.is.visible() || w.is.animating()) && (w.debug("Hiding sidebar", t), w.refreshSidebars(), w.pullPage(function () {
  11080. t.call(z), S.onHidden.call(z);
  11081. }), S.onChange.call(z), S.onHide.call(z));
  11082. }, othersAnimating: function othersAnimating() {
  11083. return q.not(O).filter("." + T.animating).length > 0;
  11084. }, othersVisible: function othersVisible() {
  11085. return q.not(O).filter("." + T.visible).length > 0;
  11086. }, othersActive: function othersActive() {
  11087. return w.othersVisible() || w.othersAnimating();
  11088. }, hideOthers: function hideOthers(e) {
  11089. var t = q.not(O).filter("." + T.visible),
  11090. n = t.length,
  11091. i = 0;e = e || function () {}, t.sidebar("hide", function () {
  11092. ++i == n && e();
  11093. });
  11094. }, toggle: function toggle() {
  11095. w.verbose("Determining toggled direction"), w.is.hidden() ? w.show() : w.hide();
  11096. }, pushPage: function pushPage(t) {
  11097. var n,
  11098. i,
  11099. _o,
  11100. a = w.get.transition(),
  11101. 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() {
  11102. w.bind.clickaway(), w.add.inlineCSS(), w.set.animating(), w.set.visible();
  11103. }, i = function i() {
  11104. w.set.dimmed();
  11105. }, _o = function o(e) {
  11106. e.target == r[0] && (r.off(C + b, _o), w.remove.animating(), w.bind.scrollLock(), t.call(z));
  11107. }, r.off(C + b), r.on(C + b, _o), v(n), S.dimPage && !w.othersVisible() && v(i);
  11108. }, pullPage: function pullPage(t) {
  11109. var n,
  11110. _i,
  11111. o = w.get.transition(),
  11112. 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() {
  11113. w.set.transition(o), w.set.animating(), w.remove.visible(), S.dimPage && !w.othersVisible() && j.removeClass(T.dimmed);
  11114. }, _i = function i(e) {
  11115. 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));
  11116. }, a.off(C + b), a.on(C + b, _i), v(n);
  11117. }, scrollToTop: function scrollToTop() {
  11118. w.verbose("Scrolling to top of page to avoid animation issues"), x = e(t).scrollTop(), O.scrollTop(0), t.scrollTo(0, 0);
  11119. }, scrollBack: function scrollBack() {
  11120. w.verbose("Scrolling back to original page position"), t.scrollTo(0, x);
  11121. }, clear: { cache: function cache() {
  11122. w.verbose("Clearing cached dimensions"), w.cache = {};
  11123. } }, set: { ios: function ios() {
  11124. c.addClass(T.ios);
  11125. }, pushed: function pushed() {
  11126. D.addClass(T.pushed);
  11127. }, pushable: function pushable() {
  11128. D.addClass(T.pushable);
  11129. }, dimmed: function dimmed() {
  11130. j.addClass(T.dimmed);
  11131. }, active: function active() {
  11132. O.addClass(T.active);
  11133. }, animating: function animating() {
  11134. O.addClass(T.animating);
  11135. }, transition: function transition(e) {
  11136. e = e || w.get.transition(), O.addClass(e);
  11137. }, direction: function direction(e) {
  11138. e = e || w.get.direction(), O.addClass(T[e]);
  11139. }, visible: function visible() {
  11140. O.addClass(T.visible);
  11141. }, overlay: function overlay() {
  11142. O.addClass(T.overlay);
  11143. } }, remove: { inlineCSS: function inlineCSS() {
  11144. w.debug("Removing inline css styles", r), r && r.length > 0 && r.remove();
  11145. }, ios: function ios() {
  11146. c.removeClass(T.ios);
  11147. }, pushed: function pushed() {
  11148. D.removeClass(T.pushed);
  11149. }, pushable: function pushable() {
  11150. D.removeClass(T.pushable);
  11151. }, active: function active() {
  11152. O.removeClass(T.active);
  11153. }, animating: function animating() {
  11154. O.removeClass(T.animating);
  11155. }, transition: function transition(e) {
  11156. e = e || w.get.transition(), O.removeClass(e);
  11157. }, direction: function direction(e) {
  11158. e = e || w.get.direction(), O.removeClass(T[e]);
  11159. }, visible: function visible() {
  11160. O.removeClass(T.visible);
  11161. }, overlay: function overlay() {
  11162. O.removeClass(T.overlay);
  11163. } }, get: { direction: function direction() {
  11164. return O.hasClass(T.top) ? T.top : O.hasClass(T.right) ? T.right : O.hasClass(T.bottom) ? T.bottom : T.left;
  11165. }, transition: function transition() {
  11166. var e,
  11167. 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;
  11168. }, transitionEvent: function transitionEvent() {
  11169. var e,
  11170. t = n.createElement("element"),
  11171. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  11172. if (t.style[e] !== i) return o[e];
  11173. }
  11174. } }, is: { ie: function ie() {
  11175. return !t.ActiveXObject && "ActiveXObject" in t || "ActiveXObject" in t;
  11176. }, ios: function ios() {
  11177. var e = navigator.userAgent,
  11178. t = e.match(R.ios),
  11179. n = e.match(R.mobileChrome);return !(!t || n) && (w.verbose("Browser was found to be iOS", e), !0);
  11180. }, mobile: function mobile() {
  11181. 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);
  11182. }, hidden: function hidden() {
  11183. return !w.is.visible();
  11184. }, visible: function visible() {
  11185. return O.hasClass(T.visible);
  11186. }, open: function open() {
  11187. return w.is.visible();
  11188. }, closed: function closed() {
  11189. return w.is.hidden();
  11190. }, vertical: function vertical() {
  11191. return O.hasClass(T.top);
  11192. }, animating: function animating() {
  11193. return D.hasClass(T.animating);
  11194. }, rtl: function rtl() {
  11195. return w.cache.rtl === i && (w.cache.rtl = "rtl" == O.css("direction")), w.cache.rtl;
  11196. } }, setting: function setting(t, n) {
  11197. if (w.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, S, t);else {
  11198. if (n === i) return S[t];e.isPlainObject(S[t]) ? e.extend(!0, S[t], n) : S[t] = n;
  11199. }
  11200. }, internal: function internal(t, n) {
  11201. if (e.isPlainObject(t)) e.extend(!0, w, t);else {
  11202. if (n === i) return w[t];w[t] = n;
  11203. }
  11204. }, debug: function debug() {
  11205. !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)));
  11206. }, verbose: function verbose() {
  11207. !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)));
  11208. }, error: function error() {
  11209. S.silent || (w.error = Function.prototype.bind.call(console.error, console, S.name + ":"), w.error.apply(console, arguments));
  11210. }, performance: { log: function log(e) {
  11211. 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);
  11212. }, display: function display() {
  11213. var t = S.name + ":",
  11214. n = 0;f = !1, clearTimeout(w.performance.timer), e.each(m, function (e, t) {
  11215. n += t["Execution Time"];
  11216. }), 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) {
  11217. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11218. }), console.groupEnd()), m = [];
  11219. } }, invoke: function invoke(t, n, o) {
  11220. var r,
  11221. s,
  11222. l,
  11223. 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) {
  11224. 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 {
  11225. 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];
  11226. }
  11227. })), 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;
  11228. } }, p ? (I === i && w.initialize(), w.invoke(g)) : (I !== i && w.invoke("destroy"), w.initialize());
  11229. }), a !== i ? a : this;
  11230. }, 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" } };
  11231. }(jQuery, window, document), function (e, t, n, i) {
  11232. "use strict";
  11233. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sticky = function (o) {
  11234. var a,
  11235. r = e(this),
  11236. s = r.selector || "",
  11237. l = new Date().getTime(),
  11238. c = [],
  11239. u = arguments[0],
  11240. d = "string" == typeof u,
  11241. f = [].slice.call(arguments, 1);return r.each(function () {
  11242. var r,
  11243. m,
  11244. g,
  11245. p,
  11246. h,
  11247. v = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sticky.settings, o) : e.extend({}, e.fn.sticky.settings),
  11248. b = v.className,
  11249. y = v.namespace,
  11250. x = v.error,
  11251. C = "." + y,
  11252. w = "module-" + y,
  11253. S = e(this),
  11254. k = e(t),
  11255. T = e(v.scrollContext),
  11256. A = (S.selector, S.data(w)),
  11257. R = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  11258. setTimeout(e, 0);
  11259. },
  11260. P = this;h = { initialize: function initialize() {
  11261. h.determineContainer(), h.determineContext(), h.verbose("Initializing sticky", v, r), h.save.positions(), h.checkErrors(), h.bind.events(), v.observeChanges && h.observeChanges(), h.instantiate();
  11262. }, instantiate: function instantiate() {
  11263. h.verbose("Storing instance of module", h), A = h, S.data(w, h);
  11264. }, destroy: function destroy() {
  11265. 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);
  11266. }, observeChanges: function observeChanges() {
  11267. "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));
  11268. }, determineContainer: function determineContainer() {
  11269. r = v.container ? e(v.container) : S.offsetParent();
  11270. }, determineContext: function determineContext() {
  11271. 0 !== (m = v.context ? e(v.context) : r).length || h.error(x.invalidContext, v.context, S);
  11272. }, checkErrors: function checkErrors() {
  11273. 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);
  11274. }, bind: { events: function events() {
  11275. 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);
  11276. } }, event: { changed: function changed(e) {
  11277. clearTimeout(h.timer), h.timer = setTimeout(function () {
  11278. h.verbose("DOM tree modified, updating sticky menu", e), h.refresh();
  11279. }, 100);
  11280. }, documentChanged: function documentChanged(t) {
  11281. [].forEach.call(t, function (t) {
  11282. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  11283. (t == P || e(t).find(P).length > 0) && (h.debug("Element removed from DOM, tearing down events"), h.destroy());
  11284. });
  11285. });
  11286. }, load: function load() {
  11287. h.verbose("Page contents finished loading"), R(h.refresh);
  11288. }, resize: function resize() {
  11289. h.verbose("Window resized"), R(h.refresh);
  11290. }, scroll: function scroll() {
  11291. R(function () {
  11292. T.triggerHandler("scrollchange" + C, T.scrollTop());
  11293. });
  11294. }, scrollchange: function scrollchange(e, t) {
  11295. h.stick(t), v.onScroll.call(P);
  11296. } }, refresh: function refresh(e) {
  11297. h.reset(), v.context || h.determineContext(), e && h.determineContainer(), h.save.positions(), h.stick(), v.onReposition.call(P);
  11298. }, supports: { sticky: function sticky() {
  11299. var t = e("<div/>");t[0];return t.addClass(b.supported), t.css("position").match("sticky");
  11300. } }, save: { lastScroll: function lastScroll(e) {
  11301. h.lastScroll = e;
  11302. }, elementScroll: function elementScroll(e) {
  11303. h.elementScroll = e;
  11304. }, positions: function positions() {
  11305. var e = { height: T.height() },
  11306. 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() },
  11307. 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);
  11308. } }, get: { direction: function direction(e) {
  11309. var t = "down";return e = e || T.scrollTop(), h.lastScroll !== i && (h.lastScroll < e ? t = "down" : h.lastScroll > e && (t = "up")), t;
  11310. }, scrollChange: function scrollChange(e) {
  11311. return e = e || T.scrollTop(), h.lastScroll ? e - h.lastScroll : 0;
  11312. }, currentElementScroll: function currentElementScroll() {
  11313. return h.elementScroll ? h.elementScroll : h.is.top() ? Math.abs(parseInt(S.css("top"), 10)) || 0 : Math.abs(parseInt(S.css("bottom"), 10)) || 0;
  11314. }, elementScroll: function elementScroll(e) {
  11315. e = e || T.scrollTop();var t = h.cache.element,
  11316. n = h.cache.scrollContext,
  11317. i = h.get.scrollChange(e),
  11318. o = t.height - n.height + v.offset,
  11319. a = h.get.currentElementScroll(),
  11320. r = a + i;return a = h.cache.fits || r < 0 ? 0 : r > o ? o : r;
  11321. } }, remove: { lastScroll: function lastScroll() {
  11322. delete h.lastScroll;
  11323. }, elementScroll: function elementScroll(e) {
  11324. delete h.elementScroll;
  11325. }, minimumSize: function minimumSize() {
  11326. r.css("min-height", "");
  11327. }, offset: function offset() {
  11328. S.css("margin-top", "");
  11329. } }, set: { offset: function offset() {
  11330. h.verbose("Setting offset on element", v.offset), S.css("margin-top", v.offset);
  11331. }, containerSize: function containerSize() {
  11332. 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 }));
  11333. }, minimumSize: function minimumSize() {
  11334. var e = h.cache.element;r.css("min-height", e.height);
  11335. }, scroll: function scroll(e) {
  11336. 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));
  11337. }, size: function size() {
  11338. 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"));
  11339. } }, is: { standardScroll: function standardScroll() {
  11340. return T[0] == t;
  11341. }, top: function top() {
  11342. return S.hasClass(b.top);
  11343. }, bottom: function bottom() {
  11344. return S.hasClass(b.bottom);
  11345. }, initialPosition: function initialPosition() {
  11346. return !h.is.fixed() && !h.is.bound();
  11347. }, hidden: function hidden() {
  11348. return !S.is(":visible");
  11349. }, bound: function bound() {
  11350. return S.hasClass(b.bound);
  11351. }, fixed: function fixed() {
  11352. return S.hasClass(b.fixed);
  11353. } }, stick: function stick(e) {
  11354. var t = e || T.scrollTop(),
  11355. n = h.cache,
  11356. i = n.fits,
  11357. o = n.sameHeight,
  11358. a = n.element,
  11359. r = n.scrollContext,
  11360. s = n.context,
  11361. l = h.is.bottom() && v.pushing ? v.bottomOffset : v.offset,
  11362. c = (e = { top: t + l, bottom: t + l + r.height }, h.get.direction(e.top), i ? 0 : h.get.elementScroll(e.top)),
  11363. 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())));
  11364. }, bindTop: function bindTop() {
  11365. 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);
  11366. }, bindBottom: function bindBottom() {
  11367. 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);
  11368. }, setInitialPosition: function setInitialPosition() {
  11369. h.debug("Returning to initial position"), h.unfix(), h.unbind();
  11370. }, fixTop: function fixTop() {
  11371. 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);
  11372. }, fixBottom: function fixBottom() {
  11373. 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);
  11374. }, unbind: function unbind() {
  11375. h.is.bound() && (h.debug("Removing container bound position on element"), h.remove.offset(), S.removeClass(b.bound).removeClass(b.top).removeClass(b.bottom));
  11376. }, unfix: function unfix() {
  11377. 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));
  11378. }, reset: function reset() {
  11379. h.debug("Resetting elements position"), h.unbind(), h.unfix(), h.resetCSS(), h.remove.offset(), h.remove.lastScroll();
  11380. }, resetCSS: function resetCSS() {
  11381. S.css({ width: "", height: "" }), r.css({ height: "" });
  11382. }, setting: function setting(t, n) {
  11383. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  11384. if (n === i) return v[t];v[t] = n;
  11385. }
  11386. }, internal: function internal(t, n) {
  11387. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  11388. if (n === i) return h[t];h[t] = n;
  11389. }
  11390. }, debug: function debug() {
  11391. !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)));
  11392. }, verbose: function verbose() {
  11393. !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)));
  11394. }, error: function error() {
  11395. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  11396. }, performance: { log: function log(e) {
  11397. 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);
  11398. }, display: function display() {
  11399. var t = v.name + ":",
  11400. n = 0;l = !1, clearTimeout(h.performance.timer), e.each(c, function (e, t) {
  11401. n += t["Execution Time"];
  11402. }), 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) {
  11403. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11404. }), console.groupEnd()), c = [];
  11405. } }, invoke: function invoke(t, n, o) {
  11406. var r,
  11407. s,
  11408. l,
  11409. 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) {
  11410. 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 {
  11411. 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];
  11412. }
  11413. })), 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;
  11414. } }, d ? (A === i && h.initialize(), h.invoke(u)) : (A !== i && A.invoke("destroy"), h.initialize());
  11415. }), a !== i ? a : this;
  11416. }, 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" } };
  11417. }(jQuery, window, document), function (e, t, n, i) {
  11418. "use strict";
  11419. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.tab = function (o) {
  11420. var a,
  11421. r = e.isFunction(this) ? e(t) : e(this),
  11422. s = r.selector || "",
  11423. l = new Date().getTime(),
  11424. c = [],
  11425. u = arguments[0],
  11426. d = "string" == typeof u,
  11427. f = [].slice.call(arguments, 1),
  11428. m = !1;return r.each(function () {
  11429. var g,
  11430. p,
  11431. h,
  11432. v,
  11433. b,
  11434. y,
  11435. x = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.tab.settings, o) : e.extend({}, e.fn.tab.settings),
  11436. C = x.className,
  11437. w = x.metadata,
  11438. S = x.selector,
  11439. k = x.error,
  11440. T = "." + x.namespace,
  11441. A = "module-" + x.namespace,
  11442. R = e(this),
  11443. P = {},
  11444. E = !0,
  11445. F = 0,
  11446. O = this,
  11447. D = R.data(A);b = { initialize: function initialize() {
  11448. 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();
  11449. }, instantiate: function instantiate() {
  11450. b.verbose("Storing instance of module", b), D = b, R.data(A, b);
  11451. }, destroy: function destroy() {
  11452. b.debug("Destroying tabs", R), R.removeData(A).off(T);
  11453. }, bind: { events: function events() {
  11454. e.isWindow(O) || (b.debug("Attaching tab activation events to element", R), R.on("click" + T, b.event.click));
  11455. } }, determineTabs: function determineTabs() {
  11456. 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));
  11457. }, fix: { callbacks: function callbacks() {
  11458. 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));
  11459. } }, initializeHistory: function initializeHistory() {
  11460. if (b.debug("Initializing page state"), e.address === i) return b.error(k.state), !1;if ("state" == x.historyType) {
  11461. if (b.debug("Using HTML5 to manage state"), !1 === x.path) return b.error(k.path), !1;e.address.history(!0).state(x.path);
  11462. }e.address.bind("change", b.event.history.change);
  11463. }, event: { click: function click(t) {
  11464. 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");
  11465. }, history: { change: function change(t) {
  11466. var n = t.pathNames.join("/") || b.get.initialPath(),
  11467. 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);
  11468. } } }, refresh: function refresh() {
  11469. h && (b.debug("Refreshing tab", h), b.changeTab(h));
  11470. }, cache: { read: function read(e) {
  11471. return e !== i && P[e];
  11472. }, add: function add(e, t) {
  11473. e = e || h, b.debug("Adding cached content for", e), P[e] = t;
  11474. }, remove: function remove(e) {
  11475. e = e || h, b.debug("Removing cached content for", e), delete P[e];
  11476. } }, set: { auto: function auto() {
  11477. 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 };
  11478. }, loading: function loading(e) {
  11479. 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));
  11480. }, state: function state(t) {
  11481. e.address.value(t);
  11482. } }, changeTab: function changeTab(n) {
  11483. var i = t.history && t.history.pushState && x.ignoreFirstLoad && E,
  11484. o = x.auto || e.isPlainObject(x.apiSettings),
  11485. a = o && !i ? b.utilities.pathToArray(n) : b.get.defaultPathArray(n);n = b.utilities.arrayToPath(a), e.each(a, function (t, r) {
  11486. var s,
  11487. l,
  11488. c,
  11489. u,
  11490. d = a.slice(0, t + 1),
  11491. f = b.utilities.arrayToPath(d),
  11492. m = b.is.tab(f),
  11493. p = t + 1 == a.length,
  11494. S = b.get.tabElement(f);if (b.verbose("Looking for tab", r), m) {
  11495. 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);
  11496. } else {
  11497. 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 () {
  11498. b.scrollTo(s);
  11499. }, 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;
  11500. }
  11501. });
  11502. }, scrollTo: function scrollTo(t) {
  11503. 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));
  11504. }, update: { content: function content(t, n, o) {
  11505. var a = b.get.tabElement(t),
  11506. 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);
  11507. } }, fetch: { content: function content(t, n) {
  11508. var o,
  11509. a,
  11510. r = b.get.tabElement(t),
  11511. s = { dataType: "html", encodeParameters: !1, on: "now", cache: x.alwaysRefresh, headers: { "X-Remote": !0 }, onSuccess: function onSuccess(e) {
  11512. "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 () {
  11513. var e = r.children().clone(!0);e = e.not("script"), b.cache.add(n, e);
  11514. }, 0) : b.cache.add(n, r.html());
  11515. }, urlData: { tab: n } },
  11516. l = r.api("get request") || !1,
  11517. 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);
  11518. } }, activate: { all: function all(e) {
  11519. b.activate.tab(e), b.activate.navigation(e);
  11520. }, tab: function tab(e) {
  11521. var t = b.get.tabElement(e),
  11522. n = "siblings" == x.deactivate ? t.siblings(p) : p.not(t),
  11523. 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));
  11524. }, navigation: function navigation(e) {
  11525. var t = b.get.navElement(e),
  11526. n = "siblings" == x.deactivate ? t.siblings(r) : r.not(t),
  11527. i = t.hasClass(C.active);b.verbose("Activating tab navigation for", t, e), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading));
  11528. } }, deactivate: { all: function all() {
  11529. b.deactivate.navigation(), b.deactivate.tabs();
  11530. }, navigation: function navigation() {
  11531. r.removeClass(C.active);
  11532. }, tabs: function tabs() {
  11533. p.removeClass(C.active + " " + C.loading);
  11534. } }, is: { tab: function tab(e) {
  11535. return e !== i && b.get.tabElement(e).length > 0;
  11536. } }, get: { initialPath: function initialPath() {
  11537. return r.eq(0).data(w.tab) || p.eq(0).data(w.tab);
  11538. }, path: function path() {
  11539. return e.address.value();
  11540. }, defaultPathArray: function defaultPathArray(e) {
  11541. return b.utilities.pathToArray(b.get.defaultPath(e));
  11542. }, defaultPath: function defaultPath(e) {
  11543. var t = r.filter("[data-" + w.tab + '^="' + e + '/"]').eq(0).data(w.tab) || !1;if (t) {
  11544. if (b.debug("Found default tab", t), F < x.maxDepth) return F++, b.get.defaultPath(t);b.error(k.recursion);
  11545. } else b.debug("No default tabs found for", e, p);return F = 0, e;
  11546. }, navElement: function navElement(e) {
  11547. return e = e || h, r.filter("[data-" + w.tab + '="' + e + '"]');
  11548. }, tabElement: function tabElement(e) {
  11549. 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;
  11550. }, tab: function tab() {
  11551. return h;
  11552. } }, utilities: { filterArray: function filterArray(t, n) {
  11553. return e.grep(t, function (t) {
  11554. return -1 == e.inArray(t, n);
  11555. });
  11556. }, last: function last(t) {
  11557. return !!e.isArray(t) && t[t.length - 1];
  11558. }, pathToArray: function pathToArray(e) {
  11559. return e === i && (e = h), "string" == typeof e ? e.split("/") : [e];
  11560. }, arrayToPath: function arrayToPath(t) {
  11561. return !!e.isArray(t) && t.join("/");
  11562. } }, setting: function setting(t, n) {
  11563. if (b.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, x, t);else {
  11564. if (n === i) return x[t];e.isPlainObject(x[t]) ? e.extend(!0, x[t], n) : x[t] = n;
  11565. }
  11566. }, internal: function internal(t, n) {
  11567. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  11568. if (n === i) return b[t];b[t] = n;
  11569. }
  11570. }, debug: function debug() {
  11571. !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)));
  11572. }, verbose: function verbose() {
  11573. !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)));
  11574. }, error: function error() {
  11575. x.silent || (b.error = Function.prototype.bind.call(console.error, console, x.name + ":"), b.error.apply(console, arguments));
  11576. }, performance: { log: function log(e) {
  11577. 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);
  11578. }, display: function display() {
  11579. var t = x.name + ":",
  11580. n = 0;l = !1, clearTimeout(b.performance.timer), e.each(c, function (e, t) {
  11581. n += t["Execution Time"];
  11582. }), 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) {
  11583. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11584. }), console.groupEnd()), c = [];
  11585. } }, invoke: function invoke(t, n, o) {
  11586. var r,
  11587. s,
  11588. l,
  11589. 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) {
  11590. 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 {
  11591. 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];
  11592. }
  11593. })), 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;
  11594. } }, d ? (D === i && b.initialize(), b.invoke(u)) : (D !== i && D.invoke("destroy"), b.initialize());
  11595. }), a !== i ? a : this;
  11596. }, e.tab = function () {
  11597. e(t).tab.apply(this, arguments);
  11598. }, 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" } };
  11599. }(jQuery, window, document), function (e, t, n, i) {
  11600. "use strict";
  11601. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.transition = function () {
  11602. var o,
  11603. a = e(this),
  11604. r = a.selector || "",
  11605. s = new Date().getTime(),
  11606. l = [],
  11607. c = arguments,
  11608. u = c[0],
  11609. d = [].slice.call(arguments, 1),
  11610. f = "string" == typeof u;t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function (t) {
  11611. var m,
  11612. g,
  11613. p,
  11614. h,
  11615. v,
  11616. b,
  11617. y,
  11618. x,
  11619. C,
  11620. w = e(this),
  11621. S = this;(C = { initialize: function initialize() {
  11622. 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());
  11623. }, instantiate: function instantiate() {
  11624. C.verbose("Storing instance of module", C), g = C, w.data(y, g);
  11625. }, destroy: function destroy() {
  11626. C.verbose("Destroying previous module for", S), w.removeData(y);
  11627. }, refresh: function refresh() {
  11628. C.verbose("Refreshing display type on next animation"), delete C.displayType;
  11629. }, forceRepaint: function forceRepaint() {
  11630. C.verbose("Forcing element repaint");var e = w.parent(),
  11631. t = w.next();0 === t.length ? w.detach().appendTo(e) : w.detach().insertBefore(t);
  11632. }, repaint: function repaint() {
  11633. C.verbose("Repainting element");S.offsetWidth;
  11634. }, delay: function delay(e) {
  11635. var n,
  11636. 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);
  11637. }, animate: function animate(e) {
  11638. if (m = e || m, !C.is.supported()) return C.error(p.support), !1;if (C.debug("Preparing animation", m.animation), C.is.animating()) {
  11639. 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();
  11640. }C.can.animate() ? C.set.animating(m.animation) : C.error(p.noAnimation, m.animation, S);
  11641. }, reset: function reset() {
  11642. C.debug("Resetting animation to beginning conditions"), C.remove.animationCallbacks(), C.restore.conditions(), C.remove.animating();
  11643. }, queue: function queue(e) {
  11644. C.debug("Queueing animation of", e), C.queuing = !0, w.one(b + ".queue" + x, function () {
  11645. C.queuing = !1, C.repaint(), C.animate.apply(this, m);
  11646. });
  11647. }, complete: function complete(e) {
  11648. 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)));
  11649. }, force: { visible: function visible() {
  11650. var e = w.attr("style"),
  11651. t = C.get.userStyle(),
  11652. n = C.get.displayType(),
  11653. o = t + "display: " + n + " !important;",
  11654. a = w.css("display"),
  11655. r = e === i || "" === e;a !== n ? (C.verbose("Overriding default display to show element", n), w.attr("style", o)) : r && w.removeAttr("style");
  11656. }, hidden: function hidden() {
  11657. var e = w.attr("style"),
  11658. t = w.css("display"),
  11659. 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"));
  11660. } }, has: { direction: function direction(t) {
  11661. var n = !1;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  11662. t !== h.inward && t !== h.outward || (n = !0);
  11663. })), n;
  11664. }, inlineDisplay: function inlineDisplay() {
  11665. var t = w.attr("style") || "";return e.isArray(t.match(/display.*?;/, ""));
  11666. } }, set: { animating: function animating(e) {
  11667. 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);
  11668. }, duration: function duration(e, t) {
  11669. ((t = "number" == typeof (t = t || m.duration) ? t + "ms" : t) || 0 === t) && (C.verbose("Setting animation duration", t), w.css({ "animation-duration": t }));
  11670. }, direction: function direction(e) {
  11671. (e = e || C.get.direction()) == h.inward ? C.set.inward() : C.set.outward();
  11672. }, looping: function looping() {
  11673. C.debug("Transition set to loop"), w.addClass(h.looping);
  11674. }, hidden: function hidden() {
  11675. w.addClass(h.transition).addClass(h.hidden);
  11676. }, inward: function inward() {
  11677. C.debug("Setting direction to inward"), w.removeClass(h.outward).addClass(h.inward);
  11678. }, outward: function outward() {
  11679. C.debug("Setting direction to outward"), w.removeClass(h.inward).addClass(h.outward);
  11680. }, visible: function visible() {
  11681. w.addClass(h.transition).addClass(h.visible);
  11682. } }, start: { animation: function animation(e) {
  11683. 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);
  11684. } }, save: { animation: function animation(e) {
  11685. C.cache || (C.cache = {}), C.cache.animation = e;
  11686. }, displayType: function displayType(e) {
  11687. "none" !== e && w.data(v.displayType, e);
  11688. }, transitionExists: function transitionExists(t, n) {
  11689. e.fn.transition.exists[t] = n, C.verbose("Saving existence of transition", t, n);
  11690. } }, restore: { conditions: function conditions() {
  11691. var e = C.get.currentAnimation();e && (w.removeClass(e), C.verbose("Removing animation class", C.cache)), C.remove.duration();
  11692. } }, add: { failSafe: function failSafe() {
  11693. var e = C.get.duration();C.timer = setTimeout(function () {
  11694. w.triggerHandler(b);
  11695. }, e + m.failSafeDelay), C.verbose("Adding fail safe timer", C.timer);
  11696. } }, remove: { animating: function animating() {
  11697. w.removeClass(h.animating);
  11698. }, animationCallbacks: function animationCallbacks() {
  11699. C.remove.queueCallback(), C.remove.completeCallback();
  11700. }, queueCallback: function queueCallback() {
  11701. w.off(".queue" + x);
  11702. }, completeCallback: function completeCallback() {
  11703. w.off(".complete" + x);
  11704. }, display: function display() {
  11705. w.css("display", "");
  11706. }, direction: function direction() {
  11707. w.removeClass(h.inward).removeClass(h.outward);
  11708. }, duration: function duration() {
  11709. w.css("animation-duration", "");
  11710. }, failSafe: function failSafe() {
  11711. C.verbose("Removing fail safe timer", C.timer), C.timer && clearTimeout(C.timer);
  11712. }, hidden: function hidden() {
  11713. w.removeClass(h.hidden);
  11714. }, visible: function visible() {
  11715. w.removeClass(h.visible);
  11716. }, looping: function looping() {
  11717. C.debug("Transitions are no longer looping"), C.is.looping() && (C.reset(), w.removeClass(h.looping));
  11718. }, transition: function transition() {
  11719. w.removeClass(h.visible).removeClass(h.hidden);
  11720. } }, get: { settings: function settings(t, n, i) {
  11721. 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 });
  11722. }, animationClass: function animationClass(e) {
  11723. var t = e || m.animation,
  11724. n = C.can.transition() && !C.has.direction() ? C.get.direction() + " " : "";return h.animating + " " + h.transition + " " + n + t;
  11725. }, currentAnimation: function currentAnimation() {
  11726. return !(!C.cache || C.cache.animation === i) && C.cache.animation;
  11727. }, currentDirection: function currentDirection() {
  11728. return C.is.inward() ? h.inward : h.outward;
  11729. }, direction: function direction() {
  11730. return C.is.hidden() || !C.is.visible() ? h.inward : h.outward;
  11731. }, animationDirection: function animationDirection(t) {
  11732. var n;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  11733. t === h.inward ? n = h.inward : t === h.outward && (n = h.outward);
  11734. })), n || !1;
  11735. }, duration: function duration(e) {
  11736. 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;
  11737. }, displayType: function displayType(e) {
  11738. return e = e === i || e, m.displayType ? m.displayType : (e && w.data(v.displayType) === i && C.can.transition(!0), w.data(v.displayType));
  11739. }, userStyle: function userStyle(e) {
  11740. return (e = e || w.attr("style") || "").replace(/display.*?;/, "");
  11741. }, transitionExists: function transitionExists(t) {
  11742. return e.fn.transition.exists[t];
  11743. }, animationStartEvent: function animationStartEvent() {
  11744. var e,
  11745. t = n.createElement("div"),
  11746. o = { animation: "animationstart", OAnimation: "oAnimationStart", MozAnimation: "mozAnimationStart", WebkitAnimation: "webkitAnimationStart" };for (e in o) {
  11747. if (t.style[e] !== i) return o[e];
  11748. }return !1;
  11749. }, animationEndEvent: function animationEndEvent() {
  11750. var e,
  11751. t = n.createElement("div"),
  11752. o = { animation: "animationend", OAnimation: "oAnimationEnd", MozAnimation: "mozAnimationEnd", WebkitAnimation: "webkitAnimationEnd" };for (e in o) {
  11753. if (t.style[e] !== i) return o[e];
  11754. }return !1;
  11755. } }, can: { transition: function transition(t) {
  11756. var n,
  11757. o,
  11758. a,
  11759. r,
  11760. s,
  11761. l,
  11762. c = m.animation,
  11763. u = C.get.transitionExists(c),
  11764. d = C.get.displayType(!1);if (u === i || t) {
  11765. 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 {
  11766. if ("none" == r || !r) return void C.debug("No animation defined in css", c);C.debug("Static animation found", c, d), l = !1;
  11767. }C.save.transitionExists(c, l);
  11768. }return u !== i ? u : l;
  11769. }, animate: function animate() {
  11770. return C.can.transition() !== i;
  11771. } }, is: { animating: function animating() {
  11772. return w.hasClass(h.animating);
  11773. }, inward: function inward() {
  11774. return w.hasClass(h.inward);
  11775. }, outward: function outward() {
  11776. return w.hasClass(h.outward);
  11777. }, looping: function looping() {
  11778. return w.hasClass(h.looping);
  11779. }, occurring: function occurring(e) {
  11780. return e = "." + (e = e || m.animation).replace(" ", "."), w.filter(e).length > 0;
  11781. }, visible: function visible() {
  11782. return w.is(":visible");
  11783. }, hidden: function hidden() {
  11784. return "hidden" === w.css("visibility");
  11785. }, supported: function supported() {
  11786. return !1 !== b;
  11787. } }, hide: function hide() {
  11788. 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);
  11789. }, show: function show(e) {
  11790. C.verbose("Showing element", e), C.remove.hidden(), C.set.visible(), C.force.visible(), m.onShow.call(S), m.onComplete.call(S);
  11791. }, toggle: function toggle() {
  11792. C.is.visible() ? C.hide() : C.show();
  11793. }, stop: function stop() {
  11794. C.debug("Stopping current animation"), w.triggerHandler(b);
  11795. }, stopAll: function stopAll() {
  11796. C.debug("Stopping all animation"), C.remove.queueCallback(), w.triggerHandler(b);
  11797. }, clear: { queue: function queue() {
  11798. C.debug("Clearing animation queue"), C.remove.queueCallback();
  11799. } }, enable: function enable() {
  11800. C.verbose("Starting animation"), w.removeClass(h.disabled);
  11801. }, disable: function disable() {
  11802. C.debug("Stopping animation"), w.addClass(h.disabled);
  11803. }, setting: function setting(t, n) {
  11804. if (C.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  11805. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  11806. }
  11807. }, internal: function internal(t, n) {
  11808. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  11809. if (n === i) return C[t];C[t] = n;
  11810. }
  11811. }, debug: function debug() {
  11812. !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)));
  11813. }, verbose: function verbose() {
  11814. !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)));
  11815. }, error: function error() {
  11816. m.silent || (C.error = Function.prototype.bind.call(console.error, console, m.name + ":"), C.error.apply(console, arguments));
  11817. }, performance: { log: function log(e) {
  11818. 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);
  11819. }, display: function display() {
  11820. var t = m.name + ":",
  11821. n = 0;s = !1, clearTimeout(C.performance.timer), e.each(l, function (e, t) {
  11822. n += t["Execution Time"];
  11823. }), 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) {
  11824. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11825. }), console.groupEnd()), l = [];
  11826. } }, invoke: function invoke(t, n, a) {
  11827. var r,
  11828. s,
  11829. l,
  11830. 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) {
  11831. 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 {
  11832. 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];
  11833. }
  11834. })), 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;
  11835. } }).initialize();
  11836. }), o !== i ? o : this;
  11837. }, 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" } };
  11838. }(jQuery, window, document), function (e, t, n, i) {
  11839. "use strict";
  11840. 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) {
  11841. var o,
  11842. a = e.isFunction(this) ? e(t) : e(this),
  11843. r = a.selector || "",
  11844. s = new Date().getTime(),
  11845. l = [],
  11846. c = arguments[0],
  11847. u = "string" == typeof c,
  11848. d = [].slice.call(arguments, 1);return a.each(function () {
  11849. var a,
  11850. f,
  11851. m,
  11852. g,
  11853. p,
  11854. h,
  11855. v = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.api.settings, n) : e.extend({}, e.fn.api.settings),
  11856. b = v.namespace,
  11857. y = v.metadata,
  11858. x = v.selector,
  11859. C = v.error,
  11860. w = v.className,
  11861. S = "." + b,
  11862. k = "module-" + b,
  11863. T = e(this),
  11864. A = T.closest(x.form),
  11865. R = v.stateContext ? e(v.stateContext) : T,
  11866. P = this,
  11867. E = R[0],
  11868. F = T.data(k);h = { initialize: function initialize() {
  11869. u || h.bind.events(), h.instantiate();
  11870. }, instantiate: function instantiate() {
  11871. h.verbose("Storing instance of module", h), F = h, T.data(k, F);
  11872. }, destroy: function destroy() {
  11873. h.verbose("Destroying previous module for", P), T.removeData(k).off(S);
  11874. }, bind: { events: function events() {
  11875. 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());
  11876. } }, decode: { json: function json(e) {
  11877. if (e !== i && "string" == typeof e) try {
  11878. e = JSON.parse(e);
  11879. } catch (e) {}return e;
  11880. } }, read: { cachedResponse: function cachedResponse(e) {
  11881. 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);
  11882. } }, write: { cachedResponse: function cachedResponse(n, o) {
  11883. 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);
  11884. } }, query: function query() {
  11885. if (h.is.disabled()) h.debug("Element is disabled API request aborted");else {
  11886. if (h.is.loading()) {
  11887. if (!v.interruptRequests) return void h.debug("Cancelling request, previous request is still pending");h.debug("Interrupting previous request"), h.abort();
  11888. }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()) {
  11889. if ((m = h.add.urlData(m)) || h.is.mocked()) {
  11890. 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 () {
  11891. h.timer && delete h.timer, h.debug("Sending throttled request", g, a.method), h.send.request();
  11892. }, 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());
  11893. }
  11894. } else h.error(C.missingURL);
  11895. }
  11896. }, should: { removeError: function removeError() {
  11897. return !0 === v.hideError || "auto" === v.hideError && !h.is.form();
  11898. } }, is: { disabled: function disabled() {
  11899. return T.filter(x.disabled).length > 0;
  11900. }, expectingJSON: function expectingJSON() {
  11901. return "json" === v.dataType || "jsonp" === v.dataType;
  11902. }, form: function form() {
  11903. return T.is("form") || R.is("form");
  11904. }, mocked: function mocked() {
  11905. return v.mockResponse || v.mockResponseAsync || v.response || v.responseAsync;
  11906. }, input: function input() {
  11907. return T.is("input");
  11908. }, loading: function loading() {
  11909. return !!h.request && "pending" == h.request.state();
  11910. }, abortedRequest: function abortedRequest(e) {
  11911. 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);
  11912. }, validResponse: function validResponse(t) {
  11913. 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);
  11914. } }, was: { cancelled: function cancelled() {
  11915. return h.cancelled || !1;
  11916. }, succesful: function succesful() {
  11917. return h.request && "resolved" == h.request.state();
  11918. }, failure: function failure() {
  11919. return h.request && "rejected" == h.request.state();
  11920. }, complete: function complete() {
  11921. return h.request && ("resolved" == h.request.state() || "rejected" == h.request.state());
  11922. } }, add: { urlData: function urlData(t, n) {
  11923. 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) {
  11924. var r = -1 !== a.indexOf("$") ? a.substr(2, a.length - 3) : a.substr(1, a.length - 2),
  11925. 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);
  11926. })), a && (h.debug("Looking for optional URL variables", o), e.each(a, function (o, a) {
  11927. var r = -1 !== a.indexOf("$") ? a.substr(3, a.length - 4) : a.substr(2, a.length - 3),
  11928. 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, ""));
  11929. }))), t;
  11930. }, formData: function formData(t) {
  11931. var n = e.fn.serializeObject !== i,
  11932. 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;
  11933. } }, send: { request: function request() {
  11934. 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);
  11935. } }, event: { trigger: function trigger(e) {
  11936. h.query(), "submit" != e.type && "click" != e.type || e.preventDefault();
  11937. }, xhr: { always: function always() {}, done: function done(t, n, i) {
  11938. var o = this,
  11939. a = new Date().getTime() - p,
  11940. r = v.loadingDuration - a,
  11941. 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 () {
  11942. h.is.validResponse(t) ? h.request.resolveWith(o, [t, i]) : h.request.rejectWith(o, [i, "invalid"]);
  11943. }, r);
  11944. }, fail: function fail(e, t, n) {
  11945. var i = this,
  11946. o = new Date().getTime() - p,
  11947. a = v.loadingDuration - o;(a = a > 0 ? a : 0) > 0 && h.debug("Response completed early delaying state change by", a), setTimeout(function () {
  11948. h.is.abortedRequest(e) ? h.request.rejectWith(i, [e, "aborted", n]) : h.request.rejectWith(i, [e, "error", t, n]);
  11949. }, a);
  11950. } }, request: { done: function done(e, t) {
  11951. 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);
  11952. }, complete: function complete(e, t) {
  11953. 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);
  11954. }, fail: function fail(e, t, n) {
  11955. var o = h.get.responseFromXHR(e),
  11956. 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);
  11957. } } }, create: { request: function request() {
  11958. return e.Deferred().always(h.event.request.complete).done(h.event.request.done).fail(h.event.request.fail);
  11959. }, mockedXHR: function mockedXHR() {
  11960. var t,
  11961. n,
  11962. i,
  11963. o = v.mockResponse || v.response,
  11964. 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) {
  11965. h.debug("Async callback returned response", e), e ? i.resolveWith(E, [e, !1, { responseText: e }]) : i.rejectWith(E, [{ responseText: e }, !1, !1]);
  11966. }, h.debug("Using specified async response callback", a), a.call(E, f, t)), i;
  11967. }, xhr: function xhr() {
  11968. 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;
  11969. } }, set: { error: function error() {
  11970. h.verbose("Adding error state to element", R), R.addClass(w.error);
  11971. }, loading: function loading() {
  11972. h.verbose("Adding loading state to element", R), R.addClass(w.loading), p = new Date().getTime();
  11973. } }, remove: { error: function error() {
  11974. h.verbose("Removing error state from element", R), R.removeClass(w.error);
  11975. }, loading: function loading() {
  11976. h.verbose("Removing loading state from element", R), R.removeClass(w.loading);
  11977. } }, get: { responseFromXHR: function responseFromXHR(t) {
  11978. return !!e.isPlainObject(t) && (h.is.expectingJSON() ? h.decode.json(t.responseText) : t.responseText);
  11979. }, errorFromRequest: function errorFromRequest(t, n, o) {
  11980. return e.isPlainObject(t) && t.error !== i ? t.error : v.error[n] !== i ? v.error[n] : o;
  11981. }, request: function request() {
  11982. return h.request || !1;
  11983. }, xhr: function xhr() {
  11984. return h.xhr || !1;
  11985. }, settings: function settings() {
  11986. 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);
  11987. }, urlEncodedValue: function urlEncodedValue(e) {
  11988. var n = t.decodeURIComponent(e),
  11989. 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);
  11990. }, defaultData: function defaultData() {
  11991. var t = {};return e.isWindow(P) || (h.is.input() ? t.value = T.val() : h.is.form() || (t.text = T.text())), t;
  11992. }, event: function event() {
  11993. 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;
  11994. }, templatedURL: function templatedURL(e) {
  11995. 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) {
  11996. 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];
  11997. } 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;
  11998. } }, abort: function abort() {
  11999. var e = h.get.xhr();e && "resolved" !== e.state() && (h.debug("Cancelling API request"), e.abort());
  12000. }, reset: function reset() {
  12001. h.remove.error(), h.remove.loading();
  12002. }, setting: function setting(t, n) {
  12003. if (h.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, v, t);else {
  12004. if (n === i) return v[t];e.isPlainObject(v[t]) ? e.extend(!0, v[t], n) : v[t] = n;
  12005. }
  12006. }, internal: function internal(t, n) {
  12007. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  12008. if (n === i) return h[t];h[t] = n;
  12009. }
  12010. }, debug: function debug() {
  12011. !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)));
  12012. }, verbose: function verbose() {
  12013. !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)));
  12014. }, error: function error() {
  12015. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  12016. }, performance: { log: function log(e) {
  12017. 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);
  12018. }, display: function display() {
  12019. var t = v.name + ":",
  12020. n = 0;s = !1, clearTimeout(h.performance.timer), e.each(l, function (e, t) {
  12021. n += t["Execution Time"];
  12022. }), 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) {
  12023. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12024. }), console.groupEnd()), l = [];
  12025. } }, invoke: function invoke(t, n, a) {
  12026. var r,
  12027. s,
  12028. l,
  12029. 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) {
  12030. 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 {
  12031. 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];
  12032. }
  12033. })), 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;
  12034. } }, u ? (F === i && h.initialize(), h.invoke(c)) : (F !== i && F.invoke("destroy"), h.initialize());
  12035. }), o !== i ? o : this;
  12036. }, 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) {
  12037. return e;
  12038. }, 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" } };
  12039. }(jQuery, window, document), function (e, t, n, i) {
  12040. "use strict";
  12041. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.visibility = function (o) {
  12042. var a,
  12043. r = e(this),
  12044. s = r.selector || "",
  12045. l = new Date().getTime(),
  12046. c = [],
  12047. u = arguments[0],
  12048. d = "string" == typeof u,
  12049. f = [].slice.call(arguments, 1),
  12050. m = r.length,
  12051. g = 0;return r.each(function () {
  12052. var r,
  12053. p,
  12054. h,
  12055. v,
  12056. b = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.visibility.settings, o) : e.extend({}, e.fn.visibility.settings),
  12057. y = b.className,
  12058. x = b.namespace,
  12059. C = b.error,
  12060. w = b.metadata,
  12061. S = "." + x,
  12062. k = "module-" + x,
  12063. T = e(t),
  12064. A = e(this),
  12065. R = e(b.context),
  12066. P = (A.selector, A.data(k)),
  12067. E = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  12068. setTimeout(e, 0);
  12069. },
  12070. F = this,
  12071. O = !1;v = { initialize: function initialize() {
  12072. 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();
  12073. }, instantiate: function instantiate() {
  12074. v.debug("Storing instance", v), A.data(k, v), P = v;
  12075. }, destroy: function destroy() {
  12076. 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);
  12077. }, observeChanges: function observeChanges() {
  12078. "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));
  12079. }, bind: { events: function events() {
  12080. 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);
  12081. } }, event: { changed: function changed(e) {
  12082. v.verbose("DOM tree modified, updating visibility calculations"), v.timer = setTimeout(function () {
  12083. v.verbose("DOM tree modified, updating sticky menu"), v.refresh();
  12084. }, 100);
  12085. }, contextChanged: function contextChanged(t) {
  12086. [].forEach.call(t, function (t) {
  12087. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  12088. (t == F || e(t).find(F).length > 0) && (v.debug("Element removed from DOM, tearing down events"), v.destroy());
  12089. });
  12090. });
  12091. }, resize: function resize() {
  12092. v.debug("Window resized"), b.refreshOnResize && E(v.refresh);
  12093. }, load: function load() {
  12094. v.debug("Page finished loading"), E(v.refresh);
  12095. }, scroll: function scroll() {
  12096. b.throttle ? (clearTimeout(v.timer), v.timer = setTimeout(function () {
  12097. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  12098. }, b.throttle)) : E(function () {
  12099. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  12100. });
  12101. }, scrollchange: function scrollchange(e, t) {
  12102. v.checkVisibility(t);
  12103. } }, precache: function precache(t, i) {
  12104. t instanceof Array || (t = [t]);for (var o = t.length, a = 0, r = [], s = n.createElement("img"), l = function l() {
  12105. ++a >= t.length && e.isFunction(i) && i();
  12106. }; o--;) {
  12107. (s = n.createElement("img")).onload = l, s.onerror = l, s.src = t[o], r.push(s);
  12108. }
  12109. }, enableCallbacks: function enableCallbacks() {
  12110. v.debug("Allowing callbacks to occur"), O = !1;
  12111. }, disableCallbacks: function disableCallbacks() {
  12112. v.debug("Disabling all callbacks temporarily"), O = !0;
  12113. }, should: { trackChanges: function trackChanges() {
  12114. return d ? (v.debug("One time query, no need to bind events"), !1) : (v.debug("Callbacks being attached"), !0);
  12115. } }, setup: { cache: function cache() {
  12116. v.cache = { occurred: {}, screen: {}, element: {} };
  12117. }, image: function image() {
  12118. var e = A.data(w.src);e && (v.verbose("Lazy loading image", e), b.once = !0, b.observeChanges = !1, b.onOnScreen = function () {
  12119. v.debug("Image on screen", F), v.precache(e, function () {
  12120. v.set.image(e, function () {
  12121. ++g == m && b.onAllLoaded.call(this), b.onLoad.call(this);
  12122. });
  12123. });
  12124. });
  12125. }, fixed: function fixed() {
  12126. 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 () {
  12127. 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);
  12128. }, b.onTopPassedReverse = function () {
  12129. v.debug("Element returned to position, removing fixed", A), v.hide.placeholder(), v.remove.fixed();
  12130. };
  12131. } }, create: { placeholder: function placeholder() {
  12132. v.verbose("Creating fixed position placeholder"), r = A.clone(!1).css("display", "none").addClass(y.placeholder).insertAfter(A);
  12133. } }, show: { placeholder: function placeholder() {
  12134. v.verbose("Showing placeholder"), r.css("display", "block").css("visibility", "hidden");
  12135. } }, hide: { placeholder: function placeholder() {
  12136. v.verbose("Hiding placeholder"), r.css("display", "none").css("visibility", "");
  12137. } }, set: { fixed: function fixed() {
  12138. 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);
  12139. }, image: function image(t, n) {
  12140. if (A.attr("src", t), b.transition) {
  12141. if (e.fn.transition !== i) {
  12142. if (A.hasClass(y.visible)) return void v.debug("Transition already occurred on this image, skipping animation");A.transition(b.transition, b.duration, n);
  12143. } else A.fadeIn(b.duration, n);
  12144. } else A.show();
  12145. } }, is: { onScreen: function onScreen() {
  12146. return v.get.elementCalculations().onScreen;
  12147. }, offScreen: function offScreen() {
  12148. return v.get.elementCalculations().offScreen;
  12149. }, visible: function visible() {
  12150. return !(!v.cache || !v.cache.element) && !(0 === v.cache.element.width && 0 === v.cache.element.offset.top);
  12151. }, verticallyScrollableContext: function verticallyScrollableContext() {
  12152. var e = R.get(0) !== t && R.css("overflow-y");return "auto" == e || "scroll" == e;
  12153. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  12154. var e = R.get(0) !== t && R.css("overflow-x");return "auto" == e || "scroll" == e;
  12155. } }, refresh: function refresh() {
  12156. v.debug("Refreshing constants (width/height)"), "fixed" == b.type && v.resetFixed(), v.reset(), v.save.position(), b.checkOnRefresh && v.checkVisibility(), b.onRefresh.call(F);
  12157. }, resetFixed: function resetFixed() {
  12158. v.remove.fixed(), v.remove.occurred();
  12159. }, reset: function reset() {
  12160. v.verbose("Resetting all cached values"), e.isPlainObject(v.cache) && (v.cache.screen = {}, v.cache.element = {});
  12161. }, checkVisibility: function checkVisibility(e) {
  12162. 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()));
  12163. }, passed: function passed(t, n) {
  12164. var o = v.get.elementCalculations();if (t && n) b.onPassed[t] = n;else {
  12165. if (t !== i) return v.get.pixelsPassed(t) > o.pixelsPassed;o.passing && e.each(b.onPassed, function (e, t) {
  12166. o.bottomVisible || o.pixelsPassed > v.get.pixelsPassed(e) ? v.execute(t, e) : b.once || v.remove.occurred(t);
  12167. });
  12168. }
  12169. }, onScreen: function onScreen(e) {
  12170. var t = v.get.elementCalculations(),
  12171. n = e || b.onOnScreen,
  12172. 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;
  12173. }, offScreen: function offScreen(e) {
  12174. var t = v.get.elementCalculations(),
  12175. n = e || b.onOffScreen,
  12176. 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;
  12177. }, passing: function passing(e) {
  12178. var t = v.get.elementCalculations(),
  12179. n = e || b.onPassing,
  12180. 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;
  12181. }, topVisible: function topVisible(e) {
  12182. var t = v.get.elementCalculations(),
  12183. n = e || b.onTopVisible,
  12184. 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;
  12185. }, bottomVisible: function bottomVisible(e) {
  12186. var t = v.get.elementCalculations(),
  12187. n = e || b.onBottomVisible,
  12188. 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;
  12189. }, topPassed: function topPassed(e) {
  12190. var t = v.get.elementCalculations(),
  12191. n = e || b.onTopPassed,
  12192. 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;
  12193. }, bottomPassed: function bottomPassed(e) {
  12194. var t = v.get.elementCalculations(),
  12195. n = e || b.onBottomPassed,
  12196. 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;
  12197. }, passingReverse: function passingReverse(e) {
  12198. var t = v.get.elementCalculations(),
  12199. n = e || b.onPassingReverse,
  12200. 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;
  12201. }, topVisibleReverse: function topVisibleReverse(e) {
  12202. var t = v.get.elementCalculations(),
  12203. n = e || b.onTopVisibleReverse,
  12204. 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;
  12205. }, bottomVisibleReverse: function bottomVisibleReverse(e) {
  12206. var t = v.get.elementCalculations(),
  12207. n = e || b.onBottomVisibleReverse,
  12208. 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;
  12209. }, topPassedReverse: function topPassedReverse(e) {
  12210. var t = v.get.elementCalculations(),
  12211. n = e || b.onTopPassedReverse,
  12212. 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;
  12213. }, bottomPassedReverse: function bottomPassedReverse(e) {
  12214. var t = v.get.elementCalculations(),
  12215. n = e || b.onBottomPassedReverse,
  12216. 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;
  12217. }, execute: function execute(e, t) {
  12218. var n = v.get.elementCalculations(),
  12219. 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);
  12220. }, remove: { fixed: function fixed() {
  12221. v.debug("Removing fixed position"), A.removeClass(y.fixed).css({ position: "", top: "", left: "", zIndex: "" }), b.onUnfixed.call(F);
  12222. }, placeholder: function placeholder() {
  12223. v.debug("Removing placeholder content"), r && r.remove();
  12224. }, occurred: function occurred(e) {
  12225. if (e) {
  12226. 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);
  12227. } else v.cache.occurred = {};
  12228. } }, save: { calculations: function calculations() {
  12229. v.verbose("Saving all calculations necessary to determine positioning"), v.save.direction(), v.save.screenCalculations(), v.save.elementCalculations();
  12230. }, occurred: function occurred(e) {
  12231. e && (v.cache.occurred[e] !== i && !0 === v.cache.occurred[e] || (v.verbose("Saving callback occurred", e), v.cache.occurred[e] = !0));
  12232. }, scroll: function scroll(e) {
  12233. e = e + b.offset || R.scrollTop() + b.offset, v.cache.scroll = e;
  12234. }, direction: function direction() {
  12235. var e,
  12236. t = v.get.scroll(),
  12237. n = v.get.lastScroll();return e = t > n && n ? "down" : t < n && n ? "up" : "static", v.cache.direction = e, v.cache.direction;
  12238. }, elementPosition: function elementPosition() {
  12239. var e = v.cache.element,
  12240. 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;
  12241. }, elementCalculations: function elementCalculations() {
  12242. var e = v.get.screenCalculations(),
  12243. 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;
  12244. }, screenCalculations: function screenCalculations() {
  12245. 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;
  12246. }, screenSize: function screenSize() {
  12247. v.verbose("Saving window position"), v.cache.screen = { height: R.height() };
  12248. }, position: function position() {
  12249. v.save.screenSize(), v.save.elementPosition();
  12250. } }, get: { pixelsPassed: function pixelsPassed(e) {
  12251. var t = v.get.elementCalculations();return e.search("%") > -1 ? t.height * (parseInt(e, 10) / 100) : parseInt(e, 10);
  12252. }, occurred: function occurred(e) {
  12253. return v.cache.occurred !== i && v.cache.occurred[e] || !1;
  12254. }, direction: function direction() {
  12255. return v.cache.direction === i && v.save.direction(), v.cache.direction;
  12256. }, elementPosition: function elementPosition() {
  12257. return v.cache.element === i && v.save.elementPosition(), v.cache.element;
  12258. }, elementCalculations: function elementCalculations() {
  12259. return v.cache.element === i && v.save.elementCalculations(), v.cache.element;
  12260. }, screenCalculations: function screenCalculations() {
  12261. return v.cache.screen === i && v.save.screenCalculations(), v.cache.screen;
  12262. }, screenSize: function screenSize() {
  12263. return v.cache.screen === i && v.save.screenSize(), v.cache.screen;
  12264. }, scroll: function scroll() {
  12265. return v.cache.scroll === i && v.save.scroll(), v.cache.scroll;
  12266. }, lastScroll: function lastScroll() {
  12267. return v.cache.screen === i ? (v.debug("First scroll event, no last scroll could be found"), !1) : v.cache.screen.top;
  12268. } }, setting: function setting(t, n) {
  12269. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  12270. if (n === i) return b[t];b[t] = n;
  12271. }
  12272. }, internal: function internal(t, n) {
  12273. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  12274. if (n === i) return v[t];v[t] = n;
  12275. }
  12276. }, debug: function debug() {
  12277. !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)));
  12278. }, verbose: function verbose() {
  12279. !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)));
  12280. }, error: function error() {
  12281. b.silent || (v.error = Function.prototype.bind.call(console.error, console, b.name + ":"), v.error.apply(console, arguments));
  12282. }, performance: { log: function log(e) {
  12283. 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);
  12284. }, display: function display() {
  12285. var t = b.name + ":",
  12286. n = 0;l = !1, clearTimeout(v.performance.timer), e.each(c, function (e, t) {
  12287. n += t["Execution Time"];
  12288. }), 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) {
  12289. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12290. }), console.groupEnd()), c = [];
  12291. } }, invoke: function invoke(t, n, o) {
  12292. var r,
  12293. s,
  12294. l,
  12295. 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) {
  12296. 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 {
  12297. 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];
  12298. }
  12299. })), 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;
  12300. } }, d ? (P === i && v.initialize(), P.save.scroll(), P.save.calculations(), v.invoke(u)) : (P !== i && P.invoke("destroy"), v.initialize());
  12301. }), a !== i ? a : this;
  12302. }, 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" } };
  12303. }(jQuery, window, document);
  12304. /***/ }),
  12305. /***/ "./js/services/i18nHelper.js":
  12306. /*!***********************************!*\
  12307. !*** ./js/services/i18nHelper.js ***!
  12308. \***********************************/
  12309. /*! no static exports found */
  12310. /***/ (function(module, exports, __webpack_require__) {
  12311. "use strict";
  12312. Object.defineProperty(exports, "__esModule", {
  12313. value: true
  12314. });
  12315. exports.i18nHelper = undefined;
  12316. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  12317. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  12318. var _localizedStringsService = __webpack_require__(/*! ./localizedStringsService */ "./js/services/localizedStringsService.js");
  12319. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12320. var StringTypes = _lineI18n2.default.StringTypes;
  12321. var i18nHelper = exports.i18nHelper = Object.freeze({
  12322. i18n: function i18n(identifier) {
  12323. var opts = identifier.split(':');
  12324. var type = opts[0].toLowerCase();
  12325. var id = opts[1];
  12326. if (StringTypes.ERROR === type) {
  12327. return _localizedStringsService.LocalizedStrings.getError(id);
  12328. } else if (StringTypes.MESSAGE === type) {
  12329. return _localizedStringsService.LocalizedStrings.getMessage(id);
  12330. } else if (StringTypes.UI === type) {
  12331. return _localizedStringsService.LocalizedStrings.getUI(id);
  12332. } else {
  12333. console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> " + identifier);
  12334. return _localizedStringsService.LocalizedStrings.getString(identifier, type);
  12335. }
  12336. }
  12337. });
  12338. /***/ }),
  12339. /***/ "./js/services/languageService.js":
  12340. /*!****************************************!*\
  12341. !*** ./js/services/languageService.js ***!
  12342. \****************************************/
  12343. /*! no static exports found */
  12344. /***/ (function(module, exports, __webpack_require__) {
  12345. "use strict";
  12346. Object.defineProperty(exports, "__esModule", {
  12347. value: true
  12348. });
  12349. exports.LanguageService = undefined;
  12350. 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; }; }();
  12351. var _grammar = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.js");
  12352. var _grammar2 = _interopRequireDefault(_grammar);
  12353. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  12354. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  12355. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12356. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12357. 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; }
  12358. 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; }
  12359. // This is for LanguageService with localStorage
  12360. // const DEFAULT_LANG = "pt";
  12361. var LanguageServiceExtended = function (_line_i18n$LanguageSe) {
  12362. _inherits(LanguageServiceExtended, _line_i18n$LanguageSe);
  12363. function LanguageServiceExtended() {
  12364. _classCallCheck(this, LanguageServiceExtended);
  12365. return _possibleConstructorReturn(this, (LanguageServiceExtended.__proto__ || Object.getPrototypeOf(LanguageServiceExtended)).call(this, iLMparameters.lang));
  12366. }
  12367. _createClass(LanguageServiceExtended, [{
  12368. key: 'getCurrentLexer',
  12369. value: function getCurrentLexer() {
  12370. var langInfo = _grammar2.default[this.getLang()];
  12371. if (langInfo === null || langInfo === undefined) {
  12372. return _grammar2.default[this.getDefaultLang()].lexer;
  12373. } else {
  12374. return langInfo.lexer;
  12375. }
  12376. }
  12377. }, {
  12378. key: 'getCurrentLangFuncs',
  12379. value: function getCurrentLangFuncs() {
  12380. var langInfo = _grammar2.default[this.getLang()];
  12381. if (langInfo === null || langInfo === undefined) {
  12382. return _grammar2.default[this.getDefaultLang()].langFuncs;
  12383. } else {
  12384. return langInfo.langFuncs;
  12385. }
  12386. }
  12387. }, {
  12388. key: 'getCurrentLangLibs',
  12389. value: function getCurrentLangLibs() {
  12390. var langInfo = _grammar2.default[this.getLang()];
  12391. if (langInfo === null || langInfo === undefined) {
  12392. return _grammar2.default[this.getDefaultLang()].langLibs;
  12393. }
  12394. return langInfo.langLibs;
  12395. }
  12396. }]);
  12397. return LanguageServiceExtended;
  12398. }(_lineI18n2.default.LanguageServiceNoLS);
  12399. var LanguageService = exports.LanguageService = new LanguageServiceExtended();
  12400. /***/ }),
  12401. /***/ "./js/services/localizedStringsService.js":
  12402. /*!************************************************!*\
  12403. !*** ./js/services/localizedStringsService.js ***!
  12404. \************************************************/
  12405. /*! no static exports found */
  12406. /***/ (function(module, exports, __webpack_require__) {
  12407. "use strict";
  12408. Object.defineProperty(exports, "__esModule", {
  12409. value: true
  12410. });
  12411. exports.LocalizedStrings = undefined;
  12412. var _languageService = __webpack_require__(/*! ./languageService */ "./js/services/languageService.js");
  12413. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  12414. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  12415. var _i18n = __webpack_require__(/*! ./../../i18n */ "./i18n/index.js");
  12416. var _i18n2 = _interopRequireDefault(_i18n);
  12417. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12418. var LocalizedStrings = exports.LocalizedStrings = Object.freeze(new _lineI18n2.default.LocalizedStrings(_languageService.LanguageService, _i18n2.default, true));
  12419. /***/ }),
  12420. /***/ "./js/typeSystem/baseTypes.js":
  12421. /*!************************************!*\
  12422. !*** ./js/typeSystem/baseTypes.js ***!
  12423. \************************************/
  12424. /*! no static exports found */
  12425. /***/ (function(module, exports, __webpack_require__) {
  12426. "use strict";
  12427. Object.defineProperty(exports, "__esModule", {
  12428. value: true
  12429. });
  12430. 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; }; }();
  12431. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12432. var BaseType = function () {
  12433. function BaseType(name, ord) {
  12434. _classCallCheck(this, BaseType);
  12435. this.name = name;
  12436. this.ord = ord;
  12437. }
  12438. _createClass(BaseType, [{
  12439. key: "isCompatible",
  12440. value: function isCompatible(another) {
  12441. if (another instanceof BaseType) {
  12442. return this.name === another.name && this.ord === another.ord;
  12443. }
  12444. return false;
  12445. }
  12446. }, {
  12447. key: "value",
  12448. get: function get() {
  12449. return this.name;
  12450. }
  12451. }]);
  12452. return BaseType;
  12453. }();
  12454. var BaseTypes = exports.BaseTypes = Object.freeze({
  12455. INTEGER: new BaseType("int", 0),
  12456. REAL: new BaseType("real", 1),
  12457. STRING: new BaseType("string", 2),
  12458. BOOLEAN: new BaseType("bool", 3),
  12459. VOID: new BaseType("void", 4),
  12460. UNDEFINED: new BaseType("undefined", 5)
  12461. });
  12462. /***/ }),
  12463. /***/ "./js/typeSystem/compoundType.js":
  12464. /*!***************************************!*\
  12465. !*** ./js/typeSystem/compoundType.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.CompoundType = 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 CompoundType = exports.CompoundType = function (_Type) {
  12480. _inherits(CompoundType, _Type);
  12481. function CompoundType(type, dimensions) {
  12482. _classCallCheck(this, CompoundType);
  12483. var _this = _possibleConstructorReturn(this, (CompoundType.__proto__ || Object.getPrototypeOf(CompoundType)).call(this, null));
  12484. _this.innerType = type;
  12485. _this.dimensions = dimensions;
  12486. return _this;
  12487. }
  12488. _createClass(CompoundType, [{
  12489. key: "isCompatible",
  12490. value: function isCompatible(another) {
  12491. if (another instanceof CompoundType) {
  12492. if (this.dimensions !== another.dimensions) {
  12493. return false;
  12494. }
  12495. return this.innerType.isCompatible(another.innerType);
  12496. }
  12497. return false;
  12498. }
  12499. }, {
  12500. key: "canAccept",
  12501. value: function canAccept(another) {
  12502. if (another instanceof CompoundType) {
  12503. return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
  12504. } else {
  12505. return this.innerType.isCompatible(another);
  12506. }
  12507. }
  12508. }]);
  12509. return CompoundType;
  12510. }(_type.Type);
  12511. /***/ }),
  12512. /***/ "./js/typeSystem/multiType.js":
  12513. /*!************************************!*\
  12514. !*** ./js/typeSystem/multiType.js ***!
  12515. \************************************/
  12516. /*! no static exports found */
  12517. /***/ (function(module, exports, __webpack_require__) {
  12518. "use strict";
  12519. Object.defineProperty(exports, "__esModule", {
  12520. value: true
  12521. });
  12522. exports.MultiType = undefined;
  12523. 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; }; }();
  12524. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  12525. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12526. 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; }
  12527. 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; }
  12528. var MultiType = exports.MultiType = function (_Type) {
  12529. _inherits(MultiType, _Type);
  12530. function MultiType(types) {
  12531. _classCallCheck(this, MultiType);
  12532. var _this = _possibleConstructorReturn(this, (MultiType.__proto__ || Object.getPrototypeOf(MultiType)).call(this, null));
  12533. _this.types = types;
  12534. return _this;
  12535. }
  12536. _createClass(MultiType, [{
  12537. key: "isCompatible",
  12538. value: function isCompatible(another) {
  12539. if (another instanceof _type.Type) {
  12540. for (var i = 0; i < this.types.length; i++) {
  12541. var t = this.types[i];
  12542. if (t.isCompatible(another)) {
  12543. return true;
  12544. }
  12545. }
  12546. }
  12547. return false;
  12548. }
  12549. }, {
  12550. key: "value",
  12551. get: function get() {
  12552. return null;
  12553. }
  12554. }, {
  12555. key: "ord",
  12556. get: function get() {
  12557. return null;
  12558. }
  12559. }]);
  12560. return MultiType;
  12561. }(_type.Type);
  12562. /***/ }),
  12563. /***/ "./js/typeSystem/parsers.js":
  12564. /*!**********************************!*\
  12565. !*** ./js/typeSystem/parsers.js ***!
  12566. \**********************************/
  12567. /*! no static exports found */
  12568. /***/ (function(module, exports, __webpack_require__) {
  12569. "use strict";
  12570. Object.defineProperty(exports, "__esModule", {
  12571. value: true
  12572. });
  12573. exports.toInt = toInt;
  12574. exports.toString = toString;
  12575. exports.toReal = toReal;
  12576. exports.toBool = toBool;
  12577. exports.convertToString = convertToString;
  12578. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  12579. var _types = __webpack_require__(/*! ./types */ "./js/typeSystem/types.js");
  12580. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  12581. var _decimal2 = _interopRequireDefault(_decimal);
  12582. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12583. function toInt(str) {
  12584. return new _decimal2.default(str);
  12585. }
  12586. function toString(str) {
  12587. var value = str.replace(/^"/, '');
  12588. value = value.replace(/"$/, '');
  12589. value = value.replace(/\\b/g, "\b");
  12590. value = value.replace(/\\t/g, "\t");
  12591. value = value.replace(/\\n/g, "\n");
  12592. value = value.replace(/\\r/g, "\r");
  12593. value = value.replace(/\\\"/g, "\"");
  12594. value = value.replace(/\\\'/g, "\'");
  12595. value = value.replace(/\\\\/g, "\\");
  12596. return value;
  12597. }
  12598. function toReal(value) {
  12599. return new _decimal2.default(value);
  12600. }
  12601. function toBool(str) {
  12602. var val = "'" + str + "'";
  12603. var lexer = _languageService.LanguageService.getCurrentLexer();
  12604. var instance = new lexer(null);
  12605. if (instance.literalNames[lexer.RK_TRUE] === val) {
  12606. return true;
  12607. } else if (instance.literalNames[lexer.RK_FALSE] === val) {
  12608. return false;
  12609. } else {
  12610. // TODO: better error message
  12611. throw new Error(str + "not a valid boolean");
  12612. }
  12613. }
  12614. function convertBoolToString(bool) {
  12615. var lexer = _languageService.LanguageService.getCurrentLexer();
  12616. var instance = new lexer(null);
  12617. if (bool) {
  12618. return instance.literalNames[lexer.RK_TRUE];
  12619. } else {
  12620. return instance.literalNames[lexer.RK_FALSE];
  12621. }
  12622. }
  12623. function convertToString(stoObj, type) {
  12624. switch (type.ord) {
  12625. case _types.Types.INTEGER.ord:
  12626. return stoObj.toString();
  12627. case _types.Types.REAL.ord:
  12628. {
  12629. if (stoObj.dp() <= 0) {
  12630. return stoObj.toFixed(1);
  12631. } else {
  12632. return stoObj.toNumber();
  12633. }
  12634. }
  12635. case _types.Types.BOOLEAN.ord:
  12636. return convertBoolToString(stoObj);
  12637. default:
  12638. return stoObj;
  12639. }
  12640. }
  12641. /***/ }),
  12642. /***/ "./js/typeSystem/type.js":
  12643. /*!*******************************!*\
  12644. !*** ./js/typeSystem/type.js ***!
  12645. \*******************************/
  12646. /*! no static exports found */
  12647. /***/ (function(module, exports, __webpack_require__) {
  12648. "use strict";
  12649. Object.defineProperty(exports, "__esModule", {
  12650. value: true
  12651. });
  12652. 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; }; }();
  12653. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12654. var Type = exports.Type = function () {
  12655. function Type(baseType) {
  12656. _classCallCheck(this, Type);
  12657. this.baseType = baseType;
  12658. }
  12659. _createClass(Type, [{
  12660. key: "isCompatible",
  12661. value: function isCompatible(another) {
  12662. if (another instanceof Type) {
  12663. return this.baseType.isCompatible(another.baseType);
  12664. }
  12665. return false;
  12666. }
  12667. }, {
  12668. key: "value",
  12669. get: function get() {
  12670. return this.baseType.value;
  12671. }
  12672. }, {
  12673. key: "ord",
  12674. get: function get() {
  12675. return this.baseType.ord;
  12676. }
  12677. }]);
  12678. return Type;
  12679. }();
  12680. /***/ }),
  12681. /***/ "./js/typeSystem/types.js":
  12682. /*!********************************!*\
  12683. !*** ./js/typeSystem/types.js ***!
  12684. \********************************/
  12685. /*! no static exports found */
  12686. /***/ (function(module, exports, __webpack_require__) {
  12687. "use strict";
  12688. Object.defineProperty(exports, "__esModule", {
  12689. value: true
  12690. });
  12691. exports.Types = undefined;
  12692. var _baseTypes = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  12693. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  12694. var _multiType = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.js");
  12695. var INTEGER = new _type.Type(_baseTypes.BaseTypes.INTEGER);
  12696. var REAL = new _type.Type(_baseTypes.BaseTypes.REAL);
  12697. var STRING = new _type.Type(_baseTypes.BaseTypes.STRING);
  12698. var BOOLEAN = new _type.Type(_baseTypes.BaseTypes.BOOLEAN);
  12699. var VOID = new _type.Type(_baseTypes.BaseTypes.VOID);
  12700. var UNDEFINED = new _type.Type(_baseTypes.BaseTypes.UNDEFINED);
  12701. var ALL = new _multiType.MultiType([INTEGER, REAL, STRING, BOOLEAN]);
  12702. var Types = exports.Types = Object.freeze({
  12703. INTEGER: INTEGER,
  12704. REAL: REAL,
  12705. STRING: STRING,
  12706. BOOLEAN: BOOLEAN,
  12707. VOID: VOID,
  12708. UNDEFINED: UNDEFINED,
  12709. ALL: ALL
  12710. });
  12711. /***/ }),
  12712. /***/ "./js/util/inputTest.js":
  12713. /*!******************************!*\
  12714. !*** ./js/util/inputTest.js ***!
  12715. \******************************/
  12716. /*! no static exports found */
  12717. /***/ (function(module, exports, __webpack_require__) {
  12718. "use strict";
  12719. Object.defineProperty(exports, "__esModule", {
  12720. value: true
  12721. });
  12722. exports.InputTest = undefined;
  12723. 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; }; }();
  12724. var _input = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  12725. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12726. 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; }
  12727. 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; }
  12728. var InputTest = exports.InputTest = function (_Input) {
  12729. _inherits(InputTest, _Input);
  12730. function InputTest(inputList) {
  12731. _classCallCheck(this, InputTest);
  12732. var _this = _possibleConstructorReturn(this, (InputTest.__proto__ || Object.getPrototypeOf(InputTest)).call(this));
  12733. _this.index = 0;
  12734. _this.inputList = inputList;
  12735. return _this;
  12736. }
  12737. _createClass(InputTest, [{
  12738. key: 'requestInput',
  12739. value: function requestInput(callback) {
  12740. if (this.index < this.inputList.length) {
  12741. callback(this.inputList[this.index]);
  12742. this.index++;
  12743. } else {
  12744. throw new Error('The amount of requests exceeded the amount of available inputs');
  12745. }
  12746. }
  12747. }]);
  12748. return InputTest;
  12749. }(_input.Input);
  12750. /***/ }),
  12751. /***/ "./js/util/outputTest.js":
  12752. /*!*******************************!*\
  12753. !*** ./js/util/outputTest.js ***!
  12754. \*******************************/
  12755. /*! no static exports found */
  12756. /***/ (function(module, exports, __webpack_require__) {
  12757. "use strict";
  12758. Object.defineProperty(exports, "__esModule", {
  12759. value: true
  12760. });
  12761. exports.OutputTest = undefined;
  12762. 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; }; }();
  12763. var _output = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  12764. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12765. 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; }
  12766. 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; }
  12767. var OutputTest = exports.OutputTest = function (_Output) {
  12768. _inherits(OutputTest, _Output);
  12769. function OutputTest() {
  12770. _classCallCheck(this, OutputTest);
  12771. var _this = _possibleConstructorReturn(this, (OutputTest.__proto__ || Object.getPrototypeOf(OutputTest)).call(this));
  12772. _this.list = [];
  12773. return _this;
  12774. }
  12775. _createClass(OutputTest, [{
  12776. key: 'sendOutput',
  12777. value: function sendOutput(text) {
  12778. this.list.push(text);
  12779. }
  12780. }]);
  12781. return OutputTest;
  12782. }(_output.Output);
  12783. /***/ }),
  12784. /***/ "./js/visualUI/algorithm.js":
  12785. /*!**********************************!*\
  12786. !*** ./js/visualUI/algorithm.js ***!
  12787. \**********************************/
  12788. /*! no static exports found */
  12789. /***/ (function(module, exports, __webpack_require__) {
  12790. "use strict";
  12791. Object.defineProperty(exports, "__esModule", {
  12792. value: true
  12793. });
  12794. exports.renderAlgorithm = renderAlgorithm;
  12795. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  12796. var _jquery2 = _interopRequireDefault(_jquery);
  12797. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  12798. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  12799. var Models = _interopRequireWildcard(_ivprog_elements);
  12800. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  12801. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  12802. var GlobalsManagement = _interopRequireWildcard(_globals);
  12803. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  12804. var VariablesManagement = _interopRequireWildcard(_variables);
  12805. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  12806. var CommandsManagement = _interopRequireWildcard(_commands);
  12807. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  12808. var CodeManagement = _interopRequireWildcard(_code_generator);
  12809. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  12810. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  12811. var _functions = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
  12812. var FunctionsManagement = _interopRequireWildcard(_functions);
  12813. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  12814. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  12815. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  12816. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  12817. 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; } }
  12818. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12819. var block_render = false;
  12820. function renderAlgorithm() {
  12821. if (block_render) {
  12822. return;
  12823. }
  12824. block_render = true;
  12825. (0, _jquery2.default)('.all_functions').children().off();
  12826. (0, _jquery2.default)('.all_functions').empty();
  12827. (0, _jquery2.default)('.list_globals').children().off();
  12828. (0, _jquery2.default)('.list_globals').empty();
  12829. for (var i = 0; i < window.program_obj.functions.length; i++) {
  12830. FunctionsManagement.renderFunction(window.program_obj.functions[i]);
  12831. }
  12832. for (var i = 0; i < window.program_obj.globals.length; i++) {
  12833. GlobalsManagement.renderGlobal(window.program_obj.globals[i]);
  12834. }
  12835. setTimeout(function () {
  12836. block_render = false;
  12837. }, 500);
  12838. }
  12839. /***/ }),
  12840. /***/ "./js/visualUI/code_generator.js":
  12841. /*!***************************************!*\
  12842. !*** ./js/visualUI/code_generator.js ***!
  12843. \***************************************/
  12844. /*! no static exports found */
  12845. /***/ (function(module, exports, __webpack_require__) {
  12846. "use strict";
  12847. Object.defineProperty(exports, "__esModule", {
  12848. value: true
  12849. });
  12850. exports.generate = generate;
  12851. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  12852. var _jquery2 = _interopRequireDefault(_jquery);
  12853. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  12854. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  12855. var Models = _interopRequireWildcard(_ivprog_elements);
  12856. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  12857. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  12858. var GlobalsManagement = _interopRequireWildcard(_globals);
  12859. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  12860. var VariablesManagement = _interopRequireWildcard(_variables);
  12861. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  12862. var CommandsManagement = _interopRequireWildcard(_commands);
  12863. 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; } }
  12864. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12865. function generate() {
  12866. (0, _jquery2.default)('.ivprog_visual_panel').find('.error_icon').remove();
  12867. var code = _localizedStringsService.LocalizedStrings.getUI('program') + ' { ';
  12868. code += globalsCode();
  12869. code += '\n';
  12870. var has_error = false;
  12871. for (var i = 0; i < window.program_obj.functions.length; i++) {
  12872. var n_code = functionsCode(window.program_obj.functions[i]);
  12873. if (n_code == null) {
  12874. has_error = true;
  12875. }
  12876. code += n_code;
  12877. code += '\n';
  12878. }
  12879. code += '\n}';
  12880. if (has_error) {
  12881. return null;
  12882. } else {
  12883. return code;
  12884. }
  12885. }
  12886. function functionsCode(function_obj) {
  12887. var ret = '\n\t' + _localizedStringsService.LocalizedStrings.getUI('function') + ' ';
  12888. var has_error = false;
  12889. switch (function_obj.return_type) {
  12890. case _types.Types.INTEGER:
  12891. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  12892. break;
  12893. case _types.Types.REAL:
  12894. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  12895. break;
  12896. case _types.Types.TEXT:
  12897. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  12898. break;
  12899. case _types.Types.BOOLEAN:
  12900. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  12901. break;
  12902. case _types.Types.VOID:
  12903. ret += _localizedStringsService.LocalizedStrings.getUI('void');
  12904. break;
  12905. }
  12906. ret += ' ';
  12907. if (function_obj.return_dimensions == 1) {
  12908. ret += '[] ';
  12909. } else if (function_obj.return_dimensions == 2) {
  12910. ret += '[][] ';
  12911. }
  12912. ret += function_obj.name + ' ( ';
  12913. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  12914. ret += parametersCode(function_obj.parameters_list[j]);
  12915. if (j + 1 < function_obj.parameters_list.length) {
  12916. ret += ',';
  12917. }
  12918. }
  12919. ret += ' ) {';
  12920. for (var j = 0; j < function_obj.variables_list.length; j++) {
  12921. ret += variablesCode(function_obj.variables_list[j]);
  12922. }
  12923. for (var j = 0; j < function_obj.commands.length; j++) {
  12924. //try {
  12925. ret += commandsCode(function_obj.commands[j]);
  12926. /*} catch (err) {
  12927. has_error = true;
  12928. console.error(err.message);
  12929. var todos = $('body').find('.command_container');
  12930. for (var i = 0; i < todos.length; i++) {
  12931. if ($(todos[i]).data('command') == function_obj.commands[j]) {
  12932. $( todos[i] ).prepend( ' <i class="ui icon red exclamation triangle error_icon"></i> ' );
  12933. break;
  12934. }
  12935. }
  12936. }*/
  12937. }
  12938. ret += '\n\t}';
  12939. if (has_error) {
  12940. return null;
  12941. } else {
  12942. return ret;
  12943. }
  12944. }
  12945. function commandsCode(command_obj) {
  12946. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  12947. switch (command_obj.type) {
  12948. case Models.COMMAND_TYPES.break:
  12949. return breaksCode(command_obj, indentation);
  12950. case Models.COMMAND_TYPES.comment:
  12951. return commentsCode(command_obj, indentation);
  12952. case Models.COMMAND_TYPES.reader:
  12953. return readersCode(command_obj, indentation);
  12954. case Models.COMMAND_TYPES.writer:
  12955. return writersCode(command_obj, indentation);
  12956. case Models.COMMAND_TYPES.functioncall:
  12957. return functioncallsCode(command_obj, indentation);
  12958. case Models.COMMAND_TYPES.attribution:
  12959. return attributionsCode(command_obj, indentation);
  12960. case Models.COMMAND_TYPES.whiletrue:
  12961. return whiletruesCode(command_obj, indentation);
  12962. case Models.COMMAND_TYPES.dowhiletrue:
  12963. return doWhilesCode(command_obj, indentation);
  12964. case Models.COMMAND_TYPES.iftrue:
  12965. return iftruesCode(command_obj, indentation);
  12966. case Models.COMMAND_TYPES.repeatNtimes:
  12967. return repeatNtimesCode(command_obj, indentation);
  12968. case Models.COMMAND_TYPES.switch:
  12969. return switchsCode(command_obj, indentation);
  12970. case Models.COMMAND_TYPES.return:
  12971. return returnsCode(command_obj, indentation);
  12972. }
  12973. }
  12974. function returnsCode(command_obj, indentation) {
  12975. var ret = '\n';
  12976. for (var i = 0; i < indentation; i++) {
  12977. ret += '\t';
  12978. }
  12979. ret += _localizedStringsService.LocalizedStrings.getUI('text_return');
  12980. if (command_obj.variable_value_menu) {
  12981. try {
  12982. ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu);
  12983. } catch (err) {}
  12984. }
  12985. return ret;
  12986. }
  12987. function breaksCode(command_obj, indentation) {
  12988. var ret = '\n';
  12989. for (var i = 0; i < indentation; i++) {
  12990. ret += '\t';
  12991. }
  12992. ret += _localizedStringsService.LocalizedStrings.getUI('text_break');
  12993. return ret;
  12994. }
  12995. function switchsCode(command_obj, indentation) {
  12996. var ret = '\n';
  12997. for (var i = 0; i < indentation; i++) {
  12998. ret += '\t';
  12999. }
  13000. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( ';
  13001. ret += variableValueMenuCode(command_obj.variable);
  13002. ret += ' ) { ';
  13003. if (command_obj.cases) {
  13004. for (var i = 0; i < command_obj.cases.length; i++) {
  13005. ret += switchcasesCode(command_obj.cases[i], indentation + 1);
  13006. }
  13007. }
  13008. ret += '\n';
  13009. for (var i = 0; i < indentation; i++) {
  13010. ret += '\t';
  13011. }
  13012. ret += '} ';
  13013. return ret;
  13014. }
  13015. function switchcasesCode(switchcase, indentation) {
  13016. var ret = '\n';
  13017. for (var i = 0; i < indentation; i++) {
  13018. ret += '\t';
  13019. }
  13020. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' ';
  13021. ret += variableValueMenuCode(switchcase.variable_value_menu);
  13022. ret += ' :';
  13023. if (switchcase.commands_block) {
  13024. for (var i = 0; i < switchcase.commands_block.length; i++) {
  13025. ret += commandsCode(switchcase.commands_block[i], indentation + 1);
  13026. }
  13027. }
  13028. return ret;
  13029. }
  13030. function repeatNtimesCode(command_obj, indentation) {
  13031. var ret = '\n';
  13032. for (var i = 0; i < indentation; i++) {
  13033. ret += '\t';
  13034. }
  13035. ret += _localizedStringsService.LocalizedStrings.getUI('text_for') + ' ( ';
  13036. if (command_obj.var_attribution) {
  13037. ret += variableValueMenuCode(command_obj.var_attribution);
  13038. ret += ' = ';
  13039. ret += variableValueMenuCode(command_obj.expression1);
  13040. }
  13041. ret += ' ; ';
  13042. if (command_obj.expression2) {
  13043. switch (command_obj.expression2.expression.type) {
  13044. case Models.EXPRESSION_TYPES.exp_logic:
  13045. ret += logicExpressionCode(command_obj.expression2.expression);
  13046. break;
  13047. case Models.EXPRESSION_TYPES.exp_arithmetic:
  13048. ret += arithmeticExpressionCode(command_obj.expression2.expression);
  13049. break;
  13050. }
  13051. }
  13052. ret += ' ; ';
  13053. if (command_obj.var_incrementation) {
  13054. ret += variableValueMenuCode(command_obj.var_incrementation);
  13055. ret += ' = ';
  13056. ret += variableValueMenuCode(command_obj.expression3.itens[0]);
  13057. switch (command_obj.expression3.itens[1]) {
  13058. case Models.ARITHMETIC_TYPES.plus:
  13059. ret += ' + ';
  13060. break;
  13061. case Models.ARITHMETIC_TYPES.minus:
  13062. ret += ' - ';
  13063. break;
  13064. case Models.ARITHMETIC_TYPES.multiplication:
  13065. ret += ' * ';
  13066. break;
  13067. case Models.ARITHMETIC_TYPES.division:
  13068. ret += ' / ';
  13069. break;
  13070. case Models.ARITHMETIC_TYPES.module:
  13071. ret += ' % ';
  13072. break;
  13073. }
  13074. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  13075. }
  13076. ret += ' ) { ';
  13077. if (command_obj.commands_block) {
  13078. for (var i = 0; i < command_obj.commands_block.length; i++) {
  13079. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  13080. }
  13081. }
  13082. ret += '\n';
  13083. for (var i = 0; i < indentation; i++) {
  13084. ret += '\t';
  13085. }
  13086. ret += '}';
  13087. return ret;
  13088. }
  13089. function iftruesCode(command_obj, indentation) {
  13090. var ret = '\n';
  13091. for (var i = 0; i < indentation; i++) {
  13092. ret += '\t';
  13093. }
  13094. ret += _localizedStringsService.LocalizedStrings.getUI('text_if');
  13095. switch (command_obj.expression.expression.type) {
  13096. case Models.EXPRESSION_TYPES.exp_logic:
  13097. ret += logicExpressionCode(command_obj.expression.expression);
  13098. break;
  13099. case Models.EXPRESSION_TYPES.exp_arithmetic:
  13100. ret += arithmeticExpressionCode(command_obj.expression.expression);
  13101. break;
  13102. }
  13103. ret += ' { ';
  13104. if (command_obj.commands_block) {
  13105. for (var i = 0; i < command_obj.commands_block.length; i++) {
  13106. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  13107. }
  13108. }
  13109. ret += '\n';
  13110. for (var i = 0; i < indentation; i++) {
  13111. ret += '\t';
  13112. }
  13113. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' {';
  13114. if (command_obj.commands_else) {
  13115. for (var i = 0; i < command_obj.commands_else.length; i++) {
  13116. ret += commandsCode(command_obj.commands_else[i], indentation + 1);
  13117. }
  13118. }
  13119. ret += '\n';
  13120. for (var i = 0; i < indentation; i++) {
  13121. ret += '\t';
  13122. }
  13123. ret += '}';
  13124. return ret;
  13125. }
  13126. function doWhilesCode(command_obj, indentation) {
  13127. var ret = '\n';
  13128. for (var i = 0; i < indentation; i++) {
  13129. ret += '\t';
  13130. }
  13131. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_do') + ' { ';
  13132. if (command_obj.commands_block) {
  13133. for (var i = 0; i < command_obj.commands_block.length; i++) {
  13134. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  13135. }
  13136. }
  13137. ret += '\n';
  13138. for (var i = 0; i < indentation; i++) {
  13139. ret += '\t';
  13140. }
  13141. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  13142. switch (command_obj.expression.expression.type) {
  13143. case Models.EXPRESSION_TYPES.exp_logic:
  13144. ret += logicExpressionCode(command_obj.expression.expression);
  13145. break;
  13146. case Models.EXPRESSION_TYPES.exp_arithmetic:
  13147. ret += arithmeticExpressionCode(command_obj.expression.expression);
  13148. break;
  13149. }
  13150. return ret;
  13151. }
  13152. function whiletruesCode(command_obj, indentation) {
  13153. var ret = '\n';
  13154. for (var i = 0; i < indentation; i++) {
  13155. ret += '\t';
  13156. }
  13157. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  13158. switch (command_obj.expression.expression.type) {
  13159. case Models.EXPRESSION_TYPES.exp_logic:
  13160. ret += logicExpressionCode(command_obj.expression.expression);
  13161. break;
  13162. case Models.EXPRESSION_TYPES.exp_arithmetic:
  13163. ret += arithmeticExpressionCode(command_obj.expression.expression);
  13164. break;
  13165. }
  13166. ret += ' { ';
  13167. if (command_obj.commands_block) {
  13168. for (var i = 0; i < command_obj.commands_block.length; i++) {
  13169. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  13170. }
  13171. }
  13172. ret += '\n';
  13173. for (var i = 0; i < indentation; i++) {
  13174. ret += '\t';
  13175. }
  13176. ret += '}';
  13177. return ret;
  13178. }
  13179. function logicExpressionCode(expression) {
  13180. var ret = ' ( ';
  13181. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  13182. ret += logicExpressionCode(expression.first_operand);
  13183. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  13184. ret += arithmeticExpressionCode(expression.first_operand);
  13185. } else {
  13186. ret += variableValueMenuCode(expression.first_operand);
  13187. }
  13188. if (expression.operator) {
  13189. switch (expression.operator) {
  13190. case Models.LOGIC_COMPARISON.equals_to:
  13191. ret += ' == ';
  13192. break;
  13193. case Models.LOGIC_COMPARISON.not_equals_to:
  13194. ret += ' != ';
  13195. break;
  13196. case Models.LOGIC_COMPARISON.and:
  13197. ret += ' && ';
  13198. break;
  13199. case Models.LOGIC_COMPARISON.or:
  13200. ret += ' || ';
  13201. break;
  13202. }
  13203. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  13204. ret += logicExpressionCode(expression.second_operand);
  13205. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  13206. ret += arithmeticExpressionCode(expression.second_operand);
  13207. } else {
  13208. ret += variableValueMenuCode(expression.second_operand);
  13209. }
  13210. }
  13211. ret += ' ) ';
  13212. return ret;
  13213. }
  13214. function arithmeticExpressionCode(expression) {
  13215. var ret = ' ( ';
  13216. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  13217. ret += logicExpressionCode(expression.first_operand);
  13218. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  13219. ret += arithmeticExpressionCode(expression.first_operand);
  13220. } else {
  13221. ret += variableValueMenuCode(expression.first_operand);
  13222. }
  13223. switch (expression.operator) {
  13224. case Models.ARITHMETIC_COMPARISON.greater_than:
  13225. ret += ' > ';
  13226. break;
  13227. case Models.ARITHMETIC_COMPARISON.less_than:
  13228. ret += ' < ';
  13229. break;
  13230. case Models.ARITHMETIC_COMPARISON.equals_to:
  13231. ret += ' == ';
  13232. break;
  13233. case Models.ARITHMETIC_COMPARISON.not_equals_to:
  13234. ret += ' != ';
  13235. break;
  13236. case Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
  13237. ret += ' >= ';
  13238. break;
  13239. case Models.ARITHMETIC_COMPARISON.less_than_or_equals_to:
  13240. ret += ' <= ';
  13241. break;
  13242. }
  13243. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  13244. ret += logicExpressionCode(expression.second_operand);
  13245. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  13246. ret += arithmeticExpressionCode(expression.second_operand);
  13247. } else {
  13248. ret += variableValueMenuCode(expression.second_operand);
  13249. }
  13250. ret += ' ) ';
  13251. return ret;
  13252. }
  13253. function attributionsCode(command_obj, indentation) {
  13254. var ret = '\n';
  13255. for (var i = 0; i < indentation; i++) {
  13256. ret += '\t';
  13257. }
  13258. ret += variableValueMenuCode(command_obj.variable) + ' = ';
  13259. for (var i = 0; i < command_obj.expression.length; i++) {
  13260. ret += elementExpressionCode(command_obj.expression[i]);
  13261. }
  13262. return ret;
  13263. }
  13264. function elementExpressionCode(expression_obj) {
  13265. var ret = '';
  13266. for (var i = 0; i < expression_obj.itens.length; i++) {
  13267. if (expression_obj.itens[i].type) {
  13268. ret += variableValueMenuCode(expression_obj.itens[i]);
  13269. } else if (expression_obj.itens[i].type_exp) {
  13270. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  13271. ret += ' ( ';
  13272. }
  13273. ret += elementExpressionCode(expression_obj.itens[i]);
  13274. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  13275. ret += ' ) ';
  13276. }
  13277. } else {
  13278. switch (expression_obj.itens[i]) {
  13279. case Models.ARITHMETIC_TYPES.plus:
  13280. ret += ' + ';
  13281. break;
  13282. case Models.ARITHMETIC_TYPES.minus:
  13283. ret += ' - ';
  13284. break;
  13285. case Models.ARITHMETIC_TYPES.multiplication:
  13286. ret += ' * ';
  13287. break;
  13288. case Models.ARITHMETIC_TYPES.division:
  13289. ret += ' / ';
  13290. break;
  13291. case Models.ARITHMETIC_TYPES.module:
  13292. ret += ' % ';
  13293. break;
  13294. }
  13295. }
  13296. }
  13297. return ret;
  13298. }
  13299. function functioncallsCode(command_obj, indentation) {
  13300. var ret = '\n';
  13301. for (var i = 0; i < indentation; i++) {
  13302. ret += '\t';
  13303. }
  13304. ret += variableValueMenuCode(command_obj.function_called);
  13305. return ret;
  13306. }
  13307. function readersCode(command_obj, indentation) {
  13308. var ret = '\n';
  13309. for (var i = 0; i < indentation; i++) {
  13310. ret += '\t';
  13311. }
  13312. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( ';
  13313. ret += variableValueMenuCode(command_obj.variable_value_menu);
  13314. ret += ' ) ';
  13315. return ret;
  13316. }
  13317. function variableValueMenuCode(variable_obj) {
  13318. var ret = '';
  13319. if (variable_obj.function_called) {
  13320. ret += variable_obj.function_called.name + ' ( ';
  13321. if (variable_obj.parameters_list) {
  13322. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  13323. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  13324. if (i + 1 < variable_obj.parameters_list.length) {
  13325. ret += ', ';
  13326. }
  13327. }
  13328. }
  13329. ret += ' )';
  13330. } else if (variable_obj.content.type) {
  13331. ret += variable_obj.content.name;
  13332. if (variable_obj.content.dimensions == 1) {
  13333. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  13334. }
  13335. if (variable_obj.content.dimensions == 2) {
  13336. ret += ' [ ' + variableValueMenuCode(variable_obj.row) + ' ] ';
  13337. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  13338. }
  13339. } else {
  13340. if (isNaN(variable_obj.content)) {
  13341. ret += '"' + variable_obj.content + '"';
  13342. } else {
  13343. ret += variable_obj.content;
  13344. }
  13345. }
  13346. return ret;
  13347. }
  13348. function writersCode(command_obj, indentation) {
  13349. var ret = '\n';
  13350. for (var i = 0; i < indentation; i++) {
  13351. ret += '\t';
  13352. }
  13353. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( ';
  13354. for (var i = 0; i < command_obj.content.length; i++) {
  13355. ret += variableValueMenuCode(command_obj.content[i]);
  13356. if (i + 1 < command_obj.content.length) {
  13357. ret += ' + ';
  13358. }
  13359. }
  13360. ret += ' ) ';
  13361. return ret;
  13362. }
  13363. function commentsCode(command_obj, indentation) {
  13364. var ret = '\n';
  13365. for (var i = 0; i < indentation; i++) {
  13366. ret += '\t';
  13367. }
  13368. ret += '// ';
  13369. ret += command_obj.comment_text.content;
  13370. return ret;
  13371. }
  13372. function parametersCode(parameter_obj) {
  13373. var ret = '';
  13374. switch (parameter_obj.type) {
  13375. case _types.Types.INTEGER:
  13376. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  13377. break;
  13378. case _types.Types.REAL:
  13379. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  13380. break;
  13381. case _types.Types.TEXT:
  13382. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  13383. break;
  13384. case _types.Types.BOOLEAN:
  13385. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  13386. break;
  13387. }
  13388. ret += parameter_obj.name + '';
  13389. if (parameter_obj.dimensions == 1) {
  13390. ret += ' []';
  13391. } else if (parameter_obj.dimensions == 2) {
  13392. ret += ' [][]';
  13393. }
  13394. return ret;
  13395. }
  13396. function variablesCode(variable_obj) {
  13397. var ret = '';
  13398. var temp = variable_obj;
  13399. ret += '\n\t\t';
  13400. if (temp.is_constant) {
  13401. ret += 'const ';
  13402. }
  13403. switch (temp.type) {
  13404. case _types.Types.INTEGER:
  13405. ret += _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  13406. break;
  13407. case _types.Types.REAL:
  13408. ret += _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  13409. break;
  13410. case _types.Types.TEXT:
  13411. ret += _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  13412. break;
  13413. case _types.Types.BOOLEAN:
  13414. ret += _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  13415. break;
  13416. }
  13417. ret += temp.name + ' ';
  13418. if (temp.dimensions == 1) {
  13419. ret += '[' + temp.columns + '] ';
  13420. switch (temp.type) {
  13421. case _types.Types.INTEGER:
  13422. ret += '= {' + temp.value + '}';
  13423. break;
  13424. case _types.Types.REAL:
  13425. ret += '= {' + temp.value.toFixed(2) + '}';
  13426. break;
  13427. case _types.Types.TEXT:
  13428. ret += '= {';
  13429. for (var j = 0; j < temp.value.length; j++) {
  13430. ret += '"' + temp.value[j] + '"';
  13431. if (j + 1 < temp.value.length) {
  13432. ret += ',';
  13433. }
  13434. }
  13435. ret += '}';
  13436. break;
  13437. case _types.Types.BOOLEAN:
  13438. ret += '= {';
  13439. for (var j = 0; j < temp.value.length; j++) {
  13440. if (temp.value[j]) {
  13441. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  13442. } else {
  13443. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  13444. }
  13445. if (j + 1 < temp.value.length) {
  13446. ret += ',';
  13447. }
  13448. }
  13449. ret += '}';
  13450. break;
  13451. }
  13452. } else if (temp.dimensions == 2) {
  13453. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  13454. switch (temp.type) {
  13455. case _types.Types.INTEGER:
  13456. ret += '= {';
  13457. for (var j = 0; j < temp.rows; j++) {
  13458. ret += '{' + temp.value[j] + '}';
  13459. if (j + 1 < temp.rows) {
  13460. ret += ',';
  13461. }
  13462. }
  13463. ret += '}';
  13464. break;
  13465. case _types.Types.REAL:
  13466. ret += '= {';
  13467. for (var j = 0; j < temp.rows; j++) {
  13468. ret += '{' + temp.value[j].toFixed(2) + '}';
  13469. if (j + 1 < temp.rows) {
  13470. ret += ',';
  13471. }
  13472. }
  13473. ret += '}';
  13474. break;
  13475. case _types.Types.TEXT:
  13476. ret += '= {';
  13477. for (var j = 0; j < temp.rows; j++) {
  13478. ret += '{';
  13479. for (var k = 0; k < temp.columns; k++) {
  13480. ret += '"' + temp.value[j][k] + '"';
  13481. if (k + 1 < temp.columns) {
  13482. ret += ',';
  13483. }
  13484. }
  13485. ret += '}';
  13486. if (j + 1 < temp.rows) {
  13487. ret += ',';
  13488. }
  13489. }
  13490. ret += '}';
  13491. break;
  13492. case _types.Types.BOOLEAN:
  13493. ret += '= {';
  13494. for (var j = 0; j < temp.rows; j++) {
  13495. ret += '{';
  13496. for (var k = 0; k < temp.columns; k++) {
  13497. if (temp.value[j][k]) {
  13498. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  13499. } else {
  13500. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  13501. }
  13502. if (k + 1 < temp.columns) {
  13503. ret += ',';
  13504. }
  13505. }
  13506. ret += '}';
  13507. if (j + 1 < temp.rows) {
  13508. ret += ',';
  13509. }
  13510. }
  13511. ret += '}';
  13512. break;
  13513. }
  13514. } else {
  13515. switch (temp.type) {
  13516. case _types.Types.INTEGER:
  13517. ret += '= ' + temp.value;
  13518. break;
  13519. case _types.Types.REAL:
  13520. ret += '= ' + temp.value.toFixed(2);
  13521. break;
  13522. case _types.Types.TEXT:
  13523. ret += '= "' + temp.value + '"';
  13524. break;
  13525. case _types.Types.BOOLEAN:
  13526. ret += '= ';
  13527. if (temp.value) {
  13528. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  13529. } else {
  13530. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  13531. }
  13532. break;
  13533. }
  13534. }
  13535. return ret;
  13536. }
  13537. function globalsCode() {
  13538. var ret = '';
  13539. if (window.program_obj.globals) {
  13540. for (var i = 0; i < window.program_obj.globals.length; i++) {
  13541. var temp = window.program_obj.globals[i];
  13542. ret += '\n\t';
  13543. if (temp.is_constant) {
  13544. ret += 'const ';
  13545. }
  13546. switch (temp.type) {
  13547. case _types.Types.INTEGER:
  13548. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  13549. break;
  13550. case _types.Types.REAL:
  13551. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  13552. break;
  13553. case _types.Types.TEXT:
  13554. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  13555. break;
  13556. case _types.Types.BOOLEAN:
  13557. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  13558. break;
  13559. }
  13560. ret += ' ' + temp.name + ' ';
  13561. if (temp.dimensions == 1) {
  13562. ret += '[' + temp.columns + '] ';
  13563. switch (temp.type) {
  13564. case _types.Types.INTEGER:
  13565. ret += '= {' + temp.value + '}';
  13566. break;
  13567. case _types.Types.REAL:
  13568. ret += '= {';
  13569. for (var j = 0; j < temp.value.length; j++) {
  13570. ret += temp.value[j].toFixed(2);
  13571. if (j + 1 < temp.value.length) {
  13572. ret += ',';
  13573. }
  13574. }
  13575. ret += '}';
  13576. break;
  13577. case _types.Types.TEXT:
  13578. ret += '= {';
  13579. for (var j = 0; j < temp.value.length; j++) {
  13580. ret += '"' + temp.value[j] + '"';
  13581. if (j + 1 < temp.value.length) {
  13582. ret += ',';
  13583. }
  13584. }
  13585. ret += '}';
  13586. break;
  13587. case _types.Types.BOOLEAN:
  13588. ret += '= {';
  13589. for (var j = 0; j < temp.value.length; j++) {
  13590. if (temp.value[j]) {
  13591. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  13592. } else {
  13593. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  13594. }
  13595. if (j + 1 < temp.value.length) {
  13596. ret += ',';
  13597. }
  13598. }
  13599. ret += '}';
  13600. break;
  13601. }
  13602. } else if (temp.dimensions == 2) {
  13603. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  13604. switch (temp.type) {
  13605. case _types.Types.INTEGER:
  13606. ret += '= {';
  13607. for (var j = 0; j < temp.rows; j++) {
  13608. ret += '{' + temp.value[j] + '}';
  13609. if (j + 1 < temp.rows) {
  13610. ret += ',';
  13611. }
  13612. }
  13613. ret += '}';
  13614. break;
  13615. case _types.Types.REAL:
  13616. ret += '= {';
  13617. for (var j = 0; j < temp.rows; j++) {
  13618. ret += '{';
  13619. for (var k = 0; k < temp.columns; k++) {
  13620. ret += temp.value[j][k].toFixed(2);
  13621. if (k + 1 < temp.columns) {
  13622. ret += ',';
  13623. }
  13624. }
  13625. ret += '}';
  13626. if (j + 1 < temp.rows) {
  13627. ret += ',';
  13628. }
  13629. }
  13630. ret += '}';
  13631. break;
  13632. case _types.Types.TEXT:
  13633. ret += '= {';
  13634. for (var j = 0; j < temp.rows; j++) {
  13635. ret += '{';
  13636. for (var k = 0; k < temp.columns; k++) {
  13637. ret += '"' + temp.value[j][k] + '"';
  13638. if (k + 1 < temp.columns) {
  13639. ret += ',';
  13640. }
  13641. }
  13642. ret += '}';
  13643. if (j + 1 < temp.rows) {
  13644. ret += ',';
  13645. }
  13646. }
  13647. ret += '}';
  13648. break;
  13649. case _types.Types.BOOLEAN:
  13650. ret += '= {';
  13651. for (var j = 0; j < temp.rows; j++) {
  13652. ret += '{';
  13653. for (var k = 0; k < temp.columns; k++) {
  13654. if (temp.value[j][k]) {
  13655. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  13656. } else {
  13657. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  13658. }
  13659. if (k + 1 < temp.columns) {
  13660. ret += ',';
  13661. }
  13662. }
  13663. ret += '}';
  13664. if (j + 1 < temp.rows) {
  13665. ret += ',';
  13666. }
  13667. }
  13668. ret += '}';
  13669. break;
  13670. }
  13671. } else {
  13672. switch (temp.type) {
  13673. case _types.Types.INTEGER:
  13674. ret += '= ' + temp.value;
  13675. break;
  13676. case _types.Types.REAL:
  13677. ret += '= ' + temp.value.toFixed(2);
  13678. break;
  13679. case _types.Types.TEXT:
  13680. ret += '= "' + temp.value + '"';
  13681. break;
  13682. case _types.Types.BOOLEAN:
  13683. ret += '= ';
  13684. if (temp.value) {
  13685. ret += _localizedStringsService.LocalizedStrings.getUI("true");;
  13686. } else {
  13687. ret += _localizedStringsService.LocalizedStrings.getUI("false");;
  13688. }
  13689. break;
  13690. }
  13691. }
  13692. }
  13693. }
  13694. return ret;
  13695. }
  13696. /***/ }),
  13697. /***/ "./js/visualUI/commands.js":
  13698. /*!*********************************!*\
  13699. !*** ./js/visualUI/commands.js ***!
  13700. \*********************************/
  13701. /*! no static exports found */
  13702. /***/ (function(module, exports, __webpack_require__) {
  13703. "use strict";
  13704. Object.defineProperty(exports, "__esModule", {
  13705. value: true
  13706. });
  13707. exports.removeCommand = removeCommand;
  13708. exports.createFloatingCommand = createFloatingCommand;
  13709. exports.renderCommand = renderCommand;
  13710. exports.genericCreateCommand = genericCreateCommand;
  13711. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  13712. var _jquery2 = _interopRequireDefault(_jquery);
  13713. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  13714. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  13715. var Models = _interopRequireWildcard(_ivprog_elements);
  13716. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  13717. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  13718. var GlobalsManagement = _interopRequireWildcard(_globals);
  13719. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  13720. var VariablesManagement = _interopRequireWildcard(_variables);
  13721. var _comment = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  13722. var CommentsManagement = _interopRequireWildcard(_comment);
  13723. var _reader = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  13724. var ReadersManagement = _interopRequireWildcard(_reader);
  13725. var _writer = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  13726. var WritersManagement = _interopRequireWildcard(_writer);
  13727. var _attribution = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  13728. var AttributionsManagement = _interopRequireWildcard(_attribution);
  13729. var _iftrue = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  13730. var IftruesManagement = _interopRequireWildcard(_iftrue);
  13731. var _repeatNtimes = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  13732. var RepeatNtimesManagement = _interopRequireWildcard(_repeatNtimes);
  13733. var _whiletrue = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  13734. var WhiletruesManagement = _interopRequireWildcard(_whiletrue);
  13735. var _dowhiletrue = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  13736. var DowhiletruesManagement = _interopRequireWildcard(_dowhiletrue);
  13737. var _switch = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  13738. var SwitchesManagement = _interopRequireWildcard(_switch);
  13739. var _functioncall = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  13740. var FunctioncallsManagement = _interopRequireWildcard(_functioncall);
  13741. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  13742. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  13743. var _break = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  13744. var BreaksManagement = _interopRequireWildcard(_break);
  13745. var _return = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  13746. var ReturnsManagement = _interopRequireWildcard(_return);
  13747. 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; } }
  13748. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13749. var has_element_created_draged = false;
  13750. var which_element_is_draged = null;
  13751. function removeCommand(command, function_obj, dom_obj) {
  13752. console.log('debugging removeCommand');
  13753. console.log('command');
  13754. console.log(command);
  13755. console.log('function_obj');
  13756. console.log(function_obj);
  13757. console.log('dom_obj');
  13758. console.log(dom_obj);
  13759. if (function_obj.commands.indexOf(command) > -1) {
  13760. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  13761. return true;
  13762. }
  13763. // Utilize dois parantNode, pois o primeiro é o div de comandos
  13764. try {
  13765. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  13766. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  13767. return true;
  13768. }
  13769. } catch (err) {}
  13770. try {
  13771. if (dom_obj.parent().parent().data('command').type == Models.COMMAND_TYPES.iftrue) {
  13772. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  13773. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  13774. return true;
  13775. }
  13776. }
  13777. } catch (err) {}
  13778. console.log('veja: ');
  13779. console.log(dom_obj.parent());
  13780. if (dom_obj.parent().data('switchcase')) {
  13781. console.log("o que encontrei: ");
  13782. console.log(dom_obj.parent().data('switchcase'));
  13783. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  13784. return true;
  13785. }
  13786. return false;
  13787. }
  13788. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  13789. var floatingObject;
  13790. switch (command_type) {
  13791. case Models.COMMAND_TYPES.break:
  13792. floatingObject = BreaksManagement.createFloatingCommand();
  13793. break;
  13794. case Models.COMMAND_TYPES.comment:
  13795. floatingObject = CommentsManagement.createFloatingCommand();
  13796. break;
  13797. case Models.COMMAND_TYPES.reader:
  13798. floatingObject = ReadersManagement.createFloatingCommand();
  13799. break;
  13800. case Models.COMMAND_TYPES.writer:
  13801. floatingObject = WritersManagement.createFloatingCommand();
  13802. break;
  13803. case Models.COMMAND_TYPES.attribution:
  13804. floatingObject = AttributionsManagement.createFloatingCommand();
  13805. break;
  13806. case Models.COMMAND_TYPES.iftrue:
  13807. floatingObject = IftruesManagement.createFloatingCommand();
  13808. break;
  13809. case Models.COMMAND_TYPES.repeatNtimes:
  13810. floatingObject = RepeatNtimesManagement.createFloatingCommand();
  13811. break;
  13812. case Models.COMMAND_TYPES.whiletrue:
  13813. floatingObject = WhiletruesManagement.createFloatingCommand();
  13814. break;
  13815. case Models.COMMAND_TYPES.dowhiletrue:
  13816. floatingObject = DowhiletruesManagement.createFloatingCommand();
  13817. break;
  13818. case Models.COMMAND_TYPES.switch:
  13819. floatingObject = SwitchesManagement.createFloatingCommand();
  13820. break;
  13821. case Models.COMMAND_TYPES.functioncall:
  13822. floatingObject = FunctioncallsManagement.createFloatingCommand();
  13823. break;
  13824. case Models.COMMAND_TYPES.return:
  13825. floatingObject = ReturnsManagement.createFloatingCommand();
  13826. break;
  13827. }
  13828. floatingObject.draggable().appendTo("body");
  13829. floatingObject.mouseup(function (evt) {
  13830. manageCommand(function_obj, function_container, evt, command_type);
  13831. });
  13832. floatingObject.css("position", "absolute");
  13833. mouse_event.type = "mousedown.draggable";
  13834. mouse_event.target = floatingObject[0];
  13835. floatingObject.css("left", mouse_event.pageX - 15);
  13836. floatingObject.css("top", mouse_event.pageY - 15);
  13837. floatingObject.trigger(mouse_event);
  13838. }
  13839. // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  13840. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  13841. var createdElement;
  13842. switch (command.type) {
  13843. case Models.COMMAND_TYPES.comment:
  13844. createdElement = CommentsManagement.renderCommand(command, function_obj);
  13845. break;
  13846. case Models.COMMAND_TYPES.break:
  13847. createdElement = BreaksManagement.renderCommand(command, function_obj);
  13848. break;
  13849. case Models.COMMAND_TYPES.reader:
  13850. createdElement = ReadersManagement.renderCommand(command, function_obj);
  13851. break;
  13852. case Models.COMMAND_TYPES.writer:
  13853. createdElement = WritersManagement.renderCommand(command, function_obj);
  13854. break;
  13855. case Models.COMMAND_TYPES.attribution:
  13856. createdElement = AttributionsManagement.renderCommand(command, function_obj);
  13857. break;
  13858. case Models.COMMAND_TYPES.functioncall:
  13859. createdElement = FunctioncallsManagement.renderCommand(command, function_obj);
  13860. break;
  13861. case Models.COMMAND_TYPES.iftrue:
  13862. createdElement = IftruesManagement.renderCommand(command, function_obj);
  13863. break;
  13864. case Models.COMMAND_TYPES.repeatNtimes:
  13865. createdElement = RepeatNtimesManagement.renderCommand(command, function_obj);
  13866. break;
  13867. case Models.COMMAND_TYPES.whiletrue:
  13868. createdElement = WhiletruesManagement.renderCommand(command, function_obj);
  13869. break;
  13870. case Models.COMMAND_TYPES.dowhiletrue:
  13871. createdElement = DowhiletruesManagement.renderCommand(command, function_obj);
  13872. break;
  13873. case Models.COMMAND_TYPES.switch:
  13874. createdElement = SwitchesManagement.renderCommand(command, function_obj);
  13875. break;
  13876. case Models.COMMAND_TYPES.return:
  13877. createdElement = ReturnsManagement.renderCommand(command, function_obj);
  13878. break;
  13879. }
  13880. switch (before_after_inside) {
  13881. case 1:
  13882. createdElement.insertBefore(element_reference);
  13883. break;
  13884. case 2:
  13885. createdElement.insertAfter(element_reference);
  13886. break;
  13887. case 3:
  13888. element_reference.append(createdElement);
  13889. break;
  13890. }
  13891. }
  13892. function genericCreateCommand(command_type) {
  13893. switch (command_type) {
  13894. case Models.COMMAND_TYPES.break:
  13895. return new Models.Break();
  13896. case Models.COMMAND_TYPES.comment:
  13897. return new Models.Comment(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_value, _localizedStringsService.LocalizedStrings.getUI('text_comment'), null, null, false));
  13898. case Models.COMMAND_TYPES.reader:
  13899. return new Models.Reader(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false));
  13900. case Models.COMMAND_TYPES.writer:
  13901. return new Models.Writer([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  13902. case Models.COMMAND_TYPES.attribution:
  13903. return new Models.Attribution(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), []);
  13904. case Models.COMMAND_TYPES.functioncall:
  13905. return new Models.FunctionCall(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_function, null, null, null, false), null);
  13906. case Models.COMMAND_TYPES.iftrue:
  13907. return new Models.IfTrue(new Models.ConditionalExpression(null), null, null);
  13908. case Models.COMMAND_TYPES.repeatNtimes:
  13909. 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);
  13910. case Models.COMMAND_TYPES.whiletrue:
  13911. return new Models.WhileTrue(new Models.ConditionalExpression(null), null);
  13912. case Models.COMMAND_TYPES.dowhiletrue:
  13913. return new Models.DoWhileTrue(new Models.ConditionalExpression(null), null);
  13914. case Models.COMMAND_TYPES.switch:
  13915. var sc = [new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true))];
  13916. return new Models.Switch(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true), sc);
  13917. case Models.COMMAND_TYPES.return:
  13918. return new Models.Return(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  13919. }
  13920. }
  13921. function manageCommand(function_obj, function_container, event, command_type) {
  13922. (0, _jquery2.default)(".created_element").each(function (index) {
  13923. (0, _jquery2.default)(this).remove();
  13924. });
  13925. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  13926. console.log('soltou no: ');
  13927. console.log(el);
  13928. console.log(el.data('fun'));
  13929. // Primeiro verificar se ele soltou no espaço da função correta:
  13930. var hier = el.parentsUntil(".all_functions");
  13931. var esta_correto = false;
  13932. var esta_na_div_correta = false;
  13933. if (el.hasClass("commands_list_div")) {
  13934. esta_na_div_correta = true;
  13935. }
  13936. for (var i = 0; i < hier.length; i++) {
  13937. var temp = (0, _jquery2.default)(hier[i]);
  13938. if (temp.hasClass("commands_list_div")) {
  13939. esta_na_div_correta = true;
  13940. }
  13941. if (temp.data('fun') == function_obj) {
  13942. esta_correto = true;
  13943. break;
  13944. }
  13945. }
  13946. if (!esta_correto) {
  13947. has_element_created_draged = false;
  13948. which_element_is_draged = null;
  13949. return;
  13950. } else {
  13951. if (!esta_na_div_correta) {
  13952. has_element_created_draged = false;
  13953. which_element_is_draged = null;
  13954. return;
  13955. }
  13956. }
  13957. // Agora é descobrir qual o escopo para adicionar o comando:
  13958. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  13959. if (typeof el.data('fun') !== 'undefined') {
  13960. // Se a lista de comandos estiver vazia, então é o primeiro.
  13961. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  13962. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  13963. // pode adicionar
  13964. el.data('fun').commands = [];
  13965. var new_cmd = genericCreateCommand(command_type);
  13966. el.data('fun').commands.push(new_cmd);
  13967. renderCommand(new_cmd, (0, _jquery2.default)(function_container).find('.commands_list_div'), 3, function_obj);
  13968. } else {
  13969. // Entra nesse else, caso já existam outros comandos no bloco:
  13970. findNearbyCommandToAddInFunctionScope(el, event, (0, _jquery2.default)(function_container).find('.commands_list_div'), function_obj, command_type);
  13971. }
  13972. } else {
  13973. console.log("soltou em um comando");
  13974. // descobrir em qual comando ele soltou:
  13975. var hier_find = el.parentsUntil(".commands_list_div");
  13976. var hierarquia_bottom_up = [];
  13977. if (typeof el.data('command') !== 'undefined') {
  13978. hierarquia_bottom_up.push(el.data('command'));
  13979. }
  13980. for (var i = 0; i < hier_find.length; i++) {
  13981. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  13982. hierarquia_bottom_up.push((0, _jquery2.default)(hier_find[i]).data('command'));
  13983. }
  13984. }
  13985. console.log("comando em que soltou: ");
  13986. console.log(hierarquia_bottom_up[0]);
  13987. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  13988. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  13989. console.log(hierarquia_bottom_up[i]);
  13990. }
  13991. // Se for do tipo break, verificar se está no contexto correto:
  13992. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  13993. var is_correct_context = false;
  13994. if (command_type == Models.COMMAND_TYPES.break) {
  13995. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  13996. 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) {
  13997. is_correct_context = true;
  13998. break;
  13999. }
  14000. }
  14001. if (!is_correct_context) {
  14002. console.error("Context not allowed to insert BREAK COMMAND!");
  14003. return;
  14004. }
  14005. }
  14006. // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  14007. if (hierarquia_bottom_up.length == 1) {
  14008. console.log('QQ1');
  14009. var sub_elemento = false;
  14010. for (var i = 0; i < hier_find.length; i++) {
  14011. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  14012. console.log('QQ2');
  14013. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  14014. sub_elemento = true;
  14015. break;
  14016. }
  14017. }
  14018. if (!sub_elemento) {
  14019. console.log('QQ3');
  14020. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  14021. }
  14022. } else {
  14023. console.log('QQ4');
  14024. // caso exista mais de um elemento na hierarquia:
  14025. if (typeof (0, _jquery2.default)(el).data('command') !== 'undefined') {
  14026. console.log('QQ5');
  14027. console.log("PPP1");
  14028. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  14029. } else {
  14030. console.log('QQ6');
  14031. var sub_elemento = false;
  14032. for (var i = 0; i < hier_find.length; i++) {
  14033. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  14034. console.log('QQ7');
  14035. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  14036. sub_elemento = true;
  14037. break;
  14038. }
  14039. }
  14040. }
  14041. }
  14042. }
  14043. has_element_created_draged = false;
  14044. which_element_is_draged = null;
  14045. }
  14046. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  14047. var el_jq = (0, _jquery2.default)(el);
  14048. var command_parent = el_jq.data('command');
  14049. 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) {
  14050. console.log('QQ17');
  14051. 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) {
  14052. console.log('QQ18');
  14053. // Se não tiver outro comando ainda no bloco, só adiciona:
  14054. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  14055. command_parent.commands_block = [];
  14056. var recentComand = genericCreateCommand(command_type);
  14057. command_parent.commands_block.push(recentComand);
  14058. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  14059. } else {
  14060. // Se já tem algum comando no bloco:
  14061. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  14062. }
  14063. } else {
  14064. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  14065. addCommandToSwitchCase(event, function_obj, command_type);
  14066. }
  14067. } else {
  14068. console.log('QQ19');
  14069. // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  14070. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  14071. }
  14072. }
  14073. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  14074. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  14075. var menor_distancia = 999999999;
  14076. var elemento_menor_distancia = null;
  14077. var antes = true;
  14078. var t_bot;
  14079. var t_top;
  14080. // Descobrindo o elemento mais próximo:
  14081. for (var i = 0; i < all_sub.length; i++) {
  14082. t_top = all_sub[i].getBoundingClientRect().top;
  14083. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  14084. if (t_top - event.clientY < menor_distancia) {
  14085. menor_distancia = event.clientY - t_top;
  14086. elemento_menor_distancia = all_sub[i];
  14087. }
  14088. }
  14089. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  14090. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  14091. if (borda_inferior - event.clientY < menor_distancia) {
  14092. var recentComand = genericCreateCommand(command_type);
  14093. command_parent.commands_block.push(recentComand);
  14094. //
  14095. renderCommand(recentComand, node_list_commands, 3, function_obj);
  14096. } else {
  14097. var recentComand = genericCreateCommand(command_type);
  14098. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  14099. if (index > -1) {
  14100. command_parent.commands_block.splice(index, 0, recentComand);
  14101. }
  14102. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  14103. }
  14104. }
  14105. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  14106. var el_jq = (0, _jquery2.default)(el);
  14107. var command_parent = (0, _jquery2.default)(el.parentNode.parentNode).data('command');
  14108. var command_target = el_jq.data('command');
  14109. var temp_parent = (0, _jquery2.default)(el.parentNode.parentNode);
  14110. var is_in_else = false;
  14111. if (!command_parent) {
  14112. command_parent = el_jq.data('command');
  14113. temp_parent = el_jq;
  14114. var hier = el_jq.parentsUntil(".command_container");
  14115. for (var i = 0; i < hier.length; i++) {
  14116. var temp = (0, _jquery2.default)(hier[i]);
  14117. if (typeof temp.data('else') != 'undefined') {
  14118. is_in_else = true;
  14119. }
  14120. if (typeof temp.data('command') != 'undefined') {
  14121. command_parent = temp.data('command');
  14122. temp_parent = temp;
  14123. }
  14124. }
  14125. }
  14126. var hier = el_jq.parentsUntil(".command_container");
  14127. for (var i = 0; i < hier.length; i++) {
  14128. var temp = (0, _jquery2.default)(hier[i]);
  14129. if (typeof temp.data('else') != 'undefined') {
  14130. is_in_else = true;
  14131. }
  14132. }
  14133. if (command_parent == command_target) {
  14134. var hier = el_jq.parentsUntil(".command_container");
  14135. for (var i = 0; i < hier.length; i++) {
  14136. var temp = (0, _jquery2.default)(hier[i]);
  14137. if (typeof temp.data('else') !== 'undefined') {
  14138. is_in_else = true;
  14139. break;
  14140. }
  14141. }
  14142. }
  14143. if (command_parent.type != Models.COMMAND_TYPES.iftrue && command_parent.type != Models.COMMAND_TYPES.switch) {
  14144. var hier = temp_parent.parentsUntil(".all_cases_div");
  14145. console.log("vou procurar!!");
  14146. for (var i = 0; i < hier.length; i++) {
  14147. console.log("estou vasculhando...");
  14148. var temp = (0, _jquery2.default)(hier[i]);
  14149. if (typeof temp.data('switchcase') !== 'undefined') {
  14150. console.log("encontrei");
  14151. command_parent = temp.data('switchcase');
  14152. is_in_else = false;
  14153. break;
  14154. }
  14155. }
  14156. }
  14157. console.log('debugging:');
  14158. console.log('el_jq');
  14159. console.log(el_jq);
  14160. console.log('command_parent');
  14161. console.log(command_parent);
  14162. console.log('command_target');
  14163. console.log(command_target);
  14164. var menor_distancia = 999999999;
  14165. var antes = true;
  14166. var t_bot;
  14167. var t_top;
  14168. t_top = el.getBoundingClientRect().top;
  14169. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  14170. var d_top = event.clientY - t_top; // distancia topo
  14171. var d_bot = t_bot - event.clientY; // distancia baixo
  14172. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  14173. if (d_top < d_bot) {
  14174. var recentComand = genericCreateCommand(command_type);
  14175. console.log('MMM1');
  14176. if (is_in_else) {
  14177. console.log('MMM2');
  14178. if (command_parent == command_target) {
  14179. console.log('MMM3');
  14180. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  14181. command_parent.commands_else = [];
  14182. var recentComand = genericCreateCommand(command_type);
  14183. command_parent.commands_else.push(recentComand);
  14184. renderCommand(recentComand, el_jq, 3, function_obj);
  14185. } else {
  14186. // Se já tem algum comando no bloco:
  14187. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  14188. }
  14189. return;
  14190. }
  14191. console.log('MMM7');
  14192. var index = command_parent.commands_else.indexOf(command_target);
  14193. if (index > -1) {
  14194. command_parent.commands_else.splice(index, 0, recentComand);
  14195. }
  14196. renderCommand(recentComand, el, 1, function_obj);
  14197. } else {
  14198. console.log('MMM4');
  14199. if (command_parent == command_target) {
  14200. console.log('Nxxxx5');
  14201. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  14202. command_parent.commands_block = [];
  14203. console.log('SSS4');
  14204. var recentComand = genericCreateCommand(command_type);
  14205. command_parent.commands_block.push(recentComand);
  14206. renderCommand(recentComand, el_jq, 3, function_obj);
  14207. } else {
  14208. console.log('SSS5');
  14209. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  14210. }
  14211. return;
  14212. }
  14213. console.log('MMM6');
  14214. var index = command_parent.commands_block.indexOf(command_target);
  14215. if (index > -1) {
  14216. command_parent.commands_block.splice(index, 0, recentComand);
  14217. }
  14218. renderCommand(recentComand, el, 1, function_obj);
  14219. }
  14220. } else {
  14221. console.log('XXX1');
  14222. var recentComand = genericCreateCommand(command_type);
  14223. if (is_in_else) {
  14224. if (command_parent == command_target) {
  14225. console.log('MMM3');
  14226. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  14227. command_parent.commands_else = [];
  14228. console.log('SSS1');
  14229. var recentComand = genericCreateCommand(command_type);
  14230. command_parent.commands_else.push(recentComand);
  14231. renderCommand(recentComand, el_jq, 3, function_obj);
  14232. } else {
  14233. // Se já tem algum comando no bloco:
  14234. console.log('SSS2');
  14235. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  14236. }
  14237. return;
  14238. }
  14239. console.log('XXX2');
  14240. var index = command_parent.commands_else.indexOf(command_target);
  14241. if (index > -1) {
  14242. command_parent.commands_else.splice(index + 1, 0, recentComand);
  14243. }
  14244. renderCommand(recentComand, el, 2, function_obj);
  14245. } else {
  14246. if (command_parent == command_target) {
  14247. console.log('Nxxxx78');
  14248. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  14249. command_parent.commands_block = [];
  14250. var recentComand = genericCreateCommand(command_type);
  14251. command_parent.commands_block.push(recentComand);
  14252. console.log('SSS6');
  14253. renderCommand(recentComand, el_jq, 3, function_obj);
  14254. } else {
  14255. console.log('SSS7');
  14256. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  14257. }
  14258. return;
  14259. }
  14260. console.log('XXX3');
  14261. var index = command_parent.commands_block.indexOf(command_target);
  14262. if (index > -1) {
  14263. command_parent.commands_block.splice(index + 1, 0, recentComand);
  14264. }
  14265. renderCommand(recentComand, el, 2, function_obj);
  14266. }
  14267. }
  14268. }
  14269. function insertCommandInBlock(el, event, function_obj, command_type) {
  14270. var el_jq = (0, _jquery2.default)(el);
  14271. var command_parent = el_jq.data('command');
  14272. 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) {
  14273. // Se não tiver outro comando ainda no bloco, só adiciona:
  14274. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  14275. command_parent.commands_block = [];
  14276. var recentComand = genericCreateCommand(command_type);
  14277. command_parent.commands_block.push(recentComand);
  14278. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  14279. } else {
  14280. // Se já tem algum comando no bloco:
  14281. findInBlockCorrectPlace(el, event, function_obj, command_type);
  14282. }
  14283. } else if (el_jq.data('command').type == Models.COMMAND_TYPES.iftrue) {
  14284. console.log('QQ9');
  14285. // no if ou no else?
  14286. var correct_div = (0, _jquery2.default)(document.elementFromPoint(event.pageX, event.pageY));
  14287. var is_in_if = true;
  14288. if (correct_div.data('if')) {
  14289. is_in_if = true;
  14290. } else if (correct_div.data('else')) {
  14291. is_in_if = false;
  14292. } else {
  14293. var hier = correct_div.parentsUntil(".command_container");
  14294. for (var i = 0; i < hier.length; i++) {
  14295. var temp = (0, _jquery2.default)(hier[i]);
  14296. if (typeof temp.data('if') !== 'undefined') {
  14297. is_in_if = true;
  14298. break;
  14299. }
  14300. if (typeof temp.data('else') !== 'undefined') {
  14301. is_in_if = false;
  14302. break;
  14303. }
  14304. }
  14305. }
  14306. if (is_in_if) {
  14307. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  14308. command_parent.commands_block = [];
  14309. var recentComand = genericCreateCommand(command_type);
  14310. command_parent.commands_block.push(recentComand);
  14311. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  14312. } else {
  14313. // Se já tem algum comando no bloco:
  14314. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  14315. }
  14316. } else {
  14317. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  14318. command_parent.commands_else = [];
  14319. var recentComand = genericCreateCommand(command_type);
  14320. command_parent.commands_else.push(recentComand);
  14321. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  14322. } else {
  14323. // Se já tem algum comando no bloco:
  14324. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  14325. }
  14326. }
  14327. } else {
  14328. // é do tipo switch
  14329. console.log("está tentando inserir em um switch que está na raiz!");
  14330. addCommandToSwitchCase(event, function_obj, command_type);
  14331. }
  14332. }
  14333. function addCommandToSwitchCase(event, function_obj, command_type) {
  14334. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  14335. var which_case = el.data('switchcase');
  14336. var case_div = el;
  14337. if (!which_case) {
  14338. var hier_find = el.parentsUntil(".all_cases_div");
  14339. for (var i = 0; i < hier_find.length; i++) {
  14340. if (typeof (0, _jquery2.default)(hier_find[i]).data('switchcase') !== 'undefined') {
  14341. which_case = (0, _jquery2.default)(hier_find[i]).data('switchcase');
  14342. case_div = (0, _jquery2.default)(hier_find[i]);
  14343. break;
  14344. }
  14345. }
  14346. }
  14347. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  14348. which_case.commands_block = [];
  14349. var recentComand = genericCreateCommand(command_type);
  14350. which_case.commands_block.push(recentComand);
  14351. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  14352. } else {
  14353. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  14354. }
  14355. }
  14356. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  14357. var all_sub = case_div.find('div.command_container');
  14358. var menor_distancia = 999999999;
  14359. var elemento_menor_distancia = null;
  14360. var antes = true;
  14361. var t_bot;
  14362. var t_top;
  14363. // Descobrindo o elemento mais próximo:
  14364. for (var i = 0; i < all_sub.length; i++) {
  14365. t_top = all_sub[i].getBoundingClientRect().top;
  14366. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  14367. if (t_top - event.clientY < menor_distancia) {
  14368. menor_distancia = event.clientY - t_top;
  14369. elemento_menor_distancia = all_sub[i];
  14370. }
  14371. }
  14372. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  14373. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  14374. if (borda_inferior - event.clientY < menor_distancia) {
  14375. var recentComand = genericCreateCommand(command_type);
  14376. which_case.commands_block.push(recentComand);
  14377. renderCommand(recentComand, (0, _jquery2.default)(case_div.find('.case_commands_block')[0]), 3, function_obj);
  14378. } else {
  14379. var recentComand = genericCreateCommand(command_type);
  14380. var index = which_case.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  14381. if (index > -1) {
  14382. which_case.commands_block.splice(index, 0, recentComand);
  14383. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  14384. }
  14385. }
  14386. }
  14387. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  14388. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  14389. var el_jq = (0, _jquery2.default)(el);
  14390. var all_sub = el_jq.find('div.command_container');
  14391. var menor_distancia = 999999999;
  14392. var elemento_menor_distancia = null;
  14393. var antes = true;
  14394. var t_bot;
  14395. var t_top;
  14396. // Descobrindo o elemento mais próximo:
  14397. for (var i = 0; i < all_sub.length; i++) {
  14398. t_top = all_sub[i].getBoundingClientRect().top;
  14399. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  14400. if (t_top - event.clientY < menor_distancia) {
  14401. menor_distancia = event.clientY - t_top;
  14402. elemento_menor_distancia = all_sub[i];
  14403. }
  14404. }
  14405. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  14406. console.log("menor_distancia: ");
  14407. console.log(elemento_menor_distancia);
  14408. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  14409. if (borda_inferior - event.clientY < menor_distancia) {
  14410. console.log('QQ11');
  14411. var recentComand = genericCreateCommand(command_type);
  14412. var command_parent = el_jq.data('command');
  14413. if (is_in_else) {
  14414. console.log('QQ15');
  14415. command_parent.commands_else.push(recentComand);
  14416. console.log('el_jq');
  14417. console.log(el_jq);
  14418. console.log("$(el_jq.find('.commands_else')[0]):: ");
  14419. console.log((0, _jquery2.default)(el_jq.find('.commands_else')[0]));
  14420. renderCommand(recentComand, el_jq, 3, function_obj);
  14421. } else {
  14422. console.log('QQ16');
  14423. command_parent.commands_block.push(recentComand);
  14424. renderCommand(recentComand, (0, _jquery2.default)(el_jq.find('.block_commands')[0]), 3, function_obj);
  14425. }
  14426. } else {
  14427. console.log('QQ12');
  14428. var recentComand = genericCreateCommand(command_type);
  14429. var command_parent = el_jq.data('command');
  14430. if (is_in_else) {
  14431. var index = command_parent.commands_else.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  14432. if (index > -1) {
  14433. command_parent.commands_else.splice(index, 0, recentComand);
  14434. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  14435. }
  14436. } else {
  14437. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  14438. if (index > -1) {
  14439. command_parent.commands_block.splice(index, 0, recentComand);
  14440. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  14441. }
  14442. }
  14443. }
  14444. }
  14445. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  14446. switch ((0, _jquery2.default)(el).data('command').type) {
  14447. case Models.COMMAND_TYPES.iftrue:
  14448. case Models.COMMAND_TYPES.switch:
  14449. case Models.COMMAND_TYPES.repeatNtimes:
  14450. case Models.COMMAND_TYPES.whiletrue:
  14451. case Models.COMMAND_TYPES.dowhiletrue:
  14452. insertCommandInBlock(el, event, function_obj, command_type);
  14453. return;
  14454. }
  14455. var menor_distancia = 999999999;
  14456. var antes = true;
  14457. var t_bot;
  14458. var t_top;
  14459. t_top = el.getBoundingClientRect().top;
  14460. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  14461. var d_top = event.clientY - t_top; // distancia topo
  14462. var d_bot = t_bot - event.clientY; // distancia baixo
  14463. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  14464. if (d_top < d_bot) {
  14465. var recentComand = genericCreateCommand(command_type);
  14466. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  14467. if (index > -1) {
  14468. function_obj.commands.splice(index, 0, recentComand);
  14469. }
  14470. renderCommand(recentComand, el, 1, function_obj);
  14471. } else {
  14472. var recentComand = genericCreateCommand(command_type);
  14473. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  14474. if (index > -1) {
  14475. function_obj.commands.splice(index + 1, 0, recentComand);
  14476. }
  14477. renderCommand(recentComand, el, 2, function_obj);
  14478. }
  14479. }
  14480. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  14481. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  14482. var menor_distancia = 999999999;
  14483. var elemento_menor_distancia = null;
  14484. var antes = true;
  14485. var t_bot;
  14486. var t_top;
  14487. // Descobrindo o elemento mais próximo:
  14488. for (var i = 0; i < all_sub.length; i++) {
  14489. t_top = all_sub[i].getBoundingClientRect().top;
  14490. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  14491. if (t_top - event.clientY < menor_distancia) {
  14492. menor_distancia = event.clientY - t_top;
  14493. elemento_menor_distancia = all_sub[i];
  14494. }
  14495. }
  14496. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  14497. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  14498. if (borda_inferior - event.clientY < menor_distancia) {
  14499. var recentComand = genericCreateCommand(command_type);
  14500. function_obj.commands.push(recentComand);
  14501. //
  14502. renderCommand(recentComand, node_list_commands, 3, function_obj);
  14503. } else {
  14504. var recentComand = genericCreateCommand(command_type);
  14505. var index = function_obj.commands.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  14506. if (index > -1) {
  14507. function_obj.commands.splice(index, 0, recentComand);
  14508. }
  14509. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  14510. }
  14511. }
  14512. /***/ }),
  14513. /***/ "./js/visualUI/commands/attribution.js":
  14514. /*!*********************************************!*\
  14515. !*** ./js/visualUI/commands/attribution.js ***!
  14516. \*********************************************/
  14517. /*! no static exports found */
  14518. /***/ (function(module, exports, __webpack_require__) {
  14519. "use strict";
  14520. Object.defineProperty(exports, "__esModule", {
  14521. value: true
  14522. });
  14523. exports.createFloatingCommand = createFloatingCommand;
  14524. exports.renderCommand = renderCommand;
  14525. exports.manageExpressionElements = manageExpressionElements;
  14526. exports.renderMenuOperations = renderMenuOperations;
  14527. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14528. var _jquery2 = _interopRequireDefault(_jquery);
  14529. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  14530. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14531. var Models = _interopRequireWildcard(_ivprog_elements);
  14532. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14533. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  14534. var GlobalsManagement = _interopRequireWildcard(_globals);
  14535. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  14536. var VariablesManagement = _interopRequireWildcard(_variables);
  14537. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14538. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  14539. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  14540. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  14541. var CommandsManagement = _interopRequireWildcard(_commands);
  14542. 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; } }
  14543. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14544. function createFloatingCommand() {
  14545. return (0, _jquery2.default)('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
  14546. }
  14547. function renderCommand(command, function_obj) {
  14548. 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 span_command_spec">' + _localizedStringsService.LocalizedStrings.getUI('text_receives') + '</span> ' + '<div class="expression_elements"></div> </div>');
  14549. el.data('command', command);
  14550. VariableValueMenu.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
  14551. 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)]);
  14552. command.expression.push(exp);
  14553. addHandlers(command, function_obj, el);
  14554. renderExpressionElements(command, function_obj, el);
  14555. return el;
  14556. }
  14557. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  14558. var index_to_move = expression_element.itens.indexOf(ref_object);
  14559. switch (selectedItem.data('exp')) {
  14560. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  14561. 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)]);
  14562. expression_element.itens[index_to_move] = exp;
  14563. break;
  14564. case Models.EXPRESSION_ELEMENTS.op_exp:
  14565. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, expression_element.itens[index_to_move]]);
  14566. expression_element.itens[index_to_move] = exp;
  14567. break;
  14568. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  14569. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [expression_element.itens[index_to_move]]);
  14570. expression_element.itens[index_to_move] = exp;
  14571. break;
  14572. }
  14573. renderExpressionElements(command, function_obj, dom_object);
  14574. }
  14575. function renderExpressionElements(command, function_obj, el) {
  14576. var expression_div = el.find('.expression_elements');
  14577. var command_container;
  14578. if (el.hasClass("command_container") == false) {
  14579. var hier = el.parentsUntil(".command_container");
  14580. for (var i = 0; i < hier.length; i++) {
  14581. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  14582. command_container = (0, _jquery2.default)(hier[i]);
  14583. break;
  14584. }
  14585. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  14586. expression_div = (0, _jquery2.default)(hier[i]);
  14587. break;
  14588. }
  14589. }
  14590. }
  14591. if (command_container) {
  14592. expression_div = command_container.find('.expression_elements');
  14593. }
  14594. expression_div.text('');
  14595. for (var i = 0; i < command.expression.length; i++) {
  14596. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  14597. temp.data('ref_element', command.expression[i]);
  14598. temp.data('ref_index', i);
  14599. expression_div.append(temp);
  14600. renderElement(command, function_obj, temp, command.expression[i]);
  14601. }
  14602. }
  14603. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  14604. var context_menu = '<div class="ui dropdown"><div class="text">';
  14605. switch (expression_element.itens[index_op]) {
  14606. case Models.ARITHMETIC_TYPES.plus:
  14607. context_menu += '+';
  14608. break;
  14609. case Models.ARITHMETIC_TYPES.minus:
  14610. context_menu += '-';
  14611. break;
  14612. case Models.ARITHMETIC_TYPES.multiplication:
  14613. context_menu += '*';
  14614. break;
  14615. case Models.ARITHMETIC_TYPES.division:
  14616. context_menu += '/';
  14617. break;
  14618. case Models.ARITHMETIC_TYPES.module:
  14619. context_menu += '%';
  14620. break;
  14621. case Models.ARITHMETIC_TYPES.none:
  14622. context_menu += '...';
  14623. break;
  14624. }
  14625. context_menu += '</div><div class="menu">';
  14626. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.plus + '">+</div>';
  14627. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.minus + '">-</div>';
  14628. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.multiplication + '">*</div>';
  14629. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.division + '">/</div>';
  14630. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.module + '">%</div>';
  14631. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.none + '" data-text="...">Nenhum</div>';
  14632. context_menu += '</div></div>';
  14633. context_menu = (0, _jquery2.default)(context_menu);
  14634. temp_op.append(context_menu);
  14635. context_menu.dropdown({
  14636. onChange: function onChange(value, text, $selectedItem) {
  14637. expression_element.itens[index_op] = value;
  14638. }
  14639. });
  14640. }
  14641. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  14642. if (el.hasClass("command_container") == false) {
  14643. var hier = el.parentsUntil(".commands_list_div");
  14644. for (var i = 0; i < hier.length; i++) {
  14645. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  14646. el = (0, _jquery2.default)(hier[i]);
  14647. break;
  14648. }
  14649. }
  14650. }
  14651. if (dom_append_menu.hasClass("expression_elements") == false) {
  14652. var hier = el.parentsUntil(".commands_list_div");
  14653. for (var i = 0; i < hier.length; i++) {
  14654. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  14655. dom_append_menu = (0, _jquery2.default)(hier[i]);
  14656. break;
  14657. }
  14658. }
  14659. }
  14660. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  14661. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  14662. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  14663. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  14664. context_menu += '</div></div>';
  14665. context_menu = (0, _jquery2.default)(context_menu);
  14666. dom_append_menu.append(context_menu);
  14667. context_menu.dropdown({
  14668. onChange: function onChange(value, text, $selectedItem) {
  14669. switch (value) {
  14670. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  14671. 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)]);
  14672. expression_append_new_expression.push(exp);
  14673. break;
  14674. case Models.EXPRESSION_ELEMENTS.op_exp:
  14675. 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)]);
  14676. expression_append_new_expression.push(exp);
  14677. break;
  14678. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  14679. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  14680. expression_append_new_expression.push(exp);
  14681. break;
  14682. }
  14683. renderExpressionElements(command, function_obj, el);
  14684. }
  14685. });
  14686. }
  14687. function renderElement(command, function_obj, el, expression_element) {
  14688. switch (expression_element.type_exp) {
  14689. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  14690. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  14691. var temp_exp_1 = (0, _jquery2.default)('<div class="component_element"></div>');
  14692. var temp_exp_2 = (0, _jquery2.default)('<div class="component_element"></div>');
  14693. el.append(temp_exp_1);
  14694. el.append(temp_op);
  14695. el.append(temp_exp_2);
  14696. if (expression_element.itens[0].type) {
  14697. VariableValueMenu.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  14698. } else {
  14699. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  14700. }
  14701. renderOperator(command, function_obj, temp_op, expression_element, 1);
  14702. if (expression_element.itens[2].type) {
  14703. VariableValueMenu.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  14704. } else {
  14705. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  14706. }
  14707. break;
  14708. case Models.EXPRESSION_ELEMENTS.op_exp:
  14709. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  14710. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  14711. el.append(temp_op);
  14712. el.append(temp_exp);
  14713. renderOperator(command, function_obj, temp_op, expression_element, 0);
  14714. if (expression_element.itens[1].type) {
  14715. VariableValueMenu.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  14716. } else {
  14717. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  14718. }
  14719. break;
  14720. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  14721. var temp_par_1 = (0, _jquery2.default)('<div class="component_element"> ( </div>');
  14722. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  14723. var temp_par_2 = (0, _jquery2.default)('<div class="component_element"> ) </div>');
  14724. el.append(temp_par_1);
  14725. el.append(temp_exp);
  14726. for (var j = 0; j < expression_element.itens.length; j++) {
  14727. if (expression_element.itens[j].type) {
  14728. VariableValueMenu.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  14729. } else {
  14730. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  14731. }
  14732. }
  14733. //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  14734. el.append(temp_par_2);
  14735. break;
  14736. }
  14737. }
  14738. function renderExpression(command, function_obj, el) {
  14739. var expression_div = el.find('.expression_elements');
  14740. expression_div.text('');
  14741. var menu_add_item = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  14742. menu_add_item.data('index_add', 0);
  14743. expression_div.append(menu_add_item);
  14744. for (var i = 0; i < command.expression.length; i++) {
  14745. if (command.expression[i].type) {
  14746. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  14747. temp.data('ref_element', command.expression[i]);
  14748. temp.data('ref_index', i);
  14749. expression_div.append(temp);
  14750. VariableValueMenu.renderMenu(command, command.expression[i], temp, function_obj);
  14751. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  14752. var temp = (0, _jquery2.default)('<div class="expression_element">' + command.expression[i] + '</div>');
  14753. temp.data('ref_element', command.expression[i]);
  14754. temp.data('ref_index', i);
  14755. expression_div.append(temp);
  14756. } else {
  14757. var temp = '<div class="expression_element">';
  14758. switch (command.expression[i]) {
  14759. case Models.ARITHMETIC_TYPES.plus:
  14760. temp += '+';
  14761. break;
  14762. case Models.ARITHMETIC_TYPES.minus:
  14763. temp += '-';
  14764. break;
  14765. case Models.ARITHMETIC_TYPES.multiplication:
  14766. temp += '*';
  14767. break;
  14768. case Models.ARITHMETIC_TYPES.division:
  14769. temp += '/';
  14770. break;
  14771. case Models.ARITHMETIC_TYPES.module:
  14772. temp += '%';
  14773. break;
  14774. }
  14775. temp += '</div>';
  14776. temp = (0, _jquery2.default)(temp);
  14777. temp.data('ref_element', command.expression[i]);
  14778. temp.data('ref_index', i);
  14779. expression_div.append(temp);
  14780. }
  14781. var menu_add_item_seq = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  14782. var index_temp = i + 1;
  14783. menu_add_item_seq.data('index_add', index_temp);
  14784. expression_div.append(menu_add_item_seq);
  14785. }
  14786. addMenuItens(command, function_obj, el);
  14787. }
  14788. function addMenuItens(command, function_obj, expression_div) {
  14789. var divs_expression = expression_div.find('.menu_add_item');
  14790. for (var i = 0; i < divs_expression.length; i++) {
  14791. var temp = (0, _jquery2.default)(divs_expression[i]).data('index_add');
  14792. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  14793. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  14794. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_operator') + '</div>';
  14795. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_parentheses') + '</div>';
  14796. context_menu += '</div></div>';
  14797. context_menu = (0, _jquery2.default)(context_menu);
  14798. (0, _jquery2.default)(divs_expression[i]).append(context_menu);
  14799. context_menu.dropdown({
  14800. on: 'hover',
  14801. onChange: function onChange(value, text, $selectedItem) {
  14802. switch ($selectedItem.data('option')) {
  14803. case "value":
  14804. command.expression.splice($selectedItem.data('index'), 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  14805. renderExpression(command, function_obj, expression_div);
  14806. break;
  14807. case "operator":
  14808. command.expression.splice($selectedItem.data('index'), 0, Models.ARITHMETIC_TYPES.plus);
  14809. renderExpression(command, function_obj, expression_div);
  14810. break;
  14811. case "parentheses":
  14812. command.expression.splice($selectedItem.data('index'), 0, "(");
  14813. command.expression.splice($selectedItem.data('index') + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  14814. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  14815. renderExpression(command, function_obj, expression_div);
  14816. break;
  14817. }
  14818. }
  14819. });
  14820. }
  14821. }
  14822. function addHandlers(command, function_obj, attribution_dom) {
  14823. attribution_dom.find('.button_remove_command').on('click', function () {
  14824. if (CommandsManagement.removeCommand(command, function_obj, attribution_dom)) {
  14825. attribution_dom.remove();
  14826. }
  14827. });
  14828. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  14829. renderExpressionElements(command, function_obj, attribution_dom);
  14830. });
  14831. }
  14832. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  14833. /*console.log("recebido o seguinte DOM: ");
  14834. console.log(dom_object);
  14835. if (dom_object.hasClass('var_attributed')) {
  14836. return;
  14837. } else {
  14838. var hier = dom_object.parentsUntil(".command_container");
  14839. for (var i = 0; i < hier.length; i++) {
  14840. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  14841. return;
  14842. }
  14843. }
  14844. }
  14845. dom_object.find('.context_menu_clear').remove();
  14846. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  14847. for (var tm in Models.ARITHMETIC_TYPES) {
  14848. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  14849. }
  14850. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  14851. menu_operations += '</div></div>';
  14852. menu_operations = $(menu_operations);
  14853. dom_object.append(menu_operations);
  14854. menu_operations.dropdown({
  14855. onChange: function(value, text, $selectedItem) {
  14856. switch ($($selectedItem).data('option')) {
  14857. case "clear":
  14858. $(dom_object).text('');
  14859. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  14860. break;
  14861. default:
  14862. createExpressionAround(command, ref_object, dom_object, function_obj);
  14863. menu_operations.find('.text').text('');
  14864. }
  14865. }
  14866. });*/
  14867. }
  14868. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  14869. (0, _jquery2.default)('<span> ( </span>').insertBefore(dom_object);
  14870. (0, _jquery2.default)('<span> ) </span>').insertAfter(dom_object);
  14871. VariableValueMenu.renderMenu(command, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), dom_object, function_obj);
  14872. }
  14873. /***/ }),
  14874. /***/ "./js/visualUI/commands/break.js":
  14875. /*!***************************************!*\
  14876. !*** ./js/visualUI/commands/break.js ***!
  14877. \***************************************/
  14878. /*! no static exports found */
  14879. /***/ (function(module, exports, __webpack_require__) {
  14880. "use strict";
  14881. Object.defineProperty(exports, "__esModule", {
  14882. value: true
  14883. });
  14884. exports.createFloatingCommand = createFloatingCommand;
  14885. exports.renderCommand = renderCommand;
  14886. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14887. var _jquery2 = _interopRequireDefault(_jquery);
  14888. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  14889. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14890. var Models = _interopRequireWildcard(_ivprog_elements);
  14891. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14892. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  14893. var CommandsManagement = _interopRequireWildcard(_commands);
  14894. 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; } }
  14895. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14896. function createFloatingCommand() {
  14897. 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>');
  14898. }
  14899. function renderCommand(command, function_obj) {
  14900. 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>');
  14901. el.data('command', command);
  14902. addHandlers(command, function_obj, el);
  14903. return el;
  14904. }
  14905. function addHandlers(command, function_obj, break_dom) {
  14906. break_dom.find('.button_remove_command').on('click', function () {
  14907. if (CommandsManagement.removeCommand(command, function_obj, break_dom)) {
  14908. break_dom.remove();
  14909. }
  14910. });
  14911. }
  14912. /***/ }),
  14913. /***/ "./js/visualUI/commands/comment.js":
  14914. /*!*****************************************!*\
  14915. !*** ./js/visualUI/commands/comment.js ***!
  14916. \*****************************************/
  14917. /*! no static exports found */
  14918. /***/ (function(module, exports, __webpack_require__) {
  14919. "use strict";
  14920. Object.defineProperty(exports, "__esModule", {
  14921. value: true
  14922. });
  14923. exports.createFloatingCommand = createFloatingCommand;
  14924. exports.renderCommand = renderCommand;
  14925. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14926. var _jquery2 = _interopRequireDefault(_jquery);
  14927. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  14928. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14929. var Models = _interopRequireWildcard(_ivprog_elements);
  14930. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14931. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  14932. var GlobalsManagement = _interopRequireWildcard(_globals);
  14933. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  14934. var VariablesManagement = _interopRequireWildcard(_variables);
  14935. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14936. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  14937. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  14938. var CommandsManagement = _interopRequireWildcard(_commands);
  14939. 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; } }
  14940. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14941. function createFloatingCommand() {
  14942. 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>');
  14943. }
  14944. function renderCommand(command, function_obj) {
  14945. 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>');
  14946. el.data('command', command);
  14947. addHandlers(command, function_obj, el);
  14948. renderTextComment(command, function_obj, el);
  14949. return el;
  14950. }
  14951. function renderTextComment(command, function_obj, el) {
  14952. VariableValueMenu.renderMenu(command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  14953. }
  14954. function addHandlers(command, function_obj, comment_dom) {
  14955. comment_dom.find('.button_remove_command').on('click', function () {
  14956. if (CommandsManagement.removeCommand(command, function_obj, comment_dom)) {
  14957. comment_dom.remove();
  14958. }
  14959. });
  14960. }
  14961. /***/ }),
  14962. /***/ "./js/visualUI/commands/conditional_expression.js":
  14963. /*!********************************************************!*\
  14964. !*** ./js/visualUI/commands/conditional_expression.js ***!
  14965. \********************************************************/
  14966. /*! no static exports found */
  14967. /***/ (function(module, exports, __webpack_require__) {
  14968. "use strict";
  14969. Object.defineProperty(exports, "__esModule", {
  14970. value: true
  14971. });
  14972. exports.renderExpression = renderExpression;
  14973. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14974. var _jquery2 = _interopRequireDefault(_jquery);
  14975. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  14976. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14977. var Models = _interopRequireWildcard(_ivprog_elements);
  14978. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14979. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  14980. var GlobalsManagement = _interopRequireWildcard(_globals);
  14981. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  14982. var VariablesManagement = _interopRequireWildcard(_variables);
  14983. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14984. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  14985. 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; } }
  14986. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14987. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  14988. if (expression.expression == null || expression.expression.length < 1) {
  14989. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  14990. } else {
  14991. var main_div = (0, _jquery2.default)('<div class="expression_elements"></div>');
  14992. switch (expression.expression.type) {
  14993. case Models.EXPRESSION_TYPES.exp_logic:
  14994. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  14995. break;
  14996. case Models.EXPRESSION_TYPES.exp_arithmetic:
  14997. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  14998. break;
  14999. }
  15000. initial_el_to_render.append(main_div);
  15001. }
  15002. }
  15003. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  15004. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  15005. menu_operator.dropdown({
  15006. values: [{
  15007. name: '>',
  15008. value: Models.ARITHMETIC_COMPARISON.greater_than,
  15009. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than
  15010. }, {
  15011. name: '<',
  15012. value: Models.ARITHMETIC_COMPARISON.less_than,
  15013. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than
  15014. }, {
  15015. name: '==',
  15016. value: Models.ARITHMETIC_COMPARISON.equals_to,
  15017. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.equals_to
  15018. }, {
  15019. name: '!=',
  15020. value: Models.ARITHMETIC_COMPARISON.not_equals_to,
  15021. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.not_equals_to
  15022. }, {
  15023. name: '>=',
  15024. value: Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to,
  15025. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to
  15026. }, {
  15027. name: '<=',
  15028. value: Models.ARITHMETIC_COMPARISON.less_than_or_equals_to,
  15029. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than_or_equals_to
  15030. }],
  15031. onChange: function onChange(value, text, $selectedItem) {
  15032. expression_arithmetic.operator = value;
  15033. }
  15034. });
  15035. element_to_append.append(menu_operator);
  15036. }
  15037. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  15038. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  15039. menu_operator.dropdown({
  15040. values: [{
  15041. name: '==',
  15042. value: Models.LOGIC_COMPARISON.equals_to,
  15043. selected: logic_operator == Models.LOGIC_COMPARISON.equals_to
  15044. }, {
  15045. name: '!=',
  15046. value: Models.LOGIC_COMPARISON.not_equals_to,
  15047. selected: logic_operator == Models.LOGIC_COMPARISON.not_equals_to
  15048. }, {
  15049. name: '&&',
  15050. value: Models.LOGIC_COMPARISON.and,
  15051. selected: logic_operator == Models.LOGIC_COMPARISON.and
  15052. }, {
  15053. name: '||',
  15054. value: Models.LOGIC_COMPARISON.or,
  15055. selected: logic_operator == Models.LOGIC_COMPARISON.or
  15056. }],
  15057. onChange: function onChange(value, text, $selectedItem) {
  15058. if ($selectedItem) {
  15059. expression_logic.operator = value;
  15060. if (expression_logic.second_operand == null) {
  15061. expression_logic.second_operand = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  15062. initial_el_to_render.empty();
  15063. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  15064. }
  15065. }
  15066. }
  15067. });
  15068. element_to_append.append(menu_operator);
  15069. }
  15070. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  15071. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> ( </span> ');
  15072. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  15073. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  15074. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  15075. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> ) </span> ');
  15076. if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15077. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  15078. } else if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15079. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  15080. } else {
  15081. VariableValueMenuManagement.renderMenu(command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  15082. }
  15083. element_to_append.append(exp_el_par_1);
  15084. element_to_append.append(exp_el_expr_el_1);
  15085. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  15086. element_to_append.append(exp_el_expr_operand);
  15087. if (expression_logic.second_operand) {
  15088. if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15089. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  15090. } else if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15091. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  15092. } else {
  15093. VariableValueMenuManagement.renderMenu(command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  15094. }
  15095. element_to_append.append(exp_el_expr_el_2);
  15096. }
  15097. element_to_append.append(exp_el_par_2);
  15098. }
  15099. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  15100. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> ( </span> ');
  15101. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  15102. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  15103. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  15104. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> ) </span> ');
  15105. if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15106. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  15107. } else if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15108. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  15109. } else {
  15110. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  15111. }
  15112. if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15113. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  15114. } else if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15115. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  15116. } else {
  15117. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  15118. }
  15119. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  15120. element_to_append.append(exp_el_par_1);
  15121. element_to_append.append(exp_el_expr_el_1);
  15122. element_to_append.append(exp_el_expr_operand);
  15123. element_to_append.append(exp_el_expr_el_2);
  15124. element_to_append.append(exp_el_par_2);
  15125. }
  15126. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  15127. var start_menu = '';
  15128. start_menu += '<div class="ui dropdown menu_start_rendered"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  15129. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_logic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_logic_expression') + '</div>';
  15130. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_arithmetic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_arithmetic_expression') + '</div>';
  15131. start_menu += '</div></div>';
  15132. start_menu = (0, _jquery2.default)(start_menu);
  15133. start_menu.dropdown({
  15134. onChange: function onChange(value, text, $selectedItem) {
  15135. switch ($selectedItem.data('exp')) {
  15136. case Models.EXPRESSION_TYPES.exp_logic:
  15137. expression.expression = new Models.LogicExpression(false, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  15138. break;
  15139. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15140. 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);
  15141. break;
  15142. }
  15143. initial_el_to_render.html('');
  15144. renderExpression(command, expression, function_obj, initial_el_to_render);
  15145. }
  15146. });
  15147. initial_el_to_render.append(' <span class="span_command_spec"> ( </span> ');
  15148. initial_el_to_render.append(start_menu);
  15149. initial_el_to_render.append(' <span class="span_command_spec"> ) </span> ');
  15150. }
  15151. /***/ }),
  15152. /***/ "./js/visualUI/commands/contextualized_menu.js":
  15153. /*!*****************************************************!*\
  15154. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  15155. \*****************************************************/
  15156. /*! no static exports found */
  15157. /***/ (function(module, exports, __webpack_require__) {
  15158. "use strict";
  15159. Object.defineProperty(exports, "__esModule", {
  15160. value: true
  15161. });
  15162. exports.renderMenu = renderMenu;
  15163. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15164. var _jquery2 = _interopRequireDefault(_jquery);
  15165. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15166. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15167. var Models = _interopRequireWildcard(_ivprog_elements);
  15168. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15169. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15170. var CommandsManagement = _interopRequireWildcard(_commands);
  15171. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15172. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  15173. var _switch = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  15174. var SwitchManagement = _interopRequireWildcard(_switch);
  15175. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  15176. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  15177. 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; } }
  15178. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15179. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  15180. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  15181. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  15182. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  15183. } else {
  15184. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  15185. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.switchcase + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_case') + ' </a>';
  15186. }
  15187. menu_div += '</div></div>';
  15188. menu_div = (0, _jquery2.default)(menu_div);
  15189. dom_where_render.append(menu_div);
  15190. addHandlers(command, dom_where_render, function_obj, dom_command);
  15191. }
  15192. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  15193. dom_where_render.find('.menu_commands').dropdown({
  15194. on: 'hover'
  15195. });
  15196. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  15197. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  15198. if (command.commands_block == null || command.commands_block.length == 0) {
  15199. command.commands_block = [];
  15200. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  15201. command.commands_block.push(new_cmd);
  15202. CommandsManagement.renderCommand(new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  15203. } else {
  15204. CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), (0, _jquery2.default)(this).data('command'), evt);
  15205. }
  15206. } else {
  15207. switch ((0, _jquery2.default)(this).data('command')) {
  15208. case Models.COMMAND_TYPES.break:
  15209. CommandsManagement.createFloatingCommand(function_obj, null, (0, _jquery2.default)(this).data('command'), evt);
  15210. break;
  15211. case Models.COMMAND_TYPES.switchcase:
  15212. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  15213. break;
  15214. }
  15215. }
  15216. });
  15217. }
  15218. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  15219. if (command.cases == null) {
  15220. command.cases = [];
  15221. }
  15222. var sc = new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  15223. command.cases.push(sc);
  15224. SwitchManagement.renderCase(sc, command, function_obj, dom_command.find('.all_cases_div'));
  15225. }
  15226. /***/ }),
  15227. /***/ "./js/visualUI/commands/dowhiletrue.js":
  15228. /*!*********************************************!*\
  15229. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  15230. \*********************************************/
  15231. /*! no static exports found */
  15232. /***/ (function(module, exports, __webpack_require__) {
  15233. "use strict";
  15234. Object.defineProperty(exports, "__esModule", {
  15235. value: true
  15236. });
  15237. exports.createFloatingCommand = createFloatingCommand;
  15238. exports.renderCommand = renderCommand;
  15239. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15240. var _jquery2 = _interopRequireDefault(_jquery);
  15241. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15242. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15243. var Models = _interopRequireWildcard(_ivprog_elements);
  15244. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15245. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15246. var GlobalsManagement = _interopRequireWildcard(_globals);
  15247. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15248. var VariablesManagement = _interopRequireWildcard(_variables);
  15249. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15250. var CommandsManagement = _interopRequireWildcard(_commands);
  15251. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  15252. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  15253. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  15254. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  15255. 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; } }
  15256. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15257. function createFloatingCommand() {
  15258. return (0, _jquery2.default)('<div class="ui dowhiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_do') + ' {<br>} ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + '(x < 10) </span></div>');
  15259. }
  15260. function renderCommand(command, function_obj) {
  15261. var ret = '';
  15262. 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 class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_do') + ' </span>';
  15263. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  15264. ret += '</div>';
  15265. ret += ' <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' </span> <div class="conditional_expression"></div>';
  15266. ret += '</div>';
  15267. var el = (0, _jquery2.default)(ret);
  15268. el.data('command', command);
  15269. addHandlers(command, function_obj, el);
  15270. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  15271. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  15272. if (command.commands_block) {
  15273. for (var j = 0; j < command.commands_block.length; j++) {
  15274. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  15275. }
  15276. }
  15277. return el;
  15278. }
  15279. function addHandlers(command, function_obj, dowhiletrue_dom) {
  15280. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  15281. if (CommandsManagement.removeCommand(command, function_obj, dowhiletrue_dom)) {
  15282. dowhiletrue_dom.remove();
  15283. }
  15284. });
  15285. }
  15286. /***/ }),
  15287. /***/ "./js/visualUI/commands/functioncall.js":
  15288. /*!**********************************************!*\
  15289. !*** ./js/visualUI/commands/functioncall.js ***!
  15290. \**********************************************/
  15291. /*! no static exports found */
  15292. /***/ (function(module, exports, __webpack_require__) {
  15293. "use strict";
  15294. Object.defineProperty(exports, "__esModule", {
  15295. value: true
  15296. });
  15297. exports.createFloatingCommand = createFloatingCommand;
  15298. exports.renderCommand = renderCommand;
  15299. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15300. var _jquery2 = _interopRequireDefault(_jquery);
  15301. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15302. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15303. var Models = _interopRequireWildcard(_ivprog_elements);
  15304. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15305. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15306. var GlobalsManagement = _interopRequireWildcard(_globals);
  15307. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15308. var VariablesManagement = _interopRequireWildcard(_variables);
  15309. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15310. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  15311. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15312. var CommandsManagement = _interopRequireWildcard(_commands);
  15313. 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; } }
  15314. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15315. function createFloatingCommand() {
  15316. return (0, _jquery2.default)('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  15317. }
  15318. function renderCommand(command, function_obj) {
  15319. 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>');
  15320. el.data('command', command);
  15321. VariableValueMenu.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  15322. addHandlers(command, function_obj, el);
  15323. return el;
  15324. }
  15325. function addHandlers(command, function_obj, functioncall_dom) {
  15326. functioncall_dom.find('.button_remove_command').on('click', function () {
  15327. if (CommandsManagement.removeCommand(command, function_obj, functioncall_dom)) {
  15328. functioncall_dom.remove();
  15329. }
  15330. });
  15331. }
  15332. /***/ }),
  15333. /***/ "./js/visualUI/commands/iftrue.js":
  15334. /*!****************************************!*\
  15335. !*** ./js/visualUI/commands/iftrue.js ***!
  15336. \****************************************/
  15337. /*! no static exports found */
  15338. /***/ (function(module, exports, __webpack_require__) {
  15339. "use strict";
  15340. Object.defineProperty(exports, "__esModule", {
  15341. value: true
  15342. });
  15343. exports.createFloatingCommand = createFloatingCommand;
  15344. exports.renderCommand = renderCommand;
  15345. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15346. var _jquery2 = _interopRequireDefault(_jquery);
  15347. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15348. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15349. var Models = _interopRequireWildcard(_ivprog_elements);
  15350. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15351. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15352. var GlobalsManagement = _interopRequireWildcard(_globals);
  15353. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15354. var VariablesManagement = _interopRequireWildcard(_variables);
  15355. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15356. var CommandsManagement = _interopRequireWildcard(_commands);
  15357. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  15358. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  15359. 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; } }
  15360. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15361. function createFloatingCommand() {
  15362. return (0, _jquery2.default)('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  15363. }
  15364. function renderCommand(command, function_obj) {
  15365. var ret = '';
  15366. 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>';
  15367. ret += '<span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_if') + '</span>';
  15368. ret += ' <div class="conditional_expression"></div>';
  15369. ret += '<span> </span> ';
  15370. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  15371. ret += '</div></div>';
  15372. ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' </span>';
  15373. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  15374. ret += '</div>';
  15375. ret += '<span></span></div>';
  15376. ret += '</div>';
  15377. var el = (0, _jquery2.default)(ret);
  15378. el.data('command', command);
  15379. el.find('.block_commands').data('command', command);
  15380. el.find('.data_block_if').data('command', command);
  15381. el.find('.data_block_else').data('command', command);
  15382. addHandlers(command, function_obj, el);
  15383. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  15384. el.find('.button_refresh_attribution').on('click', function () {
  15385. el.find('.conditional_expression').empty();
  15386. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  15387. });
  15388. if (command.commands_block) {
  15389. for (var j = 0; j < command.commands_block.length; j++) {
  15390. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.commands_if')[0]), 3, function_obj);
  15391. }
  15392. }
  15393. if (command.commands_else) {
  15394. for (var j = 0; j < command.commands_else.length; j++) {
  15395. CommandsManagement.renderCommand(command.commands_else[j], (0, _jquery2.default)(el.find('.commands_else')[0]), 3, function_obj);
  15396. }
  15397. }
  15398. return el;
  15399. }
  15400. function addHandlers(command, function_obj, iftrue_dom) {
  15401. iftrue_dom.find('.button_remove_command').on('click', function () {
  15402. if (CommandsManagement.removeCommand(command, function_obj, iftrue_dom)) {
  15403. iftrue_dom.remove();
  15404. }
  15405. });
  15406. }
  15407. /***/ }),
  15408. /***/ "./js/visualUI/commands/reader.js":
  15409. /*!****************************************!*\
  15410. !*** ./js/visualUI/commands/reader.js ***!
  15411. \****************************************/
  15412. /*! no static exports found */
  15413. /***/ (function(module, exports, __webpack_require__) {
  15414. "use strict";
  15415. Object.defineProperty(exports, "__esModule", {
  15416. value: true
  15417. });
  15418. exports.createFloatingCommand = createFloatingCommand;
  15419. exports.renderCommand = renderCommand;
  15420. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15421. var _jquery2 = _interopRequireDefault(_jquery);
  15422. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15423. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15424. var Models = _interopRequireWildcard(_ivprog_elements);
  15425. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15426. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15427. var GlobalsManagement = _interopRequireWildcard(_globals);
  15428. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15429. var VariablesManagement = _interopRequireWildcard(_variables);
  15430. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15431. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  15432. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15433. var CommandsManagement = _interopRequireWildcard(_commands);
  15434. 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; } }
  15435. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15436. function createFloatingCommand() {
  15437. 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>');
  15438. }
  15439. function renderCommand(command, function_obj) {
  15440. 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 class="span_command_spec">' + _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( </span> <div class="var_value_menu_div"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  15441. el = (0, _jquery2.default)(el);
  15442. el.data('command', command);
  15443. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  15444. addHandlers(command, function_obj, el);
  15445. return el;
  15446. }
  15447. function addHandlers(command, function_obj, reader_dom) {
  15448. reader_dom.find('.button_remove_command').on('click', function () {
  15449. if (CommandsManagement.removeCommand(command, function_obj, reader_dom)) {
  15450. reader_dom.remove();
  15451. }
  15452. });
  15453. }
  15454. /***/ }),
  15455. /***/ "./js/visualUI/commands/repeatNtimes.js":
  15456. /*!**********************************************!*\
  15457. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  15458. \**********************************************/
  15459. /*! no static exports found */
  15460. /***/ (function(module, exports, __webpack_require__) {
  15461. "use strict";
  15462. Object.defineProperty(exports, "__esModule", {
  15463. value: true
  15464. });
  15465. exports.createFloatingCommand = createFloatingCommand;
  15466. exports.renderCommand = renderCommand;
  15467. exports.manageExpressionElements = manageExpressionElements;
  15468. exports.manageClearExpressionElements = manageClearExpressionElements;
  15469. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15470. var _jquery2 = _interopRequireDefault(_jquery);
  15471. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15472. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15473. var Models = _interopRequireWildcard(_ivprog_elements);
  15474. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15475. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15476. var GlobalsManagement = _interopRequireWildcard(_globals);
  15477. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15478. var VariablesManagement = _interopRequireWildcard(_variables);
  15479. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15480. var CommandsManagement = _interopRequireWildcard(_commands);
  15481. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  15482. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  15483. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15484. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  15485. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  15486. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  15487. 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; } }
  15488. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15489. function createFloatingCommand() {
  15490. 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>');
  15491. }
  15492. function renderCommand(command, function_obj) {
  15493. 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 class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_for') + ' ( </span> <div class="ui attribution_expression"><div class="ui variable_attribution"></div> <span class="text_receives span_command_spec"></span> <div class="ui var_value_expression div_expression_st"></div> </div> ; <div class="conditional_expression"></div> ; <div class="ui incrementation_field"><div class="ui incrementation_variable"></div> <span class="text_inc_receives span_command_spec"></span> <div class="ui first_operand"></div><div class="ui operator"></div><div class="ui second_operand"></div></div> <span class="span_command_spec"> ) </span>';
  15494. ret += '<div class="ui block_commands">';
  15495. ret += '</div>';
  15496. ret += '<span> </span>';
  15497. ret += '</div>';
  15498. var el = (0, _jquery2.default)(ret);
  15499. el.data('command', command);
  15500. addHandlers(command, function_obj, el);
  15501. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  15502. VariableValueMenu.renderMenu(command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  15503. ConditionalExpressionManagement.renderExpression(command, command.expression2, function_obj, el.find('.conditional_expression'));
  15504. VariableValueMenu.renderMenu(command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  15505. if (command.commands_block) {
  15506. for (var j = 0; j < command.commands_block.length; j++) {
  15507. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  15508. }
  15509. }
  15510. return el;
  15511. }
  15512. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  15513. if (dom_object.hasClass('variable_attribution')) {
  15514. (0, _jquery2.default)(dom_object).parent().find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  15515. command.expression1 = new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  15516. (0, _jquery2.default)(dom_object).parent().find('.var_value_expression').empty();
  15517. VariableValueMenu.renderMenu(command, command.expression1, (0, _jquery2.default)(dom_object).parent().find('.var_value_expression'), function_obj);
  15518. }
  15519. if (dom_object.hasClass('incrementation_variable')) {
  15520. (0, _jquery2.default)(dom_object).parent().find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  15521. 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)]);
  15522. command.expression3 = exp;
  15523. VariableValueMenu.renderMenu(command, command.expression3.itens[0], (0, _jquery2.default)(dom_object).parent().find('.first_operand'), function_obj);
  15524. renderOperator(command, function_obj, (0, _jquery2.default)(dom_object).parent().find('.operator'), command.expression3, 1);
  15525. VariableValueMenu.renderMenu(command, command.expression3.itens[2], (0, _jquery2.default)(dom_object).parent().find('.second_operand'), function_obj);
  15526. }
  15527. }
  15528. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  15529. if (dom_object.hasClass('variable_attribution')) {
  15530. (0, _jquery2.default)(dom_object).parent().find('.text_receives').text('');
  15531. command.expression1 = null;
  15532. (0, _jquery2.default)(dom_object).parent().find('.var_value_expression').empty();
  15533. }
  15534. if (dom_object.hasClass('incrementation_variable')) {
  15535. (0, _jquery2.default)(dom_object).parent().find('.text_inc_receives').text('');
  15536. command.expression3 = null;
  15537. (0, _jquery2.default)(dom_object).parent().find('.first_operand').empty();
  15538. (0, _jquery2.default)(dom_object).parent().find('.operator').empty();
  15539. (0, _jquery2.default)(dom_object).parent().find('.second_operand').empty();
  15540. }
  15541. }
  15542. function addHandlers(command, function_obj, repeatNtimes_dom) {
  15543. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  15544. if (CommandsManagement.removeCommand(command, function_obj, repeatNtimes_dom)) {
  15545. repeatNtimes_dom.remove();
  15546. }
  15547. });
  15548. }
  15549. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  15550. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div></div>');
  15551. menu_operator.dropdown({
  15552. values: [{
  15553. name: '+',
  15554. value: Models.ARITHMETIC_TYPES.plus,
  15555. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.plus
  15556. }, {
  15557. name: '-',
  15558. value: Models.ARITHMETIC_TYPES.minus,
  15559. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.minus
  15560. }, {
  15561. name: '*',
  15562. value: Models.ARITHMETIC_TYPES.multiplication,
  15563. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.multiplication
  15564. }, {
  15565. name: '/',
  15566. value: Models.ARITHMETIC_TYPES.division,
  15567. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.division
  15568. }, {
  15569. name: '%',
  15570. value: Models.ARITHMETIC_TYPES.module,
  15571. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.module
  15572. }],
  15573. onChange: function onChange(value, text, $selectedItem) {
  15574. expression_element.itens[index_op] = value;
  15575. }
  15576. });
  15577. temp_op.append(menu_operator);
  15578. }
  15579. /***/ }),
  15580. /***/ "./js/visualUI/commands/return.js":
  15581. /*!****************************************!*\
  15582. !*** ./js/visualUI/commands/return.js ***!
  15583. \****************************************/
  15584. /*! no static exports found */
  15585. /***/ (function(module, exports, __webpack_require__) {
  15586. "use strict";
  15587. Object.defineProperty(exports, "__esModule", {
  15588. value: true
  15589. });
  15590. exports.createFloatingCommand = createFloatingCommand;
  15591. exports.renderCommand = renderCommand;
  15592. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15593. var _jquery2 = _interopRequireDefault(_jquery);
  15594. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15595. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15596. var Models = _interopRequireWildcard(_ivprog_elements);
  15597. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15598. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15599. var GlobalsManagement = _interopRequireWildcard(_globals);
  15600. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15601. var VariablesManagement = _interopRequireWildcard(_variables);
  15602. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15603. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  15604. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15605. var CommandsManagement = _interopRequireWildcard(_commands);
  15606. 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; } }
  15607. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15608. function createFloatingCommand() {
  15609. 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>');
  15610. }
  15611. function renderCommand(command, function_obj) {
  15612. 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 class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_return') + ' </span> <div class="var_value_menu_div"></div></div>');
  15613. el.data('command', command);
  15614. addHandlers(command, function_obj, el);
  15615. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  15616. return el;
  15617. }
  15618. function addHandlers(command, function_obj, return_dom) {
  15619. return_dom.find('.button_remove_command').on('click', function () {
  15620. if (CommandsManagement.removeCommand(command, function_obj, return_dom)) {
  15621. return_dom.remove();
  15622. }
  15623. });
  15624. }
  15625. /***/ }),
  15626. /***/ "./js/visualUI/commands/switch.js":
  15627. /*!****************************************!*\
  15628. !*** ./js/visualUI/commands/switch.js ***!
  15629. \****************************************/
  15630. /*! no static exports found */
  15631. /***/ (function(module, exports, __webpack_require__) {
  15632. "use strict";
  15633. Object.defineProperty(exports, "__esModule", {
  15634. value: true
  15635. });
  15636. exports.createFloatingCommand = createFloatingCommand;
  15637. exports.renderCommand = renderCommand;
  15638. exports.renderCase = renderCase;
  15639. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15640. var _jquery2 = _interopRequireDefault(_jquery);
  15641. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15642. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15643. var Models = _interopRequireWildcard(_ivprog_elements);
  15644. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15645. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15646. var GlobalsManagement = _interopRequireWildcard(_globals);
  15647. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15648. var VariablesManagement = _interopRequireWildcard(_variables);
  15649. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15650. var CommandsManagement = _interopRequireWildcard(_commands);
  15651. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15652. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  15653. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  15654. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  15655. 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; } }
  15656. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15657. function createFloatingCommand() {
  15658. 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>');
  15659. }
  15660. function renderCommand(command, function_obj) {
  15661. var ret = '';
  15662. 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>';
  15663. ret += '</div>';
  15664. var el = (0, _jquery2.default)(ret);
  15665. el.data('command', command);
  15666. addHandlers(command, function_obj, el);
  15667. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  15668. VariableValueMenu.renderMenu(command, command.variable, el.find('.variable_to_switch'), function_obj);
  15669. if (command.cases) {
  15670. for (var i = 0; i < command.cases.length; i++) {
  15671. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  15672. }
  15673. }
  15674. return el;
  15675. }
  15676. function renderCase(switchcase, command, function_obj, el) {
  15677. 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>');
  15678. VariableValueMenu.renderMenu(command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  15679. casediv.data('switchcase', switchcase);
  15680. casediv.find('.case_commands_block').data('switchcase', switchcase);
  15681. el.append(casediv);
  15682. if (switchcase.commands_block) {
  15683. for (var j = 0; j < switchcase.commands_block.length; j++) {
  15684. CommandsManagement.renderCommand(switchcase.commands_block[j], (0, _jquery2.default)(casediv.find('.case_commands_block')[0]), 3, function_obj);
  15685. }
  15686. }
  15687. casediv.find('.button_remove_command').on('click', function () {
  15688. for (var i = 0; i < command.cases.length; i++) {
  15689. if (switchcase == command.cases[i]) {
  15690. delete command.cases[i];
  15691. command.cases.splice(i, 1);
  15692. casediv.remove();
  15693. break;
  15694. }
  15695. }
  15696. });
  15697. }
  15698. function addHandlers(command, function_obj, switch_dom) {
  15699. switch_dom.find('.button_remove_command').on('click', function () {
  15700. if (CommandsManagement.removeCommand(command, function_obj, switch_dom)) {
  15701. switch_dom.remove();
  15702. }
  15703. });
  15704. }
  15705. /***/ }),
  15706. /***/ "./js/visualUI/commands/variable_value_menu.js":
  15707. /*!*****************************************************!*\
  15708. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  15709. \*****************************************************/
  15710. /*! no static exports found */
  15711. /***/ (function(module, exports, __webpack_require__) {
  15712. "use strict";
  15713. Object.defineProperty(exports, "__esModule", {
  15714. value: true
  15715. });
  15716. exports.VAR_OR_VALUE_TYPES = undefined;
  15717. exports.renderMenu = renderMenu;
  15718. exports.refreshMenu = refreshMenu;
  15719. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15720. var _jquery2 = _interopRequireDefault(_jquery);
  15721. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15722. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15723. var Models = _interopRequireWildcard(_ivprog_elements);
  15724. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15725. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15726. var GlobalsManagement = _interopRequireWildcard(_globals);
  15727. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15728. var VariablesManagement = _interopRequireWildcard(_variables);
  15729. var _attribution = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  15730. var AttribuitionsManagement = _interopRequireWildcard(_attribution);
  15731. var _writer = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  15732. var WritersManagement = _interopRequireWildcard(_writer);
  15733. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  15734. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  15735. 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; } }
  15736. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15737. 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,
  15738. value_and_function: 6, all: 7 });
  15739. function renderMenu(command, ref_object, dom_object, function_obj) {
  15740. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  15741. var expression_element = arguments[5];
  15742. 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">';
  15743. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  15744. 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">';
  15745. menu_var_or_value += '</div>';
  15746. }
  15747. 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) {
  15748. 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');
  15749. menu_var_or_value += '<div class="menu menu_only_functions">';
  15750. menu_var_or_value += '</div></div>';
  15751. }
  15752. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  15753. 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">';
  15754. menu_var_or_value += '</div>';
  15755. }
  15756. 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) {
  15757. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('variable');
  15758. menu_var_or_value += '<div class="menu menu_only_vars">';
  15759. menu_var_or_value += '</div></div>';
  15760. }
  15761. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  15762. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  15763. }
  15764. 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) {
  15765. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  15766. if (command.type == Models.COMMAND_TYPES.attribution) {
  15767. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  15768. menu_var_or_value += '<div class="menu">';
  15769. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  15770. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  15771. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  15772. menu_var_or_value += '</div></div>';
  15773. }
  15774. }
  15775. menu_var_or_value += '</div></div>';
  15776. menu_var_or_value = (0, _jquery2.default)(menu_var_or_value);
  15777. dom_object.append(menu_var_or_value);
  15778. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  15779. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  15780. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  15781. if (ref_object.content || ref_object.function_called) {
  15782. // Verificar se a variável ainda existe:
  15783. if (isVarInProgram(ref_object.content, function_obj)) {
  15784. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  15785. } else {
  15786. if (ref_object.content && ref_object.content.type) {
  15787. ref_object.content = null;
  15788. appendSelectText(ref_object, menu_var_or_value);
  15789. } else {
  15790. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  15791. }
  15792. }
  15793. } else {
  15794. appendSelectText(ref_object, menu_var_or_value);
  15795. }
  15796. }
  15797. function appendSelectText(ref_object, menu_var_or_value) {
  15798. switch (ref_object.variable_and_value) {
  15799. case VAR_OR_VALUE_TYPES.only_variable:
  15800. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_var') + '</i>');
  15801. break;
  15802. case VAR_OR_VALUE_TYPES.all:
  15803. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  15804. break;
  15805. case VAR_OR_VALUE_TYPES.variable_and_function:
  15806. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  15807. break;
  15808. case VAR_OR_VALUE_TYPES.only_function:
  15809. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_function') + '</i>');
  15810. break;
  15811. }
  15812. }
  15813. function isVarInProgram(var_obj, function_obj) {
  15814. // Verify in globals:
  15815. if (window.program_obj.globals) {
  15816. for (var i = 0; i < window.program_obj.globals.length; i++) {
  15817. if (window.program_obj.globals[i] == var_obj) {
  15818. return true;
  15819. }
  15820. }
  15821. }
  15822. // Verify in locals:
  15823. if (function_obj.variables_list) {
  15824. for (var i = 0; i < function_obj.variables_list.length; i++) {
  15825. if (function_obj.variables_list[i] == var_obj) {
  15826. return true;
  15827. }
  15828. }
  15829. }
  15830. // Verify in parameters:
  15831. if (function_obj.parameters_list) {
  15832. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  15833. if (function_obj.parameters_list[i] == var_obj) {
  15834. return true;
  15835. }
  15836. }
  15837. }
  15838. return false;
  15839. }
  15840. function refreshMenu(menu_var_or_value_dom) {
  15841. console.log('\n\n');
  15842. console.log(menu_var_or_value_dom);
  15843. console.log("olá, fui chamado! note alguns DATAS recuperados: ");
  15844. console.log(menu_var_or_value_dom.data());
  15845. console.log('\n\n\n');
  15846. }
  15847. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  15848. if (ref_object.function_called) {
  15849. menu_var_or_value.remove();
  15850. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  15851. } else if (ref_object.content.type) {
  15852. menu_var_or_value.remove();
  15853. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  15854. } else {
  15855. menu_var_or_value.remove();
  15856. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  15857. }
  15858. }
  15859. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  15860. if (variable_obj.content || variable_obj.function_called) {
  15861. // Verificar se a variável ainda existe:
  15862. if (isVarInProgram(variable_obj.content, function_obj)) {} else {
  15863. if (variable_obj.content && variable_obj.content.type) {
  15864. variable_obj.content = null;
  15865. appendSelectText(variable_obj, menu_var_or_value);
  15866. }
  15867. }
  15868. } else {
  15869. appendSelectText(variable_obj, menu_var_or_value);
  15870. }
  15871. if (variable_obj.content == null && variable_obj.function_called == null) {
  15872. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  15873. return;
  15874. }
  15875. var ret = '';
  15876. if (variable_obj.function_called) {
  15877. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  15878. menu_var_or_value.find('.text').text(' ');
  15879. dom_object.find('.menu_var_or_value_dom').remove();
  15880. var parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  15881. parameters_menu += '<span> ) </span></div>';
  15882. parameters_menu = (0, _jquery2.default)(parameters_menu);
  15883. dom_object.append(parameters_menu);
  15884. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  15885. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  15886. if (command.type == Models.COMMAND_TYPES.attribution) {
  15887. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  15888. context_menu += '<div class="menu">';
  15889. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  15890. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  15891. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  15892. context_menu += '</div></div>';
  15893. }
  15894. context_menu += '</div></div>';
  15895. context_menu = (0, _jquery2.default)(context_menu);
  15896. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  15897. context_menu.dropdown({
  15898. onChange: function onChange(value, text, $selectedItem) {
  15899. if ($selectedItem.data('clear')) {
  15900. console.log('PP1');
  15901. dom_object.text('');
  15902. variable_obj.content = null;
  15903. variable_obj.row = null;
  15904. variable_obj.column = null;
  15905. delete variable_obj.function_called;
  15906. delete variable_obj.parameters_list;
  15907. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  15908. }
  15909. if ($selectedItem.data('exp')) {
  15910. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  15911. }
  15912. }
  15913. });
  15914. } else {
  15915. menu_var_or_value.find('.text').text(' ');
  15916. dom_object.find('.menu_var_or_value_dom').remove();
  15917. var parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  15918. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  15919. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  15920. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  15921. parameters_menu += ' , ';
  15922. }
  15923. }
  15924. parameters_menu += '<span> ) </span></div>';
  15925. parameters_menu = (0, _jquery2.default)(parameters_menu);
  15926. dom_object.append(parameters_menu);
  15927. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  15928. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  15929. }
  15930. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  15931. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  15932. if (command.type == Models.COMMAND_TYPES.attribution) {
  15933. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  15934. context_menu += '<div class="menu">';
  15935. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  15936. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  15937. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  15938. context_menu += '</div></div>';
  15939. }
  15940. context_menu += '</div></div>';
  15941. context_menu = (0, _jquery2.default)(context_menu);
  15942. context_menu.insertAfter(parameters_menu);
  15943. context_menu.dropdown({
  15944. onChange: function onChange(value, text, $selectedItem) {
  15945. if ($selectedItem.data('clear')) {
  15946. console.log('PP2');
  15947. dom_object.text('');
  15948. variable_obj.content = null;
  15949. variable_obj.row = null;
  15950. variable_obj.column = null;
  15951. delete variable_obj.function_called;
  15952. delete variable_obj.parameters_list;
  15953. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  15954. }
  15955. if ($selectedItem.data('exp')) {
  15956. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  15957. }
  15958. }
  15959. });
  15960. }
  15961. } else if (variable_obj.content.type) {
  15962. var variable_render = "";
  15963. if (variable_obj.content.dimensions == 1) {
  15964. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  15965. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  15966. variable_render += '</div>';
  15967. variable_render = (0, _jquery2.default)(variable_render);
  15968. dom_object.append(variable_render);
  15969. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  15970. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  15971. if (command.type == Models.COMMAND_TYPES.attribution) {
  15972. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  15973. context_menu += '<div class="menu">';
  15974. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  15975. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  15976. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  15977. context_menu += '</div></div>';
  15978. }
  15979. context_menu += '</div></div>';
  15980. context_menu = (0, _jquery2.default)(context_menu);
  15981. variable_render.append(context_menu);
  15982. context_menu.dropdown({
  15983. onChange: function onChange(value, text, $selectedItem) {
  15984. if ($selectedItem.data('clear')) {
  15985. console.log('PP3');
  15986. dom_object.text('');
  15987. variable_obj.content = null;
  15988. variable_obj.row = null;
  15989. variable_obj.column = null;
  15990. delete variable_obj.function_called;
  15991. delete variable_obj.parameters_list;
  15992. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  15993. }
  15994. if ($selectedItem.data('exp')) {
  15995. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  15996. }
  15997. }
  15998. });
  15999. if (!variable_obj.column) {
  16000. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  16001. }
  16002. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  16003. } else if (variable_obj.content.dimensions == 2) {
  16004. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  16005. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  16006. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  16007. variable_render += '</div>';
  16008. variable_render = (0, _jquery2.default)(variable_render);
  16009. dom_object.append(variable_render);
  16010. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16011. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  16012. if (command.type == Models.COMMAND_TYPES.attribution) {
  16013. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  16014. context_menu += '<div class="menu">';
  16015. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16016. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16017. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16018. context_menu += '</div></div>';
  16019. }
  16020. context_menu += '</div></div>';
  16021. context_menu = (0, _jquery2.default)(context_menu);
  16022. variable_render.append(context_menu);
  16023. context_menu.dropdown({
  16024. onChange: function onChange(value, text, $selectedItem) {
  16025. if ($selectedItem.data('clear')) {
  16026. console.log('PP4');
  16027. dom_object.text('');
  16028. variable_obj.content = null;
  16029. variable_obj.row = null;
  16030. variable_obj.column = null;
  16031. delete variable_obj.function_called;
  16032. delete variable_obj.parameters_list;
  16033. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  16034. }
  16035. if ($selectedItem.data('exp')) {
  16036. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16037. }
  16038. }
  16039. });
  16040. if (!variable_obj.column) {
  16041. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  16042. }
  16043. if (!variable_obj.row) {
  16044. variable_obj.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  16045. }
  16046. variableValueMenuCode(command, variable_obj.row, (0, _jquery2.default)(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  16047. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  16048. } else {
  16049. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  16050. variable_render += '</div>';
  16051. variable_render = (0, _jquery2.default)(variable_render);
  16052. dom_object.append(variable_render);
  16053. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16054. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  16055. if (command.type == Models.COMMAND_TYPES.attribution) {
  16056. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  16057. context_menu += '<div class="menu">';
  16058. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16059. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16060. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16061. context_menu += '</div></div>';
  16062. }
  16063. context_menu += '</div></div>';
  16064. context_menu = (0, _jquery2.default)(context_menu);
  16065. variable_render.append(context_menu);
  16066. context_menu.dropdown({
  16067. onChange: function onChange(value, text, $selectedItem) {
  16068. if ($selectedItem.data('clear')) {
  16069. console.log('PP5');
  16070. dom_object.text('');
  16071. variable_obj.content = null;
  16072. variable_obj.row = null;
  16073. variable_obj.column = null;
  16074. delete variable_obj.function_called;
  16075. delete variable_obj.parameters_list;
  16076. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  16077. }
  16078. if ($selectedItem.data('exp')) {
  16079. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16080. }
  16081. }
  16082. });
  16083. }
  16084. } else {
  16085. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  16086. variable_render += '</div>';
  16087. variable_render = (0, _jquery2.default)(variable_render);
  16088. dom_object.append(variable_render);
  16089. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16090. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  16091. if (command.type == Models.COMMAND_TYPES.attribution) {
  16092. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  16093. context_menu += '<div class="menu">';
  16094. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16095. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16096. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16097. context_menu += '</div></div>';
  16098. }
  16099. context_menu += '</div></div>';
  16100. context_menu = (0, _jquery2.default)(context_menu);
  16101. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  16102. context_menu.insertAfter(variable_render);
  16103. }
  16104. context_menu.dropdown({
  16105. onChange: function onChange(value, text, $selectedItem) {
  16106. if ($selectedItem.data('clear')) {
  16107. console.log('PP6');
  16108. dom_object.text('');
  16109. variable_obj.content = null;
  16110. variable_obj.row = null;
  16111. variable_obj.column = null;
  16112. delete variable_obj.function_called;
  16113. delete variable_obj.parameters_list;
  16114. dom_object.find('.value_rendered').remove();
  16115. dom_object.find('.context_menu_clear').remove();
  16116. dom_object.find('.width-dynamic-minus').remove();
  16117. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  16118. }
  16119. if ($selectedItem.data('exp')) {
  16120. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16121. }
  16122. }
  16123. });
  16124. variable_render.on('click', function (e) {
  16125. variable_render.remove();
  16126. variable_render.empty();
  16127. variable_render.remove();
  16128. dom_object.empty();
  16129. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  16130. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  16131. });
  16132. }
  16133. }
  16134. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  16135. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  16136. sub_menu.text('');
  16137. for (var i = 0; i < window.program_obj.functions.length; i++) {
  16138. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + ' </div>');
  16139. temp.data('function_reference', window.program_obj.functions[i]);
  16140. sub_menu.append(temp);
  16141. }
  16142. }
  16143. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  16144. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  16145. sub_menu.text('');
  16146. if (window.program_obj.globals) {
  16147. if (ref_object.include_constant) {
  16148. for (var i = 0; i < window.program_obj.globals.length; i++) {
  16149. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  16150. temp.data('variable_reference', window.program_obj.globals[i]);
  16151. sub_menu.append(temp);
  16152. }
  16153. } else {
  16154. for (var i = 0; i < window.program_obj.globals.length; i++) {
  16155. if (!window.program_obj.globals[i].is_constant) {
  16156. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  16157. temp.data('variable_reference', window.program_obj.globals[i]);
  16158. sub_menu.append(temp);
  16159. }
  16160. }
  16161. }
  16162. }
  16163. if (function_obj.parameters_list) {
  16164. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  16165. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + ' </div>');
  16166. temp.data('variable_reference', function_obj.parameters_list[i]);
  16167. sub_menu.append(temp);
  16168. }
  16169. }
  16170. if (function_obj.variables_list) {
  16171. for (var i = 0; i < function_obj.variables_list.length; i++) {
  16172. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + ' </div>');
  16173. temp.data('variable_reference', function_obj.variables_list[i]);
  16174. sub_menu.append(temp);
  16175. }
  16176. }
  16177. }
  16178. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  16179. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  16180. menu_var_or_value.dropdown({
  16181. onChange: function onChange(value, text, $selectedItem) {
  16182. dom_object.find('.var_name').remove();
  16183. switch ($selectedItem.data('option')) {
  16184. case VAR_OR_VALUE_TYPES.only_function:
  16185. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('function_reference'), expression_element);
  16186. break;
  16187. case VAR_OR_VALUE_TYPES.only_value:
  16188. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  16189. break;
  16190. case VAR_OR_VALUE_TYPES.only_variable:
  16191. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('variable_reference'), expression_element);
  16192. break;
  16193. }
  16194. if ($selectedItem.data('exp')) {
  16195. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16196. }
  16197. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  16198. RepeatNTimesManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16199. }
  16200. }
  16201. });
  16202. }
  16203. dom_object.find('.width-dynamic').on('input', function () {
  16204. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  16205. (0, _jquery2.default)(this).focus();
  16206. var tmpStr = (0, _jquery2.default)(this).val();
  16207. (0, _jquery2.default)(this).val('');
  16208. (0, _jquery2.default)(this).val(tmpStr);
  16209. (0, _jquery2.default)(this).css({
  16210. width: inputWidth
  16211. });
  16212. }).trigger('input');
  16213. if (command.type == Models.COMMAND_TYPES.comment) {
  16214. dom_object.parent().on('click', function (e) {
  16215. dom_object.find('.value_rendered').remove();
  16216. dom_object.find('.value_rendered').empty();
  16217. dom_object.find('.value_rendered').remove();
  16218. dom_object.empty();
  16219. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  16220. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  16221. });
  16222. }
  16223. }
  16224. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  16225. ref_object.function_called = function_selected;
  16226. ref_object.parameters_list = [];
  16227. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  16228. menu_var_or_value.find('.text').text(' ');
  16229. dom_object.find('.menu_var_or_value_dom').remove();
  16230. var parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  16231. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  16232. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  16233. if (j + 1 != function_selected.parameters_list.length) {
  16234. parameters_menu += ' , ';
  16235. }
  16236. }
  16237. parameters_menu += '<span> ) </span></div>';
  16238. parameters_menu = (0, _jquery2.default)(parameters_menu);
  16239. dom_object.append(parameters_menu);
  16240. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  16241. var temp = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  16242. ref_object.parameters_list.push(temp);
  16243. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  16244. }
  16245. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16246. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  16247. if (command.type == Models.COMMAND_TYPES.attribution) {
  16248. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  16249. context_menu += '<div class="menu">';
  16250. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16251. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16252. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16253. context_menu += '</div></div>';
  16254. }
  16255. context_menu += '</div></div>';
  16256. context_menu = (0, _jquery2.default)(context_menu);
  16257. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  16258. context_menu.dropdown({
  16259. onChange: function onChange(value, text, $selectedItem) {
  16260. if ($selectedItem.data('clear')) {
  16261. console.log('PP7');
  16262. dom_object.text('');
  16263. ref_object.content = null;
  16264. ref_object.row = null;
  16265. ref_object.column = null;
  16266. delete ref_object.function_called;
  16267. delete ref_object.parameters_list;
  16268. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  16269. }
  16270. if ($selectedItem.data('exp')) {
  16271. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16272. }
  16273. }
  16274. });
  16275. } else {
  16276. menu_var_or_value.find('.text').text(' ');
  16277. dom_object.find('.menu_var_or_value_dom').remove();
  16278. var parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  16279. parameters_menu += '<span> ) </span></div>';
  16280. parameters_menu = (0, _jquery2.default)(parameters_menu);
  16281. dom_object.append(parameters_menu);
  16282. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16283. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  16284. if (command.type == Models.COMMAND_TYPES.attribution) {
  16285. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  16286. context_menu += '<div class="menu">';
  16287. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16288. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16289. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16290. context_menu += '</div></div>';
  16291. }
  16292. context_menu += '</div></div>';
  16293. context_menu = (0, _jquery2.default)(context_menu);
  16294. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  16295. context_menu.dropdown({
  16296. onChange: function onChange(value, text, $selectedItem) {
  16297. if ($selectedItem.data('clear')) {
  16298. console.log('PP8');
  16299. dom_object.text('');
  16300. ref_object.content = null;
  16301. ref_object.row = null;
  16302. ref_object.column = null;
  16303. delete ref_object.function_called;
  16304. delete ref_object.parameters_list;
  16305. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  16306. }
  16307. if ($selectedItem.data('exp')) {
  16308. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16309. }
  16310. }
  16311. });
  16312. }
  16313. if (command.type == Models.COMMAND_TYPES.attribution) {
  16314. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  16315. }
  16316. if (command.type == Models.COMMAND_TYPES.writer) {
  16317. WritersManagement.addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object.content);
  16318. }
  16319. }
  16320. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  16321. ref_object.content = variable_selected;
  16322. menu_var_or_value.find('.text').text(' ');
  16323. dom_object.find('.menu_var_or_value_dom').remove();
  16324. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  16325. if (variable_selected.dimensions == 1) {
  16326. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  16327. }
  16328. if (variable_selected.dimensions == 2) {
  16329. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  16330. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  16331. }
  16332. variable_render += '</div>';
  16333. variable_render = (0, _jquery2.default)(variable_render);
  16334. dom_object.append(variable_render);
  16335. if (variable_selected.dimensions == 1) {
  16336. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  16337. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  16338. }
  16339. if (variable_selected.dimensions == 2) {
  16340. ref_object.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  16341. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  16342. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  16343. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  16344. }
  16345. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16346. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  16347. if (command.type == Models.COMMAND_TYPES.attribution) {
  16348. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  16349. context_menu += '<div class="menu">';
  16350. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16351. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16352. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16353. context_menu += '</div></div>';
  16354. }
  16355. context_menu += '</div></div>';
  16356. context_menu = (0, _jquery2.default)(context_menu);
  16357. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  16358. context_menu.dropdown({
  16359. onChange: function onChange(value, text, $selectedItem) {
  16360. if ($selectedItem.data('clear')) {
  16361. console.log('PP9');
  16362. dom_object.text('');
  16363. ref_object.content = null;
  16364. ref_object.row = null;
  16365. ref_object.column = null;
  16366. delete ref_object.function_called;
  16367. delete ref_object.parameters_list;
  16368. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  16369. }
  16370. if ($selectedItem.data('exp')) {
  16371. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16372. }
  16373. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  16374. RepeatNTimesManagement.manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16375. }
  16376. }
  16377. });
  16378. if (command.type == Models.COMMAND_TYPES.attribution) {
  16379. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  16380. }
  16381. if (command.type == Models.COMMAND_TYPES.writer) {
  16382. WritersManagement.addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  16383. }
  16384. }
  16385. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  16386. if (ref_object.content == null) {
  16387. ref_object.content = "";
  16388. }
  16389. menu_var_or_value.find('.text').text(' ');
  16390. var field = (0, _jquery2.default)('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  16391. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  16392. var rendered = (0, _jquery2.default)('<div class="value_rendered"></div>');
  16393. rendered.insertBefore(field);
  16394. field.focus();
  16395. field.val(ref_object.content);
  16396. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16397. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  16398. if (command.type == Models.COMMAND_TYPES.attribution) {
  16399. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  16400. context_menu += '<div class="menu">';
  16401. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16402. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16403. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16404. context_menu += '</div></div>';
  16405. }
  16406. context_menu += '</div></div>';
  16407. context_menu = (0, _jquery2.default)(context_menu);
  16408. dom_object.find('.menu_var_or_value_dom').remove();
  16409. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  16410. context_menu.insertAfter(field);
  16411. }
  16412. context_menu.dropdown({
  16413. onChange: function onChange(value, text, $selectedItem) {
  16414. if ($selectedItem.data('clear')) {
  16415. console.log('PP10');
  16416. dom_object.text('');
  16417. dom_object.find('.value_rendered').remove();
  16418. dom_object.find('.context_menu_clear').remove();
  16419. dom_object.find('.width-dynamic-minus').remove();
  16420. ref_object.content = null;
  16421. ref_object.row = null;
  16422. ref_object.column = null;
  16423. delete ref_object.function_called;
  16424. delete ref_object.parameters_list;
  16425. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  16426. }
  16427. if ($selectedItem.data('exp')) {
  16428. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16429. }
  16430. }
  16431. });
  16432. dom_object.find('.width-dynamic-minus').focusout(function () {
  16433. if ((0, _jquery2.default)(this).val().trim()) {
  16434. ref_object.content = (0, _jquery2.default)(this).val().trim();
  16435. }
  16436. rendered.text(ref_object.content);
  16437. (0, _jquery2.default)(this).remove();
  16438. });
  16439. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  16440. var code = e.keyCode || e.which;
  16441. if (code == 13) {
  16442. if ((0, _jquery2.default)(this).val().trim()) {
  16443. ref_object.content = (0, _jquery2.default)(this).val().trim();
  16444. }
  16445. rendered.text(ref_object.content);
  16446. (0, _jquery2.default)(this).remove();
  16447. }
  16448. if (code == 27) {
  16449. rendered.text(ref_object.content);
  16450. (0, _jquery2.default)(this).remove();
  16451. }
  16452. });
  16453. if (command.type == Models.COMMAND_TYPES.comment) {
  16454. rendered.parent().on('click', function (e) {
  16455. console.log("TTT14");
  16456. rendered.remove();
  16457. rendered.empty();
  16458. rendered.remove();
  16459. dom_object.empty();
  16460. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  16461. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  16462. });
  16463. }
  16464. rendered.on('click', function (e) {
  16465. console.log("TTT2");
  16466. rendered.remove();
  16467. rendered.empty();
  16468. rendered.remove();
  16469. dom_object.empty();
  16470. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  16471. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  16472. });
  16473. if (command.type == Models.COMMAND_TYPES.attribution) {
  16474. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  16475. }
  16476. if (command.type == Models.COMMAND_TYPES.writer) {
  16477. WritersManagement.addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object.content);
  16478. }
  16479. }
  16480. _jquery2.default.fn.textWidth = function (text, font) {
  16481. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  16482. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  16483. return _jquery2.default.fn.textWidth.fakeEl.width();
  16484. };
  16485. /***/ }),
  16486. /***/ "./js/visualUI/commands/whiletrue.js":
  16487. /*!*******************************************!*\
  16488. !*** ./js/visualUI/commands/whiletrue.js ***!
  16489. \*******************************************/
  16490. /*! no static exports found */
  16491. /***/ (function(module, exports, __webpack_require__) {
  16492. "use strict";
  16493. Object.defineProperty(exports, "__esModule", {
  16494. value: true
  16495. });
  16496. exports.createFloatingCommand = createFloatingCommand;
  16497. exports.renderCommand = renderCommand;
  16498. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16499. var _jquery2 = _interopRequireDefault(_jquery);
  16500. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16501. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16502. var Models = _interopRequireWildcard(_ivprog_elements);
  16503. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16504. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16505. var GlobalsManagement = _interopRequireWildcard(_globals);
  16506. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16507. var VariablesManagement = _interopRequireWildcard(_variables);
  16508. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16509. var CommandsManagement = _interopRequireWildcard(_commands);
  16510. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  16511. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  16512. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  16513. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  16514. 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; } }
  16515. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16516. function createFloatingCommand() {
  16517. 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>');
  16518. }
  16519. function renderCommand(command, function_obj) {
  16520. var ret = '';
  16521. 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 class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' </span>';
  16522. ret += ' <div class="conditional_expression"></div>';
  16523. ret += ' </span>';
  16524. ret += '<div class="ui block_commands">';
  16525. ret += '</div>';
  16526. ret += '<span> </span>';
  16527. ret += '</div>';
  16528. var el = (0, _jquery2.default)(ret);
  16529. el.data('command', command);
  16530. addHandlers(command, function_obj, el);
  16531. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  16532. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  16533. if (command.commands_block) {
  16534. for (var j = 0; j < command.commands_block.length; j++) {
  16535. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  16536. }
  16537. }
  16538. return el;
  16539. }
  16540. function addHandlers(command, function_obj, whiletrue_dom) {
  16541. whiletrue_dom.find('.button_remove_command').on('click', function () {
  16542. if (CommandsManagement.removeCommand(command, function_obj, whiletrue_dom)) {
  16543. whiletrue_dom.remove();
  16544. }
  16545. });
  16546. }
  16547. /***/ }),
  16548. /***/ "./js/visualUI/commands/writer.js":
  16549. /*!****************************************!*\
  16550. !*** ./js/visualUI/commands/writer.js ***!
  16551. \****************************************/
  16552. /*! no static exports found */
  16553. /***/ (function(module, exports, __webpack_require__) {
  16554. "use strict";
  16555. Object.defineProperty(exports, "__esModule", {
  16556. value: true
  16557. });
  16558. exports.createFloatingCommand = createFloatingCommand;
  16559. exports.renderCommand = renderCommand;
  16560. exports.addContent = addContent;
  16561. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16562. var _jquery2 = _interopRequireDefault(_jquery);
  16563. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16564. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16565. var Models = _interopRequireWildcard(_ivprog_elements);
  16566. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16567. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16568. var GlobalsManagement = _interopRequireWildcard(_globals);
  16569. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16570. var VariablesManagement = _interopRequireWildcard(_variables);
  16571. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16572. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16573. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16574. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16575. var CommandsManagement = _interopRequireWildcard(_commands);
  16576. 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; } }
  16577. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16578. function createFloatingCommand() {
  16579. 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>');
  16580. }
  16581. function renderCommand(command, function_obj) {
  16582. var ret = '';
  16583. 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 class="span_command_spec">' + _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( </span><div class="var_value_menu_div"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  16584. var el = (0, _jquery2.default)(ret);
  16585. el.data('command', command);
  16586. VariableValueMenu.renderMenu(command, command.content[0], (0, _jquery2.default)(el).find('.var_value_menu_div'), function_obj);
  16587. addHandlers(command, function_obj, el);
  16588. return el;
  16589. }
  16590. function addHandlers(command, function_obj, writer_dom) {
  16591. writer_dom.find('.button_remove_command').on('click', function () {
  16592. if (CommandsManagement.removeCommand(command, function_obj, writer_dom)) {
  16593. writer_dom.remove();
  16594. }
  16595. });
  16596. }
  16597. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  16598. if ((0, _jquery2.default)(dom_object).hasClass('var_value_menu_div')) {
  16599. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  16600. (0, _jquery2.default)(icon_add_item).insertAfter(dom_object);
  16601. (0, _jquery2.default)(icon_add_item).on('click', function (e) {
  16602. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  16603. (0, _jquery2.default)(new_div_item).insertAfter(icon_add_item);
  16604. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  16605. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  16606. command.content.push(new_related_menu);
  16607. });
  16608. }
  16609. }
  16610. /***/ }),
  16611. /***/ "./js/visualUI/functions.js":
  16612. /*!**********************************!*\
  16613. !*** ./js/visualUI/functions.js ***!
  16614. \**********************************/
  16615. /*! no static exports found */
  16616. /***/ (function(module, exports, __webpack_require__) {
  16617. "use strict";
  16618. Object.defineProperty(exports, "__esModule", {
  16619. value: true
  16620. });
  16621. exports.renderFunction = renderFunction;
  16622. exports.initVisualUI = initVisualUI;
  16623. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16624. var _jquery2 = _interopRequireDefault(_jquery);
  16625. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  16626. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16627. var Models = _interopRequireWildcard(_ivprog_elements);
  16628. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16629. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  16630. var GlobalsManagement = _interopRequireWildcard(_globals);
  16631. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  16632. var VariablesManagement = _interopRequireWildcard(_variables);
  16633. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  16634. var CommandsManagement = _interopRequireWildcard(_commands);
  16635. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  16636. var CodeManagement = _interopRequireWildcard(_code_generator);
  16637. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16638. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16639. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  16640. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  16641. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  16642. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  16643. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  16644. var _semanticAnalyser = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  16645. var _ivprogAssessment = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  16646. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  16647. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  16648. 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; } }
  16649. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16650. var counter_new_functions = 0;
  16651. var counter_new_parameters = 0;
  16652. var studentTemp = null;
  16653. var domConsole = null;
  16654. window.studentGrade = null;
  16655. var program = new Models.Program();
  16656. /*const variable1 = new Models.Variable(Types.INTEGER, "a", 1);
  16657. const parameter1 = new Models.Variable(Types.INTEGER, "par_1", 1);
  16658. const command1 = new Models.Comment(new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.only_value, "Testing rendering commands"));
  16659. const sumFunction = new Models.Function("soma", Types.INTEGER, 0, [parameter1], false, false, [], null, [command1]);
  16660. program.addFunction(sumFunction);
  16661. */
  16662. console.log(' ___ ___ ________ \n / / / / / ____/ \n / / / / / / \n / / / / ______ ___ / /__ \n / / / / / \\ / / / ___/ \n / /______ / / / /\\ \\/ / / / \n / / / / / / \\ / / /____ \n/__________/ /___/ /___/ \\___/ /________/ ');
  16663. var mainFunction = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("start"), _types.Types.VOID, 0, [], true, false);
  16664. mainFunction.function_comment = new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_main'));
  16665. program.addFunction(mainFunction);
  16666. window.program_obj = program;
  16667. window.generator = CodeManagement.generate;
  16668. window.runCodeAssessment = runCodeAssessment;
  16669. window.renderAlgorithm = AlgorithmManagement.renderAlgorithm;
  16670. _melankeWatchjs2.default.watch(program.globals, function () {
  16671. AlgorithmManagement.renderAlgorithm();
  16672. }, 1);
  16673. function addFunctionHandler() {
  16674. 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')));
  16675. program.addFunction(new_function);
  16676. counter_new_functions++;
  16677. renderFunction(new_function);
  16678. }
  16679. function addParameter(function_obj, function_container) {
  16680. if (function_obj.parameters_list == null) {
  16681. function_obj.parameters_list = [];
  16682. }
  16683. var new_parameter = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI("new_parameter") + "_" + counter_new_parameters);
  16684. function_obj.parameters_list.push(new_parameter);
  16685. counter_new_parameters++;
  16686. renderParameter(function_obj, new_parameter, function_container);
  16687. }
  16688. function updateReturnType(function_obj, new_type) {
  16689. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  16690. function_obj.return_type = new_type;
  16691. function_obj.return_dimensions = new_dimensions;
  16692. }
  16693. function removeFunction(function_obj) {
  16694. var index = program.functions.indexOf(function_obj);
  16695. if (index > -1) {
  16696. program.functions.splice(index, 1);
  16697. }
  16698. }
  16699. function minimizeFunction(function_obj) {
  16700. function_obj.is_hidden = !function_obj.is_hidden;
  16701. }
  16702. function addHandlers(function_obj, function_container) {
  16703. function_container.find('.ui.dropdown.function_return').dropdown({
  16704. onChange: function onChange(value, text, $selectedItem) {
  16705. if ($selectedItem.data('dimensions')) {
  16706. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  16707. } else {
  16708. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')]);
  16709. }
  16710. }
  16711. });
  16712. function_container.find(".name_function_updated").on('click', function (e) {
  16713. enableNameFunctionUpdate(function_obj, function_container);
  16714. });
  16715. function_container.find(".add_parameter_button").on('click', function (e) {
  16716. addParameter(function_obj, function_container);
  16717. });
  16718. function_container.find('.menu_commands').dropdown({
  16719. on: 'hover'
  16720. });
  16721. function_container.find('.menu_commands a').on('click', function (evt) {
  16722. if (function_obj.commands == null || function_obj.commands.length == 0) {
  16723. function_obj.commands = [];
  16724. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  16725. function_obj.commands.push(new_cmd);
  16726. CommandsManagement.renderCommand(new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  16727. } else {
  16728. CommandsManagement.createFloatingCommand(function_obj, function_container, (0, _jquery2.default)(this).data('command'), evt);
  16729. }
  16730. });
  16731. function_container.find('.add_var_button_function').on('click', function (e) {
  16732. VariablesManagement.addVariable(function_obj, function_container);
  16733. });
  16734. function_container.find('.remove_function_button').on('click', function (e) {
  16735. removeFunction(function_obj);
  16736. function_container.slideUp(400);
  16737. });
  16738. function_container.find('.minimize_function_button').on('click', function (e) {
  16739. minimizeFunction(function_obj);
  16740. function_container.find(".function_area").toggle();
  16741. function_container.find(".add_var_top_button").toggle();
  16742. });
  16743. }
  16744. // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  16745. function renderFunctionReturn(function_obj, function_element) {
  16746. var ret = '<div class="ui dropdown function_return">';
  16747. if (function_obj.return_dimensions > 0) {
  16748. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI("vector") + ':' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type);
  16749. if (function_obj.return_dimensions == 1) {
  16750. ret += ' [ ] ';
  16751. } else {
  16752. ret += ' [ ] [ ] ';
  16753. }
  16754. ret += '</div>';
  16755. } else {
  16756. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type) + '</div>';
  16757. }
  16758. ret += '<div class="menu">';
  16759. for (var tm in _types.Types) {
  16760. 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>';
  16761. }
  16762. for (var tm in _types.Types) {
  16763. if (tm == _types.Types.VOID.toUpperCase()) {
  16764. continue;
  16765. }
  16766. 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>';
  16767. }
  16768. ret += '</div></div>';
  16769. ret = (0, _jquery2.default)(ret);
  16770. function_element.find('.function_return').append(ret);
  16771. }
  16772. function renderFunction(function_obj) {
  16773. var appender = '<div class="ui secondary segment function_div list-group-item">';
  16774. if (function_obj.function_comment) {
  16775. //appender += renderComment(function_obj.function_comment, sequence, true, -1);
  16776. }
  16777. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  16778. 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>';
  16779. 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>';
  16780. appender += '<div class="ui icon button dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  16781. 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>';
  16782. appender += '<div class="function_signature_div">' + _localizedStringsService.LocalizedStrings.getUI("function") + ' ';
  16783. if (function_obj.is_main) {
  16784. 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> ' + ' <span class="parethesis_function">( </span> <div class="ui large labels parameters_list">';
  16785. } else {
  16786. appender += '<div class="ui function_return"></div>';
  16787. appender += '<div class="function_name_div function_name_div_updated"><span class="span_name_function name_function_updated">' + function_obj.name + '</span> </div> ' + ' <span class="parethesis_function"> ( </span> <i class="ui icon plus square outline add_parameter_button"></i> <div class="ui large labels parameters_list container_parameters_list">';
  16788. }
  16789. appender += '</div> <span class="parethesis_function"> ) </span> </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_">';
  16790. appender += '</div>';
  16791. appender += '<div class="function_close_div"></div>' + '</div>' + '</div>';
  16792. appender = (0, _jquery2.default)(appender);
  16793. (0, _jquery2.default)('.all_functions').append(appender);
  16794. appender.data('fun', function_obj);
  16795. appender.find('.commands_list_div').data('fun', function_obj);
  16796. renderFunctionReturn(function_obj, appender);
  16797. addHandlers(function_obj, appender);
  16798. // Rendering parameters:
  16799. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  16800. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  16801. }
  16802. // Rendering variables:
  16803. for (var j = 0; j < function_obj.variables_list.length; j++) {
  16804. VariablesManagement.renderVariable(appender, function_obj.variables_list[j], function_obj);
  16805. }
  16806. // Rendering commands:
  16807. for (var j = 0; j < function_obj.commands.length; j++) {
  16808. CommandsManagement.renderCommand(function_obj.commands[j], (0, _jquery2.default)(appender.find('.commands_list_div')[0]), 3, function_obj);
  16809. }
  16810. (0, _jquery2.default)('.minimize_function_button').popup({
  16811. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_minimize"),
  16812. delay: {
  16813. show: 750,
  16814. hide: 0
  16815. }
  16816. });
  16817. }
  16818. function initVisualUI() {
  16819. // MUST USE CONST, LET, OR VAR !!!!!!
  16820. var mainDiv = (0, _jquery2.default)('#visual-main-div');
  16821. // fill mainDiv with functions and globals...
  16822. // renderAlgorithm()...
  16823. (0, _jquery2.default)('.add_function_button').on('click', function () {
  16824. addFunctionHandler();
  16825. });
  16826. (0, _jquery2.default)('.add_global_button').on('click', function () {
  16827. GlobalsManagement.addGlobal(program);
  16828. });
  16829. (0, _jquery2.default)('.run_button').on('click', function () {
  16830. runCode();
  16831. });
  16832. (0, _jquery2.default)('.visual_coding_button').on('click', function () {
  16833. toggleVisualCoding();
  16834. });
  16835. (0, _jquery2.default)('.textual_coding_button').on('click', function () {
  16836. toggleTextualCoding();
  16837. });
  16838. (0, _jquery2.default)('.assessment').on('click', function () {
  16839. runCodeAssessment();
  16840. is_iassign = true;
  16841. });
  16842. (0, _jquery2.default)('.div_toggle_console').on('click', function () {
  16843. toggleConsole();
  16844. });
  16845. }
  16846. var is_iassign = false;
  16847. (0, _jquery2.default)(document).ready(function () {
  16848. for (var i = 0; i < program.functions.length; i++) {
  16849. renderFunction(program.functions[i]);
  16850. }
  16851. var time_show = 750;
  16852. (0, _jquery2.default)('.visual_coding_button').popup({
  16853. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_visual"),
  16854. delay: {
  16855. show: time_show,
  16856. hide: 0
  16857. }
  16858. });
  16859. (0, _jquery2.default)('.textual_coding_button').popup({
  16860. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_textual"),
  16861. delay: {
  16862. show: time_show,
  16863. hide: 0
  16864. }
  16865. });
  16866. (0, _jquery2.default)('.upload_file_button').popup({
  16867. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_upload"),
  16868. delay: {
  16869. show: time_show,
  16870. hide: 0
  16871. }
  16872. });
  16873. (0, _jquery2.default)('.download_file_button').popup({
  16874. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_download"),
  16875. delay: {
  16876. show: time_show,
  16877. hide: 0
  16878. }
  16879. });
  16880. (0, _jquery2.default)('.undo_button').popup({
  16881. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_undo"),
  16882. delay: {
  16883. show: time_show,
  16884. hide: 0
  16885. }
  16886. });
  16887. (0, _jquery2.default)('.redo_button').popup({
  16888. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_redo"),
  16889. delay: {
  16890. show: time_show,
  16891. hide: 0
  16892. }
  16893. });
  16894. (0, _jquery2.default)('.run_button').popup({
  16895. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_run"),
  16896. delay: {
  16897. show: time_show,
  16898. hide: 0
  16899. }
  16900. });
  16901. (0, _jquery2.default)('.assessment_button').popup({
  16902. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_evaluate"),
  16903. delay: {
  16904. show: time_show,
  16905. hide: 0
  16906. }
  16907. });
  16908. (0, _jquery2.default)('.help_button').popup({
  16909. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_help"),
  16910. delay: {
  16911. show: time_show,
  16912. hide: 0
  16913. }
  16914. });
  16915. (0, _jquery2.default)('.add_global_button').popup({
  16916. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_add_global"),
  16917. delay: {
  16918. show: time_show,
  16919. hide: 0
  16920. }
  16921. });
  16922. (0, _jquery2.default)('.div_toggle_console').popup({
  16923. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_console"),
  16924. delay: {
  16925. show: time_show,
  16926. hide: 0
  16927. }
  16928. });
  16929. });
  16930. function runCodeAssessment() {
  16931. toggleConsole(true);
  16932. window.studentGrade = null;
  16933. studentTemp = null;
  16934. var strCode = CodeManagement.generate();
  16935. if (strCode == null) {
  16936. return;
  16937. }
  16938. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  16939. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  16940. var runner = new _ivprogAssessment.IVProgAssessment(strCode, testCases, domConsole);
  16941. runner.runTest().then(function (grade) {
  16942. if (!is_iassign) {
  16943. parent.getEvaluationCallback(grade);
  16944. } else {
  16945. is_iassign = false;
  16946. }
  16947. }).catch(function (err) {
  16948. return domConsole.err(err.message);
  16949. });
  16950. }
  16951. function runCode() {
  16952. toggleConsole(true);
  16953. var strCode = CodeManagement.generate();
  16954. if (strCode == null) {
  16955. return;
  16956. }
  16957. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  16958. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  16959. try {
  16960. var parser = _ivprogParser.IVProgParser.createParser(strCode);
  16961. var analyser = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  16962. var data = analyser.analyseTree();
  16963. var proc = new _ivprogProcessor.IVProgProcessor(data);
  16964. proc.registerInput(domConsole);
  16965. proc.registerOutput(domConsole);
  16966. (0, _jquery2.default)("#ivprog-term").addClass('ivprog-term-active');
  16967. proc.interpretAST().then(function (_) {
  16968. domConsole.info("Programa executado com sucesso!");
  16969. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  16970. }).catch(function (err) {
  16971. domConsole.err(err.message);
  16972. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  16973. });
  16974. } catch (error) {
  16975. domConsole.err(error.message);
  16976. console.log(error);
  16977. }
  16978. }
  16979. function toggleConsole(is_running) {
  16980. if (is_running) {
  16981. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  16982. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  16983. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  16984. return;
  16985. }
  16986. if ((0, _jquery2.default)('#ivprog-term').css('min-height') == '160px') {
  16987. // esconder
  16988. (0, _jquery2.default)('.ivprog-term-div').css('display', 'none');
  16989. (0, _jquery2.default)('#ivprog-term').css('min-height', '0');
  16990. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-30px');
  16991. (0, _jquery2.default)('#ivprog-term').css('padding', '5px');
  16992. } else {
  16993. // mostrar
  16994. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  16995. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  16996. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  16997. }
  16998. }
  16999. function waitToCloseConsole() {
  17000. domConsole.info("Aperte qualquer tecla para fechar...");
  17001. var p = new Promise(function (resolve, _) {
  17002. domConsole.requestInput(resolve, true);
  17003. });
  17004. p.then(function (_) {
  17005. domConsole.dispose();
  17006. domConsole = null;
  17007. (0, _jquery2.default)("#ivprog-term").hide();
  17008. });
  17009. }
  17010. function toggleTextualCoding() {
  17011. var code = CodeManagement.generate();
  17012. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'none');
  17013. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'block');
  17014. (0, _jquery2.default)('.ivprog_textual_panel').removeClass('loading');
  17015. (0, _jquery2.default)('.ivprog_textual_code').text(code);
  17016. (0, _jquery2.default)('.visual_coding_button').removeClass('active');
  17017. (0, _jquery2.default)('.textual_coding_button').addClass('active');
  17018. }
  17019. function toggleVisualCoding() {
  17020. (0, _jquery2.default)('.ivprog_textual_panel').addClass('loading');
  17021. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'none');
  17022. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'block');
  17023. (0, _jquery2.default)('.textual_coding_button').removeClass('active');
  17024. (0, _jquery2.default)('.visual_coding_button').addClass('active');
  17025. }
  17026. function removeParameter(function_obj, parameter_obj, parameter_container) {
  17027. var index = function_obj.parameters_list.indexOf(parameter_obj);
  17028. if (index > -1) {
  17029. function_obj.parameters_list.splice(index, 1);
  17030. }
  17031. (0, _jquery2.default)(parameter_container).remove();
  17032. }
  17033. function updateParameterType(parameter_obj, new_type) {
  17034. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  17035. parameter_obj.type = new_type;
  17036. parameter_obj.dimensions = new_dimensions;
  17037. if (new_dimensions > 0) {
  17038. parameter_obj.rows = new_dimensions;
  17039. parameter_obj.columns = 2;
  17040. }
  17041. }
  17042. function renderParameter(function_obj, parameter_obj, function_container) {
  17043. var ret = "";
  17044. ret += '<div class="ui label function_name_parameter">';
  17045. ret += '<div class="ui dropdown parameter_type">';
  17046. if (parameter_obj.dimensions > 0) {
  17047. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type);
  17048. if (parameter_obj.dimensions == 1) {
  17049. ret += ' [ ] ';
  17050. } else {
  17051. ret += ' [ ] [ ] ';
  17052. }
  17053. ret += '</div>';
  17054. } else {
  17055. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type) + '</div>';
  17056. }
  17057. ret += '<div class="menu">';
  17058. for (var tm in _types.Types) {
  17059. if (tm == _types.Types.VOID.toUpperCase()) {
  17060. continue;
  17061. }
  17062. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  17063. }
  17064. for (var tm in _types.Types) {
  17065. if (tm == _types.Types.VOID.toUpperCase()) {
  17066. continue;
  17067. }
  17068. 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>';
  17069. }
  17070. ret += '</div></div>';
  17071. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  17072. ret += ' <i class="red icon times remove_parameter"></i></div>';
  17073. ret = (0, _jquery2.default)(ret);
  17074. function_container.find('.container_parameters_list').append(ret);
  17075. ret.find('.remove_parameter').on('click', function (e) {
  17076. removeParameter(function_obj, parameter_obj, ret);
  17077. });
  17078. ret.find('.ui.dropdown.parameter_type').dropdown({
  17079. onChange: function onChange(value, text, $selectedItem) {
  17080. if ($selectedItem.data('dimensions')) {
  17081. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  17082. } else {
  17083. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')]);
  17084. }
  17085. }
  17086. });
  17087. ret.find('.label_enable_name_parameter').on('click', function (e) {
  17088. enableNameParameterUpdate(parameter_obj, ret);
  17089. });
  17090. }
  17091. var opened_name_parameter = false;
  17092. var opened_input_parameter = null;
  17093. function enableNameParameterUpdate(parameter_obj, parent_node) {
  17094. if (opened_name_parameter) {
  17095. opened_input_parameter.focus();
  17096. return;
  17097. }
  17098. opened_name_parameter = true;
  17099. parent_node = (0, _jquery2.default)(parent_node);
  17100. var input_field;
  17101. parent_node.find('.span_name_parameter').text('');
  17102. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parameter_obj.name + "' />");
  17103. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  17104. input_field.on('input', function () {
  17105. var inputWidth = input_field.textWidth() + 10;
  17106. opened_input_parameter = input_field;
  17107. input_field.focus();
  17108. var tmpStr = input_field.val();
  17109. input_field.val('');
  17110. input_field.val(tmpStr);
  17111. input_field.css({
  17112. width: inputWidth
  17113. });
  17114. }).trigger('input');
  17115. input_field.focusout(function () {
  17116. /// update array:
  17117. if (input_field.val().trim()) {
  17118. parameter_obj.name = input_field.val().trim();
  17119. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  17120. }
  17121. input_field.off();
  17122. input_field.remove();
  17123. /// update elements:
  17124. opened_name_parameter = false;
  17125. opened_input_parameter = false;
  17126. });
  17127. input_field.on('keydown', function (e) {
  17128. var code = e.keyCode || e.which;
  17129. if (code == 13) {
  17130. if (input_field.val().trim()) {
  17131. parameter_obj.name = input_field.val().trim();
  17132. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  17133. }
  17134. input_field.off();
  17135. input_field.remove();
  17136. /// update elements:
  17137. opened_name_parameter = false;
  17138. opened_input_parameter = false;
  17139. }
  17140. if (code == 27) {
  17141. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  17142. input_field.off();
  17143. input_field.remove();
  17144. /// update elements:
  17145. opened_name_parameter = false;
  17146. opened_input_parameter = false;
  17147. }
  17148. });
  17149. input_field.select();
  17150. }
  17151. var opened_name_function = false;
  17152. var opened_input = null;
  17153. var previousPadding = null;
  17154. function enableNameFunctionUpdate(function_obj, parent_node) {
  17155. if (opened_name_function) {
  17156. opened_input.focus();
  17157. return;
  17158. }
  17159. parent_node = (0, _jquery2.default)(parent_node);
  17160. parent_node.find('.span_name_function').text('');
  17161. var input_field;
  17162. if (!previousPadding) {
  17163. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  17164. }
  17165. parent_node.find('.span_name_function').css('padding-left', '0');
  17166. parent_node.find('.span_name_function').css('padding-right', '0');
  17167. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + function_obj.name + "' />");
  17168. input_field.insertBefore(parent_node.find('.span_name_function'));
  17169. input_field.on('input', function () {
  17170. var inputWidth = input_field.textWidth() + 10;
  17171. opened_input = input_field;
  17172. input_field.focus();
  17173. var tmpStr = input_field.val();
  17174. input_field.val('');
  17175. input_field.val(tmpStr);
  17176. input_field.css({
  17177. width: inputWidth
  17178. });
  17179. }).trigger('input');
  17180. input_field.focusout(function () {
  17181. /// update array:
  17182. if (input_field.val().trim()) {
  17183. function_obj.name = input_field.val().trim();
  17184. }
  17185. input_field.off();
  17186. input_field.remove();
  17187. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  17188. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  17189. parent_node.find('.span_name_function').text(function_obj.name);
  17190. /// update elements:
  17191. opened_name_function = false;
  17192. opened_input = false;
  17193. });
  17194. input_field.on('keydown', function (e) {
  17195. var code = e.keyCode || e.which;
  17196. if (code == 13) {
  17197. if (input_field.val().trim()) {
  17198. function_obj.name = input_field.val().trim();
  17199. }
  17200. input_field.off();
  17201. input_field.remove();
  17202. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  17203. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  17204. parent_node.find('.span_name_function').text(function_obj.name);
  17205. /// update elements:
  17206. opened_name_function = false;
  17207. opened_input = false;
  17208. }
  17209. if (code == 27) {
  17210. input_field.off();
  17211. input_field.remove();
  17212. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  17213. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  17214. parent_node.find('.span_name_function').text(function_obj.name);
  17215. /// update elements:
  17216. opened_name_function = false;
  17217. opened_input = false;
  17218. }
  17219. });
  17220. input_field.select();
  17221. }
  17222. /***/ }),
  17223. /***/ "./js/visualUI/globals.js":
  17224. /*!********************************!*\
  17225. !*** ./js/visualUI/globals.js ***!
  17226. \********************************/
  17227. /*! no static exports found */
  17228. /***/ (function(module, exports, __webpack_require__) {
  17229. "use strict";
  17230. Object.defineProperty(exports, "__esModule", {
  17231. value: true
  17232. });
  17233. exports.addGlobal = addGlobal;
  17234. exports.renderGlobal = renderGlobal;
  17235. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17236. var _jquery2 = _interopRequireDefault(_jquery);
  17237. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  17238. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17239. var Models = _interopRequireWildcard(_ivprog_elements);
  17240. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17241. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  17242. 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; } }
  17243. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17244. window.jQuery = _jquery2.default;
  17245. var counter_new_globals = 0;
  17246. function addGlobal(program) {
  17247. var new_global = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals, 1);
  17248. counter_new_globals++;
  17249. program.addGlobal(new_global);
  17250. renderGlobal(new_global);
  17251. }
  17252. function toggleConstant(global_var) {
  17253. global_var.is_constant = !global_var.is_constant;
  17254. }
  17255. function updateName(global_var, new_name) {
  17256. global_var.name = new_name;
  17257. }
  17258. function updateType(global_var, new_type) {
  17259. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  17260. global_var.type = new_type;
  17261. global_var.dimensions = new_dimensions;
  17262. if (new_dimensions > 0) {
  17263. global_var.rows = new_dimensions;
  17264. global_var.columns = 2;
  17265. }
  17266. updateInitialValues(global_var);
  17267. }
  17268. function removeGlobal(global_var, global_container) {
  17269. var index = window.program_obj.globals.indexOf(global_var);
  17270. if (index > -1) {
  17271. window.program_obj.globals.splice(index, 1);
  17272. }
  17273. global_container.children().off();
  17274. global_container.off();
  17275. global_container.remove();
  17276. }
  17277. function updateInitialValues(global_var) {
  17278. if (global_var.type == _types.Types.INTEGER) {
  17279. if (global_var.dimensions == 0) {
  17280. global_var.value = 1;
  17281. }
  17282. if (global_var.dimensions == 1) {
  17283. global_var.value = [1, 1];
  17284. }
  17285. if (global_var.dimensions == 2) {
  17286. global_var.value = [[1, 1], [1, 1]];
  17287. }
  17288. }
  17289. if (global_var.type == _types.Types.REAL) {
  17290. if (global_var.dimensions == 0) {
  17291. global_var.value = 1.0;
  17292. }
  17293. if (global_var.dimensions == 1) {
  17294. global_var.value = [1.0, 1.0];
  17295. }
  17296. if (global_var.dimensions == 2) {
  17297. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  17298. }
  17299. }
  17300. if (global_var.type == _types.Types.TEXT) {
  17301. if (global_var.dimensions == 0) {
  17302. global_var.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  17303. }
  17304. if (global_var.dimensions == 1) {
  17305. global_var.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  17306. }
  17307. if (global_var.dimensions == 2) {
  17308. global_var.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  17309. }
  17310. }
  17311. if (global_var.type == _types.Types.BOOLEAN) {
  17312. if (global_var.dimensions == 0) {
  17313. global_var.value = true;
  17314. }
  17315. if (global_var.dimensions == 1) {
  17316. global_var.value = [true, true];
  17317. }
  17318. if (global_var.dimensions == 2) {
  17319. global_var.value = [[true, true], [true, true]];
  17320. }
  17321. }
  17322. }
  17323. function alternateBooleanGlobalValue(global_var, value_container) {
  17324. global_var.value = !global_var.value;
  17325. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value));
  17326. }
  17327. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  17328. global_var.value[index] = !global_var.value[index];
  17329. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[index]));
  17330. }
  17331. function removeGlobalColumnVector(global_var) {
  17332. if (global_var.columns == 0) {
  17333. return;
  17334. }
  17335. global_var.columns--;
  17336. global_var.value.splice(global_var.value.length - 1, 1);
  17337. }
  17338. function addGlobalColumnVector(global_var) {
  17339. global_var.columns++;
  17340. if (global_var.type == _types.Types.INTEGER) {
  17341. global_var.value.push(1);
  17342. }
  17343. if (global_var.type == _types.Types.REAL) {
  17344. global_var.value.push(1.0);
  17345. }
  17346. if (global_var.type == _types.Types.TEXT) {
  17347. global_var.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  17348. }
  17349. if (global_var.type == _types.Types.BOOLEAN) {
  17350. global_var.value.push(true);
  17351. }
  17352. }
  17353. function removeColumnGlobalMatrix(global_var) {
  17354. if (global_var.columns == 0) {
  17355. return;
  17356. }
  17357. global_var.columns--;
  17358. for (var i = 0; i < global_var.rows; i++) {
  17359. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  17360. }
  17361. }
  17362. function addColumnGlobalMatrix(global_var) {
  17363. global_var.columns++;
  17364. if (global_var.type == _types.Types.INTEGER) {
  17365. for (var i = 0; i < global_var.rows; i++) {
  17366. global_var.value[i].push(1);
  17367. }
  17368. }
  17369. if (global_var.type == _types.Types.REAL) {
  17370. for (var i = 0; i < global_var.rows; i++) {
  17371. global_var.value[i].push(1.0);
  17372. }
  17373. }
  17374. if (global_var.type == _types.Types.TEXT) {
  17375. for (var i = 0; i < global_var.rows; i++) {
  17376. global_var.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  17377. }
  17378. }
  17379. if (global_var.type == _types.Types.BOOLEAN) {
  17380. for (var i = 0; i < global_var.rows; i++) {
  17381. global_var.value[i].push(true);
  17382. }
  17383. }
  17384. }
  17385. function removeLineGlobalMatrix(global_var) {
  17386. if (global_var.rows == 0) {
  17387. return;
  17388. }
  17389. global_var.rows--;
  17390. global_var.value.splice(global_var.value.length - 1, 1);
  17391. }
  17392. function addLineGlobalMatrix(global_var) {
  17393. global_var.rows++;
  17394. if (global_var.type == _types.Types.INTEGER) {
  17395. var n_l = [];
  17396. for (var i = 0; i < global_var.columns; i++) {
  17397. n_l.push(1);
  17398. }
  17399. global_var.value.push(n_l);
  17400. }
  17401. if (global_var.type == _types.Types.REAL) {
  17402. var n_l = [];
  17403. for (i = 0; i < global_var.columns; i++) {
  17404. n_l.push(1.0);
  17405. }
  17406. global_var.value.push(n_l);
  17407. }
  17408. if (global_var.type == _types.Types.TEXT) {
  17409. var n_l = [];
  17410. for (i = 0; i < global_var.columns; i++) {
  17411. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  17412. }
  17413. global_var.value.push(n_l);
  17414. }
  17415. if (global_var.type == _types.Types.BOOLEAN) {
  17416. var n_l = [];
  17417. for (i = 0; i < global_var.columns; i++) {
  17418. n_l.push(true);
  17419. }
  17420. global_var.value.push(n_l);
  17421. }
  17422. }
  17423. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  17424. global_var.value[row][index] = !global_var.value[row][index];
  17425. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[row][index]));
  17426. }
  17427. function renderValues(global_var, global_container) {
  17428. var ret = "";
  17429. var j = 0;
  17430. if (global_var.dimensions == 0) {
  17431. if (global_var.type == _types.Types.REAL) {
  17432. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  17433. } else {
  17434. if (global_var.type == _types.Types.BOOLEAN) {
  17435. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value) + '</span> </div> ';
  17436. } else {
  17437. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  17438. }
  17439. }
  17440. } else {
  17441. ret += '<table class="tabela_var">';
  17442. if (global_var.dimensions == 1) {
  17443. ret += '<tr>';
  17444. if (global_var.type == _types.Types.REAL) {
  17445. for (var k = 0; k < global_var.columns; k++) {
  17446. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  17447. }
  17448. } else {
  17449. for (var k = 0; k < global_var.columns; k++) {
  17450. if (global_var.type == _types.Types.BOOLEAN) {
  17451. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[k]) + '</span></td>';
  17452. } else {
  17453. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  17454. }
  17455. }
  17456. }
  17457. ret += '</tr>';
  17458. ret += '</table>';
  17459. 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>';
  17460. }
  17461. if (global_var.dimensions == 2) {
  17462. if (global_var.type == _types.Types.REAL) {
  17463. for (var l = 0; l < global_var.rows; l++) {
  17464. ret += '<tr>';
  17465. for (var k = 0; k < global_var.columns; k++) {
  17466. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  17467. }
  17468. ret += '</tr>';
  17469. }
  17470. } else {
  17471. for (var l = 0; l < global_var.rows; l++) {
  17472. ret += '<tr>';
  17473. for (var k = 0; k < global_var.columns; k++) {
  17474. if (global_var.type == _types.Types.BOOLEAN) {
  17475. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[l][k]) + '</span></td>';
  17476. } else {
  17477. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  17478. }
  17479. }
  17480. ret += '</tr>';
  17481. }
  17482. }
  17483. if (global_var.rows == 0) {
  17484. ret += '<tr><td></td></tr>';
  17485. }
  17486. 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>';
  17487. ret += '</table>';
  17488. 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>';
  17489. }
  17490. }
  17491. global_container.find(".div_valor_var").html('');
  17492. ret = (0, _jquery2.default)(ret);
  17493. ret.find('.span_value_variable').data('associatedOject', global_var);
  17494. ret.find(".boolean_simple_type").on('click', function (e) {
  17495. alternateBooleanGlobalValue(global_var, this.parentNode);
  17496. });
  17497. ret.find(".simple_var").on('click', function (e) {
  17498. enableGlobalValueUpdate(global_var, this.parentNode);
  17499. });
  17500. ret.find(".boolean_vector_var").on('click', function (e) {
  17501. alternateBooleanGlobalVectorValue(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  17502. });
  17503. ret.find(".vector_var").on('click', function (e) {
  17504. enableGlobalVectorValueUpdate(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  17505. });
  17506. ret.find(".remove_global_vector_column").on('click', function (e) {
  17507. removeGlobalColumnVector(global_var);
  17508. global_container.find(".div_valor_var").html('');
  17509. renderValues(global_var, global_container);
  17510. });
  17511. ret.find(".add_global_vector_column").on('click', function (e) {
  17512. addGlobalColumnVector(global_var);
  17513. global_container.find(".div_valor_var").html('');
  17514. renderValues(global_var, global_container);
  17515. });
  17516. ret.find(".remove_global_matrix_column").on('click', function (e) {
  17517. removeColumnGlobalMatrix(global_var);
  17518. global_container.find(".div_valor_var").html('');
  17519. renderValues(global_var, global_container);
  17520. });
  17521. ret.find(".add_global_matrix_column").on('click', function (e) {
  17522. addColumnGlobalMatrix(global_var);
  17523. global_container.find(".div_valor_var").html('');
  17524. renderValues(global_var, global_container);
  17525. });
  17526. ret.find(".remove_global_matrix_line").on('click', function (e) {
  17527. removeLineGlobalMatrix(global_var);
  17528. global_container.find(".div_valor_var").html('');
  17529. renderValues(global_var, global_container);
  17530. });
  17531. ret.find(".add_global_matrix_line").on('click', function (e) {
  17532. addLineGlobalMatrix(global_var);
  17533. global_container.find(".div_valor_var").html('');
  17534. renderValues(global_var, global_container);
  17535. });
  17536. ret.find(".boolean_matrix_var").on('click', function (e) {
  17537. alternateBooleanGlobalMatrixValue(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  17538. });
  17539. ret.find(".matrix_var").on('click', function (e) {
  17540. enableGlobalMatrixValueUpdate(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  17541. });
  17542. global_container.find(".div_valor_var").append(ret);
  17543. updateColumnsAndRowsText(global_container, global_var);
  17544. }
  17545. function addHandlers(global_container) {
  17546. var global_var = global_container.data('associatedOject');
  17547. // Manage constant option:
  17548. global_container.find(".alternate_constant").on('click', function (e) {
  17549. toggleConstant(global_var);
  17550. (0, _jquery2.default)(this).removeClass("on off");
  17551. if (global_var.is_constant) {
  17552. (0, _jquery2.default)(this).addClass("on");
  17553. } else {
  17554. (0, _jquery2.default)(this).addClass("off");
  17555. }
  17556. });
  17557. // Manage global name:
  17558. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  17559. enableNameUpdate(global_container);
  17560. });
  17561. // Menu to change type:
  17562. global_container.find('.ui.dropdown.global_type').dropdown({
  17563. onChange: function onChange(value, text, $selectedItem) {
  17564. if ($selectedItem.data('dimensions')) {
  17565. updateType(global_var, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  17566. } else {
  17567. updateType(global_var, _types.Types[$selectedItem.data('type')]);
  17568. }
  17569. renderValues(global_var, global_container);
  17570. }
  17571. });
  17572. // Remove global:
  17573. global_container.find(".remove_global").on('click', function (e) {
  17574. removeGlobal(global_var, global_container);
  17575. });
  17576. }
  17577. function updateColumnsAndRowsText(global_container, global_var) {
  17578. var prev = global_container.find('.text').text().split('[');
  17579. if (prev.length == 2) {
  17580. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  17581. global_container.find('.text').empty();
  17582. global_container.find('.text').text(ff);
  17583. }
  17584. if (prev.length == 3) {
  17585. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  17586. global_container.find('.text').empty();
  17587. global_container.find('.text').text(ff);
  17588. }
  17589. }
  17590. function renderGlobal(global_var) {
  17591. var element = '<div class="ui label global_container"><div class="global_const">const: ';
  17592. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  17593. element += '<div class="ui dropdown global_type">';
  17594. if (global_var.dimensions > 0) {
  17595. element += '<div class="text">' + i18n('ui:vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(global_var.type);
  17596. for (var i = 0; i < global_var.dimensions; i++) {
  17597. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  17598. }
  17599. element += '</div>';
  17600. } else {
  17601. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(global_var.type.toLowerCase()) + '</div>';
  17602. }
  17603. element += '<div class="menu">';
  17604. for (var tm in _types.Types) {
  17605. if (tm == _types.Types.VOID.toUpperCase()) {
  17606. continue;
  17607. }
  17608. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  17609. }
  17610. for (var tm in _types.Types) {
  17611. if (tm == _types.Types.VOID.toUpperCase()) {
  17612. continue;
  17613. }
  17614. 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>';
  17615. }
  17616. 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> ';
  17617. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  17618. element += ' <i class="red icon times remove_global"></i></div>';
  17619. var complete_element = (0, _jquery2.default)(element);
  17620. complete_element.data('associatedOject', global_var);
  17621. (0, _jquery2.default)('.list_globals').append(complete_element);
  17622. addHandlers(complete_element);
  17623. renderValues(global_var, complete_element);
  17624. if (global_var.dimensions == 1) {
  17625. complete_element.find('.dimensions_0').text(global_var.columns);
  17626. }
  17627. if (global_var.dimensions == 2) {
  17628. complete_element.find('.dimensions_0').text(global_var.columns);
  17629. complete_element.find('.dimensions_1').text(global_var.rows);
  17630. }
  17631. }
  17632. var opened_name_value_matrix_global_v = false;
  17633. var opened_input_value_matrix_global_v = null;
  17634. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  17635. if (opened_name_value_matrix_global_v) {
  17636. opened_input_value_matrix_global_v.focus();
  17637. return;
  17638. }
  17639. parent_node = (0, _jquery2.default)(parent_node);
  17640. opened_name_value_matrix_global_v = true;
  17641. parent_node.find('.span_value_variable').text('');
  17642. var input_field;
  17643. if (global_var.type == _types.Types.REAL) {
  17644. input_field = (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) + "' />");
  17645. input_field.insertBefore(parent_node.find('.span_value_variable'));
  17646. } else {
  17647. input_field = (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] + "' />");
  17648. input_field.insertBefore(parent_node.find('.span_value_variable'));
  17649. }
  17650. input_field.on('input', function () {
  17651. var inputWidth = input_field.textWidth() + 10;
  17652. opened_input_value_matrix_global_v = input_field;
  17653. input_field.focus();
  17654. var tmpStr = input_field.val();
  17655. input_field.val('');
  17656. input_field.val(tmpStr);
  17657. input_field.css({
  17658. width: inputWidth
  17659. });
  17660. }).trigger('input');
  17661. input_field.focusout(function () {
  17662. /// update array:
  17663. if (input_field.val().trim()) {
  17664. if (global_var.type == _types.Types.REAL) {
  17665. global_var.value[row][index] = parseFloat(input_field.val().trim());
  17666. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  17667. } else {
  17668. if (global_var.type == _types.Types.INTEGER) {
  17669. global_var.value[row][index] = parseInt(input_field.val().trim());
  17670. } else {
  17671. global_var.value[row][index] = input_field.val().trim();
  17672. }
  17673. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  17674. }
  17675. } else {
  17676. if (global_var.type == _types.Types.REAL) {
  17677. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  17678. } else {
  17679. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  17680. }
  17681. }
  17682. if (global_var.type == _types.Types.TEXT) {
  17683. global_var.value[row][index] = input_field.val();
  17684. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  17685. }
  17686. input_field.off();
  17687. input_field.remove();
  17688. /// update elements:
  17689. opened_name_value_matrix_global_v = false;
  17690. opened_input_value_matrix_global_v = false;
  17691. });
  17692. input_field.on('keydown', function (e) {
  17693. var code = e.keyCode || e.which;
  17694. if (code == 13) {
  17695. if (input_field.val().trim()) {
  17696. if (global_var.type == _types.Types.REAL) {
  17697. global_var.value[row][index] = parseFloat(input_field.val().trim());
  17698. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  17699. } else {
  17700. if (global_var.type == _types.Types.INTEGER) {
  17701. global_var.value[row][index] = parseInt(input_field.val().trim());
  17702. } else {
  17703. global_var.value[row][index] = input_field.val().trim();
  17704. }
  17705. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  17706. }
  17707. } else {
  17708. if (global_var.type == _types.Types.REAL) {
  17709. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  17710. } else {
  17711. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  17712. }
  17713. }
  17714. if (global_var.type == _types.Types.TEXT) {
  17715. global_var.value[row][index] = input_field.val();
  17716. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  17717. }
  17718. input_field.off();
  17719. input_field.remove();
  17720. /// update elements:
  17721. opened_name_value_matrix_global_v = false;
  17722. opened_input_value_matrix_global_v = false;
  17723. }
  17724. if (code == 27) {
  17725. if (global_var.type == _types.Types.REAL) {
  17726. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  17727. } else {
  17728. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  17729. }
  17730. input_field.off();
  17731. input_field.remove();
  17732. /// update elements:
  17733. opened_name_value_matrix_global_v = false;
  17734. opened_input_value_matrix_global_v = false;
  17735. }
  17736. });
  17737. input_field.select();
  17738. }
  17739. var opened_name_value_global_var = false;
  17740. var opened_input_value_global_ar = null;
  17741. function enableGlobalValueUpdate(global_var, parent_node) {
  17742. if (opened_name_value_global_var) {
  17743. opened_input_value_global_ar.focus();
  17744. return;
  17745. }
  17746. parent_node = (0, _jquery2.default)(parent_node);
  17747. opened_name_value_global_var = true;
  17748. parent_node.find('.span_value_variable').text('');
  17749. var input_field;
  17750. if (global_var.type == _types.Types.REAL) {
  17751. input_field = (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) + "' />");
  17752. input_field.insertBefore(parent_node.find('.span_value_variable'));
  17753. } else {
  17754. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value + "' />");
  17755. input_field.insertBefore(parent_node.find('.span_value_variable'));
  17756. }
  17757. input_field.on('input', function () {
  17758. var inputWidth = input_field.textWidth() + 10;
  17759. opened_input_value_global_ar = input_field;
  17760. input_field.focus();
  17761. var tmpStr = input_field.val();
  17762. input_field.val('');
  17763. input_field.val(tmpStr);
  17764. input_field.css({
  17765. width: inputWidth
  17766. });
  17767. }).trigger('input');
  17768. input_field.focusout(function () {
  17769. /// update array:
  17770. if (input_field.val().trim()) {
  17771. if (global_var.type == _types.Types.REAL) {
  17772. global_var.value = parseFloat(input_field.val().trim());
  17773. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  17774. } else {
  17775. if (global_var.type == _types.Types.INTEGER) {
  17776. global_var.value = parseInt(input_field.val().trim());
  17777. } else {
  17778. global_var.value = input_field.val().trim();
  17779. }
  17780. parent_node.find('.span_value_variable').text(global_var.value);
  17781. }
  17782. } else {
  17783. if (global_var.type == _types.Types.REAL) {
  17784. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  17785. } else {
  17786. parent_node.find('.span_value_variable').text(global_var.value);
  17787. }
  17788. }
  17789. if (global_var.type == _types.Types.TEXT) {
  17790. global_var.value = input_field.val();
  17791. parent_node.find('.span_value_variable').text(global_var.value);
  17792. }
  17793. input_field.off();
  17794. input_field.remove();
  17795. /// update elements:
  17796. opened_name_value_global_var = false;
  17797. opened_input_value_global_ar = false;
  17798. });
  17799. input_field.on('keydown', function (e) {
  17800. var code = e.keyCode || e.which;
  17801. if (code == 13) {
  17802. if (input_field.val().trim()) {
  17803. if (global_var.type == _types.Types.REAL) {
  17804. global_var.value = parseFloat(input_field.val().trim());
  17805. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  17806. } else {
  17807. if (global_var.type == _types.Types.INTEGER) {
  17808. global_var.value = parseInt(input_field.val().trim());
  17809. } else {
  17810. global_var.value = input_field.val().trim();
  17811. }
  17812. parent_node.find('.span_value_variable').text(global_var.value);
  17813. }
  17814. } else {
  17815. if (global_var.type == _types.Types.REAL) {
  17816. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  17817. } else {
  17818. parent_node.find('.span_value_variable').text(global_var.value);
  17819. }
  17820. }
  17821. if (global_var.type == _types.Types.TEXT) {
  17822. global_var.value = input_field.val();
  17823. parent_node.find('.span_value_variable').text(global_var.value);
  17824. }
  17825. input_field.off();
  17826. input_field.remove();
  17827. /// update elements:
  17828. opened_name_value_global_var = false;
  17829. opened_input_value_global_ar = false;
  17830. }
  17831. if (code == 27) {
  17832. if (global_var.type == _types.Types.REAL) {
  17833. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  17834. } else {
  17835. parent_node.find('.span_value_variable').text(global_var.value);
  17836. }
  17837. input_field.off();
  17838. input_field.remove();
  17839. /// update elements:
  17840. opened_name_value_global_var = false;
  17841. opened_input_value_global_ar = false;
  17842. }
  17843. });
  17844. input_field.select();
  17845. }
  17846. var opened_name_global = false;
  17847. var opened_input_global = null;
  17848. function enableNameUpdate(global_container) {
  17849. var global_var = global_container.data('associatedOject');
  17850. if (opened_name_global) {
  17851. opened_input_global.focus();
  17852. return;
  17853. }
  17854. opened_name_global = true;
  17855. global_container.find('.span_name_variable').text('');
  17856. var input_name = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.name + "' />");
  17857. input_name.insertBefore(global_container.find('.span_name_variable'));
  17858. input_name.on('input', function () {
  17859. var inputWidth = input_name.textWidth() + 10;
  17860. opened_input_global = input_name;
  17861. opened_input_global.focus();
  17862. opened_input_global.css({
  17863. width: inputWidth
  17864. });
  17865. }).trigger('input');
  17866. input_name.focusout(function () {
  17867. /// update array:
  17868. if (input_name.val().trim().length > 0) {
  17869. updateName(global_var, input_name.val().trim());
  17870. global_container.find('.span_name_variable').text(global_var.name);
  17871. } else {
  17872. global_container.find('.span_name_variable').text(global_var.name);
  17873. }
  17874. input_name.off();
  17875. input_name.remove();
  17876. /// update elements:
  17877. opened_name_global = false;
  17878. opened_input_global = false;
  17879. });
  17880. input_name.on('keydown', function (e) {
  17881. var code = e.keyCode || e.which;
  17882. if (code == 13) {
  17883. if (input_name.val().trim()) {
  17884. updateName(global_var, input_name.val().trim());
  17885. global_container.find('.span_name_variable').text(global_var.name);
  17886. } else {
  17887. global_container.find('.span_name_variable').text(global_var.name);
  17888. }
  17889. input_name.off();
  17890. input_name.remove();
  17891. /// update elements:
  17892. opened_name_global = false;
  17893. opened_input_global = false;
  17894. }
  17895. if (code == 27) {
  17896. global_container.find('.span_name_variable').text(global_var.name);
  17897. input_name.off();
  17898. input_name.remove();
  17899. /// update elements:
  17900. opened_name_global = false;
  17901. opened_input_global = false;
  17902. }
  17903. });
  17904. input_name.select();
  17905. }
  17906. var opened_name_value_vector_global_ = false;
  17907. var opened_input_value_vector_global_ = null;
  17908. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  17909. if (opened_name_value_vector_global_) {
  17910. opened_input_value_vector_global_.focus();
  17911. return;
  17912. }
  17913. parent_node = (0, _jquery2.default)(parent_node);
  17914. opened_name_value_vector_global_ = true;
  17915. parent_node.find('.span_value_variable').text('');
  17916. var input_field;
  17917. if (global_var.type == _types.Types.REAL) {
  17918. input_field = (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) + "' />");
  17919. input_field.insertBefore(parent_node.find('.span_value_variable'));
  17920. } else {
  17921. input_field = (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] + "' />");
  17922. input_field.insertBefore(parent_node.find('.span_value_variable'));
  17923. }
  17924. input_field.on('input', function () {
  17925. var inputWidth = input_field.textWidth() + 10;
  17926. opened_input_value_vector_global_ = input_field;
  17927. input_field.focus();
  17928. var tmpStr = input_field.val();
  17929. input_field.val('');
  17930. input_field.val(tmpStr);
  17931. input_field.css({
  17932. width: inputWidth
  17933. });
  17934. }).trigger('input');
  17935. input_field.focusout(function () {
  17936. /// update array:
  17937. if (input_field.val().trim()) {
  17938. if (global_var.type == _types.Types.REAL) {
  17939. global_var.value[index] = parseFloat(input_field.val().trim());
  17940. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  17941. } else {
  17942. if (global_var.type == _types.Types.INTEGER) {
  17943. global_var.value[index] = parseInt(input_field.val().trim());
  17944. } else {
  17945. global_var.value[index] = input_field.val().trim();
  17946. }
  17947. parent_node.find('.span_value_variable').text(global_var.value[index]);
  17948. }
  17949. } else {
  17950. if (global_var.type == _types.Types.REAL) {
  17951. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  17952. } else {
  17953. parent_node.find('.span_value_variable').text(global_var.value[index]);
  17954. }
  17955. }
  17956. if (global_var.type == _types.Types.TEXT) {
  17957. global_var.value[index] = input_field.val();
  17958. parent_node.find('.span_value_variable').text(global_var.value[index]);
  17959. }
  17960. input_field.off();
  17961. input_field.remove();
  17962. /// update elements:
  17963. opened_name_value_vector_global_ = false;
  17964. opened_input_value_vector_global_ = false;
  17965. });
  17966. input_field.on('keydown', function (e) {
  17967. var code = e.keyCode || e.which;
  17968. if (code == 13) {
  17969. if (input_field.val().trim()) {
  17970. if (global_var.type == _types.Types.REAL) {
  17971. global_var.value[index] = parseFloat(input_field.val().trim());
  17972. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  17973. } else {
  17974. if (global_var.type == _types.Types.INTEGER) {
  17975. global_var.value[index] = parseInt(input_field.val().trim());
  17976. } else {
  17977. global_var.value[index] = input_field.val().trim();
  17978. }
  17979. parent_node.find('.span_value_variable').text(global_var.value[index]);
  17980. }
  17981. } else {
  17982. if (global_var.type == _types.Types.REAL) {
  17983. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  17984. } else {
  17985. parent_node.find('.span_value_variable').text(global_var.value[index]);
  17986. }
  17987. }
  17988. if (global_var.type == _types.Types.TEXT) {
  17989. global_var.value[index] = input_field.val();
  17990. parent_node.find('.span_value_variable').text(global_var.value[index]);
  17991. }
  17992. input_field.off();
  17993. input_field.remove();
  17994. /// update elements:
  17995. opened_name_value_vector_global_ = false;
  17996. opened_input_value_vector_global_ = false;
  17997. }
  17998. if (code == 27) {
  17999. if (global_var.type == _types.Types.REAL) {
  18000. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  18001. } else {
  18002. parent_node.find('.span_value_variable').text(global_var.value[index]);
  18003. }
  18004. input_field.off();
  18005. input_field.remove();
  18006. /// update elements:
  18007. opened_name_value_vector_global_ = false;
  18008. opened_input_value_vector_global_ = false;
  18009. }
  18010. });
  18011. input_field.select();
  18012. }
  18013. _jquery2.default.fn.textWidth = function (text, font) {
  18014. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  18015. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  18016. return _jquery2.default.fn.textWidth.fakeEl.width();
  18017. };
  18018. /***/ }),
  18019. /***/ "./js/visualUI/ivprog_elements.js":
  18020. /*!****************************************!*\
  18021. !*** ./js/visualUI/ivprog_elements.js ***!
  18022. \****************************************/
  18023. /*! no static exports found */
  18024. /***/ (function(module, exports, __webpack_require__) {
  18025. "use strict";
  18026. Object.defineProperty(exports, "__esModule", {
  18027. value: true
  18028. });
  18029. 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;
  18030. 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; }; }();
  18031. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  18032. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  18033. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  18034. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  18035. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  18036. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  18037. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  18038. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18039. 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; } }
  18040. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  18041. var COMMAND_TYPES = exports.COMMAND_TYPES = Object.freeze({ function: "function", comment: "comment", reader: "reader", writer: "writer", attribution: "attribution", iftrue: "iftrue",
  18042. repeatNtimes: "repeatNtimes", whiletrue: "whiletrue", dowhiletrue: "dowhiletrue", switch: "switch", switchcase: "switchcase", functioncall: "functioncall", break: "break",
  18043. return: "return" });
  18044. var ARITHMETIC_TYPES = exports.ARITHMETIC_TYPES = Object.freeze({ plus: "plus", minus: "minus", multiplication: "multiplication", division: "division", module: "module", none: "none" });
  18045. 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" });
  18046. var EXPRESSION_TYPES = exports.EXPRESSION_TYPES = Object.freeze({ exp_conditional: "exp_conditional", exp_logic: "exp_logic", exp_arithmetic: "exp_arithmetic" });
  18047. 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" });
  18048. var LOGIC_COMPARISON = exports.LOGIC_COMPARISON = Object.freeze({ equals_to: "equals_to", not_equals_to: "not_equals_to", and: "and", or: "or" });
  18049. var Variable = exports.Variable = function Variable(type, name, value) {
  18050. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  18051. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  18052. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  18053. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  18054. _classCallCheck(this, Variable);
  18055. this.type = type;
  18056. this.name = name;
  18057. this.value = value;
  18058. this.dimensions = dimensions;
  18059. this.is_constant = is_constant;
  18060. this.rows = rows;
  18061. this.columns = columns;
  18062. };
  18063. var Function = exports.Function = function Function(name) {
  18064. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types.Types.VOID;
  18065. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  18066. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  18067. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  18068. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  18069. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  18070. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  18071. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  18072. _classCallCheck(this, Function);
  18073. this.type = COMMAND_TYPES.function;
  18074. this.name = name;
  18075. this.return_type = return_type;
  18076. this.return_dimensions = return_dimensions;
  18077. this.parameters_list = parameters_list;
  18078. this.is_main = is_main;
  18079. this.is_hidden = is_hidden;
  18080. this.variables_list = variables_list;
  18081. this.function_comment = function_comment;
  18082. this.commands = commands;
  18083. };
  18084. var Comment = exports.Comment = function Comment(comment_text) {
  18085. _classCallCheck(this, Comment);
  18086. this.type = COMMAND_TYPES.comment;
  18087. this.comment_text = comment_text;
  18088. };
  18089. var Break = exports.Break = function Break() {
  18090. _classCallCheck(this, Break);
  18091. this.type = COMMAND_TYPES.break;
  18092. };
  18093. var Reader = exports.Reader = function Reader() {
  18094. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  18095. _classCallCheck(this, Reader);
  18096. this.type = COMMAND_TYPES.reader;
  18097. this.variable_value_menu = variable_value_menu;
  18098. };
  18099. var Writer = exports.Writer = function Writer(content) {
  18100. _classCallCheck(this, Writer);
  18101. this.type = COMMAND_TYPES.writer;
  18102. this.content = content;
  18103. };
  18104. var Attribution = exports.Attribution = function Attribution(variable) {
  18105. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  18106. _classCallCheck(this, Attribution);
  18107. this.type = COMMAND_TYPES.attribution;
  18108. this.variable = variable;
  18109. this.expression = expression;
  18110. };
  18111. var ExpressionElement = exports.ExpressionElement = function ExpressionElement(type_exp) {
  18112. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  18113. _classCallCheck(this, ExpressionElement);
  18114. this.type_exp = type_exp;
  18115. this.itens = itens;
  18116. };
  18117. var ConditionalExpression = exports.ConditionalExpression = function ConditionalExpression(expression) {
  18118. _classCallCheck(this, ConditionalExpression);
  18119. this.type = EXPRESSION_TYPES.exp_conditional;
  18120. this.expression = expression;
  18121. };
  18122. var LogicExpression = exports.LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  18123. _classCallCheck(this, LogicExpression);
  18124. this.type = EXPRESSION_TYPES.exp_logic;
  18125. this.has_neg = has_neg;
  18126. this.first_operand = first_operand;
  18127. this.second_operand = second_operand;
  18128. this.operator = operator;
  18129. };
  18130. var ArithmeticExpression = exports.ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  18131. _classCallCheck(this, ArithmeticExpression);
  18132. this.type = EXPRESSION_TYPES.exp_arithmetic;
  18133. this.first_operand = first_operand;
  18134. this.second_operand = second_operand;
  18135. this.operator = operator;
  18136. };
  18137. var IfTrue = exports.IfTrue = function IfTrue(expression, commands_block, commands_else) {
  18138. _classCallCheck(this, IfTrue);
  18139. this.type = COMMAND_TYPES.iftrue;
  18140. this.expression = expression;
  18141. this.commands_block = commands_block;
  18142. this.commands_else = commands_else;
  18143. };
  18144. var RepeatNTimes = exports.RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  18145. _classCallCheck(this, RepeatNTimes);
  18146. this.type = COMMAND_TYPES.repeatNtimes;
  18147. this.var_attribution = var_attribution;
  18148. this.var_incrementation = var_incrementation;
  18149. this.expression1 = expression1;
  18150. this.expression2 = expression2;
  18151. this.expression3 = expression3;
  18152. this.commands_block = commands_block;
  18153. };
  18154. var WhileTrue = exports.WhileTrue = function WhileTrue(expression, commands_block) {
  18155. _classCallCheck(this, WhileTrue);
  18156. this.type = COMMAND_TYPES.whiletrue;
  18157. this.expression = expression;
  18158. this.commands_block = commands_block;
  18159. };
  18160. var DoWhileTrue = exports.DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  18161. _classCallCheck(this, DoWhileTrue);
  18162. this.type = COMMAND_TYPES.dowhiletrue;
  18163. this.expression = expression;
  18164. this.commands_block = commands_block;
  18165. };
  18166. var Switch = exports.Switch = function Switch(variable) {
  18167. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  18168. _classCallCheck(this, Switch);
  18169. this.type = COMMAND_TYPES.switch;
  18170. this.variable = variable;
  18171. this.cases = cases;
  18172. };
  18173. var Return = exports.Return = function Return(variable_value_menu) {
  18174. _classCallCheck(this, Return);
  18175. this.type = COMMAND_TYPES.return;
  18176. this.variable_value_menu = variable_value_menu;
  18177. };
  18178. var SwitchCase = exports.SwitchCase = function SwitchCase(variable_value_menu) {
  18179. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  18180. _classCallCheck(this, SwitchCase);
  18181. this.type = COMMAND_TYPES.switchcase;
  18182. this.variable_value_menu = variable_value_menu;
  18183. this.commands_block = commands_block;
  18184. };
  18185. var FunctionCall = exports.FunctionCall = function FunctionCall(function_called, parameters_list) {
  18186. _classCallCheck(this, FunctionCall);
  18187. this.type = COMMAND_TYPES.functioncall;
  18188. this.function_called = function_called;
  18189. this.parameters_list = parameters_list;
  18190. };
  18191. var VariableValueMenu = exports.VariableValueMenu = function VariableValueMenu() {
  18192. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  18193. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  18194. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  18195. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  18196. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  18197. _classCallCheck(this, VariableValueMenu);
  18198. this.type = "var_value";
  18199. this.variable_and_value = variable_and_value;
  18200. this.content = content;
  18201. this.row = row;
  18202. this.column = column;
  18203. this.include_constant = include_constant;
  18204. };
  18205. var FunctionCallMenu = exports.FunctionCallMenu = function FunctionCallMenu() {
  18206. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  18207. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  18208. _classCallCheck(this, FunctionCallMenu);
  18209. this.type = "function_call";
  18210. this.function_called = function_called;
  18211. this.parameters_list = parameters_list;
  18212. };
  18213. var Program = exports.Program = function () {
  18214. function Program() {
  18215. _classCallCheck(this, Program);
  18216. this.functions = [];
  18217. this.globals = [];
  18218. }
  18219. _createClass(Program, [{
  18220. key: 'addFunction',
  18221. value: function addFunction(function_to_add) {
  18222. _melankeWatchjs2.default.watch(function_to_add.parameters_list, function () {
  18223. AlgorithmManagement.renderAlgorithm();
  18224. }, 1);
  18225. _melankeWatchjs2.default.watch(function_to_add.variables_list, function () {
  18226. AlgorithmManagement.renderAlgorithm();
  18227. }, 1);
  18228. this.functions.push(function_to_add);
  18229. }
  18230. }, {
  18231. key: 'addVariable',
  18232. value: function addVariable(function_to_receive, variable) {
  18233. if (this.functions[function_to_receive].variable === null) {
  18234. this.functions[function_to_receive].variables_list = [];
  18235. }
  18236. this.functions[function_to_receive].variables_list.push(variable);
  18237. }
  18238. }, {
  18239. key: 'addGlobal',
  18240. value: function addGlobal(variable) {
  18241. this.globals.push(variable);
  18242. }
  18243. }]);
  18244. return Program;
  18245. }();
  18246. /***/ }),
  18247. /***/ "./js/visualUI/types.js":
  18248. /*!******************************!*\
  18249. !*** ./js/visualUI/types.js ***!
  18250. \******************************/
  18251. /*! no static exports found */
  18252. /***/ (function(module, exports, __webpack_require__) {
  18253. "use strict";
  18254. Object.defineProperty(exports, "__esModule", {
  18255. value: true
  18256. });
  18257. var Types = exports.Types = Object.freeze({
  18258. INTEGER: "integer",
  18259. REAL: "real",
  18260. TEXT: "text",
  18261. BOOLEAN: "boolean",
  18262. VOID: "void"
  18263. });
  18264. /***/ }),
  18265. /***/ "./js/visualUI/variables.js":
  18266. /*!**********************************!*\
  18267. !*** ./js/visualUI/variables.js ***!
  18268. \**********************************/
  18269. /*! no static exports found */
  18270. /***/ (function(module, exports, __webpack_require__) {
  18271. "use strict";
  18272. Object.defineProperty(exports, "__esModule", {
  18273. value: true
  18274. });
  18275. exports.addVariable = addVariable;
  18276. exports.renderVariable = renderVariable;
  18277. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18278. var _jquery2 = _interopRequireDefault(_jquery);
  18279. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  18280. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18281. var Models = _interopRequireWildcard(_ivprog_elements);
  18282. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18283. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  18284. 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; } }
  18285. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18286. window.jQuery = _jquery2.default;
  18287. var counter_new_variables = 0;
  18288. function addVariable(function_obj, function_container) {
  18289. var new_var = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_variable') + '_' + counter_new_variables, 1);
  18290. if (function_obj.variables_list == null) {
  18291. function_obj.variables_list = [];
  18292. }
  18293. function_obj.variables_list.push(new_var);
  18294. counter_new_variables++;
  18295. renderVariable(function_container, new_var, function_obj);
  18296. }
  18297. function updateName(variable_obj, new_name) {
  18298. variable_obj.name = new_name;
  18299. }
  18300. function removeVariable(variable_obj, variable_container) {
  18301. var function_associated = variable_container.data('associatedFunction');
  18302. var index = function_associated.variables_list.indexOf(variable_obj);
  18303. if (index > -1) {
  18304. //function_associated.variables_list[index] = null;
  18305. delete function_associated.variables_list[index];
  18306. function_associated.variables_list.splice(index, 1);
  18307. }
  18308. variable_container.children().off();
  18309. variable_container.off();
  18310. variable_container.remove();
  18311. }
  18312. function updateType(variable_obj, new_type) {
  18313. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  18314. variable_obj.type = new_type;
  18315. variable_obj.dimensions = new_dimensions;
  18316. if (new_dimensions > 0) {
  18317. variable_obj.rows = new_dimensions;
  18318. variable_obj.columns = 2;
  18319. }
  18320. updateInitialValues(variable_obj);
  18321. }
  18322. function addHandlers(variable_obj, variable_container) {
  18323. // Manage variable name:
  18324. variable_container.find(".enable_edit_name_variable").on('click', function (e) {
  18325. enableNameUpdate(variable_obj, variable_container);
  18326. });
  18327. // Menu to change type:
  18328. variable_container.find('.ui.dropdown.variable_type').dropdown({
  18329. onChange: function onChange(value, text, $selectedItem) {
  18330. if ($selectedItem.data('dimensions')) {
  18331. updateType(variable_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  18332. } else {
  18333. updateType(variable_obj, _types.Types[$selectedItem.data('type')]);
  18334. }
  18335. renderValues(variable_obj, variable_container);
  18336. }
  18337. });
  18338. // Remove variable:
  18339. variable_container.find(".remove_variable").on('click', function (e) {
  18340. removeVariable(variable_obj, variable_container);
  18341. });
  18342. }
  18343. function renderVariable(function_container, new_var, function_obj) {
  18344. var element = '<div class="ui label variable_container">';
  18345. element += '<div class="ui dropdown variable_type">';
  18346. if (new_var.dimensions > 0) {
  18347. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase());
  18348. for (var i = 0; i < new_var.dimensions; i++) {
  18349. element += ' [ ] ';
  18350. }
  18351. element += '</div>';
  18352. } else {
  18353. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase()) + '</div>';
  18354. }
  18355. element += '<div class="menu">';
  18356. for (var tm in _types.Types) {
  18357. if (tm == _types.Types.VOID.toUpperCase()) {
  18358. continue;
  18359. }
  18360. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  18361. }
  18362. for (var tm in _types.Types) {
  18363. if (tm == _types.Types.VOID.toUpperCase()) {
  18364. continue;
  18365. }
  18366. 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>';
  18367. }
  18368. element += '</div></div> ';
  18369. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  18370. element += ' <span class="character_equals"> = </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  18371. element += ' <i class="red icon times remove_variable"></i></div>';
  18372. element = (0, _jquery2.default)(element);
  18373. element.data('associatedFunction', function_obj);
  18374. function_container.find('.variables_list_div').append(element);
  18375. addHandlers(new_var, element);
  18376. renderValues(new_var, element);
  18377. }
  18378. function updateColumnsAndRowsText(variable_container, variable_var) {
  18379. var prev = variable_container.find('.text').text().split('[');
  18380. if (prev.length == 2) {
  18381. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  18382. variable_container.find('.text').empty();
  18383. variable_container.find('.text').text(ff);
  18384. }
  18385. if (prev.length == 3) {
  18386. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  18387. variable_container.find('.text').empty();
  18388. variable_container.find('.text').text(ff);
  18389. }
  18390. }
  18391. function renderValues(new_var, variable_container) {
  18392. var ret = "";
  18393. var j = 0;
  18394. if (new_var.dimensions == 0) {
  18395. if (new_var.type == _types.Types.REAL) {
  18396. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  18397. } else {
  18398. if (new_var.type == _types.Types.BOOLEAN) {
  18399. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value) + '</span> </div> ';
  18400. } else {
  18401. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  18402. }
  18403. }
  18404. } else {
  18405. ret += '<table class="tabela_var">';
  18406. if (new_var.dimensions == 1) {
  18407. ret += '<tr>';
  18408. if (new_var.type == _types.Types.REAL) {
  18409. for (var k = 0; k < new_var.columns; k++) {
  18410. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  18411. }
  18412. } else {
  18413. for (var k = 0; k < new_var.columns; k++) {
  18414. if (new_var.type == _types.Types.BOOLEAN) {
  18415. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value[k]) + '</span></td>';
  18416. } else {
  18417. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  18418. }
  18419. }
  18420. }
  18421. ret += '</tr>';
  18422. ret += '</table>';
  18423. 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>';
  18424. }
  18425. if (new_var.dimensions == 2) {
  18426. if (new_var.type == _types.Types.REAL) {
  18427. for (var l = 0; l < new_var.rows; l++) {
  18428. ret += '<tr>';
  18429. for (var k = 0; k < new_var.columns; k++) {
  18430. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  18431. }
  18432. ret += '</tr>';
  18433. }
  18434. } else {
  18435. for (var l = 0; l < new_var.rows; l++) {
  18436. ret += '<tr>';
  18437. for (var k = 0; k < new_var.columns; k++) {
  18438. if (new_var.type == _types.Types.BOOLEAN) {
  18439. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value[l][k]) + '</span></td>';
  18440. } else {
  18441. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  18442. }
  18443. }
  18444. ret += '</tr>';
  18445. }
  18446. }
  18447. if (new_var.rows == 0) {
  18448. ret += '<tr><td></td></tr>';
  18449. }
  18450. 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>';
  18451. ret += '</table>';
  18452. 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>';
  18453. }
  18454. }
  18455. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  18456. ret = (0, _jquery2.default)(ret);
  18457. (0, _jquery2.default)(ret).find('.span_value_variable').data('associatedOject', new_var);
  18458. (0, _jquery2.default)(ret).find(".boolean_simple_type").on('click', function (e) {
  18459. alternateBooleanValue(new_var, this.parentNode);
  18460. });
  18461. (0, _jquery2.default)(ret).find(".simple_var").on('click', function (e) {
  18462. enableValueUpdate(new_var, this.parentNode);
  18463. });
  18464. (0, _jquery2.default)(ret).find(".boolean_vector_var").on('click', function (e) {
  18465. alternateBooleanVectorValue(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  18466. });
  18467. (0, _jquery2.default)(ret).find(".vector_var").on('click', function (e) {
  18468. enableVectorValueUpdate(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  18469. });
  18470. (0, _jquery2.default)(ret).find(".remove_global_vector_column").on('click', function (e) {
  18471. removeColumnVector(new_var);
  18472. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  18473. renderValues(new_var, variable_container);
  18474. });
  18475. (0, _jquery2.default)(ret).find(".add_global_vector_column").on('click', function (e) {
  18476. addColumnVector(new_var);
  18477. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  18478. renderValues(new_var, variable_container);
  18479. });
  18480. (0, _jquery2.default)(ret).find(".remove_global_matrix_column").on('click', function (e) {
  18481. removeColumnMatrix(new_var);
  18482. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  18483. renderValues(new_var, variable_container);
  18484. });
  18485. (0, _jquery2.default)(ret).find(".add_global_matrix_column").on('click', function (e) {
  18486. addColumnMatrix(new_var);
  18487. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  18488. renderValues(new_var, variable_container);
  18489. });
  18490. (0, _jquery2.default)(ret).find(".remove_global_matrix_line").on('click', function (e) {
  18491. removeLineMatrix(new_var);
  18492. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  18493. renderValues(new_var, variable_container);
  18494. });
  18495. (0, _jquery2.default)(ret).find(".add_global_matrix_line").on('click', function (e) {
  18496. addLineMatrix(new_var);
  18497. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  18498. renderValues(new_var, variable_container);
  18499. });
  18500. (0, _jquery2.default)(ret).find(".boolean_matrix_var").on('click', function (e) {
  18501. alternateBooleanMatrixValue(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  18502. });
  18503. (0, _jquery2.default)(ret).find(".matrix_var").on('click', function (e) {
  18504. enableMatrixValueUpdate(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  18505. });
  18506. (0, _jquery2.default)(variable_container).find(".div_valor_var").append(ret);
  18507. updateColumnsAndRowsText(variable_container, new_var);
  18508. }
  18509. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  18510. var_obj.value[row][index] = !var_obj.value[row][index];
  18511. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[row][index]));
  18512. }
  18513. function addLineMatrix(var_obj) {
  18514. var_obj.rows++;
  18515. if (var_obj.type == _types.Types.INTEGER) {
  18516. var n_l = [];
  18517. for (var i = 0; i < var_obj.columns; i++) {
  18518. n_l.push(1);
  18519. }
  18520. var_obj.value.push(n_l);
  18521. }
  18522. if (var_obj.type == _types.Types.REAL) {
  18523. var n_l = [];
  18524. for (i = 0; i < var_obj.columns; i++) {
  18525. n_l.push(1.0);
  18526. }
  18527. var_obj.value.push(n_l);
  18528. }
  18529. if (var_obj.type == _types.Types.TEXT) {
  18530. var n_l = [];
  18531. for (i = 0; i < var_obj.columns; i++) {
  18532. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  18533. }
  18534. var_obj.value.push(n_l);
  18535. }
  18536. if (var_obj.type == _types.Types.BOOLEAN) {
  18537. var n_l = [];
  18538. for (i = 0; i < var_obj.columns; i++) {
  18539. n_l.push(true);
  18540. }
  18541. var_obj.value.push(n_l);
  18542. }
  18543. }
  18544. function removeLineMatrix(var_obj) {
  18545. if (var_obj.rows == 0) {
  18546. return;
  18547. }
  18548. var_obj.rows--;
  18549. var_obj.value.splice(var_obj.value.length - 1, 1);
  18550. }
  18551. function addColumnMatrix(var_obj) {
  18552. var_obj.columns++;
  18553. if (var_obj.type == _types.Types.INTEGER) {
  18554. for (var i = 0; i < var_obj.rows; i++) {
  18555. var_obj.value[i].push(1);
  18556. }
  18557. }
  18558. if (var_obj.type == _types.Types.REAL) {
  18559. for (var i = 0; i < var_obj.rows; i++) {
  18560. var_obj.value[i].push(1.0);
  18561. }
  18562. }
  18563. if (var_obj.type == _types.Types.TEXT) {
  18564. for (var i = 0; i < var_obj.rows; i++) {
  18565. var_obj.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  18566. }
  18567. }
  18568. if (var_obj.type == _types.Types.BOOLEAN) {
  18569. for (var i = 0; i < var_obj.rows; i++) {
  18570. var_obj.value[i].push(true);
  18571. }
  18572. }
  18573. }
  18574. function removeColumnMatrix(var_obj) {
  18575. if (var_obj.columns == 0) {
  18576. return;
  18577. }
  18578. var_obj.columns--;
  18579. for (var i = 0; i < var_obj.rows; i++) {
  18580. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  18581. }
  18582. }
  18583. function addColumnVector(var_obj) {
  18584. var_obj.columns++;
  18585. if (var_obj.type == _types.Types.INTEGER) {
  18586. var_obj.value.push(1);
  18587. }
  18588. if (var_obj.type == _types.Types.REAL) {
  18589. var_obj.value.push(1.0);
  18590. }
  18591. if (var_obj.type == _types.Types.TEXT) {
  18592. var_obj.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  18593. }
  18594. if (var_obj.type == _types.Types.BOOLEAN) {
  18595. var_obj.value.push(true);
  18596. }
  18597. }
  18598. function removeColumnVector(var_obj) {
  18599. if (var_obj.columns == 0) {
  18600. return;
  18601. }
  18602. var_obj.columns--;
  18603. var_obj.value.splice(var_obj.value.length - 1, 1);
  18604. }
  18605. function alternateBooleanValue(var_obj, value_container) {
  18606. var_obj.value = !var_obj.value;
  18607. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value));
  18608. }
  18609. function alternateBooleanVectorValue(var_obj, index, value_container) {
  18610. var_obj.value[index] = !var_obj.value[index];
  18611. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[index]));
  18612. }
  18613. function updateInitialValues(variable_obj) {
  18614. if (variable_obj.type == _types.Types.INTEGER) {
  18615. if (variable_obj.dimensions == 0) {
  18616. variable_obj.value = 1;
  18617. }
  18618. if (variable_obj.dimensions == 1) {
  18619. variable_obj.value = [1, 1];
  18620. }
  18621. if (variable_obj.dimensions == 2) {
  18622. variable_obj.value = [[1, 1], [1, 1]];
  18623. }
  18624. }
  18625. if (variable_obj.type == _types.Types.REAL) {
  18626. if (variable_obj.dimensions == 0) {
  18627. variable_obj.value = 1.0;
  18628. }
  18629. if (variable_obj.dimensions == 1) {
  18630. variable_obj.value = [1.0, 1.0];
  18631. }
  18632. if (variable_obj.dimensions == 2) {
  18633. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  18634. }
  18635. }
  18636. if (variable_obj.type == _types.Types.TEXT) {
  18637. if (variable_obj.dimensions == 0) {
  18638. variable_obj.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  18639. }
  18640. if (variable_obj.dimensions == 1) {
  18641. variable_obj.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  18642. }
  18643. if (variable_obj.dimensions == 2) {
  18644. variable_obj.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  18645. }
  18646. }
  18647. if (variable_obj.type == _types.Types.BOOLEAN) {
  18648. if (variable_obj.dimensions == 0) {
  18649. variable_obj.value = true;
  18650. }
  18651. if (variable_obj.dimensions == 1) {
  18652. variable_obj.value = [true, true];
  18653. }
  18654. if (variable_obj.dimensions == 2) {
  18655. variable_obj.value = [[true, true], [true, true]];
  18656. }
  18657. }
  18658. }
  18659. var opened_name_value_vector_global_ = false;
  18660. var opened_input_value_vector_global_ = null;
  18661. function enableVectorValueUpdate(var_obj, index, parent_node) {
  18662. if (opened_name_value_vector_global_) {
  18663. opened_input_value_vector_global_.focus();
  18664. return;
  18665. }
  18666. parent_node = (0, _jquery2.default)(parent_node);
  18667. opened_name_value_vector_global_ = true;
  18668. parent_node.find('.span_value_variable').text('');
  18669. var input_field;
  18670. if (var_obj.type == _types.Types.REAL) {
  18671. input_field = (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) + "' />");
  18672. input_field.insertBefore(parent_node.find('.span_value_variable'));
  18673. } else {
  18674. input_field = (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] + "' />");
  18675. input_field.insertBefore(parent_node.find('.span_value_variable'));
  18676. }
  18677. input_field.on('input', function () {
  18678. var inputWidth = input_field.textWidth() + 10;
  18679. opened_input_value_vector_global_ = input_field;
  18680. input_field.focus();
  18681. var tmpStr = input_field.val();
  18682. input_field.val('');
  18683. input_field.val(tmpStr);
  18684. input_field.css({
  18685. width: inputWidth
  18686. });
  18687. }).trigger('input');
  18688. input_field.focusout(function () {
  18689. /// update array:
  18690. if (input_field.val().trim()) {
  18691. if (var_obj.type == _types.Types.REAL) {
  18692. var_obj.value[index] = parseFloat(input_field.val().trim());
  18693. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  18694. } else {
  18695. if (var_obj.type == _types.Types.INTEGER) {
  18696. var_obj.value[index] = parseInt(input_field.val().trim());
  18697. } else {
  18698. var_obj.value[index] = input_field.val().trim();
  18699. }
  18700. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  18701. }
  18702. } else {
  18703. if (var_obj.type == _types.Types.REAL) {
  18704. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  18705. } else {
  18706. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  18707. }
  18708. }
  18709. if (var_obj.type == _types.Types.TEXT) {
  18710. var_obj.value[index] = input_field.val();
  18711. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  18712. }
  18713. input_field.off();
  18714. input_field.remove();
  18715. /// update elements:
  18716. opened_name_value_vector_global_ = false;
  18717. opened_input_value_vector_global_ = false;
  18718. });
  18719. input_field.on('keydown', function (e) {
  18720. var code = e.keyCode || e.which;
  18721. if (code == 13) {
  18722. if (input_field.val().trim()) {
  18723. if (var_obj.type == _types.Types.REAL) {
  18724. var_obj.value[index] = parseFloat(input_field.val().trim());
  18725. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  18726. } else {
  18727. if (var_obj.type == _types.Types.INTEGER) {
  18728. var_obj.value[index] = parseInt(input_field.val().trim());
  18729. } else {
  18730. var_obj.value[index] = input_field.val().trim();
  18731. }
  18732. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  18733. }
  18734. } else {
  18735. if (var_obj.type == _types.Types.REAL) {
  18736. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  18737. } else {
  18738. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  18739. }
  18740. }
  18741. if (var_obj.type == _types.Types.TEXT) {
  18742. var_obj.value[index] = input_field.val();
  18743. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  18744. }
  18745. input_field.off();
  18746. input_field.remove();
  18747. /// update elements:
  18748. opened_name_value_vector_global_ = false;
  18749. opened_input_value_vector_global_ = false;
  18750. }
  18751. if (code == 27) {
  18752. if (var_obj.type == _types.Types.REAL) {
  18753. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  18754. } else {
  18755. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  18756. }
  18757. input_field.off();
  18758. input_field.remove();
  18759. /// update elements:
  18760. opened_name_value_vector_global_ = false;
  18761. opened_input_value_vector_global_ = false;
  18762. }
  18763. });
  18764. input_field.select();
  18765. }
  18766. var opened_name_value_global_var = false;
  18767. var opened_input_value_global_ar = null;
  18768. function enableValueUpdate(var_obj, parent_node) {
  18769. if (opened_name_value_global_var) {
  18770. opened_input_value_global_ar.focus();
  18771. return;
  18772. }
  18773. parent_node = (0, _jquery2.default)(parent_node);
  18774. opened_name_value_global_var = true;
  18775. var input_field;
  18776. parent_node.find('.span_value_variable').text('');
  18777. if (var_obj.type == _types.Types.REAL) {
  18778. input_field = (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) + "' />");
  18779. input_field.insertBefore(parent_node.find('.span_value_variable'));
  18780. } else {
  18781. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value + "' />");
  18782. input_field.insertBefore(parent_node.find('.span_value_variable'));
  18783. }
  18784. input_field.on('input', function () {
  18785. var inputWidth = input_field.textWidth() + 10;
  18786. opened_input_value_global_ar = input_field;
  18787. input_field.focus();
  18788. var tmpStr = input_field.val();
  18789. input_field.val('');
  18790. input_field.val(tmpStr);
  18791. input_field.css({
  18792. width: inputWidth
  18793. });
  18794. }).trigger('input');
  18795. input_field.focusout(function () {
  18796. /// update array:
  18797. if (input_field.val().trim()) {
  18798. if (var_obj.type == _types.Types.REAL) {
  18799. var_obj.value = parseFloat(input_field.val().trim());
  18800. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  18801. } else {
  18802. if (var_obj.type == _types.Types.INTEGER) {
  18803. var_obj.value = parseInt(input_field.val().trim());
  18804. } else {
  18805. var_obj.value = input_field.val().trim();
  18806. }
  18807. parent_node.find('.span_value_variable').text(var_obj.value);
  18808. }
  18809. } else {
  18810. if (var_obj.type == _types.Types.REAL) {
  18811. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  18812. } else {
  18813. parent_node.find('.span_value_variable').text(var_obj.value);
  18814. }
  18815. }
  18816. if (var_obj.type == _types.Types.TEXT) {
  18817. var_obj.value = input_field.val();
  18818. parent_node.find('.span_value_variable').text(var_obj.value);
  18819. }
  18820. input_field.off();
  18821. input_field.remove();
  18822. /// update elements:
  18823. opened_name_value_global_var = false;
  18824. opened_input_value_global_ar = false;
  18825. });
  18826. input_field.on('keydown', function (e) {
  18827. var code = e.keyCode || e.which;
  18828. if (code == 13) {
  18829. if (input_field.val().trim()) {
  18830. if (var_obj.type == _types.Types.REAL) {
  18831. var_obj.value = parseFloat(input_field.val().trim());
  18832. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  18833. } else {
  18834. if (var_obj.type == _types.Types.INTEGER) {
  18835. var_obj.value = parseInt(input_field.val().trim());
  18836. } else {
  18837. var_obj.value = input_field.val().trim();
  18838. }
  18839. parent_node.find('.span_value_variable').text(var_obj.value);
  18840. }
  18841. } else {
  18842. if (var_obj.type == _types.Types.REAL) {
  18843. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  18844. } else {
  18845. parent_node.find('.span_value_variable').text(var_obj.value);
  18846. }
  18847. }
  18848. if (var_obj.type == _types.Types.TEXT) {
  18849. var_obj.value = input_field.val();
  18850. parent_node.find('.span_value_variable').text(var_obj.value);
  18851. }
  18852. input_field.off();
  18853. input_field.remove();
  18854. /// update elements:
  18855. opened_name_value_global_var = false;
  18856. opened_input_value_global_ar = false;
  18857. }
  18858. if (code == 27) {
  18859. if (var_obj.type == _types.Types.REAL) {
  18860. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  18861. } else {
  18862. parent_node.find('.span_value_variable').text(var_obj.value);
  18863. }
  18864. input_field.off();
  18865. input_field.remove();
  18866. /// update elements:
  18867. opened_name_value_global_var = false;
  18868. opened_input_value_global_ar = false;
  18869. }
  18870. });
  18871. input_field.select();
  18872. }
  18873. var opened_name_global = false;
  18874. var opened_input_global = null;
  18875. function enableNameUpdate(variable_obj, variable_container) {
  18876. if (opened_name_global) {
  18877. opened_input_global.focus();
  18878. return;
  18879. }
  18880. opened_name_global = true;
  18881. variable_container.find('.span_name_variable').text('');
  18882. var input_name;
  18883. input_name = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + variable_obj.name + "' />");
  18884. input_name.insertBefore(variable_container.find('.span_name_variable'));
  18885. input_name.on('input', function () {
  18886. var inputWidth = input_name.textWidth() + 10;
  18887. opened_input_global = input_name;
  18888. input_name.focus();
  18889. var tmpStr = input_name.val();
  18890. input_name.val('');
  18891. input_name.val(tmpStr);
  18892. input_name.css({
  18893. width: inputWidth
  18894. });
  18895. }).trigger('input');
  18896. input_name.focusout(function () {
  18897. /// update array:
  18898. if (input_name.val().trim().length > 0) {
  18899. updateName(variable_obj, input_name.val().trim());
  18900. variable_container.find('.span_name_variable').text(variable_obj.name);
  18901. } else {
  18902. variable_container.find('.span_name_variable').text(variable_obj.name);
  18903. }
  18904. input_name.off();
  18905. input_name.remove();
  18906. /// update elements:
  18907. opened_name_global = false;
  18908. opened_input_global = false;
  18909. });
  18910. input_name.on('keydown', function (e) {
  18911. var code = e.keyCode || e.which;
  18912. if (code == 13) {
  18913. if (input_name.val().trim().length > 0) {
  18914. updateName(variable_obj, input_name.val().trim());
  18915. variable_container.find('.span_name_variable').text(variable_obj.name);
  18916. } else {
  18917. variable_container.find('.span_name_variable').text(variable_obj.name);
  18918. }
  18919. input_name.off();
  18920. input_name.remove();
  18921. /// update elements:
  18922. opened_name_global = false;
  18923. opened_input_global = false;
  18924. }
  18925. if (code == 27) {
  18926. variable_container.find('.span_name_variable').text(variable_obj.name);
  18927. input_name.off();
  18928. input_name.remove();
  18929. /// update elements:
  18930. opened_name_global = false;
  18931. opened_input_global = false;
  18932. }
  18933. });
  18934. input_name.select();
  18935. }
  18936. var opened_name_value_matrix_global_v = false;
  18937. var opened_input_value_matrix_global_v = null;
  18938. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  18939. if (opened_name_value_matrix_global_v) {
  18940. opened_input_value_matrix_global_v.focus();
  18941. return;
  18942. }
  18943. parent_node = (0, _jquery2.default)(parent_node);
  18944. opened_name_value_matrix_global_v = true;
  18945. parent_node.find('.span_value_variable').text('');
  18946. var input_field;
  18947. if (var_obj.type == _types.Types.REAL) {
  18948. input_field = (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) + "' />");
  18949. input_field.insertBefore(parent_node.find('.span_value_variable'));
  18950. } else {
  18951. input_field = (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] + "' />");
  18952. input_field.insertBefore(parent_node.find('.span_value_variable'));
  18953. }
  18954. input_field.on('input', function () {
  18955. var inputWidth = input_field.textWidth() + 10;
  18956. opened_input_value_matrix_global_v = input_field;
  18957. input_field.focus();
  18958. var tmpStr = input_field.val();
  18959. input_field.val('');
  18960. input_field.val(tmpStr);
  18961. input_field.css({
  18962. width: inputWidth
  18963. });
  18964. }).trigger('input');
  18965. input_field.focusout(function () {
  18966. /// update array:
  18967. if (input_field.val().trim()) {
  18968. if (var_obj.type == _types.Types.REAL) {
  18969. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  18970. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  18971. } else {
  18972. if (var_obj.type == _types.Types.INTEGER) {
  18973. var_obj.value[row][index] = parseInt(input_field.val().trim());
  18974. } else {
  18975. var_obj.value[row][index] = input_field.val().trim();
  18976. }
  18977. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  18978. }
  18979. } else {
  18980. if (var_obj.type == _types.Types.REAL) {
  18981. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  18982. } else {
  18983. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  18984. }
  18985. }
  18986. if (var_obj.type == _types.Types.TEXT) {
  18987. var_obj.value[row][index] = input_field.val();
  18988. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  18989. }
  18990. input_field.off();
  18991. input_field.remove();
  18992. /// update elements:
  18993. opened_name_value_matrix_global_v = false;
  18994. opened_input_value_matrix_global_v = false;
  18995. });
  18996. input_field.on('keydown', function (e) {
  18997. var code = e.keyCode || e.which;
  18998. if (code == 13) {
  18999. if (input_field.val().trim()) {
  19000. if (var_obj.type == _types.Types.REAL) {
  19001. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  19002. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  19003. } else {
  19004. if (var_obj.type == _types.Types.INTEGER) {
  19005. var_obj.value[row][index] = parseInt(input_field.val().trim());
  19006. } else {
  19007. var_obj.value[row][index] = input_field.val().trim();
  19008. }
  19009. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  19010. }
  19011. } else {
  19012. if (var_obj.type == _types.Types.REAL) {
  19013. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  19014. } else {
  19015. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  19016. }
  19017. }
  19018. if (var_obj.type == _types.Types.TEXT) {
  19019. var_obj.value[row][index] = input_field.val();
  19020. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  19021. }
  19022. input_field.off();
  19023. input_field.remove();
  19024. /// update elements:
  19025. opened_name_value_matrix_global_v = false;
  19026. opened_input_value_matrix_global_v = false;
  19027. }
  19028. if (code == 27) {
  19029. if (var_obj.type == _types.Types.REAL) {
  19030. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  19031. } else {
  19032. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  19033. }
  19034. input_field.off();
  19035. input_field.remove();
  19036. /// update elements:
  19037. opened_name_value_matrix_global_v = false;
  19038. opened_input_value_matrix_global_v = false;
  19039. }
  19040. });
  19041. input_field.select();
  19042. }
  19043. /***/ }),
  19044. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  19045. /*!****************************************************!*\
  19046. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  19047. \****************************************************/
  19048. /*! no static exports found */
  19049. /***/ (function(module, exports, __webpack_require__) {
  19050. "use strict";
  19051. //
  19052. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19053. * Use of this file is governed by the BSD 3-clause license that
  19054. * can be found in the LICENSE.txt file in the project root.
  19055. */
  19056. // This implementation of {@link TokenStream} loads tokens from a
  19057. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  19058. // access to any previous token by index.
  19059. //
  19060. // <p>
  19061. // This token stream ignores the value of {@link Token//getChannel}. If your
  19062. // parser requires the token stream filter tokens to only those on a particular
  19063. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  19064. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  19065. // {@link CommonTokenStream}.</p>
  19066. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  19067. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  19068. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  19069. // this is just to keep meaningful parameter types to Parser
  19070. function TokenStream() {
  19071. return this;
  19072. }
  19073. function BufferedTokenStream(tokenSource) {
  19074. TokenStream.call(this);
  19075. // The {@link TokenSource} from which tokens for this stream are fetched.
  19076. this.tokenSource = tokenSource;
  19077. // A collection of all tokens fetched from the token source. The list is
  19078. // considered a complete view of the input once {@link //fetchedEOF} is set
  19079. // to {@code true}.
  19080. this.tokens = [];
  19081. // The index into {@link //tokens} of the current token (next token to
  19082. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  19083. // be
  19084. // {@link //LT LT(1)}.
  19085. //
  19086. // <p>This field is set to -1 when the stream is first constructed or when
  19087. // {@link //setTokenSource} is called, indicating that the first token has
  19088. // not yet been fetched from the token source. For additional information,
  19089. // see the documentation of {@link IntStream} for a description of
  19090. // Initializing Methods.</p>
  19091. this.index = -1;
  19092. // Indicates whether the {@link Token//EOF} token has been fetched from
  19093. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  19094. // performance for the following cases:
  19095. //
  19096. // <ul>
  19097. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  19098. // prevent
  19099. // consuming the EOF symbol is optimized by checking the values of
  19100. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  19101. // //LA}.</li>
  19102. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  19103. // into
  19104. // {@link //tokens} is trivial with this field.</li>
  19105. // <ul>
  19106. this.fetchedEOF = false;
  19107. return this;
  19108. }
  19109. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  19110. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  19111. BufferedTokenStream.prototype.mark = function () {
  19112. return 0;
  19113. };
  19114. BufferedTokenStream.prototype.release = function (marker) {
  19115. // no resources to release
  19116. };
  19117. BufferedTokenStream.prototype.reset = function () {
  19118. this.seek(0);
  19119. };
  19120. BufferedTokenStream.prototype.seek = function (index) {
  19121. this.lazyInit();
  19122. this.index = this.adjustSeekIndex(index);
  19123. };
  19124. BufferedTokenStream.prototype.get = function (index) {
  19125. this.lazyInit();
  19126. return this.tokens[index];
  19127. };
  19128. BufferedTokenStream.prototype.consume = function () {
  19129. var skipEofCheck = false;
  19130. if (this.index >= 0) {
  19131. if (this.fetchedEOF) {
  19132. // the last token in tokens is EOF. skip check if p indexes any
  19133. // fetched token except the last.
  19134. skipEofCheck = this.index < this.tokens.length - 1;
  19135. } else {
  19136. // no EOF token in tokens. skip check if p indexes a fetched token.
  19137. skipEofCheck = this.index < this.tokens.length;
  19138. }
  19139. } else {
  19140. // not yet initialized
  19141. skipEofCheck = false;
  19142. }
  19143. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  19144. throw "cannot consume EOF";
  19145. }
  19146. if (this.sync(this.index + 1)) {
  19147. this.index = this.adjustSeekIndex(this.index + 1);
  19148. }
  19149. };
  19150. // Make sure index {@code i} in tokens has a token.
  19151. //
  19152. // @return {@code true} if a token is located at index {@code i}, otherwise
  19153. // {@code false}.
  19154. // @see //get(int i)
  19155. // /
  19156. BufferedTokenStream.prototype.sync = function (i) {
  19157. var n = i - this.tokens.length + 1; // how many more elements we need?
  19158. if (n > 0) {
  19159. var fetched = this.fetch(n);
  19160. return fetched >= n;
  19161. }
  19162. return true;
  19163. };
  19164. // Add {@code n} elements to buffer.
  19165. //
  19166. // @return The actual number of elements added to the buffer.
  19167. // /
  19168. BufferedTokenStream.prototype.fetch = function (n) {
  19169. if (this.fetchedEOF) {
  19170. return 0;
  19171. }
  19172. for (var i = 0; i < n; i++) {
  19173. var t = this.tokenSource.nextToken();
  19174. t.tokenIndex = this.tokens.length;
  19175. this.tokens.push(t);
  19176. if (t.type === Token.EOF) {
  19177. this.fetchedEOF = true;
  19178. return i + 1;
  19179. }
  19180. }
  19181. return n;
  19182. };
  19183. // Get all tokens from start..stop inclusively///
  19184. BufferedTokenStream.prototype.getTokens = function (start, stop, types) {
  19185. if (types === undefined) {
  19186. types = null;
  19187. }
  19188. if (start < 0 || stop < 0) {
  19189. return null;
  19190. }
  19191. this.lazyInit();
  19192. var subset = [];
  19193. if (stop >= this.tokens.length) {
  19194. stop = this.tokens.length - 1;
  19195. }
  19196. for (var i = start; i < stop; i++) {
  19197. var t = this.tokens[i];
  19198. if (t.type === Token.EOF) {
  19199. break;
  19200. }
  19201. if (types === null || types.contains(t.type)) {
  19202. subset.push(t);
  19203. }
  19204. }
  19205. return subset;
  19206. };
  19207. BufferedTokenStream.prototype.LA = function (i) {
  19208. return this.LT(i).type;
  19209. };
  19210. BufferedTokenStream.prototype.LB = function (k) {
  19211. if (this.index - k < 0) {
  19212. return null;
  19213. }
  19214. return this.tokens[this.index - k];
  19215. };
  19216. BufferedTokenStream.prototype.LT = function (k) {
  19217. this.lazyInit();
  19218. if (k === 0) {
  19219. return null;
  19220. }
  19221. if (k < 0) {
  19222. return this.LB(-k);
  19223. }
  19224. var i = this.index + k - 1;
  19225. this.sync(i);
  19226. if (i >= this.tokens.length) {
  19227. // return EOF token
  19228. // EOF must be last token
  19229. return this.tokens[this.tokens.length - 1];
  19230. }
  19231. return this.tokens[i];
  19232. };
  19233. // Allowed derived classes to modify the behavior of operations which change
  19234. // the current stream position by adjusting the target token index of a seek
  19235. // operation. The default implementation simply returns {@code i}. If an
  19236. // exception is thrown in this method, the current stream index should not be
  19237. // changed.
  19238. //
  19239. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  19240. // that
  19241. // the seek target is always an on-channel token.</p>
  19242. //
  19243. // @param i The target token index.
  19244. // @return The adjusted target token index.
  19245. BufferedTokenStream.prototype.adjustSeekIndex = function (i) {
  19246. return i;
  19247. };
  19248. BufferedTokenStream.prototype.lazyInit = function () {
  19249. if (this.index === -1) {
  19250. this.setup();
  19251. }
  19252. };
  19253. BufferedTokenStream.prototype.setup = function () {
  19254. this.sync(0);
  19255. this.index = this.adjustSeekIndex(0);
  19256. };
  19257. // Reset this token stream by setting its token source.///
  19258. BufferedTokenStream.prototype.setTokenSource = function (tokenSource) {
  19259. this.tokenSource = tokenSource;
  19260. this.tokens = [];
  19261. this.index = -1;
  19262. this.fetchedEOF = false;
  19263. };
  19264. // Given a starting index, return the index of the next token on channel.
  19265. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  19266. // on channel between i and EOF.
  19267. // /
  19268. BufferedTokenStream.prototype.nextTokenOnChannel = function (i, channel) {
  19269. this.sync(i);
  19270. if (i >= this.tokens.length) {
  19271. return -1;
  19272. }
  19273. var token = this.tokens[i];
  19274. while (token.channel !== this.channel) {
  19275. if (token.type === Token.EOF) {
  19276. return -1;
  19277. }
  19278. i += 1;
  19279. this.sync(i);
  19280. token = this.tokens[i];
  19281. }
  19282. return i;
  19283. };
  19284. // Given a starting index, return the index of the previous token on channel.
  19285. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  19286. // on channel between i and 0.
  19287. BufferedTokenStream.prototype.previousTokenOnChannel = function (i, channel) {
  19288. while (i >= 0 && this.tokens[i].channel !== channel) {
  19289. i -= 1;
  19290. }
  19291. return i;
  19292. };
  19293. // Collect all tokens on specified channel to the right of
  19294. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  19295. // EOF. If channel is -1, find any non default channel token.
  19296. BufferedTokenStream.prototype.getHiddenTokensToRight = function (tokenIndex, channel) {
  19297. if (channel === undefined) {
  19298. channel = -1;
  19299. }
  19300. this.lazyInit();
  19301. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  19302. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  19303. }
  19304. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  19305. var from_ = tokenIndex + 1;
  19306. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  19307. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  19308. return this.filterForChannel(from_, to, channel);
  19309. };
  19310. // Collect all tokens on specified channel to the left of
  19311. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  19312. // If channel is -1, find any non default channel token.
  19313. BufferedTokenStream.prototype.getHiddenTokensToLeft = function (tokenIndex, channel) {
  19314. if (channel === undefined) {
  19315. channel = -1;
  19316. }
  19317. this.lazyInit();
  19318. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  19319. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  19320. }
  19321. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  19322. if (prevOnChannel === tokenIndex - 1) {
  19323. return null;
  19324. }
  19325. // if none on channel to left, prevOnChannel=-1 then from=0
  19326. var from_ = prevOnChannel + 1;
  19327. var to = tokenIndex - 1;
  19328. return this.filterForChannel(from_, to, channel);
  19329. };
  19330. BufferedTokenStream.prototype.filterForChannel = function (left, right, channel) {
  19331. var hidden = [];
  19332. for (var i = left; i < right + 1; i++) {
  19333. var t = this.tokens[i];
  19334. if (channel === -1) {
  19335. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  19336. hidden.push(t);
  19337. }
  19338. } else if (t.channel === channel) {
  19339. hidden.push(t);
  19340. }
  19341. }
  19342. if (hidden.length === 0) {
  19343. return null;
  19344. }
  19345. return hidden;
  19346. };
  19347. BufferedTokenStream.prototype.getSourceName = function () {
  19348. return this.tokenSource.getSourceName();
  19349. };
  19350. // Get the text of all tokens in this buffer.///
  19351. BufferedTokenStream.prototype.getText = function (interval) {
  19352. this.lazyInit();
  19353. this.fill();
  19354. if (interval === undefined || interval === null) {
  19355. interval = new Interval(0, this.tokens.length - 1);
  19356. }
  19357. var start = interval.start;
  19358. if (start instanceof Token) {
  19359. start = start.tokenIndex;
  19360. }
  19361. var stop = interval.stop;
  19362. if (stop instanceof Token) {
  19363. stop = stop.tokenIndex;
  19364. }
  19365. if (start === null || stop === null || start < 0 || stop < 0) {
  19366. return "";
  19367. }
  19368. if (stop >= this.tokens.length) {
  19369. stop = this.tokens.length - 1;
  19370. }
  19371. var s = "";
  19372. for (var i = start; i < stop + 1; i++) {
  19373. var t = this.tokens[i];
  19374. if (t.type === Token.EOF) {
  19375. break;
  19376. }
  19377. s = s + t.text;
  19378. }
  19379. return s;
  19380. };
  19381. // Get all tokens from lexer until EOF///
  19382. BufferedTokenStream.prototype.fill = function () {
  19383. this.lazyInit();
  19384. while (this.fetch(1000) === 1000) {
  19385. continue;
  19386. }
  19387. };
  19388. exports.BufferedTokenStream = BufferedTokenStream;
  19389. /***/ }),
  19390. /***/ "./node_modules/antlr4/CharStreams.js":
  19391. /*!********************************************!*\
  19392. !*** ./node_modules/antlr4/CharStreams.js ***!
  19393. \********************************************/
  19394. /*! no static exports found */
  19395. /***/ (function(module, exports, __webpack_require__) {
  19396. "use strict";
  19397. //
  19398. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19399. * Use of this file is governed by the BSD 3-clause license that
  19400. * can be found in the LICENSE.txt file in the project root.
  19401. */
  19402. //
  19403. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  19404. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  19405. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  19406. // Utility functions to create InputStreams from various sources.
  19407. //
  19408. // All returned InputStreams support the full range of Unicode
  19409. // up to U+10FFFF (the default behavior of InputStream only supports
  19410. // code points up to U+FFFF).
  19411. var CharStreams = {
  19412. // Creates an InputStream from a string.
  19413. fromString: function fromString(str) {
  19414. return new InputStream(str, true);
  19415. },
  19416. // Asynchronously creates an InputStream from a blob given the
  19417. // encoding of the bytes in that blob (defaults to 'utf8' if
  19418. // encoding is null).
  19419. //
  19420. // Invokes onLoad(result) on success, onError(error) on
  19421. // failure.
  19422. fromBlob: function fromBlob(blob, encoding, onLoad, onError) {
  19423. var reader = FileReader();
  19424. reader.onload = function (e) {
  19425. var is = new InputStream(e.target.result, true);
  19426. onLoad(is);
  19427. };
  19428. reader.onerror = onError;
  19429. reader.readAsText(blob, encoding);
  19430. },
  19431. // Creates an InputStream from a Buffer given the
  19432. // encoding of the bytes in that buffer (defaults to 'utf8' if
  19433. // encoding is null).
  19434. fromBuffer: function fromBuffer(buffer, encoding) {
  19435. return new InputStream(buffer.toString(encoding), true);
  19436. },
  19437. // Asynchronously creates an InputStream from a file on disk given
  19438. // the encoding of the bytes in that file (defaults to 'utf8' if
  19439. // encoding is null).
  19440. //
  19441. // Invokes callback(error, result) on completion.
  19442. fromPath: function fromPath(path, encoding, callback) {
  19443. fs.readFile(path, encoding, function (err, data) {
  19444. var is = null;
  19445. if (data !== null) {
  19446. is = new InputStream(data, true);
  19447. }
  19448. callback(err, is);
  19449. });
  19450. },
  19451. // Synchronously creates an InputStream given a path to a file
  19452. // on disk and the encoding of the bytes in that file (defaults to
  19453. // 'utf8' if encoding is null).
  19454. fromPathSync: function fromPathSync(path, encoding) {
  19455. var data = fs.readFileSync(path, encoding);
  19456. return new InputStream(data, true);
  19457. }
  19458. };
  19459. exports.CharStreams = CharStreams;
  19460. /***/ }),
  19461. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  19462. /*!***************************************************!*\
  19463. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  19464. \***************************************************/
  19465. /*! no static exports found */
  19466. /***/ (function(module, exports, __webpack_require__) {
  19467. "use strict";
  19468. //
  19469. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19470. * Use of this file is governed by the BSD 3-clause license that
  19471. * can be found in the LICENSE.txt file in the project root.
  19472. */
  19473. //
  19474. //
  19475. // This default implementation of {@link TokenFactory} creates
  19476. // {@link CommonToken} objects.
  19477. //
  19478. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  19479. function TokenFactory() {
  19480. return this;
  19481. }
  19482. function CommonTokenFactory(copyText) {
  19483. TokenFactory.call(this);
  19484. // Indicates whether {@link CommonToken//setText} should be called after
  19485. // constructing tokens to explicitly set the text. This is useful for cases
  19486. // where the input stream might not be able to provide arbitrary substrings
  19487. // of text from the input after the lexer creates a token (e.g. the
  19488. // implementation of {@link CharStream//getText} in
  19489. // {@link UnbufferedCharStream} throws an
  19490. // {@link UnsupportedOperationException}). Explicitly setting the token text
  19491. // allows {@link Token//getText} to be called at any time regardless of the
  19492. // input stream implementation.
  19493. //
  19494. // <p>
  19495. // The default value is {@code false} to avoid the performance and memory
  19496. // overhead of copying text for every token unless explicitly requested.</p>
  19497. //
  19498. this.copyText = copyText === undefined ? false : copyText;
  19499. return this;
  19500. }
  19501. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  19502. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  19503. //
  19504. // The default {@link CommonTokenFactory} instance.
  19505. //
  19506. // <p>
  19507. // This token factory does not explicitly copy token text when constructing
  19508. // tokens.</p>
  19509. //
  19510. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  19511. CommonTokenFactory.prototype.create = function (source, type, text, channel, start, stop, line, column) {
  19512. var t = new CommonToken(source, type, channel, start, stop);
  19513. t.line = line;
  19514. t.column = column;
  19515. if (text !== null) {
  19516. t.text = text;
  19517. } else if (this.copyText && source[1] !== null) {
  19518. t.text = source[1].getText(start, stop);
  19519. }
  19520. return t;
  19521. };
  19522. CommonTokenFactory.prototype.createThin = function (type, text) {
  19523. var t = new CommonToken(null, type);
  19524. t.text = text;
  19525. return t;
  19526. };
  19527. exports.CommonTokenFactory = CommonTokenFactory;
  19528. /***/ }),
  19529. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  19530. /*!**************************************************!*\
  19531. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  19532. \**************************************************/
  19533. /*! no static exports found */
  19534. /***/ (function(module, exports, __webpack_require__) {
  19535. "use strict";
  19536. //
  19537. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19538. * Use of this file is governed by the BSD 3-clause license that
  19539. * can be found in the LICENSE.txt file in the project root.
  19540. */
  19541. ///
  19542. //
  19543. // This class extends {@link BufferedTokenStream} with functionality to filter
  19544. // token streams to tokens on a particular channel (tokens where
  19545. // {@link Token//getChannel} returns a particular value).
  19546. //
  19547. // <p>
  19548. // This token stream provides access to all tokens by index or when calling
  19549. // methods like {@link //getText}. The channel filtering is only used for code
  19550. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  19551. // {@link //LB}.</p>
  19552. //
  19553. // <p>
  19554. // By default, tokens are placed on the default channel
  19555. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  19556. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  19557. // call {@link Lexer//setChannel}.
  19558. // </p>
  19559. //
  19560. // <p>
  19561. // Note: lexer rules which use the {@code ->skip} lexer command or call
  19562. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  19563. // such a rule will not be available as part of the token stream, regardless of
  19564. // channel.</p>
  19565. ///
  19566. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  19567. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  19568. function CommonTokenStream(lexer, channel) {
  19569. BufferedTokenStream.call(this, lexer);
  19570. this.channel = channel === undefined ? Token.DEFAULT_CHANNEL : channel;
  19571. return this;
  19572. }
  19573. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  19574. CommonTokenStream.prototype.constructor = CommonTokenStream;
  19575. CommonTokenStream.prototype.adjustSeekIndex = function (i) {
  19576. return this.nextTokenOnChannel(i, this.channel);
  19577. };
  19578. CommonTokenStream.prototype.LB = function (k) {
  19579. if (k === 0 || this.index - k < 0) {
  19580. return null;
  19581. }
  19582. var i = this.index;
  19583. var n = 1;
  19584. // find k good tokens looking backwards
  19585. while (n <= k) {
  19586. // skip off-channel tokens
  19587. i = this.previousTokenOnChannel(i - 1, this.channel);
  19588. n += 1;
  19589. }
  19590. if (i < 0) {
  19591. return null;
  19592. }
  19593. return this.tokens[i];
  19594. };
  19595. CommonTokenStream.prototype.LT = function (k) {
  19596. this.lazyInit();
  19597. if (k === 0) {
  19598. return null;
  19599. }
  19600. if (k < 0) {
  19601. return this.LB(-k);
  19602. }
  19603. var i = this.index;
  19604. var n = 1; // we know tokens[pos] is a good one
  19605. // find k good tokens
  19606. while (n < k) {
  19607. // skip off-channel tokens, but make sure to not look past EOF
  19608. if (this.sync(i + 1)) {
  19609. i = this.nextTokenOnChannel(i + 1, this.channel);
  19610. }
  19611. n += 1;
  19612. }
  19613. return this.tokens[i];
  19614. };
  19615. // Count EOF just once.///
  19616. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function () {
  19617. var n = 0;
  19618. this.fill();
  19619. for (var i = 0; i < this.tokens.length; i++) {
  19620. var t = this.tokens[i];
  19621. if (t.channel === this.channel) {
  19622. n += 1;
  19623. }
  19624. if (t.type === Token.EOF) {
  19625. break;
  19626. }
  19627. }
  19628. return n;
  19629. };
  19630. exports.CommonTokenStream = CommonTokenStream;
  19631. /***/ }),
  19632. /***/ "./node_modules/antlr4/FileStream.js":
  19633. /*!*******************************************!*\
  19634. !*** ./node_modules/antlr4/FileStream.js ***!
  19635. \*******************************************/
  19636. /*! no static exports found */
  19637. /***/ (function(module, exports, __webpack_require__) {
  19638. "use strict";
  19639. //
  19640. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19641. * Use of this file is governed by the BSD 3-clause license that
  19642. * can be found in the LICENSE.txt file in the project root.
  19643. */
  19644. //
  19645. //
  19646. // This is an InputStream that is loaded from a file all at once
  19647. // when you construct the object.
  19648. //
  19649. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  19650. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  19651. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  19652. function FileStream(fileName, decodeToUnicodeCodePoints) {
  19653. var data = fs.readFileSync(fileName, "utf8");
  19654. InputStream.call(this, data, decodeToUnicodeCodePoints);
  19655. this.fileName = fileName;
  19656. return this;
  19657. }
  19658. FileStream.prototype = Object.create(InputStream.prototype);
  19659. FileStream.prototype.constructor = FileStream;
  19660. exports.FileStream = FileStream;
  19661. /***/ }),
  19662. /***/ "./node_modules/antlr4/InputStream.js":
  19663. /*!********************************************!*\
  19664. !*** ./node_modules/antlr4/InputStream.js ***!
  19665. \********************************************/
  19666. /*! no static exports found */
  19667. /***/ (function(module, exports, __webpack_require__) {
  19668. "use strict";
  19669. //
  19670. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19671. * Use of this file is governed by the BSD 3-clause license that
  19672. * can be found in the LICENSE.txt file in the project root.
  19673. */
  19674. //
  19675. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  19676. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  19677. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  19678. // Vacuum all input from a string and then treat it like a buffer.
  19679. function _loadString(stream, decodeToUnicodeCodePoints) {
  19680. stream._index = 0;
  19681. stream.data = [];
  19682. if (stream.decodeToUnicodeCodePoints) {
  19683. for (var i = 0; i < stream.strdata.length;) {
  19684. var codePoint = stream.strdata.codePointAt(i);
  19685. stream.data.push(codePoint);
  19686. i += codePoint <= 0xFFFF ? 1 : 2;
  19687. }
  19688. } else {
  19689. for (var i = 0; i < stream.strdata.length; i++) {
  19690. var codeUnit = stream.strdata.charCodeAt(i);
  19691. stream.data.push(codeUnit);
  19692. }
  19693. }
  19694. stream._size = stream.data.length;
  19695. }
  19696. // If decodeToUnicodeCodePoints is true, the input is treated
  19697. // as a series of Unicode code points.
  19698. //
  19699. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  19700. // units.
  19701. function InputStream(data, decodeToUnicodeCodePoints) {
  19702. this.name = "<empty>";
  19703. this.strdata = data;
  19704. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  19705. _loadString(this);
  19706. return this;
  19707. }
  19708. Object.defineProperty(InputStream.prototype, "index", {
  19709. get: function get() {
  19710. return this._index;
  19711. }
  19712. });
  19713. Object.defineProperty(InputStream.prototype, "size", {
  19714. get: function get() {
  19715. return this._size;
  19716. }
  19717. });
  19718. // Reset the stream so that it's in the same state it was
  19719. // when the object was created *except* the data array is not
  19720. // touched.
  19721. //
  19722. InputStream.prototype.reset = function () {
  19723. this._index = 0;
  19724. };
  19725. InputStream.prototype.consume = function () {
  19726. if (this._index >= this._size) {
  19727. // assert this.LA(1) == Token.EOF
  19728. throw "cannot consume EOF";
  19729. }
  19730. this._index += 1;
  19731. };
  19732. InputStream.prototype.LA = function (offset) {
  19733. if (offset === 0) {
  19734. return 0; // undefined
  19735. }
  19736. if (offset < 0) {
  19737. offset += 1; // e.g., translate LA(-1) to use offset=0
  19738. }
  19739. var pos = this._index + offset - 1;
  19740. if (pos < 0 || pos >= this._size) {
  19741. // invalid
  19742. return Token.EOF;
  19743. }
  19744. return this.data[pos];
  19745. };
  19746. InputStream.prototype.LT = function (offset) {
  19747. return this.LA(offset);
  19748. };
  19749. // mark/release do nothing; we have entire buffer
  19750. InputStream.prototype.mark = function () {
  19751. return -1;
  19752. };
  19753. InputStream.prototype.release = function (marker) {};
  19754. // consume() ahead until p==_index; can't just set p=_index as we must
  19755. // update line and column. If we seek backwards, just set p
  19756. //
  19757. InputStream.prototype.seek = function (_index) {
  19758. if (_index <= this._index) {
  19759. this._index = _index; // just jump; don't update stream state (line,
  19760. // ...)
  19761. return;
  19762. }
  19763. // seek forward
  19764. this._index = Math.min(_index, this._size);
  19765. };
  19766. InputStream.prototype.getText = function (start, stop) {
  19767. if (stop >= this._size) {
  19768. stop = this._size - 1;
  19769. }
  19770. if (start >= this._size) {
  19771. return "";
  19772. } else {
  19773. if (this.decodeToUnicodeCodePoints) {
  19774. var result = "";
  19775. for (var i = start; i <= stop; i++) {
  19776. result += String.fromCodePoint(this.data[i]);
  19777. }
  19778. return result;
  19779. } else {
  19780. return this.strdata.slice(start, stop + 1);
  19781. }
  19782. }
  19783. };
  19784. InputStream.prototype.toString = function () {
  19785. return this.strdata;
  19786. };
  19787. exports.InputStream = InputStream;
  19788. /***/ }),
  19789. /***/ "./node_modules/antlr4/IntervalSet.js":
  19790. /*!********************************************!*\
  19791. !*** ./node_modules/antlr4/IntervalSet.js ***!
  19792. \********************************************/
  19793. /*! no static exports found */
  19794. /***/ (function(module, exports, __webpack_require__) {
  19795. "use strict";
  19796. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19797. * Use of this file is governed by the BSD 3-clause license that
  19798. * can be found in the LICENSE.txt file in the project root.
  19799. */
  19800. /*jslint smarttabs:true */
  19801. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  19802. /* stop is not included! */
  19803. function Interval(start, stop) {
  19804. this.start = start;
  19805. this.stop = stop;
  19806. return this;
  19807. }
  19808. Interval.prototype.contains = function (item) {
  19809. return item >= this.start && item < this.stop;
  19810. };
  19811. Interval.prototype.toString = function () {
  19812. if (this.start === this.stop - 1) {
  19813. return this.start.toString();
  19814. } else {
  19815. return this.start.toString() + ".." + (this.stop - 1).toString();
  19816. }
  19817. };
  19818. Object.defineProperty(Interval.prototype, "length", {
  19819. get: function get() {
  19820. return this.stop - this.start;
  19821. }
  19822. });
  19823. function IntervalSet() {
  19824. this.intervals = null;
  19825. this.readOnly = false;
  19826. }
  19827. IntervalSet.prototype.first = function (v) {
  19828. if (this.intervals === null || this.intervals.length === 0) {
  19829. return Token.INVALID_TYPE;
  19830. } else {
  19831. return this.intervals[0].start;
  19832. }
  19833. };
  19834. IntervalSet.prototype.addOne = function (v) {
  19835. this.addInterval(new Interval(v, v + 1));
  19836. };
  19837. IntervalSet.prototype.addRange = function (l, h) {
  19838. this.addInterval(new Interval(l, h + 1));
  19839. };
  19840. IntervalSet.prototype.addInterval = function (v) {
  19841. if (this.intervals === null) {
  19842. this.intervals = [];
  19843. this.intervals.push(v);
  19844. } else {
  19845. // find insert pos
  19846. for (var k = 0; k < this.intervals.length; k++) {
  19847. var i = this.intervals[k];
  19848. // distinct range -> insert
  19849. if (v.stop < i.start) {
  19850. this.intervals.splice(k, 0, v);
  19851. return;
  19852. }
  19853. // contiguous range -> adjust
  19854. else if (v.stop === i.start) {
  19855. this.intervals[k].start = v.start;
  19856. return;
  19857. }
  19858. // overlapping range -> adjust and reduce
  19859. else if (v.start <= i.stop) {
  19860. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  19861. this.reduce(k);
  19862. return;
  19863. }
  19864. }
  19865. // greater than any existing
  19866. this.intervals.push(v);
  19867. }
  19868. };
  19869. IntervalSet.prototype.addSet = function (other) {
  19870. if (other.intervals !== null) {
  19871. for (var k = 0; k < other.intervals.length; k++) {
  19872. var i = other.intervals[k];
  19873. this.addInterval(new Interval(i.start, i.stop));
  19874. }
  19875. }
  19876. return this;
  19877. };
  19878. IntervalSet.prototype.reduce = function (k) {
  19879. // only need to reduce if k is not the last
  19880. if (k < this.intervalslength - 1) {
  19881. var l = this.intervals[k];
  19882. var r = this.intervals[k + 1];
  19883. // if r contained in l
  19884. if (l.stop >= r.stop) {
  19885. this.intervals.pop(k + 1);
  19886. this.reduce(k);
  19887. } else if (l.stop >= r.start) {
  19888. this.intervals[k] = new Interval(l.start, r.stop);
  19889. this.intervals.pop(k + 1);
  19890. }
  19891. }
  19892. };
  19893. IntervalSet.prototype.complement = function (start, stop) {
  19894. var result = new IntervalSet();
  19895. result.addInterval(new Interval(start, stop + 1));
  19896. for (var i = 0; i < this.intervals.length; i++) {
  19897. result.removeRange(this.intervals[i]);
  19898. }
  19899. return result;
  19900. };
  19901. IntervalSet.prototype.contains = function (item) {
  19902. if (this.intervals === null) {
  19903. return false;
  19904. } else {
  19905. for (var k = 0; k < this.intervals.length; k++) {
  19906. if (this.intervals[k].contains(item)) {
  19907. return true;
  19908. }
  19909. }
  19910. return false;
  19911. }
  19912. };
  19913. Object.defineProperty(IntervalSet.prototype, "length", {
  19914. get: function get() {
  19915. var len = 0;
  19916. this.intervals.map(function (i) {
  19917. len += i.length;
  19918. });
  19919. return len;
  19920. }
  19921. });
  19922. IntervalSet.prototype.removeRange = function (v) {
  19923. if (v.start === v.stop - 1) {
  19924. this.removeOne(v.start);
  19925. } else if (this.intervals !== null) {
  19926. var k = 0;
  19927. for (var n = 0; n < this.intervals.length; n++) {
  19928. var i = this.intervals[k];
  19929. // intervals are ordered
  19930. if (v.stop <= i.start) {
  19931. return;
  19932. }
  19933. // check for including range, split it
  19934. else if (v.start > i.start && v.stop < i.stop) {
  19935. this.intervals[k] = new Interval(i.start, v.start);
  19936. var x = new Interval(v.stop, i.stop);
  19937. this.intervals.splice(k, 0, x);
  19938. return;
  19939. }
  19940. // check for included range, remove it
  19941. else if (v.start <= i.start && v.stop >= i.stop) {
  19942. this.intervals.splice(k, 1);
  19943. k = k - 1; // need another pass
  19944. }
  19945. // check for lower boundary
  19946. else if (v.start < i.stop) {
  19947. this.intervals[k] = new Interval(i.start, v.start);
  19948. }
  19949. // check for upper boundary
  19950. else if (v.stop < i.stop) {
  19951. this.intervals[k] = new Interval(v.stop, i.stop);
  19952. }
  19953. k += 1;
  19954. }
  19955. }
  19956. };
  19957. IntervalSet.prototype.removeOne = function (v) {
  19958. if (this.intervals !== null) {
  19959. for (var k = 0; k < this.intervals.length; k++) {
  19960. var i = this.intervals[k];
  19961. // intervals is ordered
  19962. if (v < i.start) {
  19963. return;
  19964. }
  19965. // check for single value range
  19966. else if (v === i.start && v === i.stop - 1) {
  19967. this.intervals.splice(k, 1);
  19968. return;
  19969. }
  19970. // check for lower boundary
  19971. else if (v === i.start) {
  19972. this.intervals[k] = new Interval(i.start + 1, i.stop);
  19973. return;
  19974. }
  19975. // check for upper boundary
  19976. else if (v === i.stop - 1) {
  19977. this.intervals[k] = new Interval(i.start, i.stop - 1);
  19978. return;
  19979. }
  19980. // split existing range
  19981. else if (v < i.stop - 1) {
  19982. var x = new Interval(i.start, v);
  19983. i.start = v + 1;
  19984. this.intervals.splice(k, 0, x);
  19985. return;
  19986. }
  19987. }
  19988. }
  19989. };
  19990. IntervalSet.prototype.toString = function (literalNames, symbolicNames, elemsAreChar) {
  19991. literalNames = literalNames || null;
  19992. symbolicNames = symbolicNames || null;
  19993. elemsAreChar = elemsAreChar || false;
  19994. if (this.intervals === null) {
  19995. return "{}";
  19996. } else if (literalNames !== null || symbolicNames !== null) {
  19997. return this.toTokenString(literalNames, symbolicNames);
  19998. } else if (elemsAreChar) {
  19999. return this.toCharString();
  20000. } else {
  20001. return this.toIndexString();
  20002. }
  20003. };
  20004. IntervalSet.prototype.toCharString = function () {
  20005. var names = [];
  20006. for (var i = 0; i < this.intervals.length; i++) {
  20007. var v = this.intervals[i];
  20008. if (v.stop === v.start + 1) {
  20009. if (v.start === Token.EOF) {
  20010. names.push("<EOF>");
  20011. } else {
  20012. names.push("'" + String.fromCharCode(v.start) + "'");
  20013. }
  20014. } else {
  20015. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop - 1) + "'");
  20016. }
  20017. }
  20018. if (names.length > 1) {
  20019. return "{" + names.join(", ") + "}";
  20020. } else {
  20021. return names[0];
  20022. }
  20023. };
  20024. IntervalSet.prototype.toIndexString = function () {
  20025. var names = [];
  20026. for (var i = 0; i < this.intervals.length; i++) {
  20027. var v = this.intervals[i];
  20028. if (v.stop === v.start + 1) {
  20029. if (v.start === Token.EOF) {
  20030. names.push("<EOF>");
  20031. } else {
  20032. names.push(v.start.toString());
  20033. }
  20034. } else {
  20035. names.push(v.start.toString() + ".." + (v.stop - 1).toString());
  20036. }
  20037. }
  20038. if (names.length > 1) {
  20039. return "{" + names.join(", ") + "}";
  20040. } else {
  20041. return names[0];
  20042. }
  20043. };
  20044. IntervalSet.prototype.toTokenString = function (literalNames, symbolicNames) {
  20045. var names = [];
  20046. for (var i = 0; i < this.intervals.length; i++) {
  20047. var v = this.intervals[i];
  20048. for (var j = v.start; j < v.stop; j++) {
  20049. names.push(this.elementName(literalNames, symbolicNames, j));
  20050. }
  20051. }
  20052. if (names.length > 1) {
  20053. return "{" + names.join(", ") + "}";
  20054. } else {
  20055. return names[0];
  20056. }
  20057. };
  20058. IntervalSet.prototype.elementName = function (literalNames, symbolicNames, a) {
  20059. if (a === Token.EOF) {
  20060. return "<EOF>";
  20061. } else if (a === Token.EPSILON) {
  20062. return "<EPSILON>";
  20063. } else {
  20064. return literalNames[a] || symbolicNames[a];
  20065. }
  20066. };
  20067. exports.Interval = Interval;
  20068. exports.IntervalSet = IntervalSet;
  20069. /***/ }),
  20070. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  20071. /*!********************************************!*\
  20072. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  20073. \********************************************/
  20074. /*! no static exports found */
  20075. /***/ (function(module, exports, __webpack_require__) {
  20076. "use strict";
  20077. //
  20078. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  20079. * Use of this file is governed by the BSD 3-clause license that
  20080. * can be found in the LICENSE.txt file in the project root.
  20081. */
  20082. ///
  20083. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  20084. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  20085. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  20086. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  20087. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  20088. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  20089. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  20090. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  20091. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  20092. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  20093. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  20094. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  20095. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  20096. var PredictionContext = pc.PredictionContext;
  20097. var SingletonPredictionContext = pc.SingletonPredictionContext;
  20098. function LL1Analyzer(atn) {
  20099. this.atn = atn;
  20100. }
  20101. //* Special value added to the lookahead sets to indicate that we hit
  20102. // a predicate during analysis if {@code seeThruPreds==false}.
  20103. ///
  20104. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  20105. //*
  20106. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  20107. // of an {@link ATNState}. The returned array has one element for each
  20108. // outgoing transition in {@code s}. If the closure from transition
  20109. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  20110. // element at index <em>i</em> of the result will be {@code null}.
  20111. //
  20112. // @param s the ATN state
  20113. // @return the expected symbols for each outgoing transition of {@code s}.
  20114. ///
  20115. LL1Analyzer.prototype.getDecisionLookahead = function (s) {
  20116. if (s === null) {
  20117. return null;
  20118. }
  20119. var count = s.transitions.length;
  20120. var look = [];
  20121. for (var alt = 0; alt < count; alt++) {
  20122. look[alt] = new IntervalSet();
  20123. var lookBusy = new Set();
  20124. var seeThruPreds = false; // fail to get lookahead upon pred
  20125. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY, look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  20126. // Wipe out lookahead for this alternative if we found nothing
  20127. // or we had a predicate when we !seeThruPreds
  20128. if (look[alt].length === 0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  20129. look[alt] = null;
  20130. }
  20131. }
  20132. return look;
  20133. };
  20134. //*
  20135. // Compute set of tokens that can follow {@code s} in the ATN in the
  20136. // specified {@code ctx}.
  20137. //
  20138. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  20139. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  20140. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  20141. // reached, {@link Token//EOF} is added to the result set.</p>
  20142. //
  20143. // @param s the ATN state
  20144. // @param stopState the ATN state to stop at. This can be a
  20145. // {@link BlockEndState} to detect epsilon paths through a closure.
  20146. // @param ctx the complete parser context, or {@code null} if the context
  20147. // should be ignored
  20148. //
  20149. // @return The set of tokens that can follow {@code s} in the ATN in the
  20150. // specified {@code ctx}.
  20151. ///
  20152. LL1Analyzer.prototype.LOOK = function (s, stopState, ctx) {
  20153. var r = new IntervalSet();
  20154. var seeThruPreds = true; // ignore preds; get all lookahead
  20155. ctx = ctx || null;
  20156. var lookContext = ctx !== null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  20157. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  20158. return r;
  20159. };
  20160. //*
  20161. // Compute set of tokens that can follow {@code s} in the ATN in the
  20162. // specified {@code ctx}.
  20163. //
  20164. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  20165. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  20166. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  20167. // {@code true} and {@code stopState} or the end of the outermost rule is
  20168. // reached, {@link Token//EOF} is added to the result set.</p>
  20169. //
  20170. // @param s the ATN state.
  20171. // @param stopState the ATN state to stop at. This can be a
  20172. // {@link BlockEndState} to detect epsilon paths through a closure.
  20173. // @param ctx The outer context, or {@code null} if the outer context should
  20174. // not be used.
  20175. // @param look The result lookahead set.
  20176. // @param lookBusy A set used for preventing epsilon closures in the ATN
  20177. // from causing a stack overflow. Outside code should pass
  20178. // {@code new Set<ATNConfig>} for this argument.
  20179. // @param calledRuleStack A set used for preventing left recursion in the
  20180. // ATN from causing a stack overflow. Outside code should pass
  20181. // {@code new BitSet()} for this argument.
  20182. // @param seeThruPreds {@code true} to true semantic predicates as
  20183. // implicitly {@code true} and "see through them", otherwise {@code false}
  20184. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  20185. // result if one is encountered.
  20186. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  20187. // outermost context is reached. This parameter has no effect if {@code ctx}
  20188. // is {@code null}.
  20189. ///
  20190. LL1Analyzer.prototype._LOOK = function (s, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  20191. var c = new ATNConfig({ state: s, alt: 0, context: ctx }, null);
  20192. if (lookBusy.contains(c)) {
  20193. return;
  20194. }
  20195. lookBusy.add(c);
  20196. if (s === stopState) {
  20197. if (ctx === null) {
  20198. look.addOne(Token.EPSILON);
  20199. return;
  20200. } else if (ctx.isEmpty() && addEOF) {
  20201. look.addOne(Token.EOF);
  20202. return;
  20203. }
  20204. }
  20205. if (s instanceof RuleStopState) {
  20206. if (ctx === null) {
  20207. look.addOne(Token.EPSILON);
  20208. return;
  20209. } else if (ctx.isEmpty() && addEOF) {
  20210. look.addOne(Token.EOF);
  20211. return;
  20212. }
  20213. if (ctx !== PredictionContext.EMPTY) {
  20214. // run thru all possible stack tops in ctx
  20215. for (var i = 0; i < ctx.length; i++) {
  20216. var returnState = this.atn.states[ctx.getReturnState(i)];
  20217. var removed = calledRuleStack.contains(returnState.ruleIndex);
  20218. try {
  20219. calledRuleStack.remove(returnState.ruleIndex);
  20220. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  20221. } finally {
  20222. if (removed) {
  20223. calledRuleStack.add(returnState.ruleIndex);
  20224. }
  20225. }
  20226. }
  20227. return;
  20228. }
  20229. }
  20230. for (var j = 0; j < s.transitions.length; j++) {
  20231. var t = s.transitions[j];
  20232. if (t.constructor === RuleTransition) {
  20233. if (calledRuleStack.contains(t.target.ruleIndex)) {
  20234. continue;
  20235. }
  20236. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  20237. try {
  20238. calledRuleStack.add(t.target.ruleIndex);
  20239. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  20240. } finally {
  20241. calledRuleStack.remove(t.target.ruleIndex);
  20242. }
  20243. } else if (t instanceof AbstractPredicateTransition) {
  20244. if (seeThruPreds) {
  20245. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  20246. } else {
  20247. look.addOne(LL1Analyzer.HIT_PRED);
  20248. }
  20249. } else if (t.isEpsilon) {
  20250. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  20251. } else if (t.constructor === WildcardTransition) {
  20252. look.addRange(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  20253. } else {
  20254. var set = t.label;
  20255. if (set !== null) {
  20256. if (t instanceof NotSetTransition) {
  20257. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  20258. }
  20259. look.addSet(set);
  20260. }
  20261. }
  20262. }
  20263. };
  20264. exports.LL1Analyzer = LL1Analyzer;
  20265. /***/ }),
  20266. /***/ "./node_modules/antlr4/Lexer.js":
  20267. /*!**************************************!*\
  20268. !*** ./node_modules/antlr4/Lexer.js ***!
  20269. \**************************************/
  20270. /*! no static exports found */
  20271. /***/ (function(module, exports, __webpack_require__) {
  20272. "use strict";
  20273. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  20274. * Use of this file is governed by the BSD 3-clause license that
  20275. * can be found in the LICENSE.txt file in the project root.
  20276. */
  20277. ///
  20278. // A lexer is recognizer that draws input symbols from a character stream.
  20279. // lexer grammars result in a subclass of this object. A Lexer object
  20280. // uses simplified match() and error recovery mechanisms in the interest of speed.
  20281. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  20282. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  20283. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  20284. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  20285. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  20286. function TokenSource() {
  20287. return this;
  20288. }
  20289. function Lexer(input) {
  20290. Recognizer.call(this);
  20291. this._input = input;
  20292. this._factory = CommonTokenFactory.DEFAULT;
  20293. this._tokenFactorySourcePair = [this, input];
  20294. this._interp = null; // child classes must populate this
  20295. // The goal of all lexer rules/methods is to create a token object.
  20296. // this is an instance variable as multiple rules may collaborate to
  20297. // create a single token. nextToken will return this object after
  20298. // matching lexer rule(s). If you subclass to allow multiple token
  20299. // emissions, then set this to the last token to be matched or
  20300. // something nonnull so that the auto token emit mechanism will not
  20301. // emit another token.
  20302. this._token = null;
  20303. // What character index in the stream did the current token start at?
  20304. // Needed, for example, to get the text for current token. Set at
  20305. // the start of nextToken.
  20306. this._tokenStartCharIndex = -1;
  20307. // The line on which the first character of the token resides///
  20308. this._tokenStartLine = -1;
  20309. // The character position of first character within the line///
  20310. this._tokenStartColumn = -1;
  20311. // Once we see EOF on char stream, next token will be EOF.
  20312. // If you have DONE : EOF ; then you see DONE EOF.
  20313. this._hitEOF = false;
  20314. // The channel number for the current token///
  20315. this._channel = Token.DEFAULT_CHANNEL;
  20316. // The token type for the current token///
  20317. this._type = Token.INVALID_TYPE;
  20318. this._modeStack = [];
  20319. this._mode = Lexer.DEFAULT_MODE;
  20320. // You can set the text for the current token to override what is in
  20321. // the input char buffer. Use setText() or can set this instance var.
  20322. // /
  20323. this._text = null;
  20324. return this;
  20325. }
  20326. Lexer.prototype = Object.create(Recognizer.prototype);
  20327. Lexer.prototype.constructor = Lexer;
  20328. Lexer.DEFAULT_MODE = 0;
  20329. Lexer.MORE = -2;
  20330. Lexer.SKIP = -3;
  20331. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  20332. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  20333. Lexer.MIN_CHAR_VALUE = 0x0000;
  20334. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  20335. Lexer.prototype.reset = function () {
  20336. // wack Lexer state variables
  20337. if (this._input !== null) {
  20338. this._input.seek(0); // rewind the input
  20339. }
  20340. this._token = null;
  20341. this._type = Token.INVALID_TYPE;
  20342. this._channel = Token.DEFAULT_CHANNEL;
  20343. this._tokenStartCharIndex = -1;
  20344. this._tokenStartColumn = -1;
  20345. this._tokenStartLine = -1;
  20346. this._text = null;
  20347. this._hitEOF = false;
  20348. this._mode = Lexer.DEFAULT_MODE;
  20349. this._modeStack = [];
  20350. this._interp.reset();
  20351. };
  20352. // Return a token from this source; i.e., match a token on the char stream.
  20353. Lexer.prototype.nextToken = function () {
  20354. if (this._input === null) {
  20355. throw "nextToken requires a non-null input stream.";
  20356. }
  20357. // Mark start location in char stream so unbuffered streams are
  20358. // guaranteed at least have text of current token
  20359. var tokenStartMarker = this._input.mark();
  20360. try {
  20361. while (true) {
  20362. if (this._hitEOF) {
  20363. this.emitEOF();
  20364. return this._token;
  20365. }
  20366. this._token = null;
  20367. this._channel = Token.DEFAULT_CHANNEL;
  20368. this._tokenStartCharIndex = this._input.index;
  20369. this._tokenStartColumn = this._interp.column;
  20370. this._tokenStartLine = this._interp.line;
  20371. this._text = null;
  20372. var continueOuter = false;
  20373. while (true) {
  20374. this._type = Token.INVALID_TYPE;
  20375. var ttype = Lexer.SKIP;
  20376. try {
  20377. ttype = this._interp.match(this._input, this._mode);
  20378. } catch (e) {
  20379. if (e instanceof RecognitionException) {
  20380. this.notifyListeners(e); // report error
  20381. this.recover(e);
  20382. } else {
  20383. console.log(e.stack);
  20384. throw e;
  20385. }
  20386. }
  20387. if (this._input.LA(1) === Token.EOF) {
  20388. this._hitEOF = true;
  20389. }
  20390. if (this._type === Token.INVALID_TYPE) {
  20391. this._type = ttype;
  20392. }
  20393. if (this._type === Lexer.SKIP) {
  20394. continueOuter = true;
  20395. break;
  20396. }
  20397. if (this._type !== Lexer.MORE) {
  20398. break;
  20399. }
  20400. }
  20401. if (continueOuter) {
  20402. continue;
  20403. }
  20404. if (this._token === null) {
  20405. this.emit();
  20406. }
  20407. return this._token;
  20408. }
  20409. } finally {
  20410. // make sure we release marker after match or
  20411. // unbuffered char stream will keep buffering
  20412. this._input.release(tokenStartMarker);
  20413. }
  20414. };
  20415. // Instruct the lexer to skip creating a token for current lexer rule
  20416. // and look for another token. nextToken() knows to keep looking when
  20417. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  20418. // if token==null at end of any token rule, it creates one for you
  20419. // and emits it.
  20420. // /
  20421. Lexer.prototype.skip = function () {
  20422. this._type = Lexer.SKIP;
  20423. };
  20424. Lexer.prototype.more = function () {
  20425. this._type = Lexer.MORE;
  20426. };
  20427. Lexer.prototype.mode = function (m) {
  20428. this._mode = m;
  20429. };
  20430. Lexer.prototype.pushMode = function (m) {
  20431. if (this._interp.debug) {
  20432. console.log("pushMode " + m);
  20433. }
  20434. this._modeStack.push(this._mode);
  20435. this.mode(m);
  20436. };
  20437. Lexer.prototype.popMode = function () {
  20438. if (this._modeStack.length === 0) {
  20439. throw "Empty Stack";
  20440. }
  20441. if (this._interp.debug) {
  20442. console.log("popMode back to " + this._modeStack.slice(0, -1));
  20443. }
  20444. this.mode(this._modeStack.pop());
  20445. return this._mode;
  20446. };
  20447. // Set the char stream and reset the lexer
  20448. Object.defineProperty(Lexer.prototype, "inputStream", {
  20449. get: function get() {
  20450. return this._input;
  20451. },
  20452. set: function set(input) {
  20453. this._input = null;
  20454. this._tokenFactorySourcePair = [this, this._input];
  20455. this.reset();
  20456. this._input = input;
  20457. this._tokenFactorySourcePair = [this, this._input];
  20458. }
  20459. });
  20460. Object.defineProperty(Lexer.prototype, "sourceName", {
  20461. get: function sourceName() {
  20462. return this._input.sourceName;
  20463. }
  20464. });
  20465. // By default does not support multiple emits per nextToken invocation
  20466. // for efficiency reasons. Subclass and override this method, nextToken,
  20467. // and getToken (to push tokens into a list and pull from that list
  20468. // rather than a single variable as this implementation does).
  20469. // /
  20470. Lexer.prototype.emitToken = function (token) {
  20471. this._token = token;
  20472. };
  20473. // The standard method called to automatically emit a token at the
  20474. // outermost lexical rule. The token object should point into the
  20475. // char buffer start..stop. If there is a text override in 'text',
  20476. // use that to set the token's text. Override this method to emit
  20477. // custom Token objects or provide a new factory.
  20478. // /
  20479. Lexer.prototype.emit = function () {
  20480. var t = this._factory.create(this._tokenFactorySourcePair, this._type, this._text, this._channel, this._tokenStartCharIndex, this.getCharIndex() - 1, this._tokenStartLine, this._tokenStartColumn);
  20481. this.emitToken(t);
  20482. return t;
  20483. };
  20484. Lexer.prototype.emitEOF = function () {
  20485. var cpos = this.column;
  20486. var lpos = this.line;
  20487. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, this._input.index, this._input.index - 1, lpos, cpos);
  20488. this.emitToken(eof);
  20489. return eof;
  20490. };
  20491. Object.defineProperty(Lexer.prototype, "type", {
  20492. get: function get() {
  20493. return this.type;
  20494. },
  20495. set: function set(type) {
  20496. this._type = type;
  20497. }
  20498. });
  20499. Object.defineProperty(Lexer.prototype, "line", {
  20500. get: function get() {
  20501. return this._interp.line;
  20502. },
  20503. set: function set(line) {
  20504. this._interp.line = line;
  20505. }
  20506. });
  20507. Object.defineProperty(Lexer.prototype, "column", {
  20508. get: function get() {
  20509. return this._interp.column;
  20510. },
  20511. set: function set(column) {
  20512. this._interp.column = column;
  20513. }
  20514. });
  20515. // What is the index of the current character of lookahead?///
  20516. Lexer.prototype.getCharIndex = function () {
  20517. return this._input.index;
  20518. };
  20519. // Return the text matched so far for the current token or any text override.
  20520. //Set the complete text of this token; it wipes any previous changes to the text.
  20521. Object.defineProperty(Lexer.prototype, "text", {
  20522. get: function get() {
  20523. if (this._text !== null) {
  20524. return this._text;
  20525. } else {
  20526. return this._interp.getText(this._input);
  20527. }
  20528. },
  20529. set: function set(text) {
  20530. this._text = text;
  20531. }
  20532. });
  20533. // Return a list of all Token objects in input char stream.
  20534. // Forces load of all tokens. Does not include EOF token.
  20535. // /
  20536. Lexer.prototype.getAllTokens = function () {
  20537. var tokens = [];
  20538. var t = this.nextToken();
  20539. while (t.type !== Token.EOF) {
  20540. tokens.push(t);
  20541. t = this.nextToken();
  20542. }
  20543. return tokens;
  20544. };
  20545. Lexer.prototype.notifyListeners = function (e) {
  20546. var start = this._tokenStartCharIndex;
  20547. var stop = this._input.index;
  20548. var text = this._input.getText(start, stop);
  20549. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  20550. var listener = this.getErrorListenerDispatch();
  20551. listener.syntaxError(this, null, this._tokenStartLine, this._tokenStartColumn, msg, e);
  20552. };
  20553. Lexer.prototype.getErrorDisplay = function (s) {
  20554. var d = [];
  20555. for (var i = 0; i < s.length; i++) {
  20556. d.push(s[i]);
  20557. }
  20558. return d.join('');
  20559. };
  20560. Lexer.prototype.getErrorDisplayForChar = function (c) {
  20561. if (c.charCodeAt(0) === Token.EOF) {
  20562. return "<EOF>";
  20563. } else if (c === '\n') {
  20564. return "\\n";
  20565. } else if (c === '\t') {
  20566. return "\\t";
  20567. } else if (c === '\r') {
  20568. return "\\r";
  20569. } else {
  20570. return c;
  20571. }
  20572. };
  20573. Lexer.prototype.getCharErrorDisplay = function (c) {
  20574. return "'" + this.getErrorDisplayForChar(c) + "'";
  20575. };
  20576. // Lexers can normally match any char in it's vocabulary after matching
  20577. // a token, so do the easy thing and just kill a character and hope
  20578. // it all works out. You can instead use the rule invocation stack
  20579. // to do sophisticated error recovery if you are in a fragment rule.
  20580. // /
  20581. Lexer.prototype.recover = function (re) {
  20582. if (this._input.LA(1) !== Token.EOF) {
  20583. if (re instanceof LexerNoViableAltException) {
  20584. // skip a char and try again
  20585. this._interp.consume(this._input);
  20586. } else {
  20587. // TODO: Do we lose character or line position information?
  20588. this._input.consume();
  20589. }
  20590. }
  20591. };
  20592. exports.Lexer = Lexer;
  20593. /***/ }),
  20594. /***/ "./node_modules/antlr4/Parser.js":
  20595. /*!***************************************!*\
  20596. !*** ./node_modules/antlr4/Parser.js ***!
  20597. \***************************************/
  20598. /*! no static exports found */
  20599. /***/ (function(module, exports, __webpack_require__) {
  20600. "use strict";
  20601. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  20602. * Use of this file is governed by the BSD 3-clause license that
  20603. * can be found in the LICENSE.txt file in the project root.
  20604. */
  20605. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  20606. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  20607. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  20608. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  20609. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  20610. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  20611. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  20612. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  20613. function TraceListener(parser) {
  20614. ParseTreeListener.call(this);
  20615. this.parser = parser;
  20616. return this;
  20617. }
  20618. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  20619. TraceListener.prototype.constructor = TraceListener;
  20620. TraceListener.prototype.enterEveryRule = function (ctx) {
  20621. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  20622. };
  20623. TraceListener.prototype.visitTerminal = function (node) {
  20624. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  20625. };
  20626. TraceListener.prototype.exitEveryRule = function (ctx) {
  20627. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  20628. };
  20629. // this is all the parsing support code essentially; most of it is error
  20630. // recovery stuff.//
  20631. function Parser(input) {
  20632. Recognizer.call(this);
  20633. // The input stream.
  20634. this._input = null;
  20635. // The error handling strategy for the parser. The default value is a new
  20636. // instance of {@link DefaultErrorStrategy}.
  20637. this._errHandler = new DefaultErrorStrategy();
  20638. this._precedenceStack = [];
  20639. this._precedenceStack.push(0);
  20640. // The {@link ParserRuleContext} object for the currently executing rule.
  20641. // this is always non-null during the parsing process.
  20642. this._ctx = null;
  20643. // Specifies whether or not the parser should construct a parse tree during
  20644. // the parsing process. The default value is {@code true}.
  20645. this.buildParseTrees = true;
  20646. // When {@link //setTrace}{@code (true)} is called, a reference to the
  20647. // {@link TraceListener} is stored here so it can be easily removed in a
  20648. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  20649. // implemented as a parser listener so this field is not directly used by
  20650. // other parser methods.
  20651. this._tracer = null;
  20652. // The list of {@link ParseTreeListener} listeners registered to receive
  20653. // events during the parse.
  20654. this._parseListeners = null;
  20655. // The number of syntax errors reported during parsing. this value is
  20656. // incremented each time {@link //notifyErrorListeners} is called.
  20657. this._syntaxErrors = 0;
  20658. this.setInputStream(input);
  20659. return this;
  20660. }
  20661. Parser.prototype = Object.create(Recognizer.prototype);
  20662. Parser.prototype.contructor = Parser;
  20663. // this field maps from the serialized ATN string to the deserialized {@link
  20664. // ATN} with
  20665. // bypass alternatives.
  20666. //
  20667. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  20668. //
  20669. Parser.bypassAltsAtnCache = {};
  20670. // reset the parser's state//
  20671. Parser.prototype.reset = function () {
  20672. if (this._input !== null) {
  20673. this._input.seek(0);
  20674. }
  20675. this._errHandler.reset(this);
  20676. this._ctx = null;
  20677. this._syntaxErrors = 0;
  20678. this.setTrace(false);
  20679. this._precedenceStack = [];
  20680. this._precedenceStack.push(0);
  20681. if (this._interp !== null) {
  20682. this._interp.reset();
  20683. }
  20684. };
  20685. // Match current input symbol against {@code ttype}. If the symbol type
  20686. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  20687. // called to complete the match process.
  20688. //
  20689. // <p>If the symbol type does not match,
  20690. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  20691. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  20692. // {@code true} and the token index of the symbol returned by
  20693. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  20694. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  20695. //
  20696. // @param ttype the token type to match
  20697. // @return the matched symbol
  20698. // @throws RecognitionException if the current input symbol did not match
  20699. // {@code ttype} and the error strategy could not recover from the
  20700. // mismatched symbol
  20701. Parser.prototype.match = function (ttype) {
  20702. var t = this.getCurrentToken();
  20703. if (t.type === ttype) {
  20704. this._errHandler.reportMatch(this);
  20705. this.consume();
  20706. } else {
  20707. t = this._errHandler.recoverInline(this);
  20708. if (this.buildParseTrees && t.tokenIndex === -1) {
  20709. // we must have conjured up a new token during single token
  20710. // insertion
  20711. // if it's not the current symbol
  20712. this._ctx.addErrorNode(t);
  20713. }
  20714. }
  20715. return t;
  20716. };
  20717. // Match current input symbol as a wildcard. If the symbol type matches
  20718. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  20719. // and {@link //consume} are called to complete the match process.
  20720. //
  20721. // <p>If the symbol type does not match,
  20722. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  20723. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  20724. // {@code true} and the token index of the symbol returned by
  20725. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  20726. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  20727. //
  20728. // @return the matched symbol
  20729. // @throws RecognitionException if the current input symbol did not match
  20730. // a wildcard and the error strategy could not recover from the mismatched
  20731. // symbol
  20732. Parser.prototype.matchWildcard = function () {
  20733. var t = this.getCurrentToken();
  20734. if (t.type > 0) {
  20735. this._errHandler.reportMatch(this);
  20736. this.consume();
  20737. } else {
  20738. t = this._errHandler.recoverInline(this);
  20739. if (this._buildParseTrees && t.tokenIndex === -1) {
  20740. // we must have conjured up a new token during single token
  20741. // insertion
  20742. // if it's not the current symbol
  20743. this._ctx.addErrorNode(t);
  20744. }
  20745. }
  20746. return t;
  20747. };
  20748. Parser.prototype.getParseListeners = function () {
  20749. return this._parseListeners || [];
  20750. };
  20751. // Registers {@code listener} to receive events during the parsing process.
  20752. //
  20753. // <p>To support output-preserving grammar transformations (including but not
  20754. // limited to left-recursion removal, automated left-factoring, and
  20755. // optimized code generation), calls to listener methods during the parse
  20756. // may differ substantially from calls made by
  20757. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  20758. // particular, rule entry and exit events may occur in a different order
  20759. // during the parse than after the parser. In addition, calls to certain
  20760. // rule entry methods may be omitted.</p>
  20761. //
  20762. // <p>With the following specific exceptions, calls to listener events are
  20763. // <em>deterministic</em>, i.e. for identical input the calls to listener
  20764. // methods will be the same.</p>
  20765. //
  20766. // <ul>
  20767. // <li>Alterations to the grammar used to generate code may change the
  20768. // behavior of the listener calls.</li>
  20769. // <li>Alterations to the command line options passed to ANTLR 4 when
  20770. // generating the parser may change the behavior of the listener calls.</li>
  20771. // <li>Changing the version of the ANTLR Tool used to generate the parser
  20772. // may change the behavior of the listener calls.</li>
  20773. // </ul>
  20774. //
  20775. // @param listener the listener to add
  20776. //
  20777. // @throws NullPointerException if {@code} listener is {@code null}
  20778. //
  20779. Parser.prototype.addParseListener = function (listener) {
  20780. if (listener === null) {
  20781. throw "listener";
  20782. }
  20783. if (this._parseListeners === null) {
  20784. this._parseListeners = [];
  20785. }
  20786. this._parseListeners.push(listener);
  20787. };
  20788. //
  20789. // Remove {@code listener} from the list of parse listeners.
  20790. //
  20791. // <p>If {@code listener} is {@code null} or has not been added as a parse
  20792. // listener, this method does nothing.</p>
  20793. // @param listener the listener to remove
  20794. //
  20795. Parser.prototype.removeParseListener = function (listener) {
  20796. if (this._parseListeners !== null) {
  20797. var idx = this._parseListeners.indexOf(listener);
  20798. if (idx >= 0) {
  20799. this._parseListeners.splice(idx, 1);
  20800. }
  20801. if (this._parseListeners.length === 0) {
  20802. this._parseListeners = null;
  20803. }
  20804. }
  20805. };
  20806. // Remove all parse listeners.
  20807. Parser.prototype.removeParseListeners = function () {
  20808. this._parseListeners = null;
  20809. };
  20810. // Notify any parse listeners of an enter rule event.
  20811. Parser.prototype.triggerEnterRuleEvent = function () {
  20812. if (this._parseListeners !== null) {
  20813. var ctx = this._ctx;
  20814. this._parseListeners.map(function (listener) {
  20815. listener.enterEveryRule(ctx);
  20816. ctx.enterRule(listener);
  20817. });
  20818. }
  20819. };
  20820. //
  20821. // Notify any parse listeners of an exit rule event.
  20822. //
  20823. // @see //addParseListener
  20824. //
  20825. Parser.prototype.triggerExitRuleEvent = function () {
  20826. if (this._parseListeners !== null) {
  20827. // reverse order walk of listeners
  20828. var ctx = this._ctx;
  20829. this._parseListeners.slice(0).reverse().map(function (listener) {
  20830. ctx.exitRule(listener);
  20831. listener.exitEveryRule(ctx);
  20832. });
  20833. }
  20834. };
  20835. Parser.prototype.getTokenFactory = function () {
  20836. return this._input.tokenSource._factory;
  20837. };
  20838. // Tell our token source and error strategy about a new way to create tokens.//
  20839. Parser.prototype.setTokenFactory = function (factory) {
  20840. this._input.tokenSource._factory = factory;
  20841. };
  20842. // The ATN with bypass alternatives is expensive to create so we create it
  20843. // lazily.
  20844. //
  20845. // @throws UnsupportedOperationException if the current parser does not
  20846. // implement the {@link //getSerializedATN()} method.
  20847. //
  20848. Parser.prototype.getATNWithBypassAlts = function () {
  20849. var serializedAtn = this.getSerializedATN();
  20850. if (serializedAtn === null) {
  20851. throw "The current parser does not support an ATN with bypass alternatives.";
  20852. }
  20853. var result = this.bypassAltsAtnCache[serializedAtn];
  20854. if (result === null) {
  20855. var deserializationOptions = new ATNDeserializationOptions();
  20856. deserializationOptions.generateRuleBypassTransitions = true;
  20857. result = new ATNDeserializer(deserializationOptions).deserialize(serializedAtn);
  20858. this.bypassAltsAtnCache[serializedAtn] = result;
  20859. }
  20860. return result;
  20861. };
  20862. // The preferred method of getting a tree pattern. For example, here's a
  20863. // sample use:
  20864. //
  20865. // <pre>
  20866. // ParseTree t = parser.expr();
  20867. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  20868. // MyParser.RULE_expr);
  20869. // ParseTreeMatch m = p.match(t);
  20870. // String id = m.get("ID");
  20871. // </pre>
  20872. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  20873. Parser.prototype.compileParseTreePattern = function (pattern, patternRuleIndex, lexer) {
  20874. lexer = lexer || null;
  20875. if (lexer === null) {
  20876. if (this.getTokenStream() !== null) {
  20877. var tokenSource = this.getTokenStream().tokenSource;
  20878. if (tokenSource instanceof Lexer) {
  20879. lexer = tokenSource;
  20880. }
  20881. }
  20882. }
  20883. if (lexer === null) {
  20884. throw "Parser can't discover a lexer to use";
  20885. }
  20886. var m = new ParseTreePatternMatcher(lexer, this);
  20887. return m.compile(pattern, patternRuleIndex);
  20888. };
  20889. Parser.prototype.getInputStream = function () {
  20890. return this.getTokenStream();
  20891. };
  20892. Parser.prototype.setInputStream = function (input) {
  20893. this.setTokenStream(input);
  20894. };
  20895. Parser.prototype.getTokenStream = function () {
  20896. return this._input;
  20897. };
  20898. // Set the token stream and reset the parser.//
  20899. Parser.prototype.setTokenStream = function (input) {
  20900. this._input = null;
  20901. this.reset();
  20902. this._input = input;
  20903. };
  20904. // Match needs to return the current input symbol, which gets put
  20905. // into the label for the associated token ref; e.g., x=ID.
  20906. //
  20907. Parser.prototype.getCurrentToken = function () {
  20908. return this._input.LT(1);
  20909. };
  20910. Parser.prototype.notifyErrorListeners = function (msg, offendingToken, err) {
  20911. offendingToken = offendingToken || null;
  20912. err = err || null;
  20913. if (offendingToken === null) {
  20914. offendingToken = this.getCurrentToken();
  20915. }
  20916. this._syntaxErrors += 1;
  20917. var line = offendingToken.line;
  20918. var column = offendingToken.column;
  20919. var listener = this.getErrorListenerDispatch();
  20920. listener.syntaxError(this, offendingToken, line, column, msg, err);
  20921. };
  20922. //
  20923. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  20924. //
  20925. // <p>E.g., given the following input with {@code A} being the current
  20926. // lookahead symbol, this function moves the cursor to {@code B} and returns
  20927. // {@code A}.</p>
  20928. //
  20929. // <pre>
  20930. // A B
  20931. // ^
  20932. // </pre>
  20933. //
  20934. // If the parser is not in error recovery mode, the consumed symbol is added
  20935. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  20936. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  20937. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  20938. // added to the parse tree using
  20939. // {@link ParserRuleContext//addErrorNode(Token)}, and
  20940. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  20941. // listeners.
  20942. //
  20943. Parser.prototype.consume = function () {
  20944. var o = this.getCurrentToken();
  20945. if (o.type !== Token.EOF) {
  20946. this.getInputStream().consume();
  20947. }
  20948. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  20949. if (this.buildParseTrees || hasListener) {
  20950. var node;
  20951. if (this._errHandler.inErrorRecoveryMode(this)) {
  20952. node = this._ctx.addErrorNode(o);
  20953. } else {
  20954. node = this._ctx.addTokenNode(o);
  20955. }
  20956. node.invokingState = this.state;
  20957. if (hasListener) {
  20958. this._parseListeners.map(function (listener) {
  20959. if (node instanceof ErrorNode || node.isErrorNode !== undefined && node.isErrorNode()) {
  20960. listener.visitErrorNode(node);
  20961. } else if (node instanceof TerminalNode) {
  20962. listener.visitTerminal(node);
  20963. }
  20964. });
  20965. }
  20966. }
  20967. return o;
  20968. };
  20969. Parser.prototype.addContextToParseTree = function () {
  20970. // add current context to parent if we have a parent
  20971. if (this._ctx.parentCtx !== null) {
  20972. this._ctx.parentCtx.addChild(this._ctx);
  20973. }
  20974. };
  20975. // Always called by generated parsers upon entry to a rule. Access field
  20976. // {@link //_ctx} get the current context.
  20977. Parser.prototype.enterRule = function (localctx, state, ruleIndex) {
  20978. this.state = state;
  20979. this._ctx = localctx;
  20980. this._ctx.start = this._input.LT(1);
  20981. if (this.buildParseTrees) {
  20982. this.addContextToParseTree();
  20983. }
  20984. if (this._parseListeners !== null) {
  20985. this.triggerEnterRuleEvent();
  20986. }
  20987. };
  20988. Parser.prototype.exitRule = function () {
  20989. this._ctx.stop = this._input.LT(-1);
  20990. // trigger event on _ctx, before it reverts to parent
  20991. if (this._parseListeners !== null) {
  20992. this.triggerExitRuleEvent();
  20993. }
  20994. this.state = this._ctx.invokingState;
  20995. this._ctx = this._ctx.parentCtx;
  20996. };
  20997. Parser.prototype.enterOuterAlt = function (localctx, altNum) {
  20998. localctx.setAltNumber(altNum);
  20999. // if we have new localctx, make sure we replace existing ctx
  21000. // that is previous child of parse tree
  21001. if (this.buildParseTrees && this._ctx !== localctx) {
  21002. if (this._ctx.parentCtx !== null) {
  21003. this._ctx.parentCtx.removeLastChild();
  21004. this._ctx.parentCtx.addChild(localctx);
  21005. }
  21006. }
  21007. this._ctx = localctx;
  21008. };
  21009. // Get the precedence level for the top-most precedence rule.
  21010. //
  21011. // @return The precedence level for the top-most precedence rule, or -1 if
  21012. // the parser context is not nested within a precedence rule.
  21013. Parser.prototype.getPrecedence = function () {
  21014. if (this._precedenceStack.length === 0) {
  21015. return -1;
  21016. } else {
  21017. return this._precedenceStack[this._precedenceStack.length - 1];
  21018. }
  21019. };
  21020. Parser.prototype.enterRecursionRule = function (localctx, state, ruleIndex, precedence) {
  21021. this.state = state;
  21022. this._precedenceStack.push(precedence);
  21023. this._ctx = localctx;
  21024. this._ctx.start = this._input.LT(1);
  21025. if (this._parseListeners !== null) {
  21026. this.triggerEnterRuleEvent(); // simulates rule entry for
  21027. // left-recursive rules
  21028. }
  21029. };
  21030. //
  21031. // Like {@link //enterRule} but for recursive rules.
  21032. Parser.prototype.pushNewRecursionContext = function (localctx, state, ruleIndex) {
  21033. var previous = this._ctx;
  21034. previous.parentCtx = localctx;
  21035. previous.invokingState = state;
  21036. previous.stop = this._input.LT(-1);
  21037. this._ctx = localctx;
  21038. this._ctx.start = previous.start;
  21039. if (this.buildParseTrees) {
  21040. this._ctx.addChild(previous);
  21041. }
  21042. if (this._parseListeners !== null) {
  21043. this.triggerEnterRuleEvent(); // simulates rule entry for
  21044. // left-recursive rules
  21045. }
  21046. };
  21047. Parser.prototype.unrollRecursionContexts = function (parentCtx) {
  21048. this._precedenceStack.pop();
  21049. this._ctx.stop = this._input.LT(-1);
  21050. var retCtx = this._ctx; // save current ctx (return value)
  21051. // unroll so _ctx is as it was before call to recursive method
  21052. if (this._parseListeners !== null) {
  21053. while (this._ctx !== parentCtx) {
  21054. this.triggerExitRuleEvent();
  21055. this._ctx = this._ctx.parentCtx;
  21056. }
  21057. } else {
  21058. this._ctx = parentCtx;
  21059. }
  21060. // hook into tree
  21061. retCtx.parentCtx = parentCtx;
  21062. if (this.buildParseTrees && parentCtx !== null) {
  21063. // add return ctx into invoking rule's tree
  21064. parentCtx.addChild(retCtx);
  21065. }
  21066. };
  21067. Parser.prototype.getInvokingContext = function (ruleIndex) {
  21068. var ctx = this._ctx;
  21069. while (ctx !== null) {
  21070. if (ctx.ruleIndex === ruleIndex) {
  21071. return ctx;
  21072. }
  21073. ctx = ctx.parentCtx;
  21074. }
  21075. return null;
  21076. };
  21077. Parser.prototype.precpred = function (localctx, precedence) {
  21078. return precedence >= this._precedenceStack[this._precedenceStack.length - 1];
  21079. };
  21080. Parser.prototype.inContext = function (context) {
  21081. // TODO: useful in parser?
  21082. return false;
  21083. };
  21084. //
  21085. // Checks whether or not {@code symbol} can follow the current state in the
  21086. // ATN. The behavior of this method is equivalent to the following, but is
  21087. // implemented such that the complete context-sensitive follow set does not
  21088. // need to be explicitly constructed.
  21089. //
  21090. // <pre>
  21091. // return getExpectedTokens().contains(symbol);
  21092. // </pre>
  21093. //
  21094. // @param symbol the symbol type to check
  21095. // @return {@code true} if {@code symbol} can follow the current state in
  21096. // the ATN, otherwise {@code false}.
  21097. Parser.prototype.isExpectedToken = function (symbol) {
  21098. var atn = this._interp.atn;
  21099. var ctx = this._ctx;
  21100. var s = atn.states[this.state];
  21101. var following = atn.nextTokens(s);
  21102. if (following.contains(symbol)) {
  21103. return true;
  21104. }
  21105. if (!following.contains(Token.EPSILON)) {
  21106. return false;
  21107. }
  21108. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  21109. var invokingState = atn.states[ctx.invokingState];
  21110. var rt = invokingState.transitions[0];
  21111. following = atn.nextTokens(rt.followState);
  21112. if (following.contains(symbol)) {
  21113. return true;
  21114. }
  21115. ctx = ctx.parentCtx;
  21116. }
  21117. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  21118. return true;
  21119. } else {
  21120. return false;
  21121. }
  21122. };
  21123. // Computes the set of input symbols which could follow the current parser
  21124. // state and context, as given by {@link //getState} and {@link //getContext},
  21125. // respectively.
  21126. //
  21127. // @see ATN//getExpectedTokens(int, RuleContext)
  21128. //
  21129. Parser.prototype.getExpectedTokens = function () {
  21130. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  21131. };
  21132. Parser.prototype.getExpectedTokensWithinCurrentRule = function () {
  21133. var atn = this._interp.atn;
  21134. var s = atn.states[this.state];
  21135. return atn.nextTokens(s);
  21136. };
  21137. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  21138. Parser.prototype.getRuleIndex = function (ruleName) {
  21139. var ruleIndex = this.getRuleIndexMap()[ruleName];
  21140. if (ruleIndex !== null) {
  21141. return ruleIndex;
  21142. } else {
  21143. return -1;
  21144. }
  21145. };
  21146. // Return List&lt;String&gt; of the rule names in your parser instance
  21147. // leading up to a call to the current rule. You could override if
  21148. // you want more details such as the file/line info of where
  21149. // in the ATN a rule is invoked.
  21150. //
  21151. // this is very useful for error messages.
  21152. //
  21153. Parser.prototype.getRuleInvocationStack = function (p) {
  21154. p = p || null;
  21155. if (p === null) {
  21156. p = this._ctx;
  21157. }
  21158. var stack = [];
  21159. while (p !== null) {
  21160. // compute what follows who invoked us
  21161. var ruleIndex = p.ruleIndex;
  21162. if (ruleIndex < 0) {
  21163. stack.push("n/a");
  21164. } else {
  21165. stack.push(this.ruleNames[ruleIndex]);
  21166. }
  21167. p = p.parentCtx;
  21168. }
  21169. return stack;
  21170. };
  21171. // For debugging and other purposes.//
  21172. Parser.prototype.getDFAStrings = function () {
  21173. return this._interp.decisionToDFA.toString();
  21174. };
  21175. // For debugging and other purposes.//
  21176. Parser.prototype.dumpDFA = function () {
  21177. var seenOne = false;
  21178. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  21179. var dfa = this._interp.decisionToDFA[i];
  21180. if (dfa.states.length > 0) {
  21181. if (seenOne) {
  21182. console.log();
  21183. }
  21184. this.printer.println("Decision " + dfa.decision + ":");
  21185. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  21186. seenOne = true;
  21187. }
  21188. }
  21189. };
  21190. /*
  21191. " printer = function() {\r\n" +
  21192. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  21193. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  21194. " };\r\n" +
  21195. */
  21196. Parser.prototype.getSourceName = function () {
  21197. return this._input.sourceName;
  21198. };
  21199. // During a parse is sometimes useful to listen in on the rule entry and exit
  21200. // events as well as token matches. this is for quick and dirty debugging.
  21201. //
  21202. Parser.prototype.setTrace = function (trace) {
  21203. if (!trace) {
  21204. this.removeParseListener(this._tracer);
  21205. this._tracer = null;
  21206. } else {
  21207. if (this._tracer !== null) {
  21208. this.removeParseListener(this._tracer);
  21209. }
  21210. this._tracer = new TraceListener(this);
  21211. this.addParseListener(this._tracer);
  21212. }
  21213. };
  21214. exports.Parser = Parser;
  21215. /***/ }),
  21216. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  21217. /*!**************************************************!*\
  21218. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  21219. \**************************************************/
  21220. /*! no static exports found */
  21221. /***/ (function(module, exports, __webpack_require__) {
  21222. "use strict";
  21223. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21224. * Use of this file is governed by the BSD 3-clause license that
  21225. * can be found in the LICENSE.txt file in the project root.
  21226. */
  21227. //* A rule invocation record for parsing.
  21228. //
  21229. // Contains all of the information about the current rule not stored in the
  21230. // RuleContext. It handles parse tree children list, Any ATN state
  21231. // tracing, and the default values available for rule indications:
  21232. // start, stop, rule index, current alt number, current
  21233. // ATN state.
  21234. //
  21235. // Subclasses made for each rule and grammar track the parameters,
  21236. // return values, locals, and labels specific to that rule. These
  21237. // are the objects that are returned from rules.
  21238. //
  21239. // Note text is not an actual field of a rule return value; it is computed
  21240. // from start and stop using the input stream's toString() method. I
  21241. // could add a ctor to this so that we can pass in and store the input
  21242. // stream, but I'm not sure we want to do that. It would seem to be undefined
  21243. // to get the .text property anyway if the rule matches tokens from multiple
  21244. // input streams.
  21245. //
  21246. // I do not use getters for fields of objects that are used simply to
  21247. // group values such as this aggregate. The getters/setters are there to
  21248. // satisfy the superclass interface.
  21249. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  21250. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  21251. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  21252. var TerminalNode = Tree.TerminalNode;
  21253. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  21254. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  21255. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  21256. function ParserRuleContext(parent, invokingStateNumber) {
  21257. parent = parent || null;
  21258. invokingStateNumber = invokingStateNumber || null;
  21259. RuleContext.call(this, parent, invokingStateNumber);
  21260. this.ruleIndex = -1;
  21261. // * If we are debugging or building a parse tree for a visitor,
  21262. // we need to track all of the tokens and rule invocations associated
  21263. // with this rule's context. This is empty for parsing w/o tree constr.
  21264. // operation because we don't the need to track the details about
  21265. // how we parse this rule.
  21266. // /
  21267. this.children = null;
  21268. this.start = null;
  21269. this.stop = null;
  21270. // The exception that forced this rule to return. If the rule successfully
  21271. // completed, this is {@code null}.
  21272. this.exception = null;
  21273. }
  21274. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  21275. ParserRuleContext.prototype.constructor = ParserRuleContext;
  21276. // * COPY a ctx (I'm deliberately not using copy constructor)///
  21277. ParserRuleContext.prototype.copyFrom = function (ctx) {
  21278. // from RuleContext
  21279. this.parentCtx = ctx.parentCtx;
  21280. this.invokingState = ctx.invokingState;
  21281. this.children = null;
  21282. this.start = ctx.start;
  21283. this.stop = ctx.stop;
  21284. // copy any error nodes to alt label node
  21285. if (ctx.children) {
  21286. this.children = [];
  21287. // reset parent pointer for any error nodes
  21288. ctx.children.map(function (child) {
  21289. if (child instanceof ErrorNodeImpl) {
  21290. this.children.push(child);
  21291. child.parentCtx = this;
  21292. }
  21293. }, this);
  21294. }
  21295. };
  21296. // Double dispatch methods for listeners
  21297. ParserRuleContext.prototype.enterRule = function (listener) {};
  21298. ParserRuleContext.prototype.exitRule = function (listener) {};
  21299. // * Does not set parent link; other add methods do that///
  21300. ParserRuleContext.prototype.addChild = function (child) {
  21301. if (this.children === null) {
  21302. this.children = [];
  21303. }
  21304. this.children.push(child);
  21305. return child;
  21306. };
  21307. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  21308. // we entered a rule. If we have // label, we will need to remove
  21309. // generic ruleContext object.
  21310. // /
  21311. ParserRuleContext.prototype.removeLastChild = function () {
  21312. if (this.children !== null) {
  21313. this.children.pop();
  21314. }
  21315. };
  21316. ParserRuleContext.prototype.addTokenNode = function (token) {
  21317. var node = new TerminalNodeImpl(token);
  21318. this.addChild(node);
  21319. node.parentCtx = this;
  21320. return node;
  21321. };
  21322. ParserRuleContext.prototype.addErrorNode = function (badToken) {
  21323. var node = new ErrorNodeImpl(badToken);
  21324. this.addChild(node);
  21325. node.parentCtx = this;
  21326. return node;
  21327. };
  21328. ParserRuleContext.prototype.getChild = function (i, type) {
  21329. type = type || null;
  21330. if (this.children === null || i < 0 || i >= this.children.length) {
  21331. return null;
  21332. }
  21333. if (type === null) {
  21334. return this.children[i];
  21335. } else {
  21336. for (var j = 0; j < this.children.length; j++) {
  21337. var child = this.children[j];
  21338. if (child instanceof type) {
  21339. if (i === 0) {
  21340. return child;
  21341. } else {
  21342. i -= 1;
  21343. }
  21344. }
  21345. }
  21346. return null;
  21347. }
  21348. };
  21349. ParserRuleContext.prototype.getToken = function (ttype, i) {
  21350. if (this.children === null || i < 0 || i >= this.children.length) {
  21351. return null;
  21352. }
  21353. for (var j = 0; j < this.children.length; j++) {
  21354. var child = this.children[j];
  21355. if (child instanceof TerminalNode) {
  21356. if (child.symbol.type === ttype) {
  21357. if (i === 0) {
  21358. return child;
  21359. } else {
  21360. i -= 1;
  21361. }
  21362. }
  21363. }
  21364. }
  21365. return null;
  21366. };
  21367. ParserRuleContext.prototype.getTokens = function (ttype) {
  21368. if (this.children === null) {
  21369. return [];
  21370. } else {
  21371. var tokens = [];
  21372. for (var j = 0; j < this.children.length; j++) {
  21373. var child = this.children[j];
  21374. if (child instanceof TerminalNode) {
  21375. if (child.symbol.type === ttype) {
  21376. tokens.push(child);
  21377. }
  21378. }
  21379. }
  21380. return tokens;
  21381. }
  21382. };
  21383. ParserRuleContext.prototype.getTypedRuleContext = function (ctxType, i) {
  21384. return this.getChild(i, ctxType);
  21385. };
  21386. ParserRuleContext.prototype.getTypedRuleContexts = function (ctxType) {
  21387. if (this.children === null) {
  21388. return [];
  21389. } else {
  21390. var contexts = [];
  21391. for (var j = 0; j < this.children.length; j++) {
  21392. var child = this.children[j];
  21393. if (child instanceof ctxType) {
  21394. contexts.push(child);
  21395. }
  21396. }
  21397. return contexts;
  21398. }
  21399. };
  21400. ParserRuleContext.prototype.getChildCount = function () {
  21401. if (this.children === null) {
  21402. return 0;
  21403. } else {
  21404. return this.children.length;
  21405. }
  21406. };
  21407. ParserRuleContext.prototype.getSourceInterval = function () {
  21408. if (this.start === null || this.stop === null) {
  21409. return INVALID_INTERVAL;
  21410. } else {
  21411. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  21412. }
  21413. };
  21414. RuleContext.EMPTY = new ParserRuleContext();
  21415. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  21416. ParserRuleContext.call(parent, invokingStateNumber);
  21417. this.ruleIndex = ruleIndex;
  21418. return this;
  21419. }
  21420. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  21421. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  21422. exports.ParserRuleContext = ParserRuleContext;
  21423. /***/ }),
  21424. /***/ "./node_modules/antlr4/PredictionContext.js":
  21425. /*!**************************************************!*\
  21426. !*** ./node_modules/antlr4/PredictionContext.js ***!
  21427. \**************************************************/
  21428. /*! no static exports found */
  21429. /***/ (function(module, exports, __webpack_require__) {
  21430. "use strict";
  21431. //
  21432. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21433. * Use of this file is governed by the BSD 3-clause license that
  21434. * can be found in the LICENSE.txt file in the project root.
  21435. */
  21436. ///
  21437. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  21438. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  21439. function PredictionContext(cachedHashCode) {
  21440. this.cachedHashCode = cachedHashCode;
  21441. }
  21442. // Represents {@code $} in local context prediction, which means wildcard.
  21443. // {@code//+x =//}.
  21444. // /
  21445. PredictionContext.EMPTY = null;
  21446. // Represents {@code $} in an array in full context mode, when {@code $}
  21447. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  21448. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  21449. // /
  21450. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  21451. PredictionContext.globalNodeCount = 1;
  21452. PredictionContext.id = PredictionContext.globalNodeCount;
  21453. // Stores the computed hash code of this {@link PredictionContext}. The hash
  21454. // code is computed in parts to match the following reference algorithm.
  21455. //
  21456. // <pre>
  21457. // private int referenceHashCode() {
  21458. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  21459. // //INITIAL_HASH});
  21460. //
  21461. // for (int i = 0; i &lt; {@link //size()}; i++) {
  21462. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  21463. // getParent}(i));
  21464. // }
  21465. //
  21466. // for (int i = 0; i &lt; {@link //size()}; i++) {
  21467. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  21468. // //getReturnState getReturnState}(i));
  21469. // }
  21470. //
  21471. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  21472. // //size()});
  21473. // return hash;
  21474. // }
  21475. // </pre>
  21476. // /
  21477. // This means only the {@link //EMPTY} context is in set.
  21478. PredictionContext.prototype.isEmpty = function () {
  21479. return this === PredictionContext.EMPTY;
  21480. };
  21481. PredictionContext.prototype.hasEmptyPath = function () {
  21482. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  21483. };
  21484. PredictionContext.prototype.hashCode = function () {
  21485. return this.cachedHashCode;
  21486. };
  21487. PredictionContext.prototype.updateHashCode = function (hash) {
  21488. hash.update(this.cachedHashCode);
  21489. };
  21490. /*
  21491. function calculateHashString(parent, returnState) {
  21492. return "" + parent + returnState;
  21493. }
  21494. */
  21495. // Used to cache {@link PredictionContext} objects. Its used for the shared
  21496. // context cash associated with contexts in DFA states. This cache
  21497. // can be used for both lexers and parsers.
  21498. function PredictionContextCache() {
  21499. this.cache = {};
  21500. return this;
  21501. }
  21502. // Add a context to the cache and return it. If the context already exists,
  21503. // return that one instead and do not add a new context to the cache.
  21504. // Protect shared cache from unsafe thread access.
  21505. //
  21506. PredictionContextCache.prototype.add = function (ctx) {
  21507. if (ctx === PredictionContext.EMPTY) {
  21508. return PredictionContext.EMPTY;
  21509. }
  21510. var existing = this.cache[ctx] || null;
  21511. if (existing !== null) {
  21512. return existing;
  21513. }
  21514. this.cache[ctx] = ctx;
  21515. return ctx;
  21516. };
  21517. PredictionContextCache.prototype.get = function (ctx) {
  21518. return this.cache[ctx] || null;
  21519. };
  21520. Object.defineProperty(PredictionContextCache.prototype, "length", {
  21521. get: function get() {
  21522. return this.cache.length;
  21523. }
  21524. });
  21525. function SingletonPredictionContext(parent, returnState) {
  21526. var hashCode = 0;
  21527. if (parent !== null) {
  21528. var hash = new Hash();
  21529. hash.update(parent, returnState);
  21530. hashCode = hash.finish();
  21531. }
  21532. PredictionContext.call(this, hashCode);
  21533. this.parentCtx = parent;
  21534. this.returnState = returnState;
  21535. }
  21536. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  21537. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  21538. SingletonPredictionContext.create = function (parent, returnState) {
  21539. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  21540. // someone can pass in the bits of an array ctx that mean $
  21541. return PredictionContext.EMPTY;
  21542. } else {
  21543. return new SingletonPredictionContext(parent, returnState);
  21544. }
  21545. };
  21546. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  21547. get: function get() {
  21548. return 1;
  21549. }
  21550. });
  21551. SingletonPredictionContext.prototype.getParent = function (index) {
  21552. return this.parentCtx;
  21553. };
  21554. SingletonPredictionContext.prototype.getReturnState = function (index) {
  21555. return this.returnState;
  21556. };
  21557. SingletonPredictionContext.prototype.equals = function (other) {
  21558. if (this === other) {
  21559. return true;
  21560. } else if (!(other instanceof SingletonPredictionContext)) {
  21561. return false;
  21562. } else if (this.hashCode() !== other.hashCode()) {
  21563. return false; // can't be same if hash is different
  21564. } else {
  21565. if (this.returnState !== other.returnState) return false;else if (this.parentCtx == null) return other.parentCtx == null;else return this.parentCtx.equals(other.parentCtx);
  21566. }
  21567. };
  21568. SingletonPredictionContext.prototype.toString = function () {
  21569. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  21570. if (up.length === 0) {
  21571. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  21572. return "$";
  21573. } else {
  21574. return "" + this.returnState;
  21575. }
  21576. } else {
  21577. return "" + this.returnState + " " + up;
  21578. }
  21579. };
  21580. function EmptyPredictionContext() {
  21581. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  21582. return this;
  21583. }
  21584. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  21585. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  21586. EmptyPredictionContext.prototype.isEmpty = function () {
  21587. return true;
  21588. };
  21589. EmptyPredictionContext.prototype.getParent = function (index) {
  21590. return null;
  21591. };
  21592. EmptyPredictionContext.prototype.getReturnState = function (index) {
  21593. return this.returnState;
  21594. };
  21595. EmptyPredictionContext.prototype.equals = function (other) {
  21596. return this === other;
  21597. };
  21598. EmptyPredictionContext.prototype.toString = function () {
  21599. return "$";
  21600. };
  21601. PredictionContext.EMPTY = new EmptyPredictionContext();
  21602. function ArrayPredictionContext(parents, returnStates) {
  21603. // Parent can be null only if full ctx mode and we make an array
  21604. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  21605. // null parent and
  21606. // returnState == {@link //EMPTY_RETURN_STATE}.
  21607. var h = new Hash();
  21608. h.update(parents, returnStates);
  21609. var hashCode = h.finish();
  21610. PredictionContext.call(this, hashCode);
  21611. this.parents = parents;
  21612. this.returnStates = returnStates;
  21613. return this;
  21614. }
  21615. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  21616. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  21617. ArrayPredictionContext.prototype.isEmpty = function () {
  21618. // since EMPTY_RETURN_STATE can only appear in the last position, we
  21619. // don't need to verify that size==1
  21620. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  21621. };
  21622. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  21623. get: function get() {
  21624. return this.returnStates.length;
  21625. }
  21626. });
  21627. ArrayPredictionContext.prototype.getParent = function (index) {
  21628. return this.parents[index];
  21629. };
  21630. ArrayPredictionContext.prototype.getReturnState = function (index) {
  21631. return this.returnStates[index];
  21632. };
  21633. ArrayPredictionContext.prototype.equals = function (other) {
  21634. if (this === other) {
  21635. return true;
  21636. } else if (!(other instanceof ArrayPredictionContext)) {
  21637. return false;
  21638. } else if (this.hashCode() !== other.hashCode()) {
  21639. return false; // can't be same if hash is different
  21640. } else {
  21641. return this.returnStates === other.returnStates && this.parents === other.parents;
  21642. }
  21643. };
  21644. ArrayPredictionContext.prototype.toString = function () {
  21645. if (this.isEmpty()) {
  21646. return "[]";
  21647. } else {
  21648. var s = "[";
  21649. for (var i = 0; i < this.returnStates.length; i++) {
  21650. if (i > 0) {
  21651. s = s + ", ";
  21652. }
  21653. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  21654. s = s + "$";
  21655. continue;
  21656. }
  21657. s = s + this.returnStates[i];
  21658. if (this.parents[i] !== null) {
  21659. s = s + " " + this.parents[i];
  21660. } else {
  21661. s = s + "null";
  21662. }
  21663. }
  21664. return s + "]";
  21665. }
  21666. };
  21667. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  21668. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  21669. // /
  21670. function predictionContextFromRuleContext(atn, outerContext) {
  21671. if (outerContext === undefined || outerContext === null) {
  21672. outerContext = RuleContext.EMPTY;
  21673. }
  21674. // if we are in RuleContext of start rule, s, then PredictionContext
  21675. // is EMPTY. Nobody called us. (if we are empty, return empty)
  21676. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  21677. return PredictionContext.EMPTY;
  21678. }
  21679. // If we have a parent, convert it to a PredictionContext graph
  21680. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  21681. var state = atn.states[outerContext.invokingState];
  21682. var transition = state.transitions[0];
  21683. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  21684. }
  21685. /*
  21686. function calculateListsHashString(parents, returnStates) {
  21687. var s = "";
  21688. parents.map(function(p) {
  21689. s = s + p;
  21690. });
  21691. returnStates.map(function(r) {
  21692. s = s + r;
  21693. });
  21694. return s;
  21695. }
  21696. */
  21697. function merge(a, b, rootIsWildcard, mergeCache) {
  21698. // share same graph if both same
  21699. if (a === b) {
  21700. return a;
  21701. }
  21702. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  21703. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  21704. }
  21705. // At least one of a or b is array
  21706. // If one is $ and rootIsWildcard, return $ as// wildcard
  21707. if (rootIsWildcard) {
  21708. if (a instanceof EmptyPredictionContext) {
  21709. return a;
  21710. }
  21711. if (b instanceof EmptyPredictionContext) {
  21712. return b;
  21713. }
  21714. }
  21715. // convert singleton so both are arrays to normalize
  21716. if (a instanceof SingletonPredictionContext) {
  21717. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  21718. }
  21719. if (b instanceof SingletonPredictionContext) {
  21720. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  21721. }
  21722. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  21723. }
  21724. //
  21725. // Merge two {@link SingletonPredictionContext} instances.
  21726. //
  21727. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  21728. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  21729. // type="image/svg+xml"/></p>
  21730. //
  21731. // <p>Same stack top, parents differ; merge parents giving array node, then
  21732. // remainders of those graphs. A new root node is created to point to the
  21733. // merged parents.<br>
  21734. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  21735. // type="image/svg+xml"/></p>
  21736. //
  21737. // <p>Different stack tops pointing to same parent. Make array node for the
  21738. // root where both element in the root point to the same (original)
  21739. // parent.<br>
  21740. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  21741. // type="image/svg+xml"/></p>
  21742. //
  21743. // <p>Different stack tops pointing to different parents. Make array node for
  21744. // the root where each element points to the corresponding original
  21745. // parent.<br>
  21746. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  21747. // type="image/svg+xml"/></p>
  21748. //
  21749. // @param a the first {@link SingletonPredictionContext}
  21750. // @param b the second {@link SingletonPredictionContext}
  21751. // @param rootIsWildcard {@code true} if this is a local-context merge,
  21752. // otherwise false to indicate a full-context merge
  21753. // @param mergeCache
  21754. // /
  21755. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  21756. if (mergeCache !== null) {
  21757. var previous = mergeCache.get(a, b);
  21758. if (previous !== null) {
  21759. return previous;
  21760. }
  21761. previous = mergeCache.get(b, a);
  21762. if (previous !== null) {
  21763. return previous;
  21764. }
  21765. }
  21766. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  21767. if (rootMerge !== null) {
  21768. if (mergeCache !== null) {
  21769. mergeCache.set(a, b, rootMerge);
  21770. }
  21771. return rootMerge;
  21772. }
  21773. if (a.returnState === b.returnState) {
  21774. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  21775. // if parent is same as existing a or b parent or reduced to a parent,
  21776. // return it
  21777. if (parent === a.parentCtx) {
  21778. return a; // ax + bx = ax, if a=b
  21779. }
  21780. if (parent === b.parentCtx) {
  21781. return b; // ax + bx = bx, if a=b
  21782. }
  21783. // else: ax + ay = a'[x,y]
  21784. // merge parents x and y, giving array node with x,y then remainders
  21785. // of those graphs. dup a, a' points at merged array
  21786. // new joined parent so create new singleton pointing to it, a'
  21787. var spc = SingletonPredictionContext.create(parent, a.returnState);
  21788. if (mergeCache !== null) {
  21789. mergeCache.set(a, b, spc);
  21790. }
  21791. return spc;
  21792. } else {
  21793. // a != b payloads differ
  21794. // see if we can collapse parents due to $+x parents if local ctx
  21795. var singleParent = null;
  21796. if (a === b || a.parentCtx !== null && a.parentCtx === b.parentCtx) {
  21797. // ax +
  21798. // bx =
  21799. // [a,b]x
  21800. singleParent = a.parentCtx;
  21801. }
  21802. if (singleParent !== null) {
  21803. // parents are same
  21804. // sort payloads and use same parent
  21805. var payloads = [a.returnState, b.returnState];
  21806. if (a.returnState > b.returnState) {
  21807. payloads[0] = b.returnState;
  21808. payloads[1] = a.returnState;
  21809. }
  21810. var parents = [singleParent, singleParent];
  21811. var apc = new ArrayPredictionContext(parents, payloads);
  21812. if (mergeCache !== null) {
  21813. mergeCache.set(a, b, apc);
  21814. }
  21815. return apc;
  21816. }
  21817. // parents differ and can't merge them. Just pack together
  21818. // into array; can't merge.
  21819. // ax + by = [ax,by]
  21820. var payloads = [a.returnState, b.returnState];
  21821. var parents = [a.parentCtx, b.parentCtx];
  21822. if (a.returnState > b.returnState) {
  21823. // sort by payload
  21824. payloads[0] = b.returnState;
  21825. payloads[1] = a.returnState;
  21826. parents = [b.parentCtx, a.parentCtx];
  21827. }
  21828. var a_ = new ArrayPredictionContext(parents, payloads);
  21829. if (mergeCache !== null) {
  21830. mergeCache.set(a, b, a_);
  21831. }
  21832. return a_;
  21833. }
  21834. }
  21835. //
  21836. // Handle case where at least one of {@code a} or {@code b} is
  21837. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  21838. // to represent {@link //EMPTY}.
  21839. //
  21840. // <h2>Local-Context Merges</h2>
  21841. //
  21842. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  21843. // is true.</p>
  21844. //
  21845. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  21846. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  21847. //
  21848. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  21849. // {@code //EMPTY}; return left graph.<br>
  21850. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  21851. //
  21852. // <p>Special case of last merge if local context.<br>
  21853. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  21854. //
  21855. // <h2>Full-Context Merges</h2>
  21856. //
  21857. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  21858. // is false.</p>
  21859. //
  21860. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  21861. //
  21862. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  21863. // null parent).<br>
  21864. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  21865. //
  21866. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  21867. //
  21868. // @param a the first {@link SingletonPredictionContext}
  21869. // @param b the second {@link SingletonPredictionContext}
  21870. // @param rootIsWildcard {@code true} if this is a local-context merge,
  21871. // otherwise false to indicate a full-context merge
  21872. // /
  21873. function mergeRoot(a, b, rootIsWildcard) {
  21874. if (rootIsWildcard) {
  21875. if (a === PredictionContext.EMPTY) {
  21876. return PredictionContext.EMPTY; // // + b =//
  21877. }
  21878. if (b === PredictionContext.EMPTY) {
  21879. return PredictionContext.EMPTY; // a +// =//
  21880. }
  21881. } else {
  21882. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  21883. return PredictionContext.EMPTY; // $ + $ = $
  21884. } else if (a === PredictionContext.EMPTY) {
  21885. // $ + x = [$,x]
  21886. var payloads = [b.returnState, PredictionContext.EMPTY_RETURN_STATE];
  21887. var parents = [b.parentCtx, null];
  21888. return new ArrayPredictionContext(parents, payloads);
  21889. } else if (b === PredictionContext.EMPTY) {
  21890. // x + $ = [$,x] ($ is always first if present)
  21891. var payloads = [a.returnState, PredictionContext.EMPTY_RETURN_STATE];
  21892. var parents = [a.parentCtx, null];
  21893. return new ArrayPredictionContext(parents, payloads);
  21894. }
  21895. }
  21896. return null;
  21897. }
  21898. //
  21899. // Merge two {@link ArrayPredictionContext} instances.
  21900. //
  21901. // <p>Different tops, different parents.<br>
  21902. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  21903. //
  21904. // <p>Shared top, same parents.<br>
  21905. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  21906. //
  21907. // <p>Shared top, different parents.<br>
  21908. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  21909. //
  21910. // <p>Shared top, all shared parents.<br>
  21911. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  21912. // type="image/svg+xml"/></p>
  21913. //
  21914. // <p>Equal tops, merge parents and reduce top to
  21915. // {@link SingletonPredictionContext}.<br>
  21916. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  21917. // /
  21918. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  21919. if (mergeCache !== null) {
  21920. var previous = mergeCache.get(a, b);
  21921. if (previous !== null) {
  21922. return previous;
  21923. }
  21924. previous = mergeCache.get(b, a);
  21925. if (previous !== null) {
  21926. return previous;
  21927. }
  21928. }
  21929. // merge sorted payloads a + b => M
  21930. var i = 0; // walks a
  21931. var j = 0; // walks b
  21932. var k = 0; // walks target M array
  21933. var mergedReturnStates = [];
  21934. var mergedParents = [];
  21935. // walk and merge to yield mergedParents, mergedReturnStates
  21936. while (i < a.returnStates.length && j < b.returnStates.length) {
  21937. var a_parent = a.parents[i];
  21938. var b_parent = b.parents[j];
  21939. if (a.returnStates[i] === b.returnStates[j]) {
  21940. // same payload (stack tops are equal), must yield merged singleton
  21941. var payload = a.returnStates[i];
  21942. // $+$ = $
  21943. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE && a_parent === null && b_parent === null;
  21944. var ax_ax = a_parent !== null && b_parent !== null && a_parent === b_parent; // ax+ax
  21945. // ->
  21946. // ax
  21947. if (bothDollars || ax_ax) {
  21948. mergedParents[k] = a_parent; // choose left
  21949. mergedReturnStates[k] = payload;
  21950. } else {
  21951. // ax+ay -> a'[x,y]
  21952. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  21953. mergedParents[k] = mergedParent;
  21954. mergedReturnStates[k] = payload;
  21955. }
  21956. i += 1; // hop over left one as usual
  21957. j += 1; // but also skip one in right side since we merge
  21958. } else if (a.returnStates[i] < b.returnStates[j]) {
  21959. // copy a[i] to M
  21960. mergedParents[k] = a_parent;
  21961. mergedReturnStates[k] = a.returnStates[i];
  21962. i += 1;
  21963. } else {
  21964. // b > a, copy b[j] to M
  21965. mergedParents[k] = b_parent;
  21966. mergedReturnStates[k] = b.returnStates[j];
  21967. j += 1;
  21968. }
  21969. k += 1;
  21970. }
  21971. // copy over any payloads remaining in either array
  21972. if (i < a.returnStates.length) {
  21973. for (var p = i; p < a.returnStates.length; p++) {
  21974. mergedParents[k] = a.parents[p];
  21975. mergedReturnStates[k] = a.returnStates[p];
  21976. k += 1;
  21977. }
  21978. } else {
  21979. for (var p = j; p < b.returnStates.length; p++) {
  21980. mergedParents[k] = b.parents[p];
  21981. mergedReturnStates[k] = b.returnStates[p];
  21982. k += 1;
  21983. }
  21984. }
  21985. // trim merged if we combined a few that had same stack tops
  21986. if (k < mergedParents.length) {
  21987. // write index < last position; trim
  21988. if (k === 1) {
  21989. // for just one merged element, return singleton top
  21990. var a_ = SingletonPredictionContext.create(mergedParents[0], mergedReturnStates[0]);
  21991. if (mergeCache !== null) {
  21992. mergeCache.set(a, b, a_);
  21993. }
  21994. return a_;
  21995. }
  21996. mergedParents = mergedParents.slice(0, k);
  21997. mergedReturnStates = mergedReturnStates.slice(0, k);
  21998. }
  21999. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  22000. // if we created same array as a or b, return that instead
  22001. // TODO: track whether this is possible above during merge sort for speed
  22002. if (M === a) {
  22003. if (mergeCache !== null) {
  22004. mergeCache.set(a, b, a);
  22005. }
  22006. return a;
  22007. }
  22008. if (M === b) {
  22009. if (mergeCache !== null) {
  22010. mergeCache.set(a, b, b);
  22011. }
  22012. return b;
  22013. }
  22014. combineCommonParents(mergedParents);
  22015. if (mergeCache !== null) {
  22016. mergeCache.set(a, b, M);
  22017. }
  22018. return M;
  22019. }
  22020. //
  22021. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  22022. // ones.
  22023. // /
  22024. function combineCommonParents(parents) {
  22025. var uniqueParents = {};
  22026. for (var p = 0; p < parents.length; p++) {
  22027. var parent = parents[p];
  22028. if (!(parent in uniqueParents)) {
  22029. uniqueParents[parent] = parent;
  22030. }
  22031. }
  22032. for (var q = 0; q < parents.length; q++) {
  22033. parents[q] = uniqueParents[parents[q]];
  22034. }
  22035. }
  22036. function getCachedPredictionContext(context, contextCache, visited) {
  22037. if (context.isEmpty()) {
  22038. return context;
  22039. }
  22040. var existing = visited[context] || null;
  22041. if (existing !== null) {
  22042. return existing;
  22043. }
  22044. existing = contextCache.get(context);
  22045. if (existing !== null) {
  22046. visited[context] = existing;
  22047. return existing;
  22048. }
  22049. var changed = false;
  22050. var parents = [];
  22051. for (var i = 0; i < parents.length; i++) {
  22052. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  22053. if (changed || parent !== context.getParent(i)) {
  22054. if (!changed) {
  22055. parents = [];
  22056. for (var j = 0; j < context.length; j++) {
  22057. parents[j] = context.getParent(j);
  22058. }
  22059. changed = true;
  22060. }
  22061. parents[i] = parent;
  22062. }
  22063. }
  22064. if (!changed) {
  22065. contextCache.add(context);
  22066. visited[context] = context;
  22067. return context;
  22068. }
  22069. var updated = null;
  22070. if (parents.length === 0) {
  22071. updated = PredictionContext.EMPTY;
  22072. } else if (parents.length === 1) {
  22073. updated = SingletonPredictionContext.create(parents[0], context.getReturnState(0));
  22074. } else {
  22075. updated = new ArrayPredictionContext(parents, context.returnStates);
  22076. }
  22077. contextCache.add(updated);
  22078. visited[updated] = updated;
  22079. visited[context] = updated;
  22080. return updated;
  22081. }
  22082. // ter's recursive version of Sam's getAllNodes()
  22083. function getAllContextNodes(context, nodes, visited) {
  22084. if (nodes === null) {
  22085. nodes = [];
  22086. return getAllContextNodes(context, nodes, visited);
  22087. } else if (visited === null) {
  22088. visited = {};
  22089. return getAllContextNodes(context, nodes, visited);
  22090. } else {
  22091. if (context === null || visited[context] !== null) {
  22092. return nodes;
  22093. }
  22094. visited[context] = context;
  22095. nodes.push(context);
  22096. for (var i = 0; i < context.length; i++) {
  22097. getAllContextNodes(context.getParent(i), nodes, visited);
  22098. }
  22099. return nodes;
  22100. }
  22101. }
  22102. exports.merge = merge;
  22103. exports.PredictionContext = PredictionContext;
  22104. exports.PredictionContextCache = PredictionContextCache;
  22105. exports.SingletonPredictionContext = SingletonPredictionContext;
  22106. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  22107. exports.getCachedPredictionContext = getCachedPredictionContext;
  22108. /***/ }),
  22109. /***/ "./node_modules/antlr4/Recognizer.js":
  22110. /*!*******************************************!*\
  22111. !*** ./node_modules/antlr4/Recognizer.js ***!
  22112. \*******************************************/
  22113. /*! no static exports found */
  22114. /***/ (function(module, exports, __webpack_require__) {
  22115. "use strict";
  22116. //
  22117. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22118. * Use of this file is governed by the BSD 3-clause license that
  22119. * can be found in the LICENSE.txt file in the project root.
  22120. */
  22121. //
  22122. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22123. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  22124. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  22125. function Recognizer() {
  22126. this._listeners = [ConsoleErrorListener.INSTANCE];
  22127. this._interp = null;
  22128. this._stateNumber = -1;
  22129. return this;
  22130. }
  22131. Recognizer.tokenTypeMapCache = {};
  22132. Recognizer.ruleIndexMapCache = {};
  22133. Recognizer.prototype.checkVersion = function (toolVersion) {
  22134. var runtimeVersion = "4.7.1";
  22135. if (runtimeVersion !== toolVersion) {
  22136. console.log("ANTLR runtime and generated code versions disagree: " + runtimeVersion + "!=" + toolVersion);
  22137. }
  22138. };
  22139. Recognizer.prototype.addErrorListener = function (listener) {
  22140. this._listeners.push(listener);
  22141. };
  22142. Recognizer.prototype.removeErrorListeners = function () {
  22143. this._listeners = [];
  22144. };
  22145. Recognizer.prototype.getTokenTypeMap = function () {
  22146. var tokenNames = this.getTokenNames();
  22147. if (tokenNames === null) {
  22148. throw "The current recognizer does not provide a list of token names.";
  22149. }
  22150. var result = this.tokenTypeMapCache[tokenNames];
  22151. if (result === undefined) {
  22152. result = tokenNames.reduce(function (o, k, i) {
  22153. o[k] = i;
  22154. });
  22155. result.EOF = Token.EOF;
  22156. this.tokenTypeMapCache[tokenNames] = result;
  22157. }
  22158. return result;
  22159. };
  22160. // Get a map from rule names to rule indexes.
  22161. //
  22162. // <p>Used for XPath and tree pattern compilation.</p>
  22163. //
  22164. Recognizer.prototype.getRuleIndexMap = function () {
  22165. var ruleNames = this.ruleNames;
  22166. if (ruleNames === null) {
  22167. throw "The current recognizer does not provide a list of rule names.";
  22168. }
  22169. var result = this.ruleIndexMapCache[ruleNames];
  22170. if (result === undefined) {
  22171. result = ruleNames.reduce(function (o, k, i) {
  22172. o[k] = i;
  22173. });
  22174. this.ruleIndexMapCache[ruleNames] = result;
  22175. }
  22176. return result;
  22177. };
  22178. Recognizer.prototype.getTokenType = function (tokenName) {
  22179. var ttype = this.getTokenTypeMap()[tokenName];
  22180. if (ttype !== undefined) {
  22181. return ttype;
  22182. } else {
  22183. return Token.INVALID_TYPE;
  22184. }
  22185. };
  22186. // What is the error header, normally line/character position information?//
  22187. Recognizer.prototype.getErrorHeader = function (e) {
  22188. var line = e.getOffendingToken().line;
  22189. var column = e.getOffendingToken().column;
  22190. return "line " + line + ":" + column;
  22191. };
  22192. // How should a token be displayed in an error message? The default
  22193. // is to display just the text, but during development you might
  22194. // want to have a lot of information spit out. Override in that case
  22195. // to use t.toString() (which, for CommonToken, dumps everything about
  22196. // the token). This is better than forcing you to override a method in
  22197. // your token objects because you don't have to go modify your lexer
  22198. // so that it creates a new Java type.
  22199. //
  22200. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  22201. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  22202. // feature when necessary. For example, see
  22203. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  22204. //
  22205. Recognizer.prototype.getTokenErrorDisplay = function (t) {
  22206. if (t === null) {
  22207. return "<no token>";
  22208. }
  22209. var s = t.text;
  22210. if (s === null) {
  22211. if (t.type === Token.EOF) {
  22212. s = "<EOF>";
  22213. } else {
  22214. s = "<" + t.type + ">";
  22215. }
  22216. }
  22217. s = s.replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t");
  22218. return "'" + s + "'";
  22219. };
  22220. Recognizer.prototype.getErrorListenerDispatch = function () {
  22221. return new ProxyErrorListener(this._listeners);
  22222. };
  22223. // subclass needs to override these if there are sempreds or actions
  22224. // that the ATN interp needs to execute
  22225. Recognizer.prototype.sempred = function (localctx, ruleIndex, actionIndex) {
  22226. return true;
  22227. };
  22228. Recognizer.prototype.precpred = function (localctx, precedence) {
  22229. return true;
  22230. };
  22231. //Indicate that the recognizer has changed internal state that is
  22232. //consistent with the ATN state passed in. This way we always know
  22233. //where we are in the ATN as the parser goes along. The rule
  22234. //context objects form a stack that lets us see the stack of
  22235. //invoking rules. Combine this and we have complete ATN
  22236. //configuration information.
  22237. Object.defineProperty(Recognizer.prototype, "state", {
  22238. get: function get() {
  22239. return this._stateNumber;
  22240. },
  22241. set: function set(state) {
  22242. this._stateNumber = state;
  22243. }
  22244. });
  22245. exports.Recognizer = Recognizer;
  22246. /***/ }),
  22247. /***/ "./node_modules/antlr4/RuleContext.js":
  22248. /*!********************************************!*\
  22249. !*** ./node_modules/antlr4/RuleContext.js ***!
  22250. \********************************************/
  22251. /*! no static exports found */
  22252. /***/ (function(module, exports, __webpack_require__) {
  22253. "use strict";
  22254. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22255. * Use of this file is governed by the BSD 3-clause license that
  22256. * can be found in the LICENSE.txt file in the project root.
  22257. */
  22258. ///
  22259. // A rule context is a record of a single rule invocation. It knows
  22260. // which context invoked it, if any. If there is no parent context, then
  22261. // naturally the invoking state is not valid. The parent link
  22262. // provides a chain upwards from the current rule invocation to the root
  22263. // of the invocation tree, forming a stack. We actually carry no
  22264. // information about the rule associated with this context (except
  22265. // when parsing). We keep only the state number of the invoking state from
  22266. // the ATN submachine that invoked this. Contrast this with the s
  22267. // pointer inside ParserRuleContext that tracks the current state
  22268. // being "executed" for the current rule.
  22269. //
  22270. // The parent contexts are useful for computing lookahead sets and
  22271. // getting error information.
  22272. //
  22273. // These objects are used during parsing and prediction.
  22274. // For the special case of parsers, we use the subclass
  22275. // ParserRuleContext.
  22276. //
  22277. // @see ParserRuleContext
  22278. ///
  22279. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  22280. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  22281. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  22282. function RuleContext(parent, invokingState) {
  22283. RuleNode.call(this);
  22284. // What context invoked this rule?
  22285. this.parentCtx = parent || null;
  22286. // What state invoked the rule associated with this context?
  22287. // The "return address" is the followState of invokingState
  22288. // If parent is null, this should be -1.
  22289. this.invokingState = invokingState || -1;
  22290. return this;
  22291. }
  22292. RuleContext.prototype = Object.create(RuleNode.prototype);
  22293. RuleContext.prototype.constructor = RuleContext;
  22294. RuleContext.prototype.depth = function () {
  22295. var n = 0;
  22296. var p = this;
  22297. while (p !== null) {
  22298. p = p.parentCtx;
  22299. n += 1;
  22300. }
  22301. return n;
  22302. };
  22303. // A context is empty if there is no invoking state; meaning nobody call
  22304. // current context.
  22305. RuleContext.prototype.isEmpty = function () {
  22306. return this.invokingState === -1;
  22307. };
  22308. // satisfy the ParseTree / SyntaxTree interface
  22309. RuleContext.prototype.getSourceInterval = function () {
  22310. return INVALID_INTERVAL;
  22311. };
  22312. RuleContext.prototype.getRuleContext = function () {
  22313. return this;
  22314. };
  22315. RuleContext.prototype.getPayload = function () {
  22316. return this;
  22317. };
  22318. // Return the combined text of all child nodes. This method only considers
  22319. // tokens which have been added to the parse tree.
  22320. // <p>
  22321. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  22322. // added to the parse trees, they will not appear in the output of this
  22323. // method.
  22324. // /
  22325. RuleContext.prototype.getText = function () {
  22326. if (this.getChildCount() === 0) {
  22327. return "";
  22328. } else {
  22329. return this.children.map(function (child) {
  22330. return child.getText();
  22331. }).join("");
  22332. }
  22333. };
  22334. // For rule associated with this parse tree internal node, return
  22335. // the outer alternative number used to match the input. Default
  22336. // implementation does not compute nor store this alt num. Create
  22337. // a subclass of ParserRuleContext with backing field and set
  22338. // option contextSuperClass.
  22339. // to set it.
  22340. RuleContext.prototype.getAltNumber = function () {
  22341. return INVALID_ALT_NUMBER;
  22342. };
  22343. // Set the outer alternative number for this context node. Default
  22344. // implementation does nothing to avoid backing field overhead for
  22345. // trees that don't need it. Create
  22346. // a subclass of ParserRuleContext with backing field and set
  22347. // option contextSuperClass.
  22348. RuleContext.prototype.setAltNumber = function (altNumber) {};
  22349. RuleContext.prototype.getChild = function (i) {
  22350. return null;
  22351. };
  22352. RuleContext.prototype.getChildCount = function () {
  22353. return 0;
  22354. };
  22355. RuleContext.prototype.accept = function (visitor) {
  22356. return visitor.visitChildren(this);
  22357. };
  22358. //need to manage circular dependencies, so export now
  22359. exports.RuleContext = RuleContext;
  22360. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  22361. // Print out a whole tree, not just a node, in LISP format
  22362. // (root child1 .. childN). Print just a node if this is a leaf.
  22363. //
  22364. RuleContext.prototype.toStringTree = function (ruleNames, recog) {
  22365. return Trees.toStringTree(this, ruleNames, recog);
  22366. };
  22367. RuleContext.prototype.toString = function (ruleNames, stop) {
  22368. ruleNames = ruleNames || null;
  22369. stop = stop || null;
  22370. var p = this;
  22371. var s = "[";
  22372. while (p !== null && p !== stop) {
  22373. if (ruleNames === null) {
  22374. if (!p.isEmpty()) {
  22375. s += p.invokingState;
  22376. }
  22377. } else {
  22378. var ri = p.ruleIndex;
  22379. var ruleName = ri >= 0 && ri < ruleNames.length ? ruleNames[ri] : "" + ri;
  22380. s += ruleName;
  22381. }
  22382. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  22383. s += " ";
  22384. }
  22385. p = p.parentCtx;
  22386. }
  22387. s += "]";
  22388. return s;
  22389. };
  22390. /***/ }),
  22391. /***/ "./node_modules/antlr4/Token.js":
  22392. /*!**************************************!*\
  22393. !*** ./node_modules/antlr4/Token.js ***!
  22394. \**************************************/
  22395. /*! no static exports found */
  22396. /***/ (function(module, exports, __webpack_require__) {
  22397. "use strict";
  22398. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22399. * Use of this file is governed by the BSD 3-clause license that
  22400. * can be found in the LICENSE.txt file in the project root.
  22401. */
  22402. //
  22403. // A token has properties: text, type, line, character position in the line
  22404. // (so we can ignore tabs), token channel, index, and source from which
  22405. // we obtained this token.
  22406. function Token() {
  22407. this.source = null;
  22408. this.type = null; // token type of the token
  22409. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  22410. this.start = null; // optional; return -1 if not implemented.
  22411. this.stop = null; // optional; return -1 if not implemented.
  22412. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  22413. this.line = null; // line=1..n of the 1st character
  22414. this.column = null; // beginning of the line at which it occurs, 0..n-1
  22415. this._text = null; // text of the token.
  22416. return this;
  22417. }
  22418. Token.INVALID_TYPE = 0;
  22419. // During lookahead operations, this "token" signifies we hit rule end ATN state
  22420. // and did not follow it despite needing to.
  22421. Token.EPSILON = -2;
  22422. Token.MIN_USER_TOKEN_TYPE = 1;
  22423. Token.EOF = -1;
  22424. // All tokens go to the parser (unless skip() is called in that rule)
  22425. // on a particular "channel". The parser tunes to a particular channel
  22426. // so that whitespace etc... can go to the parser on a "hidden" channel.
  22427. Token.DEFAULT_CHANNEL = 0;
  22428. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  22429. // by parser.
  22430. Token.HIDDEN_CHANNEL = 1;
  22431. // Explicitly set the text for this token. If {code text} is not
  22432. // {@code null}, then {@link //getText} will return this value rather than
  22433. // extracting the text from the input.
  22434. //
  22435. // @param text The explicit text of the token, or {@code null} if the text
  22436. // should be obtained from the input along with the start and stop indexes
  22437. // of the token.
  22438. Object.defineProperty(Token.prototype, "text", {
  22439. get: function get() {
  22440. return this._text;
  22441. },
  22442. set: function set(text) {
  22443. this._text = text;
  22444. }
  22445. });
  22446. Token.prototype.getTokenSource = function () {
  22447. return this.source[0];
  22448. };
  22449. Token.prototype.getInputStream = function () {
  22450. return this.source[1];
  22451. };
  22452. function CommonToken(source, type, channel, start, stop) {
  22453. Token.call(this);
  22454. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  22455. this.type = type !== undefined ? type : null;
  22456. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  22457. this.start = start !== undefined ? start : -1;
  22458. this.stop = stop !== undefined ? stop : -1;
  22459. this.tokenIndex = -1;
  22460. if (this.source[0] !== null) {
  22461. this.line = source[0].line;
  22462. this.column = source[0].column;
  22463. } else {
  22464. this.column = -1;
  22465. }
  22466. return this;
  22467. }
  22468. CommonToken.prototype = Object.create(Token.prototype);
  22469. CommonToken.prototype.constructor = CommonToken;
  22470. // An empty {@link Pair} which is used as the default value of
  22471. // {@link //source} for tokens that do not have a source.
  22472. CommonToken.EMPTY_SOURCE = [null, null];
  22473. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  22474. //
  22475. // <p>
  22476. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  22477. // constructed token will share a reference to the {@link //text} field and
  22478. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  22479. // be assigned the result of calling {@link //getText}, and {@link //source}
  22480. // will be constructed from the result of {@link Token//getTokenSource} and
  22481. // {@link Token//getInputStream}.</p>
  22482. //
  22483. // @param oldToken The token to copy.
  22484. //
  22485. CommonToken.prototype.clone = function () {
  22486. var t = new CommonToken(this.source, this.type, this.channel, this.start, this.stop);
  22487. t.tokenIndex = this.tokenIndex;
  22488. t.line = this.line;
  22489. t.column = this.column;
  22490. t.text = this.text;
  22491. return t;
  22492. };
  22493. Object.defineProperty(CommonToken.prototype, "text", {
  22494. get: function get() {
  22495. if (this._text !== null) {
  22496. return this._text;
  22497. }
  22498. var input = this.getInputStream();
  22499. if (input === null) {
  22500. return null;
  22501. }
  22502. var n = input.size;
  22503. if (this.start < n && this.stop < n) {
  22504. return input.getText(this.start, this.stop);
  22505. } else {
  22506. return "<EOF>";
  22507. }
  22508. },
  22509. set: function set(text) {
  22510. this._text = text;
  22511. }
  22512. });
  22513. CommonToken.prototype.toString = function () {
  22514. var txt = this.text;
  22515. if (txt !== null) {
  22516. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  22517. } else {
  22518. txt = "<no text>";
  22519. }
  22520. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" + txt + "',<" + this.type + ">" + (this.channel > 0 ? ",channel=" + this.channel : "") + "," + this.line + ":" + this.column + "]";
  22521. };
  22522. exports.Token = Token;
  22523. exports.CommonToken = CommonToken;
  22524. /***/ }),
  22525. /***/ "./node_modules/antlr4/Utils.js":
  22526. /*!**************************************!*\
  22527. !*** ./node_modules/antlr4/Utils.js ***!
  22528. \**************************************/
  22529. /*! no static exports found */
  22530. /***/ (function(module, exports, __webpack_require__) {
  22531. "use strict";
  22532. 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; };
  22533. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22534. * Use of this file is governed by the BSD 3-clause license that
  22535. * can be found in the LICENSE.txt file in the project root.
  22536. */
  22537. function arrayToString(a) {
  22538. return "[" + a.join(", ") + "]";
  22539. }
  22540. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  22541. String.prototype.hashCode = function () {
  22542. var remainder,
  22543. bytes,
  22544. h1,
  22545. h1b,
  22546. c1,
  22547. c1b,
  22548. c2,
  22549. c2b,
  22550. k1,
  22551. i,
  22552. key = this.toString();
  22553. remainder = key.length & 3; // key.length % 4
  22554. bytes = key.length - remainder;
  22555. h1 = String.prototype.seed;
  22556. c1 = 0xcc9e2d51;
  22557. c2 = 0x1b873593;
  22558. i = 0;
  22559. while (i < bytes) {
  22560. k1 = key.charCodeAt(i) & 0xff | (key.charCodeAt(++i) & 0xff) << 8 | (key.charCodeAt(++i) & 0xff) << 16 | (key.charCodeAt(++i) & 0xff) << 24;
  22561. ++i;
  22562. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  22563. k1 = k1 << 15 | k1 >>> 17;
  22564. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  22565. h1 ^= k1;
  22566. h1 = h1 << 13 | h1 >>> 19;
  22567. h1b = (h1 & 0xffff) * 5 + (((h1 >>> 16) * 5 & 0xffff) << 16) & 0xffffffff;
  22568. h1 = (h1b & 0xffff) + 0x6b64 + (((h1b >>> 16) + 0xe654 & 0xffff) << 16);
  22569. }
  22570. k1 = 0;
  22571. switch (remainder) {
  22572. case 3:
  22573. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  22574. case 2:
  22575. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  22576. case 1:
  22577. k1 ^= key.charCodeAt(i) & 0xff;
  22578. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  22579. k1 = k1 << 15 | k1 >>> 17;
  22580. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  22581. h1 ^= k1;
  22582. }
  22583. h1 ^= key.length;
  22584. h1 ^= h1 >>> 16;
  22585. h1 = (h1 & 0xffff) * 0x85ebca6b + (((h1 >>> 16) * 0x85ebca6b & 0xffff) << 16) & 0xffffffff;
  22586. h1 ^= h1 >>> 13;
  22587. h1 = (h1 & 0xffff) * 0xc2b2ae35 + (((h1 >>> 16) * 0xc2b2ae35 & 0xffff) << 16) & 0xffffffff;
  22588. h1 ^= h1 >>> 16;
  22589. return h1 >>> 0;
  22590. };
  22591. function standardEqualsFunction(a, b) {
  22592. return a.equals(b);
  22593. }
  22594. function standardHashCodeFunction(a) {
  22595. return a.hashCode();
  22596. }
  22597. function Set(hashFunction, equalsFunction) {
  22598. this.data = {};
  22599. this.hashFunction = hashFunction || standardHashCodeFunction;
  22600. this.equalsFunction = equalsFunction || standardEqualsFunction;
  22601. return this;
  22602. }
  22603. Object.defineProperty(Set.prototype, "length", {
  22604. get: function get() {
  22605. var l = 0;
  22606. for (var key in this.data) {
  22607. if (key.indexOf("hash_") === 0) {
  22608. l = l + this.data[key].length;
  22609. }
  22610. }
  22611. return l;
  22612. }
  22613. });
  22614. Set.prototype.add = function (value) {
  22615. var hash = this.hashFunction(value);
  22616. var key = "hash_" + hash;
  22617. if (key in this.data) {
  22618. var values = this.data[key];
  22619. for (var i = 0; i < values.length; i++) {
  22620. if (this.equalsFunction(value, values[i])) {
  22621. return values[i];
  22622. }
  22623. }
  22624. values.push(value);
  22625. return value;
  22626. } else {
  22627. this.data[key] = [value];
  22628. return value;
  22629. }
  22630. };
  22631. Set.prototype.contains = function (value) {
  22632. return this.get(value) != null;
  22633. };
  22634. Set.prototype.get = function (value) {
  22635. var hash = this.hashFunction(value);
  22636. var key = "hash_" + hash;
  22637. if (key in this.data) {
  22638. var values = this.data[key];
  22639. for (var i = 0; i < values.length; i++) {
  22640. if (this.equalsFunction(value, values[i])) {
  22641. return values[i];
  22642. }
  22643. }
  22644. }
  22645. return null;
  22646. };
  22647. Set.prototype.values = function () {
  22648. var l = [];
  22649. for (var key in this.data) {
  22650. if (key.indexOf("hash_") === 0) {
  22651. l = l.concat(this.data[key]);
  22652. }
  22653. }
  22654. return l;
  22655. };
  22656. Set.prototype.toString = function () {
  22657. return arrayToString(this.values());
  22658. };
  22659. function BitSet() {
  22660. this.data = [];
  22661. return this;
  22662. }
  22663. BitSet.prototype.add = function (value) {
  22664. this.data[value] = true;
  22665. };
  22666. BitSet.prototype.or = function (set) {
  22667. var bits = this;
  22668. Object.keys(set.data).map(function (alt) {
  22669. bits.add(alt);
  22670. });
  22671. };
  22672. BitSet.prototype.remove = function (value) {
  22673. delete this.data[value];
  22674. };
  22675. BitSet.prototype.contains = function (value) {
  22676. return this.data[value] === true;
  22677. };
  22678. BitSet.prototype.values = function () {
  22679. return Object.keys(this.data);
  22680. };
  22681. BitSet.prototype.minValue = function () {
  22682. return Math.min.apply(null, this.values());
  22683. };
  22684. BitSet.prototype.hashCode = function () {
  22685. var hash = new Hash();
  22686. hash.update(this.values());
  22687. return hash.finish();
  22688. };
  22689. BitSet.prototype.equals = function (other) {
  22690. if (!(other instanceof BitSet)) {
  22691. return false;
  22692. }
  22693. return this.hashCode() === other.hashCode();
  22694. };
  22695. Object.defineProperty(BitSet.prototype, "length", {
  22696. get: function get() {
  22697. return this.values().length;
  22698. }
  22699. });
  22700. BitSet.prototype.toString = function () {
  22701. return "{" + this.values().join(", ") + "}";
  22702. };
  22703. function Map(hashFunction, equalsFunction) {
  22704. this.data = {};
  22705. this.hashFunction = hashFunction || standardHashCodeFunction;
  22706. this.equalsFunction = equalsFunction || standardEqualsFunction;
  22707. return this;
  22708. }
  22709. Object.defineProperty(Map.prototype, "length", {
  22710. get: function get() {
  22711. var l = 0;
  22712. for (var hashKey in this.data) {
  22713. if (hashKey.indexOf("hash_") === 0) {
  22714. l = l + this.data[hashKey].length;
  22715. }
  22716. }
  22717. return l;
  22718. }
  22719. });
  22720. Map.prototype.put = function (key, value) {
  22721. var hashKey = "hash_" + this.hashFunction(key);
  22722. if (hashKey in this.data) {
  22723. var entries = this.data[hashKey];
  22724. for (var i = 0; i < entries.length; i++) {
  22725. var entry = entries[i];
  22726. if (this.equalsFunction(key, entry.key)) {
  22727. var oldValue = entry.value;
  22728. entry.value = value;
  22729. return oldValue;
  22730. }
  22731. }
  22732. entries.push({ key: key, value: value });
  22733. return value;
  22734. } else {
  22735. this.data[hashKey] = [{ key: key, value: value }];
  22736. return value;
  22737. }
  22738. };
  22739. Map.prototype.containsKey = function (key) {
  22740. var hashKey = "hash_" + this.hashFunction(key);
  22741. if (hashKey in this.data) {
  22742. var entries = this.data[hashKey];
  22743. for (var i = 0; i < entries.length; i++) {
  22744. var entry = entries[i];
  22745. if (this.equalsFunction(key, entry.key)) return true;
  22746. }
  22747. }
  22748. return false;
  22749. };
  22750. Map.prototype.get = function (key) {
  22751. var hashKey = "hash_" + this.hashFunction(key);
  22752. if (hashKey in this.data) {
  22753. var entries = this.data[hashKey];
  22754. for (var i = 0; i < entries.length; i++) {
  22755. var entry = entries[i];
  22756. if (this.equalsFunction(key, entry.key)) return entry.value;
  22757. }
  22758. }
  22759. return null;
  22760. };
  22761. Map.prototype.entries = function () {
  22762. var l = [];
  22763. for (var key in this.data) {
  22764. if (key.indexOf("hash_") === 0) {
  22765. l = l.concat(this.data[key]);
  22766. }
  22767. }
  22768. return l;
  22769. };
  22770. Map.prototype.getKeys = function () {
  22771. return this.entries().map(function (e) {
  22772. return e.key;
  22773. });
  22774. };
  22775. Map.prototype.getValues = function () {
  22776. return this.entries().map(function (e) {
  22777. return e.value;
  22778. });
  22779. };
  22780. Map.prototype.toString = function () {
  22781. var ss = this.entries().map(function (entry) {
  22782. return '{' + entry.key + ':' + entry.value + '}';
  22783. });
  22784. return '[' + ss.join(", ") + ']';
  22785. };
  22786. function AltDict() {
  22787. this.data = {};
  22788. return this;
  22789. }
  22790. AltDict.prototype.get = function (key) {
  22791. key = "k-" + key;
  22792. if (key in this.data) {
  22793. return this.data[key];
  22794. } else {
  22795. return null;
  22796. }
  22797. };
  22798. AltDict.prototype.put = function (key, value) {
  22799. key = "k-" + key;
  22800. this.data[key] = value;
  22801. };
  22802. AltDict.prototype.values = function () {
  22803. var data = this.data;
  22804. var keys = Object.keys(this.data);
  22805. return keys.map(function (key) {
  22806. return data[key];
  22807. });
  22808. };
  22809. function DoubleDict() {
  22810. return this;
  22811. }
  22812. function Hash() {
  22813. this.count = 0;
  22814. this.hash = 0;
  22815. return this;
  22816. }
  22817. Hash.prototype.update = function () {
  22818. for (var i = 0; i < arguments.length; i++) {
  22819. var value = arguments[i];
  22820. if (value == null) continue;
  22821. if (Array.isArray(value)) this.update.apply(value);else {
  22822. var k = 0;
  22823. switch (typeof value === "undefined" ? "undefined" : _typeof(value)) {
  22824. case 'undefined':
  22825. case 'function':
  22826. continue;
  22827. case 'number':
  22828. case 'boolean':
  22829. k = value;
  22830. break;
  22831. case 'string':
  22832. k = value.hashCode();
  22833. break;
  22834. default:
  22835. value.updateHashCode(this);
  22836. continue;
  22837. }
  22838. k = k * 0xCC9E2D51;
  22839. k = k << 15 | k >>> 32 - 15;
  22840. k = k * 0x1B873593;
  22841. this.count = this.count + 1;
  22842. var hash = this.hash ^ k;
  22843. hash = hash << 13 | hash >>> 32 - 13;
  22844. hash = hash * 5 + 0xE6546B64;
  22845. this.hash = hash;
  22846. }
  22847. }
  22848. };
  22849. Hash.prototype.finish = function () {
  22850. var hash = this.hash ^ this.count * 4;
  22851. hash = hash ^ hash >>> 16;
  22852. hash = hash * 0x85EBCA6B;
  22853. hash = hash ^ hash >>> 13;
  22854. hash = hash * 0xC2B2AE35;
  22855. hash = hash ^ hash >>> 16;
  22856. return hash;
  22857. };
  22858. function hashStuff() {
  22859. var hash = new Hash();
  22860. hash.update.apply(arguments);
  22861. return hash.finish();
  22862. }
  22863. DoubleDict.prototype.get = function (a, b) {
  22864. var d = this[a] || null;
  22865. return d === null ? null : d[b] || null;
  22866. };
  22867. DoubleDict.prototype.set = function (a, b, o) {
  22868. var d = this[a] || null;
  22869. if (d === null) {
  22870. d = {};
  22871. this[a] = d;
  22872. }
  22873. d[b] = o;
  22874. };
  22875. function escapeWhitespace(s, escapeSpaces) {
  22876. s = s.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
  22877. if (escapeSpaces) {
  22878. s = s.replace(/ /g, "\xB7");
  22879. }
  22880. return s;
  22881. }
  22882. function titleCase(str) {
  22883. return str.replace(/\w\S*/g, function (txt) {
  22884. return txt.charAt(0).toUpperCase() + txt.substr(1);
  22885. });
  22886. };
  22887. function equalArrays(a, b) {
  22888. if (!Array.isArray(a) || !Array.isArray(b)) return false;
  22889. if (a == b) return true;
  22890. if (a.length != b.length) return false;
  22891. for (var i = 0; i < a.length; i++) {
  22892. if (a[i] == b[i]) continue;
  22893. if (!a[i].equals(b[i])) return false;
  22894. }
  22895. return true;
  22896. };
  22897. exports.Hash = Hash;
  22898. exports.Set = Set;
  22899. exports.Map = Map;
  22900. exports.BitSet = BitSet;
  22901. exports.AltDict = AltDict;
  22902. exports.DoubleDict = DoubleDict;
  22903. exports.hashStuff = hashStuff;
  22904. exports.escapeWhitespace = escapeWhitespace;
  22905. exports.arrayToString = arrayToString;
  22906. exports.titleCase = titleCase;
  22907. exports.equalArrays = equalArrays;
  22908. /***/ }),
  22909. /***/ "./node_modules/antlr4/atn/ATN.js":
  22910. /*!****************************************!*\
  22911. !*** ./node_modules/antlr4/atn/ATN.js ***!
  22912. \****************************************/
  22913. /*! no static exports found */
  22914. /***/ (function(module, exports, __webpack_require__) {
  22915. "use strict";
  22916. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22917. * Use of this file is governed by the BSD 3-clause license that
  22918. * can be found in the LICENSE.txt file in the project root.
  22919. */
  22920. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  22921. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  22922. function ATN(grammarType, maxTokenType) {
  22923. // Used for runtime deserialization of ATNs from strings///
  22924. // The type of the ATN.
  22925. this.grammarType = grammarType;
  22926. // The maximum value for any symbol recognized by a transition in the ATN.
  22927. this.maxTokenType = maxTokenType;
  22928. this.states = [];
  22929. // Each subrule/rule is a decision point and we must track them so we
  22930. // can go back later and build DFA predictors for them. This includes
  22931. // all the rules, subrules, optional blocks, ()+, ()* etc...
  22932. this.decisionToState = [];
  22933. // Maps from rule index to starting state number.
  22934. this.ruleToStartState = [];
  22935. // Maps from rule index to stop state number.
  22936. this.ruleToStopState = null;
  22937. this.modeNameToStartState = {};
  22938. // For lexer ATNs, this maps the rule index to the resulting token type.
  22939. // For parser ATNs, this maps the rule index to the generated bypass token
  22940. // type if the
  22941. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  22942. // deserialization option was specified; otherwise, this is {@code null}.
  22943. this.ruleToTokenType = null;
  22944. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  22945. // be referenced by action transitions in the ATN.
  22946. this.lexerActions = null;
  22947. this.modeToStartState = [];
  22948. return this;
  22949. }
  22950. // Compute the set of valid tokens that can occur starting in state {@code s}.
  22951. // If {@code ctx} is null, the set of tokens will not include what can follow
  22952. // the rule surrounding {@code s}. In other words, the set will be
  22953. // restricted to tokens reachable staying within {@code s}'s rule.
  22954. ATN.prototype.nextTokensInContext = function (s, ctx) {
  22955. var anal = new LL1Analyzer(this);
  22956. return anal.LOOK(s, null, ctx);
  22957. };
  22958. // Compute the set of valid tokens that can occur starting in {@code s} and
  22959. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  22960. // rule.
  22961. ATN.prototype.nextTokensNoContext = function (s) {
  22962. if (s.nextTokenWithinRule !== null) {
  22963. return s.nextTokenWithinRule;
  22964. }
  22965. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  22966. s.nextTokenWithinRule.readOnly = true;
  22967. return s.nextTokenWithinRule;
  22968. };
  22969. ATN.prototype.nextTokens = function (s, ctx) {
  22970. if (ctx === undefined) {
  22971. return this.nextTokensNoContext(s);
  22972. } else {
  22973. return this.nextTokensInContext(s, ctx);
  22974. }
  22975. };
  22976. ATN.prototype.addState = function (state) {
  22977. if (state !== null) {
  22978. state.atn = this;
  22979. state.stateNumber = this.states.length;
  22980. }
  22981. this.states.push(state);
  22982. };
  22983. ATN.prototype.removeState = function (state) {
  22984. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  22985. };
  22986. ATN.prototype.defineDecisionState = function (s) {
  22987. this.decisionToState.push(s);
  22988. s.decision = this.decisionToState.length - 1;
  22989. return s.decision;
  22990. };
  22991. ATN.prototype.getDecisionState = function (decision) {
  22992. if (this.decisionToState.length === 0) {
  22993. return null;
  22994. } else {
  22995. return this.decisionToState[decision];
  22996. }
  22997. };
  22998. // Computes the set of input symbols which could follow ATN state number
  22999. // {@code stateNumber} in the specified full {@code context}. This method
  23000. // considers the complete parser context, but does not evaluate semantic
  23001. // predicates (i.e. all predicates encountered during the calculation are
  23002. // assumed true). If a path in the ATN exists from the starting state to the
  23003. // {@link RuleStopState} of the outermost context without matching any
  23004. // symbols, {@link Token//EOF} is added to the returned set.
  23005. //
  23006. // <p>If {@code context} is {@code null}, it is treated as
  23007. // {@link ParserRuleContext//EMPTY}.</p>
  23008. //
  23009. // @param stateNumber the ATN state number
  23010. // @param context the full parse context
  23011. // @return The set of potentially valid input symbols which could follow the
  23012. // specified state in the specified context.
  23013. // @throws IllegalArgumentException if the ATN does not contain a state with
  23014. // number {@code stateNumber}
  23015. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  23016. ATN.prototype.getExpectedTokens = function (stateNumber, ctx) {
  23017. if (stateNumber < 0 || stateNumber >= this.states.length) {
  23018. throw "Invalid state number.";
  23019. }
  23020. var s = this.states[stateNumber];
  23021. var following = this.nextTokens(s);
  23022. if (!following.contains(Token.EPSILON)) {
  23023. return following;
  23024. }
  23025. var expected = new IntervalSet();
  23026. expected.addSet(following);
  23027. expected.removeOne(Token.EPSILON);
  23028. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  23029. var invokingState = this.states[ctx.invokingState];
  23030. var rt = invokingState.transitions[0];
  23031. following = this.nextTokens(rt.followState);
  23032. expected.addSet(following);
  23033. expected.removeOne(Token.EPSILON);
  23034. ctx = ctx.parentCtx;
  23035. }
  23036. if (following.contains(Token.EPSILON)) {
  23037. expected.addOne(Token.EOF);
  23038. }
  23039. return expected;
  23040. };
  23041. ATN.INVALID_ALT_NUMBER = 0;
  23042. exports.ATN = ATN;
  23043. /***/ }),
  23044. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  23045. /*!**********************************************!*\
  23046. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  23047. \**********************************************/
  23048. /*! no static exports found */
  23049. /***/ (function(module, exports, __webpack_require__) {
  23050. "use strict";
  23051. //
  23052. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23053. * Use of this file is governed by the BSD 3-clause license that
  23054. * can be found in the LICENSE.txt file in the project root.
  23055. */
  23056. ///
  23057. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  23058. // The syntactic context is a graph-structured stack node whose
  23059. // path(s) to the root is the rule invocation(s)
  23060. // chain used to arrive at the state. The semantic context is
  23061. // the tree of semantic predicates encountered before reaching
  23062. // an ATN state.
  23063. ///
  23064. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  23065. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  23066. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  23067. function checkParams(params, isCfg) {
  23068. if (params === null) {
  23069. var result = { state: null, alt: null, context: null, semanticContext: null };
  23070. if (isCfg) {
  23071. result.reachesIntoOuterContext = 0;
  23072. }
  23073. return result;
  23074. } else {
  23075. var props = {};
  23076. props.state = params.state || null;
  23077. props.alt = params.alt === undefined ? null : params.alt;
  23078. props.context = params.context || null;
  23079. props.semanticContext = params.semanticContext || null;
  23080. if (isCfg) {
  23081. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  23082. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  23083. }
  23084. return props;
  23085. }
  23086. }
  23087. function ATNConfig(params, config) {
  23088. this.checkContext(params, config);
  23089. params = checkParams(params);
  23090. config = checkParams(config, true);
  23091. // The ATN state associated with this configuration///
  23092. this.state = params.state !== null ? params.state : config.state;
  23093. // What alt (or lexer rule) is predicted by this configuration///
  23094. this.alt = params.alt !== null ? params.alt : config.alt;
  23095. // The stack of invoking states leading to the rule/states associated
  23096. // with this config. We track only those contexts pushed during
  23097. // execution of the ATN simulator.
  23098. this.context = params.context !== null ? params.context : config.context;
  23099. this.semanticContext = params.semanticContext !== null ? params.semanticContext : config.semanticContext !== null ? config.semanticContext : SemanticContext.NONE;
  23100. // We cannot execute predicates dependent upon local context unless
  23101. // we know for sure we are in the correct context. Because there is
  23102. // no way to do this efficiently, we simply cannot evaluate
  23103. // dependent predicates unless we are in the rule that initially
  23104. // invokes the ATN simulator.
  23105. //
  23106. // closure() tracks the depth of how far we dip into the
  23107. // outer context: depth &gt; 0. Note that it may not be totally
  23108. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  23109. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  23110. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  23111. return this;
  23112. }
  23113. ATNConfig.prototype.checkContext = function (params, config) {
  23114. if ((params.context === null || params.context === undefined) && (config === null || config.context === null || config.context === undefined)) {
  23115. this.context = null;
  23116. }
  23117. };
  23118. ATNConfig.prototype.hashCode = function () {
  23119. var hash = new Hash();
  23120. this.updateHashCode(hash);
  23121. return hash.finish();
  23122. };
  23123. ATNConfig.prototype.updateHashCode = function (hash) {
  23124. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  23125. };
  23126. // An ATN configuration is equal to another if both have
  23127. // the same state, they predict the same alternative, and
  23128. // syntactic/semantic contexts are the same.
  23129. ATNConfig.prototype.equals = function (other) {
  23130. if (this === other) {
  23131. return true;
  23132. } else if (!(other instanceof ATNConfig)) {
  23133. return false;
  23134. } else {
  23135. 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;
  23136. }
  23137. };
  23138. ATNConfig.prototype.hashCodeForConfigSet = function () {
  23139. var hash = new Hash();
  23140. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  23141. return hash.finish();
  23142. };
  23143. ATNConfig.prototype.equalsForConfigSet = function (other) {
  23144. if (this === other) {
  23145. return true;
  23146. } else if (!(other instanceof ATNConfig)) {
  23147. return false;
  23148. } else {
  23149. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && this.semanticContext.equals(other.semanticContext);
  23150. }
  23151. };
  23152. ATNConfig.prototype.toString = function () {
  23153. return "(" + this.state + "," + this.alt + (this.context !== null ? ",[" + this.context.toString() + "]" : "") + (this.semanticContext !== SemanticContext.NONE ? "," + this.semanticContext.toString() : "") + (this.reachesIntoOuterContext > 0 ? ",up=" + this.reachesIntoOuterContext : "") + ")";
  23154. };
  23155. function LexerATNConfig(params, config) {
  23156. ATNConfig.call(this, params, config);
  23157. // This is the backing field for {@link //getLexerActionExecutor}.
  23158. var lexerActionExecutor = params.lexerActionExecutor || null;
  23159. this.lexerActionExecutor = lexerActionExecutor || (config !== null ? config.lexerActionExecutor : null);
  23160. this.passedThroughNonGreedyDecision = config !== null ? this.checkNonGreedyDecision(config, this.state) : false;
  23161. return this;
  23162. }
  23163. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  23164. LexerATNConfig.prototype.constructor = LexerATNConfig;
  23165. LexerATNConfig.prototype.updateHashCode = function (hash) {
  23166. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  23167. };
  23168. LexerATNConfig.prototype.equals = function (other) {
  23169. 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);
  23170. };
  23171. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  23172. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  23173. LexerATNConfig.prototype.checkNonGreedyDecision = function (source, target) {
  23174. return source.passedThroughNonGreedyDecision || target instanceof DecisionState && target.nonGreedy;
  23175. };
  23176. exports.ATNConfig = ATNConfig;
  23177. exports.LexerATNConfig = LexerATNConfig;
  23178. /***/ }),
  23179. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  23180. /*!*************************************************!*\
  23181. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  23182. \*************************************************/
  23183. /*! no static exports found */
  23184. /***/ (function(module, exports, __webpack_require__) {
  23185. "use strict";
  23186. //
  23187. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23188. * Use of this file is governed by the BSD 3-clause license that
  23189. * can be found in the LICENSE.txt file in the project root.
  23190. */
  23191. //
  23192. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  23193. // info about the set, with support for combining similar configurations using a
  23194. // graph-structured stack.
  23195. ///
  23196. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  23197. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  23198. var Hash = Utils.Hash;
  23199. var Set = Utils.Set;
  23200. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  23201. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  23202. function hashATNConfig(c) {
  23203. return c.hashCodeForConfigSet();
  23204. }
  23205. function equalATNConfigs(a, b) {
  23206. if (a === b) {
  23207. return true;
  23208. } else if (a === null || b === null) {
  23209. return false;
  23210. } else return a.equalsForConfigSet(b);
  23211. }
  23212. function ATNConfigSet(fullCtx) {
  23213. //
  23214. // The reason that we need this is because we don't want the hash map to use
  23215. // the standard hash code and equals. We need all configurations with the
  23216. // same
  23217. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  23218. // doubles
  23219. // the number of objects associated with ATNConfigs. The other solution is
  23220. // to
  23221. // use a hash table that lets us specify the equals/hashcode operation.
  23222. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  23223. // when we go readonly as this set becomes a DFA state.
  23224. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  23225. // Indicates that this configuration set is part of a full context
  23226. // LL prediction. It will be used to determine how to merge $. With SLL
  23227. // it's a wildcard whereas it is not for LL context merge.
  23228. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  23229. // Indicates that the set of configurations is read-only. Do not
  23230. // allow any code to manipulate the set; DFA states will point at
  23231. // the sets and they must not change. This does not protect the other
  23232. // fields; in particular, conflictingAlts is set after
  23233. // we've made this readonly.
  23234. this.readOnly = false;
  23235. // Track the elements as they are added to the set; supports get(i)///
  23236. this.configs = [];
  23237. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  23238. // together, saves recomputation
  23239. // TODO: can we track conflicts as they are added to save scanning configs
  23240. // later?
  23241. this.uniqueAlt = 0;
  23242. this.conflictingAlts = null;
  23243. // Used in parser and lexer. In lexer, it indicates we hit a pred
  23244. // while computing a closure operation. Don't make a DFA state from this.
  23245. this.hasSemanticContext = false;
  23246. this.dipsIntoOuterContext = false;
  23247. this.cachedHashCode = -1;
  23248. return this;
  23249. }
  23250. // Adding a new config means merging contexts with existing configs for
  23251. // {@code (s, i, pi, _)}, where {@code s} is the
  23252. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  23253. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  23254. // {@code (s,i,pi)} as key.
  23255. //
  23256. // <p>This method updates {@link //dipsIntoOuterContext} and
  23257. // {@link //hasSemanticContext} when necessary.</p>
  23258. // /
  23259. ATNConfigSet.prototype.add = function (config, mergeCache) {
  23260. if (mergeCache === undefined) {
  23261. mergeCache = null;
  23262. }
  23263. if (this.readOnly) {
  23264. throw "This set is readonly";
  23265. }
  23266. if (config.semanticContext !== SemanticContext.NONE) {
  23267. this.hasSemanticContext = true;
  23268. }
  23269. if (config.reachesIntoOuterContext > 0) {
  23270. this.dipsIntoOuterContext = true;
  23271. }
  23272. var existing = this.configLookup.add(config);
  23273. if (existing === config) {
  23274. this.cachedHashCode = -1;
  23275. this.configs.push(config); // track order here
  23276. return true;
  23277. }
  23278. // a previous (s,i,pi,_), merge with it and save result
  23279. var rootIsWildcard = !this.fullCtx;
  23280. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  23281. // no need to check for existing.context, config.context in cache
  23282. // since only way to create new graphs is "call rule" and here. We
  23283. // cache at both places.
  23284. existing.reachesIntoOuterContext = Math.max(existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  23285. // make sure to preserve the precedence filter suppression during the merge
  23286. if (config.precedenceFilterSuppressed) {
  23287. existing.precedenceFilterSuppressed = true;
  23288. }
  23289. existing.context = merged; // replace context; no need to alt mapping
  23290. return true;
  23291. };
  23292. ATNConfigSet.prototype.getStates = function () {
  23293. var states = new Set();
  23294. for (var i = 0; i < this.configs.length; i++) {
  23295. states.add(this.configs[i].state);
  23296. }
  23297. return states;
  23298. };
  23299. ATNConfigSet.prototype.getPredicates = function () {
  23300. var preds = [];
  23301. for (var i = 0; i < this.configs.length; i++) {
  23302. var c = this.configs[i].semanticContext;
  23303. if (c !== SemanticContext.NONE) {
  23304. preds.push(c.semanticContext);
  23305. }
  23306. }
  23307. return preds;
  23308. };
  23309. Object.defineProperty(ATNConfigSet.prototype, "items", {
  23310. get: function get() {
  23311. return this.configs;
  23312. }
  23313. });
  23314. ATNConfigSet.prototype.optimizeConfigs = function (interpreter) {
  23315. if (this.readOnly) {
  23316. throw "This set is readonly";
  23317. }
  23318. if (this.configLookup.length === 0) {
  23319. return;
  23320. }
  23321. for (var i = 0; i < this.configs.length; i++) {
  23322. var config = this.configs[i];
  23323. config.context = interpreter.getCachedContext(config.context);
  23324. }
  23325. };
  23326. ATNConfigSet.prototype.addAll = function (coll) {
  23327. for (var i = 0; i < coll.length; i++) {
  23328. this.add(coll[i]);
  23329. }
  23330. return false;
  23331. };
  23332. ATNConfigSet.prototype.equals = function (other) {
  23333. 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;
  23334. };
  23335. ATNConfigSet.prototype.hashCode = function () {
  23336. var hash = new Hash();
  23337. this.updateHashCode(hash);
  23338. return hash.finish();
  23339. };
  23340. ATNConfigSet.prototype.updateHashCode = function (hash) {
  23341. if (this.readOnly) {
  23342. if (this.cachedHashCode === -1) {
  23343. var hash = new Hash();
  23344. hash.update(this.configs);
  23345. this.cachedHashCode = hash.finish();
  23346. }
  23347. hash.update(this.cachedHashCode);
  23348. } else {
  23349. hash.update(this.configs);
  23350. }
  23351. };
  23352. Object.defineProperty(ATNConfigSet.prototype, "length", {
  23353. get: function get() {
  23354. return this.configs.length;
  23355. }
  23356. });
  23357. ATNConfigSet.prototype.isEmpty = function () {
  23358. return this.configs.length === 0;
  23359. };
  23360. ATNConfigSet.prototype.contains = function (item) {
  23361. if (this.configLookup === null) {
  23362. throw "This method is not implemented for readonly sets.";
  23363. }
  23364. return this.configLookup.contains(item);
  23365. };
  23366. ATNConfigSet.prototype.containsFast = function (item) {
  23367. if (this.configLookup === null) {
  23368. throw "This method is not implemented for readonly sets.";
  23369. }
  23370. return this.configLookup.containsFast(item);
  23371. };
  23372. ATNConfigSet.prototype.clear = function () {
  23373. if (this.readOnly) {
  23374. throw "This set is readonly";
  23375. }
  23376. this.configs = [];
  23377. this.cachedHashCode = -1;
  23378. this.configLookup = new Set();
  23379. };
  23380. ATNConfigSet.prototype.setReadonly = function (readOnly) {
  23381. this.readOnly = readOnly;
  23382. if (readOnly) {
  23383. this.configLookup = null; // can't mod, no need for lookup cache
  23384. }
  23385. };
  23386. ATNConfigSet.prototype.toString = function () {
  23387. 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" : "");
  23388. };
  23389. function OrderedATNConfigSet() {
  23390. ATNConfigSet.call(this);
  23391. this.configLookup = new Set();
  23392. return this;
  23393. }
  23394. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  23395. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  23396. exports.ATNConfigSet = ATNConfigSet;
  23397. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  23398. /***/ }),
  23399. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  23400. /*!**************************************************************!*\
  23401. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  23402. \**************************************************************/
  23403. /*! no static exports found */
  23404. /***/ (function(module, exports, __webpack_require__) {
  23405. "use strict";
  23406. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23407. * Use of this file is governed by the BSD 3-clause license that
  23408. * can be found in the LICENSE.txt file in the project root.
  23409. */
  23410. function ATNDeserializationOptions(copyFrom) {
  23411. if (copyFrom === undefined) {
  23412. copyFrom = null;
  23413. }
  23414. this.readOnly = false;
  23415. this.verifyATN = copyFrom === null ? true : copyFrom.verifyATN;
  23416. this.generateRuleBypassTransitions = copyFrom === null ? false : copyFrom.generateRuleBypassTransitions;
  23417. return this;
  23418. }
  23419. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  23420. ATNDeserializationOptions.defaultOptions.readOnly = true;
  23421. // def __setattr__(self, key, value):
  23422. // if key!="readOnly" and self.readOnly:
  23423. // raise Exception("The object is read only.")
  23424. // super(type(self), self).__setattr__(key,value)
  23425. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  23426. /***/ }),
  23427. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  23428. /*!****************************************************!*\
  23429. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  23430. \****************************************************/
  23431. /*! no static exports found */
  23432. /***/ (function(module, exports, __webpack_require__) {
  23433. "use strict";
  23434. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23435. * Use of this file is governed by the BSD 3-clause license that
  23436. * can be found in the LICENSE.txt file in the project root.
  23437. */
  23438. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  23439. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  23440. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  23441. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  23442. var ATNState = ATNStates.ATNState;
  23443. var BasicState = ATNStates.BasicState;
  23444. var DecisionState = ATNStates.DecisionState;
  23445. var BlockStartState = ATNStates.BlockStartState;
  23446. var BlockEndState = ATNStates.BlockEndState;
  23447. var LoopEndState = ATNStates.LoopEndState;
  23448. var RuleStartState = ATNStates.RuleStartState;
  23449. var RuleStopState = ATNStates.RuleStopState;
  23450. var TokensStartState = ATNStates.TokensStartState;
  23451. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  23452. var StarLoopbackState = ATNStates.StarLoopbackState;
  23453. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  23454. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  23455. var StarBlockStartState = ATNStates.StarBlockStartState;
  23456. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  23457. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  23458. var Transition = Transitions.Transition;
  23459. var AtomTransition = Transitions.AtomTransition;
  23460. var SetTransition = Transitions.SetTransition;
  23461. var NotSetTransition = Transitions.NotSetTransition;
  23462. var RuleTransition = Transitions.RuleTransition;
  23463. var RangeTransition = Transitions.RangeTransition;
  23464. var ActionTransition = Transitions.ActionTransition;
  23465. var EpsilonTransition = Transitions.EpsilonTransition;
  23466. var WildcardTransition = Transitions.WildcardTransition;
  23467. var PredicateTransition = Transitions.PredicateTransition;
  23468. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  23469. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  23470. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  23471. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  23472. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  23473. var LexerActionType = LexerActions.LexerActionType;
  23474. var LexerSkipAction = LexerActions.LexerSkipAction;
  23475. var LexerChannelAction = LexerActions.LexerChannelAction;
  23476. var LexerCustomAction = LexerActions.LexerCustomAction;
  23477. var LexerMoreAction = LexerActions.LexerMoreAction;
  23478. var LexerTypeAction = LexerActions.LexerTypeAction;
  23479. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  23480. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  23481. var LexerModeAction = LexerActions.LexerModeAction;
  23482. // This is the earliest supported serialized UUID.
  23483. // stick to serialized version for now, we don't need a UUID instance
  23484. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  23485. //
  23486. // This UUID indicates the serialized ATN contains two sets of
  23487. // IntervalSets, where the second set's values are encoded as
  23488. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  23489. //
  23490. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  23491. // This list contains all of the currently supported UUIDs, ordered by when
  23492. // the feature first appeared in this branch.
  23493. var SUPPORTED_UUIDS = [BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP];
  23494. var SERIALIZED_VERSION = 3;
  23495. // This is the current serialized UUID.
  23496. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  23497. function initArray(length, value) {
  23498. var tmp = [];
  23499. tmp[length - 1] = value;
  23500. return tmp.map(function (i) {
  23501. return value;
  23502. });
  23503. }
  23504. function ATNDeserializer(options) {
  23505. if (options === undefined || options === null) {
  23506. options = ATNDeserializationOptions.defaultOptions;
  23507. }
  23508. this.deserializationOptions = options;
  23509. this.stateFactories = null;
  23510. this.actionFactories = null;
  23511. return this;
  23512. }
  23513. // Determines if a particular serialized representation of an ATN supports
  23514. // a particular feature, identified by the {@link UUID} used for serializing
  23515. // the ATN at the time the feature was first introduced.
  23516. //
  23517. // @param feature The {@link UUID} marking the first time the feature was
  23518. // supported in the serialized ATN.
  23519. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  23520. // currently being deserialized.
  23521. // @return {@code true} if the {@code actualUuid} value represents a
  23522. // serialized ATN at or after the feature identified by {@code feature} was
  23523. // introduced; otherwise, {@code false}.
  23524. ATNDeserializer.prototype.isFeatureSupported = function (feature, actualUuid) {
  23525. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  23526. if (idx1 < 0) {
  23527. return false;
  23528. }
  23529. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  23530. return idx2 >= idx1;
  23531. };
  23532. ATNDeserializer.prototype.deserialize = function (data) {
  23533. this.reset(data);
  23534. this.checkVersion();
  23535. this.checkUUID();
  23536. var atn = this.readATN();
  23537. this.readStates(atn);
  23538. this.readRules(atn);
  23539. this.readModes(atn);
  23540. var sets = [];
  23541. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  23542. this.readSets(atn, sets, this.readInt.bind(this));
  23543. // Next, if the ATN was serialized with the Unicode SMP feature,
  23544. // deserialize sets with 32-bit arguments <= U+10FFFF.
  23545. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  23546. this.readSets(atn, sets, this.readInt32.bind(this));
  23547. }
  23548. this.readEdges(atn, sets);
  23549. this.readDecisions(atn);
  23550. this.readLexerActions(atn);
  23551. this.markPrecedenceDecisions(atn);
  23552. this.verifyATN(atn);
  23553. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER) {
  23554. this.generateRuleBypassTransitions(atn);
  23555. // re-verify after modification
  23556. this.verifyATN(atn);
  23557. }
  23558. return atn;
  23559. };
  23560. ATNDeserializer.prototype.reset = function (data) {
  23561. var adjust = function adjust(c) {
  23562. var v = c.charCodeAt(0);
  23563. return v > 1 ? v - 2 : v + 65533;
  23564. };
  23565. var temp = data.split("").map(adjust);
  23566. // don't adjust the first value since that's the version number
  23567. temp[0] = data.charCodeAt(0);
  23568. this.data = temp;
  23569. this.pos = 0;
  23570. };
  23571. ATNDeserializer.prototype.checkVersion = function () {
  23572. var version = this.readInt();
  23573. if (version !== SERIALIZED_VERSION) {
  23574. throw "Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").";
  23575. }
  23576. };
  23577. ATNDeserializer.prototype.checkUUID = function () {
  23578. var uuid = this.readUUID();
  23579. if (SUPPORTED_UUIDS.indexOf(uuid) < 0) {
  23580. throw "Could not deserialize ATN with UUID: " + uuid + " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID;
  23581. }
  23582. this.uuid = uuid;
  23583. };
  23584. ATNDeserializer.prototype.readATN = function () {
  23585. var grammarType = this.readInt();
  23586. var maxTokenType = this.readInt();
  23587. return new ATN(grammarType, maxTokenType);
  23588. };
  23589. ATNDeserializer.prototype.readStates = function (atn) {
  23590. var j, pair, stateNumber;
  23591. var loopBackStateNumbers = [];
  23592. var endStateNumbers = [];
  23593. var nstates = this.readInt();
  23594. for (var i = 0; i < nstates; i++) {
  23595. var stype = this.readInt();
  23596. // ignore bad type of states
  23597. if (stype === ATNState.INVALID_TYPE) {
  23598. atn.addState(null);
  23599. continue;
  23600. }
  23601. var ruleIndex = this.readInt();
  23602. if (ruleIndex === 0xFFFF) {
  23603. ruleIndex = -1;
  23604. }
  23605. var s = this.stateFactory(stype, ruleIndex);
  23606. if (stype === ATNState.LOOP_END) {
  23607. // special case
  23608. var loopBackStateNumber = this.readInt();
  23609. loopBackStateNumbers.push([s, loopBackStateNumber]);
  23610. } else if (s instanceof BlockStartState) {
  23611. var endStateNumber = this.readInt();
  23612. endStateNumbers.push([s, endStateNumber]);
  23613. }
  23614. atn.addState(s);
  23615. }
  23616. // delay the assignment of loop back and end states until we know all the
  23617. // state instances have been initialized
  23618. for (j = 0; j < loopBackStateNumbers.length; j++) {
  23619. pair = loopBackStateNumbers[j];
  23620. pair[0].loopBackState = atn.states[pair[1]];
  23621. }
  23622. for (j = 0; j < endStateNumbers.length; j++) {
  23623. pair = endStateNumbers[j];
  23624. pair[0].endState = atn.states[pair[1]];
  23625. }
  23626. var numNonGreedyStates = this.readInt();
  23627. for (j = 0; j < numNonGreedyStates; j++) {
  23628. stateNumber = this.readInt();
  23629. atn.states[stateNumber].nonGreedy = true;
  23630. }
  23631. var numPrecedenceStates = this.readInt();
  23632. for (j = 0; j < numPrecedenceStates; j++) {
  23633. stateNumber = this.readInt();
  23634. atn.states[stateNumber].isPrecedenceRule = true;
  23635. }
  23636. };
  23637. ATNDeserializer.prototype.readRules = function (atn) {
  23638. var i;
  23639. var nrules = this.readInt();
  23640. if (atn.grammarType === ATNType.LEXER) {
  23641. atn.ruleToTokenType = initArray(nrules, 0);
  23642. }
  23643. atn.ruleToStartState = initArray(nrules, 0);
  23644. for (i = 0; i < nrules; i++) {
  23645. var s = this.readInt();
  23646. var startState = atn.states[s];
  23647. atn.ruleToStartState[i] = startState;
  23648. if (atn.grammarType === ATNType.LEXER) {
  23649. var tokenType = this.readInt();
  23650. if (tokenType === 0xFFFF) {
  23651. tokenType = Token.EOF;
  23652. }
  23653. atn.ruleToTokenType[i] = tokenType;
  23654. }
  23655. }
  23656. atn.ruleToStopState = initArray(nrules, 0);
  23657. for (i = 0; i < atn.states.length; i++) {
  23658. var state = atn.states[i];
  23659. if (!(state instanceof RuleStopState)) {
  23660. continue;
  23661. }
  23662. atn.ruleToStopState[state.ruleIndex] = state;
  23663. atn.ruleToStartState[state.ruleIndex].stopState = state;
  23664. }
  23665. };
  23666. ATNDeserializer.prototype.readModes = function (atn) {
  23667. var nmodes = this.readInt();
  23668. for (var i = 0; i < nmodes; i++) {
  23669. var s = this.readInt();
  23670. atn.modeToStartState.push(atn.states[s]);
  23671. }
  23672. };
  23673. ATNDeserializer.prototype.readSets = function (atn, sets, readUnicode) {
  23674. var m = this.readInt();
  23675. for (var i = 0; i < m; i++) {
  23676. var iset = new IntervalSet();
  23677. sets.push(iset);
  23678. var n = this.readInt();
  23679. var containsEof = this.readInt();
  23680. if (containsEof !== 0) {
  23681. iset.addOne(-1);
  23682. }
  23683. for (var j = 0; j < n; j++) {
  23684. var i1 = readUnicode();
  23685. var i2 = readUnicode();
  23686. iset.addRange(i1, i2);
  23687. }
  23688. }
  23689. };
  23690. ATNDeserializer.prototype.readEdges = function (atn, sets) {
  23691. var i, j, state, trans, target;
  23692. var nedges = this.readInt();
  23693. for (i = 0; i < nedges; i++) {
  23694. var src = this.readInt();
  23695. var trg = this.readInt();
  23696. var ttype = this.readInt();
  23697. var arg1 = this.readInt();
  23698. var arg2 = this.readInt();
  23699. var arg3 = this.readInt();
  23700. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  23701. var srcState = atn.states[src];
  23702. srcState.addTransition(trans);
  23703. }
  23704. // edges for rule stop states can be derived, so they aren't serialized
  23705. for (i = 0; i < atn.states.length; i++) {
  23706. state = atn.states[i];
  23707. for (j = 0; j < state.transitions.length; j++) {
  23708. var t = state.transitions[j];
  23709. if (!(t instanceof RuleTransition)) {
  23710. continue;
  23711. }
  23712. var outermostPrecedenceReturn = -1;
  23713. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  23714. if (t.precedence === 0) {
  23715. outermostPrecedenceReturn = t.target.ruleIndex;
  23716. }
  23717. }
  23718. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  23719. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  23720. }
  23721. }
  23722. for (i = 0; i < atn.states.length; i++) {
  23723. state = atn.states[i];
  23724. if (state instanceof BlockStartState) {
  23725. // we need to know the end state to set its start state
  23726. if (state.endState === null) {
  23727. throw "IllegalState";
  23728. }
  23729. // block end states can only be associated to a single block start
  23730. // state
  23731. if (state.endState.startState !== null) {
  23732. throw "IllegalState";
  23733. }
  23734. state.endState.startState = state;
  23735. }
  23736. if (state instanceof PlusLoopbackState) {
  23737. for (j = 0; j < state.transitions.length; j++) {
  23738. target = state.transitions[j].target;
  23739. if (target instanceof PlusBlockStartState) {
  23740. target.loopBackState = state;
  23741. }
  23742. }
  23743. } else if (state instanceof StarLoopbackState) {
  23744. for (j = 0; j < state.transitions.length; j++) {
  23745. target = state.transitions[j].target;
  23746. if (target instanceof StarLoopEntryState) {
  23747. target.loopBackState = state;
  23748. }
  23749. }
  23750. }
  23751. }
  23752. };
  23753. ATNDeserializer.prototype.readDecisions = function (atn) {
  23754. var ndecisions = this.readInt();
  23755. for (var i = 0; i < ndecisions; i++) {
  23756. var s = this.readInt();
  23757. var decState = atn.states[s];
  23758. atn.decisionToState.push(decState);
  23759. decState.decision = i;
  23760. }
  23761. };
  23762. ATNDeserializer.prototype.readLexerActions = function (atn) {
  23763. if (atn.grammarType === ATNType.LEXER) {
  23764. var count = this.readInt();
  23765. atn.lexerActions = initArray(count, null);
  23766. for (var i = 0; i < count; i++) {
  23767. var actionType = this.readInt();
  23768. var data1 = this.readInt();
  23769. if (data1 === 0xFFFF) {
  23770. data1 = -1;
  23771. }
  23772. var data2 = this.readInt();
  23773. if (data2 === 0xFFFF) {
  23774. data2 = -1;
  23775. }
  23776. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  23777. atn.lexerActions[i] = lexerAction;
  23778. }
  23779. }
  23780. };
  23781. ATNDeserializer.prototype.generateRuleBypassTransitions = function (atn) {
  23782. var i;
  23783. var count = atn.ruleToStartState.length;
  23784. for (i = 0; i < count; i++) {
  23785. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  23786. }
  23787. for (i = 0; i < count; i++) {
  23788. this.generateRuleBypassTransition(atn, i);
  23789. }
  23790. };
  23791. ATNDeserializer.prototype.generateRuleBypassTransition = function (atn, idx) {
  23792. var i, state;
  23793. var bypassStart = new BasicBlockStartState();
  23794. bypassStart.ruleIndex = idx;
  23795. atn.addState(bypassStart);
  23796. var bypassStop = new BlockEndState();
  23797. bypassStop.ruleIndex = idx;
  23798. atn.addState(bypassStop);
  23799. bypassStart.endState = bypassStop;
  23800. atn.defineDecisionState(bypassStart);
  23801. bypassStop.startState = bypassStart;
  23802. var excludeTransition = null;
  23803. var endState = null;
  23804. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  23805. // wrap from the beginning of the rule to the StarLoopEntryState
  23806. endState = null;
  23807. for (i = 0; i < atn.states.length; i++) {
  23808. state = atn.states[i];
  23809. if (this.stateIsEndStateFor(state, idx)) {
  23810. endState = state;
  23811. excludeTransition = state.loopBackState.transitions[0];
  23812. break;
  23813. }
  23814. }
  23815. if (excludeTransition === null) {
  23816. throw "Couldn't identify final state of the precedence rule prefix section.";
  23817. }
  23818. } else {
  23819. endState = atn.ruleToStopState[idx];
  23820. }
  23821. // all non-excluded transitions that currently target end state need to
  23822. // target blockEnd instead
  23823. for (i = 0; i < atn.states.length; i++) {
  23824. state = atn.states[i];
  23825. for (var j = 0; j < state.transitions.length; j++) {
  23826. var transition = state.transitions[j];
  23827. if (transition === excludeTransition) {
  23828. continue;
  23829. }
  23830. if (transition.target === endState) {
  23831. transition.target = bypassStop;
  23832. }
  23833. }
  23834. }
  23835. // all transitions leaving the rule start state need to leave blockStart
  23836. // instead
  23837. var ruleToStartState = atn.ruleToStartState[idx];
  23838. var count = ruleToStartState.transitions.length;
  23839. while (count > 0) {
  23840. bypassStart.addTransition(ruleToStartState.transitions[count - 1]);
  23841. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  23842. }
  23843. // link the new states
  23844. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  23845. bypassStop.addTransition(new EpsilonTransition(endState));
  23846. var matchState = new BasicState();
  23847. atn.addState(matchState);
  23848. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  23849. bypassStart.addTransition(new EpsilonTransition(matchState));
  23850. };
  23851. ATNDeserializer.prototype.stateIsEndStateFor = function (state, idx) {
  23852. if (state.ruleIndex !== idx) {
  23853. return null;
  23854. }
  23855. if (!(state instanceof StarLoopEntryState)) {
  23856. return null;
  23857. }
  23858. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  23859. if (!(maybeLoopEndState instanceof LoopEndState)) {
  23860. return null;
  23861. }
  23862. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  23863. return state;
  23864. } else {
  23865. return null;
  23866. }
  23867. };
  23868. //
  23869. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  23870. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  23871. // correct value.
  23872. //
  23873. // @param atn The ATN.
  23874. //
  23875. ATNDeserializer.prototype.markPrecedenceDecisions = function (atn) {
  23876. for (var i = 0; i < atn.states.length; i++) {
  23877. var state = atn.states[i];
  23878. if (!(state instanceof StarLoopEntryState)) {
  23879. continue;
  23880. }
  23881. // We analyze the ATN to determine if this ATN decision state is the
  23882. // decision for the closure block that determines whether a
  23883. // precedence rule should continue or complete.
  23884. //
  23885. if (atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  23886. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  23887. if (maybeLoopEndState instanceof LoopEndState) {
  23888. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  23889. state.isPrecedenceDecision = true;
  23890. }
  23891. }
  23892. }
  23893. }
  23894. };
  23895. ATNDeserializer.prototype.verifyATN = function (atn) {
  23896. if (!this.deserializationOptions.verifyATN) {
  23897. return;
  23898. }
  23899. // verify assumptions
  23900. for (var i = 0; i < atn.states.length; i++) {
  23901. var state = atn.states[i];
  23902. if (state === null) {
  23903. continue;
  23904. }
  23905. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  23906. if (state instanceof PlusBlockStartState) {
  23907. this.checkCondition(state.loopBackState !== null);
  23908. } else if (state instanceof StarLoopEntryState) {
  23909. this.checkCondition(state.loopBackState !== null);
  23910. this.checkCondition(state.transitions.length === 2);
  23911. if (state.transitions[0].target instanceof StarBlockStartState) {
  23912. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  23913. this.checkCondition(!state.nonGreedy);
  23914. } else if (state.transitions[0].target instanceof LoopEndState) {
  23915. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  23916. this.checkCondition(state.nonGreedy);
  23917. } else {
  23918. throw "IllegalState";
  23919. }
  23920. } else if (state instanceof StarLoopbackState) {
  23921. this.checkCondition(state.transitions.length === 1);
  23922. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  23923. } else if (state instanceof LoopEndState) {
  23924. this.checkCondition(state.loopBackState !== null);
  23925. } else if (state instanceof RuleStartState) {
  23926. this.checkCondition(state.stopState !== null);
  23927. } else if (state instanceof BlockStartState) {
  23928. this.checkCondition(state.endState !== null);
  23929. } else if (state instanceof BlockEndState) {
  23930. this.checkCondition(state.startState !== null);
  23931. } else if (state instanceof DecisionState) {
  23932. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  23933. } else {
  23934. this.checkCondition(state.transitions.length <= 1 || state instanceof RuleStopState);
  23935. }
  23936. }
  23937. };
  23938. ATNDeserializer.prototype.checkCondition = function (condition, message) {
  23939. if (!condition) {
  23940. if (message === undefined || message === null) {
  23941. message = "IllegalState";
  23942. }
  23943. throw message;
  23944. }
  23945. };
  23946. ATNDeserializer.prototype.readInt = function () {
  23947. return this.data[this.pos++];
  23948. };
  23949. ATNDeserializer.prototype.readInt32 = function () {
  23950. var low = this.readInt();
  23951. var high = this.readInt();
  23952. return low | high << 16;
  23953. };
  23954. ATNDeserializer.prototype.readLong = function () {
  23955. var low = this.readInt32();
  23956. var high = this.readInt32();
  23957. return low & 0x00000000FFFFFFFF | high << 32;
  23958. };
  23959. function createByteToHex() {
  23960. var bth = [];
  23961. for (var i = 0; i < 256; i++) {
  23962. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  23963. }
  23964. return bth;
  23965. }
  23966. var byteToHex = createByteToHex();
  23967. ATNDeserializer.prototype.readUUID = function () {
  23968. var bb = [];
  23969. for (var i = 7; i >= 0; i--) {
  23970. var int = this.readInt();
  23971. /* jshint bitwise: false */
  23972. bb[2 * i + 1] = int & 0xFF;
  23973. bb[2 * i] = int >> 8 & 0xFF;
  23974. }
  23975. 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]];
  23976. };
  23977. ATNDeserializer.prototype.edgeFactory = function (atn, type, src, trg, arg1, arg2, arg3, sets) {
  23978. var target = atn.states[trg];
  23979. switch (type) {
  23980. case Transition.EPSILON:
  23981. return new EpsilonTransition(target);
  23982. case Transition.RANGE:
  23983. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  23984. case Transition.RULE:
  23985. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  23986. case Transition.PREDICATE:
  23987. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  23988. case Transition.PRECEDENCE:
  23989. return new PrecedencePredicateTransition(target, arg1);
  23990. case Transition.ATOM:
  23991. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  23992. case Transition.ACTION:
  23993. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  23994. case Transition.SET:
  23995. return new SetTransition(target, sets[arg1]);
  23996. case Transition.NOT_SET:
  23997. return new NotSetTransition(target, sets[arg1]);
  23998. case Transition.WILDCARD:
  23999. return new WildcardTransition(target);
  24000. default:
  24001. throw "The specified transition type: " + type + " is not valid.";
  24002. }
  24003. };
  24004. ATNDeserializer.prototype.stateFactory = function (type, ruleIndex) {
  24005. if (this.stateFactories === null) {
  24006. var sf = [];
  24007. sf[ATNState.INVALID_TYPE] = null;
  24008. sf[ATNState.BASIC] = function () {
  24009. return new BasicState();
  24010. };
  24011. sf[ATNState.RULE_START] = function () {
  24012. return new RuleStartState();
  24013. };
  24014. sf[ATNState.BLOCK_START] = function () {
  24015. return new BasicBlockStartState();
  24016. };
  24017. sf[ATNState.PLUS_BLOCK_START] = function () {
  24018. return new PlusBlockStartState();
  24019. };
  24020. sf[ATNState.STAR_BLOCK_START] = function () {
  24021. return new StarBlockStartState();
  24022. };
  24023. sf[ATNState.TOKEN_START] = function () {
  24024. return new TokensStartState();
  24025. };
  24026. sf[ATNState.RULE_STOP] = function () {
  24027. return new RuleStopState();
  24028. };
  24029. sf[ATNState.BLOCK_END] = function () {
  24030. return new BlockEndState();
  24031. };
  24032. sf[ATNState.STAR_LOOP_BACK] = function () {
  24033. return new StarLoopbackState();
  24034. };
  24035. sf[ATNState.STAR_LOOP_ENTRY] = function () {
  24036. return new StarLoopEntryState();
  24037. };
  24038. sf[ATNState.PLUS_LOOP_BACK] = function () {
  24039. return new PlusLoopbackState();
  24040. };
  24041. sf[ATNState.LOOP_END] = function () {
  24042. return new LoopEndState();
  24043. };
  24044. this.stateFactories = sf;
  24045. }
  24046. if (type > this.stateFactories.length || this.stateFactories[type] === null) {
  24047. throw "The specified state type " + type + " is not valid.";
  24048. } else {
  24049. var s = this.stateFactories[type]();
  24050. if (s !== null) {
  24051. s.ruleIndex = ruleIndex;
  24052. return s;
  24053. }
  24054. }
  24055. };
  24056. ATNDeserializer.prototype.lexerActionFactory = function (type, data1, data2) {
  24057. if (this.actionFactories === null) {
  24058. var af = [];
  24059. af[LexerActionType.CHANNEL] = function (data1, data2) {
  24060. return new LexerChannelAction(data1);
  24061. };
  24062. af[LexerActionType.CUSTOM] = function (data1, data2) {
  24063. return new LexerCustomAction(data1, data2);
  24064. };
  24065. af[LexerActionType.MODE] = function (data1, data2) {
  24066. return new LexerModeAction(data1);
  24067. };
  24068. af[LexerActionType.MORE] = function (data1, data2) {
  24069. return LexerMoreAction.INSTANCE;
  24070. };
  24071. af[LexerActionType.POP_MODE] = function (data1, data2) {
  24072. return LexerPopModeAction.INSTANCE;
  24073. };
  24074. af[LexerActionType.PUSH_MODE] = function (data1, data2) {
  24075. return new LexerPushModeAction(data1);
  24076. };
  24077. af[LexerActionType.SKIP] = function (data1, data2) {
  24078. return LexerSkipAction.INSTANCE;
  24079. };
  24080. af[LexerActionType.TYPE] = function (data1, data2) {
  24081. return new LexerTypeAction(data1);
  24082. };
  24083. this.actionFactories = af;
  24084. }
  24085. if (type > this.actionFactories.length || this.actionFactories[type] === null) {
  24086. throw "The specified lexer action type " + type + " is not valid.";
  24087. } else {
  24088. return this.actionFactories[type](data1, data2);
  24089. }
  24090. };
  24091. exports.ATNDeserializer = ATNDeserializer;
  24092. /***/ }),
  24093. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  24094. /*!*************************************************!*\
  24095. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  24096. \*************************************************/
  24097. /*! no static exports found */
  24098. /***/ (function(module, exports, __webpack_require__) {
  24099. "use strict";
  24100. //
  24101. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24102. * Use of this file is governed by the BSD 3-clause license that
  24103. * can be found in the LICENSE.txt file in the project root.
  24104. */
  24105. ///
  24106. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  24107. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  24108. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  24109. function ATNSimulator(atn, sharedContextCache) {
  24110. // The context cache maps all PredictionContext objects that are ==
  24111. // to a single cached copy. This cache is shared across all contexts
  24112. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  24113. // to use only cached nodes/graphs in addDFAState(). We don't want to
  24114. // fill this during closure() since there are lots of contexts that
  24115. // pop up but are not used ever again. It also greatly slows down closure().
  24116. //
  24117. // <p>This cache makes a huge difference in memory and a little bit in speed.
  24118. // For the Java grammar on java.*, it dropped the memory requirements
  24119. // at the end from 25M to 16M. We don't store any of the full context
  24120. // graphs in the DFA because they are limited to local context only,
  24121. // but apparently there's a lot of repetition there as well. We optimize
  24122. // the config contexts before storing the config set in the DFA states
  24123. // by literally rebuilding them with cached subgraphs only.</p>
  24124. //
  24125. // <p>I tried a cache for use during closure operations, that was
  24126. // whacked after each adaptivePredict(). It cost a little bit
  24127. // more time I think and doesn't save on the overall footprint
  24128. // so it's not worth the complexity.</p>
  24129. ///
  24130. this.atn = atn;
  24131. this.sharedContextCache = sharedContextCache;
  24132. return this;
  24133. }
  24134. // Must distinguish between missing edge and edge we know leads nowhere///
  24135. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  24136. ATNSimulator.prototype.getCachedContext = function (context) {
  24137. if (this.sharedContextCache === null) {
  24138. return context;
  24139. }
  24140. var visited = {};
  24141. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  24142. };
  24143. exports.ATNSimulator = ATNSimulator;
  24144. /***/ }),
  24145. /***/ "./node_modules/antlr4/atn/ATNState.js":
  24146. /*!*********************************************!*\
  24147. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  24148. \*********************************************/
  24149. /*! no static exports found */
  24150. /***/ (function(module, exports, __webpack_require__) {
  24151. "use strict";
  24152. //
  24153. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24154. * Use of this file is governed by the BSD 3-clause license that
  24155. * can be found in the LICENSE.txt file in the project root.
  24156. */
  24157. //
  24158. // The following images show the relation of states and
  24159. // {@link ATNState//transitions} for various grammar constructs.
  24160. //
  24161. // <ul>
  24162. //
  24163. // <li>Solid edges marked with an &//0949; indicate a required
  24164. // {@link EpsilonTransition}.</li>
  24165. //
  24166. // <li>Dashed edges indicate locations where any transition derived from
  24167. // {@link Transition} might appear.</li>
  24168. //
  24169. // <li>Dashed nodes are place holders for either a sequence of linked
  24170. // {@link BasicState} states or the inclusion of a block representing a nested
  24171. // construct in one of the forms below.</li>
  24172. //
  24173. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  24174. // any number of alternatives (one or more). Nodes without the {@code ...} only
  24175. // support the exact number of alternatives shown in the diagram.</li>
  24176. //
  24177. // </ul>
  24178. //
  24179. // <h2>Basic Blocks</h2>
  24180. //
  24181. // <h3>Rule</h3>
  24182. //
  24183. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  24184. //
  24185. // <h3>Block of 1 or more alternatives</h3>
  24186. //
  24187. // <embed src="images/Block.svg" type="image/svg+xml"/>
  24188. //
  24189. // <h2>Greedy Loops</h2>
  24190. //
  24191. // <h3>Greedy Closure: {@code (...)*}</h3>
  24192. //
  24193. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  24194. //
  24195. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  24196. //
  24197. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  24198. //
  24199. // <h3>Greedy Optional: {@code (...)?}</h3>
  24200. //
  24201. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  24202. //
  24203. // <h2>Non-Greedy Loops</h2>
  24204. //
  24205. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  24206. //
  24207. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  24208. //
  24209. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  24210. //
  24211. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  24212. //
  24213. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  24214. //
  24215. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  24216. //
  24217. var INITIAL_NUM_TRANSITIONS = 4;
  24218. function ATNState() {
  24219. // Which ATN are we in?
  24220. this.atn = null;
  24221. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  24222. this.stateType = null;
  24223. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  24224. this.epsilonOnlyTransitions = false;
  24225. // Track the transitions emanating from this ATN state.
  24226. this.transitions = [];
  24227. // Used to cache lookahead during parsing, not used during construction
  24228. this.nextTokenWithinRule = null;
  24229. return this;
  24230. }
  24231. // constants for serialization
  24232. ATNState.INVALID_TYPE = 0;
  24233. ATNState.BASIC = 1;
  24234. ATNState.RULE_START = 2;
  24235. ATNState.BLOCK_START = 3;
  24236. ATNState.PLUS_BLOCK_START = 4;
  24237. ATNState.STAR_BLOCK_START = 5;
  24238. ATNState.TOKEN_START = 6;
  24239. ATNState.RULE_STOP = 7;
  24240. ATNState.BLOCK_END = 8;
  24241. ATNState.STAR_LOOP_BACK = 9;
  24242. ATNState.STAR_LOOP_ENTRY = 10;
  24243. ATNState.PLUS_LOOP_BACK = 11;
  24244. ATNState.LOOP_END = 12;
  24245. 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"];
  24246. ATNState.INVALID_STATE_NUMBER = -1;
  24247. ATNState.prototype.toString = function () {
  24248. return this.stateNumber;
  24249. };
  24250. ATNState.prototype.equals = function (other) {
  24251. if (other instanceof ATNState) {
  24252. return this.stateNumber === other.stateNumber;
  24253. } else {
  24254. return false;
  24255. }
  24256. };
  24257. ATNState.prototype.isNonGreedyExitState = function () {
  24258. return false;
  24259. };
  24260. ATNState.prototype.addTransition = function (trans, index) {
  24261. if (index === undefined) {
  24262. index = -1;
  24263. }
  24264. if (this.transitions.length === 0) {
  24265. this.epsilonOnlyTransitions = trans.isEpsilon;
  24266. } else if (this.epsilonOnlyTransitions !== trans.isEpsilon) {
  24267. this.epsilonOnlyTransitions = false;
  24268. }
  24269. if (index === -1) {
  24270. this.transitions.push(trans);
  24271. } else {
  24272. this.transitions.splice(index, 1, trans);
  24273. }
  24274. };
  24275. function BasicState() {
  24276. ATNState.call(this);
  24277. this.stateType = ATNState.BASIC;
  24278. return this;
  24279. }
  24280. BasicState.prototype = Object.create(ATNState.prototype);
  24281. BasicState.prototype.constructor = BasicState;
  24282. function DecisionState() {
  24283. ATNState.call(this);
  24284. this.decision = -1;
  24285. this.nonGreedy = false;
  24286. return this;
  24287. }
  24288. DecisionState.prototype = Object.create(ATNState.prototype);
  24289. DecisionState.prototype.constructor = DecisionState;
  24290. // The start of a regular {@code (...)} block.
  24291. function BlockStartState() {
  24292. DecisionState.call(this);
  24293. this.endState = null;
  24294. return this;
  24295. }
  24296. BlockStartState.prototype = Object.create(DecisionState.prototype);
  24297. BlockStartState.prototype.constructor = BlockStartState;
  24298. function BasicBlockStartState() {
  24299. BlockStartState.call(this);
  24300. this.stateType = ATNState.BLOCK_START;
  24301. return this;
  24302. }
  24303. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  24304. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  24305. // Terminal node of a simple {@code (a|b|c)} block.
  24306. function BlockEndState() {
  24307. ATNState.call(this);
  24308. this.stateType = ATNState.BLOCK_END;
  24309. this.startState = null;
  24310. return this;
  24311. }
  24312. BlockEndState.prototype = Object.create(ATNState.prototype);
  24313. BlockEndState.prototype.constructor = BlockEndState;
  24314. // The last node in the ATN for a rule, unless that rule is the start symbol.
  24315. // In that case, there is one transition to EOF. Later, we might encode
  24316. // references to all calls to this rule to compute FOLLOW sets for
  24317. // error handling.
  24318. //
  24319. function RuleStopState() {
  24320. ATNState.call(this);
  24321. this.stateType = ATNState.RULE_STOP;
  24322. return this;
  24323. }
  24324. RuleStopState.prototype = Object.create(ATNState.prototype);
  24325. RuleStopState.prototype.constructor = RuleStopState;
  24326. function RuleStartState() {
  24327. ATNState.call(this);
  24328. this.stateType = ATNState.RULE_START;
  24329. this.stopState = null;
  24330. this.isPrecedenceRule = false;
  24331. return this;
  24332. }
  24333. RuleStartState.prototype = Object.create(ATNState.prototype);
  24334. RuleStartState.prototype.constructor = RuleStartState;
  24335. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  24336. // one to the loop back to start of the block and one to exit.
  24337. //
  24338. function PlusLoopbackState() {
  24339. DecisionState.call(this);
  24340. this.stateType = ATNState.PLUS_LOOP_BACK;
  24341. return this;
  24342. }
  24343. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  24344. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  24345. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  24346. // we don't use for code generation; somebody might need it, so I'm defining
  24347. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  24348. // real decision-making note for {@code A+}.
  24349. //
  24350. function PlusBlockStartState() {
  24351. BlockStartState.call(this);
  24352. this.stateType = ATNState.PLUS_BLOCK_START;
  24353. this.loopBackState = null;
  24354. return this;
  24355. }
  24356. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  24357. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  24358. // The block that begins a closure loop.
  24359. function StarBlockStartState() {
  24360. BlockStartState.call(this);
  24361. this.stateType = ATNState.STAR_BLOCK_START;
  24362. return this;
  24363. }
  24364. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  24365. StarBlockStartState.prototype.constructor = StarBlockStartState;
  24366. function StarLoopbackState() {
  24367. ATNState.call(this);
  24368. this.stateType = ATNState.STAR_LOOP_BACK;
  24369. return this;
  24370. }
  24371. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  24372. StarLoopbackState.prototype.constructor = StarLoopbackState;
  24373. function StarLoopEntryState() {
  24374. DecisionState.call(this);
  24375. this.stateType = ATNState.STAR_LOOP_ENTRY;
  24376. this.loopBackState = null;
  24377. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  24378. this.isPrecedenceDecision = null;
  24379. return this;
  24380. }
  24381. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  24382. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  24383. // Mark the end of a * or + loop.
  24384. function LoopEndState() {
  24385. ATNState.call(this);
  24386. this.stateType = ATNState.LOOP_END;
  24387. this.loopBackState = null;
  24388. return this;
  24389. }
  24390. LoopEndState.prototype = Object.create(ATNState.prototype);
  24391. LoopEndState.prototype.constructor = LoopEndState;
  24392. // The Tokens rule start state linking to each lexer rule start state */
  24393. function TokensStartState() {
  24394. DecisionState.call(this);
  24395. this.stateType = ATNState.TOKEN_START;
  24396. return this;
  24397. }
  24398. TokensStartState.prototype = Object.create(DecisionState.prototype);
  24399. TokensStartState.prototype.constructor = TokensStartState;
  24400. exports.ATNState = ATNState;
  24401. exports.BasicState = BasicState;
  24402. exports.DecisionState = DecisionState;
  24403. exports.BlockStartState = BlockStartState;
  24404. exports.BlockEndState = BlockEndState;
  24405. exports.LoopEndState = LoopEndState;
  24406. exports.RuleStartState = RuleStartState;
  24407. exports.RuleStopState = RuleStopState;
  24408. exports.TokensStartState = TokensStartState;
  24409. exports.PlusLoopbackState = PlusLoopbackState;
  24410. exports.StarLoopbackState = StarLoopbackState;
  24411. exports.StarLoopEntryState = StarLoopEntryState;
  24412. exports.PlusBlockStartState = PlusBlockStartState;
  24413. exports.StarBlockStartState = StarBlockStartState;
  24414. exports.BasicBlockStartState = BasicBlockStartState;
  24415. /***/ }),
  24416. /***/ "./node_modules/antlr4/atn/ATNType.js":
  24417. /*!********************************************!*\
  24418. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  24419. \********************************************/
  24420. /*! no static exports found */
  24421. /***/ (function(module, exports, __webpack_require__) {
  24422. "use strict";
  24423. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24424. * Use of this file is governed by the BSD 3-clause license that
  24425. * can be found in the LICENSE.txt file in the project root.
  24426. */
  24427. ///
  24428. // Represents the type of recognizer an ATN applies to.
  24429. function ATNType() {}
  24430. ATNType.LEXER = 0;
  24431. ATNType.PARSER = 1;
  24432. exports.ATNType = ATNType;
  24433. /***/ }),
  24434. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  24435. /*!******************************************************!*\
  24436. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  24437. \******************************************************/
  24438. /*! no static exports found */
  24439. /***/ (function(module, exports, __webpack_require__) {
  24440. "use strict";
  24441. //
  24442. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24443. * Use of this file is governed by the BSD 3-clause license that
  24444. * can be found in the LICENSE.txt file in the project root.
  24445. */
  24446. ///
  24447. // When we hit an accept state in either the DFA or the ATN, we
  24448. // have to notify the character stream to start buffering characters
  24449. // via {@link IntStream//mark} and record the current state. The current sim state
  24450. // includes the current index into the input, the current line,
  24451. // and current character position in that line. Note that the Lexer is
  24452. // tracking the starting line and characterization of the token. These
  24453. // variables track the "state" of the simulator when it hits an accept state.
  24454. //
  24455. // <p>We track these variables separately for the DFA and ATN simulation
  24456. // because the DFA simulation often has to fail over to the ATN
  24457. // simulation. If the ATN simulation fails, we need the DFA to fall
  24458. // back to its previously accepted state, if any. If the ATN succeeds,
  24459. // then the ATN does the accept and the DFA simulator that invoked it
  24460. // can simply return the predicted token type.</p>
  24461. ///
  24462. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  24463. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  24464. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  24465. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  24466. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  24467. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  24468. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  24469. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  24470. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  24471. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  24472. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  24473. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  24474. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  24475. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  24476. function resetSimState(sim) {
  24477. sim.index = -1;
  24478. sim.line = 0;
  24479. sim.column = -1;
  24480. sim.dfaState = null;
  24481. }
  24482. function SimState() {
  24483. resetSimState(this);
  24484. return this;
  24485. }
  24486. SimState.prototype.reset = function () {
  24487. resetSimState(this);
  24488. };
  24489. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  24490. ATNSimulator.call(this, atn, sharedContextCache);
  24491. this.decisionToDFA = decisionToDFA;
  24492. this.recog = recog;
  24493. // The current token's starting index into the character stream.
  24494. // Shared across DFA to ATN simulation in case the ATN fails and the
  24495. // DFA did not have a previous accept state. In this case, we use the
  24496. // ATN-generated exception object.
  24497. this.startIndex = -1;
  24498. // line number 1..n within the input///
  24499. this.line = 1;
  24500. // The index of the character relative to the beginning of the line
  24501. // 0..n-1///
  24502. this.column = 0;
  24503. this.mode = Lexer.DEFAULT_MODE;
  24504. // Used during DFA/ATN exec to record the most recent accept configuration
  24505. // info
  24506. this.prevAccept = new SimState();
  24507. // done
  24508. return this;
  24509. }
  24510. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  24511. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  24512. LexerATNSimulator.debug = false;
  24513. LexerATNSimulator.dfa_debug = false;
  24514. LexerATNSimulator.MIN_DFA_EDGE = 0;
  24515. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  24516. LexerATNSimulator.match_calls = 0;
  24517. LexerATNSimulator.prototype.copyState = function (simulator) {
  24518. this.column = simulator.column;
  24519. this.line = simulator.line;
  24520. this.mode = simulator.mode;
  24521. this.startIndex = simulator.startIndex;
  24522. };
  24523. LexerATNSimulator.prototype.match = function (input, mode) {
  24524. this.match_calls += 1;
  24525. this.mode = mode;
  24526. var mark = input.mark();
  24527. try {
  24528. this.startIndex = input.index;
  24529. this.prevAccept.reset();
  24530. var dfa = this.decisionToDFA[mode];
  24531. if (dfa.s0 === null) {
  24532. return this.matchATN(input);
  24533. } else {
  24534. return this.execATN(input, dfa.s0);
  24535. }
  24536. } finally {
  24537. input.release(mark);
  24538. }
  24539. };
  24540. LexerATNSimulator.prototype.reset = function () {
  24541. this.prevAccept.reset();
  24542. this.startIndex = -1;
  24543. this.line = 1;
  24544. this.column = 0;
  24545. this.mode = Lexer.DEFAULT_MODE;
  24546. };
  24547. LexerATNSimulator.prototype.matchATN = function (input) {
  24548. var startState = this.atn.modeToStartState[this.mode];
  24549. if (LexerATNSimulator.debug) {
  24550. console.log("matchATN mode " + this.mode + " start: " + startState);
  24551. }
  24552. var old_mode = this.mode;
  24553. var s0_closure = this.computeStartState(input, startState);
  24554. var suppressEdge = s0_closure.hasSemanticContext;
  24555. s0_closure.hasSemanticContext = false;
  24556. var next = this.addDFAState(s0_closure);
  24557. if (!suppressEdge) {
  24558. this.decisionToDFA[this.mode].s0 = next;
  24559. }
  24560. var predict = this.execATN(input, next);
  24561. if (LexerATNSimulator.debug) {
  24562. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  24563. }
  24564. return predict;
  24565. };
  24566. LexerATNSimulator.prototype.execATN = function (input, ds0) {
  24567. if (LexerATNSimulator.debug) {
  24568. console.log("start state closure=" + ds0.configs);
  24569. }
  24570. if (ds0.isAcceptState) {
  24571. // allow zero-length tokens
  24572. this.captureSimState(this.prevAccept, input, ds0);
  24573. }
  24574. var t = input.LA(1);
  24575. var s = ds0; // s is current/from DFA state
  24576. while (true) {
  24577. // while more work
  24578. if (LexerATNSimulator.debug) {
  24579. console.log("execATN loop starting closure: " + s.configs);
  24580. }
  24581. // As we move src->trg, src->trg, we keep track of the previous trg to
  24582. // avoid looking up the DFA state again, which is expensive.
  24583. // If the previous target was already part of the DFA, we might
  24584. // be able to avoid doing a reach operation upon t. If s!=null,
  24585. // it means that semantic predicates didn't prevent us from
  24586. // creating a DFA state. Once we know s!=null, we check to see if
  24587. // the DFA state has an edge already for t. If so, we can just reuse
  24588. // it's configuration set; there's no point in re-computing it.
  24589. // This is kind of like doing DFA simulation within the ATN
  24590. // simulation because DFA simulation is really just a way to avoid
  24591. // computing reach/closure sets. Technically, once we know that
  24592. // we have a previously added DFA state, we could jump over to
  24593. // the DFA simulator. But, that would mean popping back and forth
  24594. // a lot and making things more complicated algorithmically.
  24595. // This optimization makes a lot of sense for loops within DFA.
  24596. // A character will take us back to an existing DFA state
  24597. // that already has lots of edges out of it. e.g., .* in comments.
  24598. // print("Target for:" + str(s) + " and:" + str(t))
  24599. var target = this.getExistingTargetState(s, t);
  24600. // print("Existing:" + str(target))
  24601. if (target === null) {
  24602. target = this.computeTargetState(input, s, t);
  24603. // print("Computed:" + str(target))
  24604. }
  24605. if (target === ATNSimulator.ERROR) {
  24606. break;
  24607. }
  24608. // If this is a consumable input element, make sure to consume before
  24609. // capturing the accept state so the input index, line, and char
  24610. // position accurately reflect the state of the interpreter at the
  24611. // end of the token.
  24612. if (t !== Token.EOF) {
  24613. this.consume(input);
  24614. }
  24615. if (target.isAcceptState) {
  24616. this.captureSimState(this.prevAccept, input, target);
  24617. if (t === Token.EOF) {
  24618. break;
  24619. }
  24620. }
  24621. t = input.LA(1);
  24622. s = target; // flip; current DFA target becomes new src/from state
  24623. }
  24624. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  24625. };
  24626. // Get an existing target state for an edge in the DFA. If the target state
  24627. // for the edge has not yet been computed or is otherwise not available,
  24628. // this method returns {@code null}.
  24629. //
  24630. // @param s The current DFA state
  24631. // @param t The next input symbol
  24632. // @return The existing target DFA state for the given input symbol
  24633. // {@code t}, or {@code null} if the target state for this edge is not
  24634. // already cached
  24635. LexerATNSimulator.prototype.getExistingTargetState = function (s, t) {
  24636. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  24637. return null;
  24638. }
  24639. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  24640. if (target === undefined) {
  24641. target = null;
  24642. }
  24643. if (LexerATNSimulator.debug && target !== null) {
  24644. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  24645. }
  24646. return target;
  24647. };
  24648. // Compute a target state for an edge in the DFA, and attempt to add the
  24649. // computed state and corresponding edge to the DFA.
  24650. //
  24651. // @param input The input stream
  24652. // @param s The current DFA state
  24653. // @param t The next input symbol
  24654. //
  24655. // @return The computed target DFA state for the given input symbol
  24656. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  24657. // returns {@link //ERROR}.
  24658. LexerATNSimulator.prototype.computeTargetState = function (input, s, t) {
  24659. var reach = new OrderedATNConfigSet();
  24660. // if we don't find an existing DFA state
  24661. // Fill reach starting from closure, following t transitions
  24662. this.getReachableConfigSet(input, s.configs, reach, t);
  24663. if (reach.items.length === 0) {
  24664. // we got nowhere on t from s
  24665. if (!reach.hasSemanticContext) {
  24666. // we got nowhere on t, don't throw out this knowledge; it'd
  24667. // cause a failover from DFA later.
  24668. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  24669. }
  24670. // stop when we can't match any more char
  24671. return ATNSimulator.ERROR;
  24672. }
  24673. // Add an edge from s to target DFA found/created for reach
  24674. return this.addDFAEdge(s, t, null, reach);
  24675. };
  24676. LexerATNSimulator.prototype.failOrAccept = function (prevAccept, input, reach, t) {
  24677. if (this.prevAccept.dfaState !== null) {
  24678. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  24679. this.accept(input, lexerActionExecutor, this.startIndex, prevAccept.index, prevAccept.line, prevAccept.column);
  24680. return prevAccept.dfaState.prediction;
  24681. } else {
  24682. // if no accept and EOF is first char, return EOF
  24683. if (t === Token.EOF && input.index === this.startIndex) {
  24684. return Token.EOF;
  24685. }
  24686. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  24687. }
  24688. };
  24689. // Given a starting configuration set, figure out all ATN configurations
  24690. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  24691. // parameter.
  24692. LexerATNSimulator.prototype.getReachableConfigSet = function (input, closure, reach, t) {
  24693. // this is used to skip processing for configs which have a lower priority
  24694. // than a config that already reached an accept state for the same rule
  24695. var skipAlt = ATN.INVALID_ALT_NUMBER;
  24696. for (var i = 0; i < closure.items.length; i++) {
  24697. var cfg = closure.items[i];
  24698. var currentAltReachedAcceptState = cfg.alt === skipAlt;
  24699. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  24700. continue;
  24701. }
  24702. if (LexerATNSimulator.debug) {
  24703. console.log("testing %s at %s\n", this.getTokenName(t), cfg.toString(this.recog, true));
  24704. }
  24705. for (var j = 0; j < cfg.state.transitions.length; j++) {
  24706. var trans = cfg.state.transitions[j]; // for each transition
  24707. var target = this.getReachableTarget(trans, t);
  24708. if (target !== null) {
  24709. var lexerActionExecutor = cfg.lexerActionExecutor;
  24710. if (lexerActionExecutor !== null) {
  24711. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  24712. }
  24713. var treatEofAsEpsilon = t === Token.EOF;
  24714. var config = new LexerATNConfig({ state: target, lexerActionExecutor: lexerActionExecutor }, cfg);
  24715. if (this.closure(input, config, reach, currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  24716. // any remaining configs for this alt have a lower priority
  24717. // than the one that just reached an accept state.
  24718. skipAlt = cfg.alt;
  24719. }
  24720. }
  24721. }
  24722. }
  24723. };
  24724. LexerATNSimulator.prototype.accept = function (input, lexerActionExecutor, startIndex, index, line, charPos) {
  24725. if (LexerATNSimulator.debug) {
  24726. console.log("ACTION %s\n", lexerActionExecutor);
  24727. }
  24728. // seek to after last char in token
  24729. input.seek(index);
  24730. this.line = line;
  24731. this.column = charPos;
  24732. if (lexerActionExecutor !== null && this.recog !== null) {
  24733. lexerActionExecutor.execute(this.recog, input, startIndex);
  24734. }
  24735. };
  24736. LexerATNSimulator.prototype.getReachableTarget = function (trans, t) {
  24737. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  24738. return trans.target;
  24739. } else {
  24740. return null;
  24741. }
  24742. };
  24743. LexerATNSimulator.prototype.computeStartState = function (input, p) {
  24744. var initialContext = PredictionContext.EMPTY;
  24745. var configs = new OrderedATNConfigSet();
  24746. for (var i = 0; i < p.transitions.length; i++) {
  24747. var target = p.transitions[i].target;
  24748. var cfg = new LexerATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  24749. this.closure(input, cfg, configs, false, false, false);
  24750. }
  24751. return configs;
  24752. };
  24753. // Since the alternatives within any lexer decision are ordered by
  24754. // preference, this method stops pursuing the closure as soon as an accept
  24755. // state is reached. After the first accept state is reached by depth-first
  24756. // search from {@code config}, all other (potentially reachable) states for
  24757. // this rule would have a lower priority.
  24758. //
  24759. // @return {@code true} if an accept state is reached, otherwise
  24760. // {@code false}.
  24761. LexerATNSimulator.prototype.closure = function (input, config, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  24762. var cfg = null;
  24763. if (LexerATNSimulator.debug) {
  24764. console.log("closure(" + config.toString(this.recog, true) + ")");
  24765. }
  24766. if (config.state instanceof RuleStopState) {
  24767. if (LexerATNSimulator.debug) {
  24768. if (this.recog !== null) {
  24769. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  24770. } else {
  24771. console.log("closure at rule stop %s\n", config);
  24772. }
  24773. }
  24774. if (config.context === null || config.context.hasEmptyPath()) {
  24775. if (config.context === null || config.context.isEmpty()) {
  24776. configs.add(config);
  24777. return true;
  24778. } else {
  24779. configs.add(new LexerATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config));
  24780. currentAltReachedAcceptState = true;
  24781. }
  24782. }
  24783. if (config.context !== null && !config.context.isEmpty()) {
  24784. for (var i = 0; i < config.context.length; i++) {
  24785. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  24786. var newContext = config.context.getParent(i); // "pop" return state
  24787. var returnState = this.atn.states[config.context.getReturnState(i)];
  24788. cfg = new LexerATNConfig({ state: returnState, context: newContext }, config);
  24789. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  24790. }
  24791. }
  24792. }
  24793. return currentAltReachedAcceptState;
  24794. }
  24795. // optimization
  24796. if (!config.state.epsilonOnlyTransitions) {
  24797. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  24798. configs.add(config);
  24799. }
  24800. }
  24801. for (var j = 0; j < config.state.transitions.length; j++) {
  24802. var trans = config.state.transitions[j];
  24803. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  24804. if (cfg !== null) {
  24805. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  24806. }
  24807. }
  24808. return currentAltReachedAcceptState;
  24809. };
  24810. // side-effect: can alter configs.hasSemanticContext
  24811. LexerATNSimulator.prototype.getEpsilonTarget = function (input, config, trans, configs, speculative, treatEofAsEpsilon) {
  24812. var cfg = null;
  24813. if (trans.serializationType === Transition.RULE) {
  24814. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  24815. cfg = new LexerATNConfig({ state: trans.target, context: newContext }, config);
  24816. } else if (trans.serializationType === Transition.PRECEDENCE) {
  24817. throw "Precedence predicates are not supported in lexers.";
  24818. } else if (trans.serializationType === Transition.PREDICATE) {
  24819. // Track traversing semantic predicates. If we traverse,
  24820. // we cannot add a DFA state for this "reach" computation
  24821. // because the DFA would not test the predicate again in the
  24822. // future. Rather than creating collections of semantic predicates
  24823. // like v3 and testing them on prediction, v4 will test them on the
  24824. // fly all the time using the ATN not the DFA. This is slower but
  24825. // semantically it's not used that often. One of the key elements to
  24826. // this predicate mechanism is not adding DFA states that see
  24827. // predicates immediately afterwards in the ATN. For example,
  24828. // a : ID {p1}? | ID {p2}? ;
  24829. // should create the start state for rule 'a' (to save start state
  24830. // competition), but should not create target of ID state. The
  24831. // collection of ATN states the following ID references includes
  24832. // states reached by traversing predicates. Since this is when we
  24833. // test them, we cannot cash the DFA state target of ID.
  24834. if (LexerATNSimulator.debug) {
  24835. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  24836. }
  24837. configs.hasSemanticContext = true;
  24838. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  24839. cfg = new LexerATNConfig({ state: trans.target }, config);
  24840. }
  24841. } else if (trans.serializationType === Transition.ACTION) {
  24842. if (config.context === null || config.context.hasEmptyPath()) {
  24843. // execute actions anywhere in the start rule for a token.
  24844. //
  24845. // TODO: if the entry rule is invoked recursively, some
  24846. // actions may be executed during the recursive call. The
  24847. // problem can appear when hasEmptyPath() is true but
  24848. // isEmpty() is false. In this case, the config needs to be
  24849. // split into two contexts - one with just the empty path
  24850. // and another with everything but the empty path.
  24851. // Unfortunately, the current algorithm does not allow
  24852. // getEpsilonTarget to return two configurations, so
  24853. // additional modifications are needed before we can support
  24854. // the split operation.
  24855. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor, this.atn.lexerActions[trans.actionIndex]);
  24856. cfg = new LexerATNConfig({ state: trans.target, lexerActionExecutor: lexerActionExecutor }, config);
  24857. } else {
  24858. // ignore actions in referenced rules
  24859. cfg = new LexerATNConfig({ state: trans.target }, config);
  24860. }
  24861. } else if (trans.serializationType === Transition.EPSILON) {
  24862. cfg = new LexerATNConfig({ state: trans.target }, config);
  24863. } else if (trans.serializationType === Transition.ATOM || trans.serializationType === Transition.RANGE || trans.serializationType === Transition.SET) {
  24864. if (treatEofAsEpsilon) {
  24865. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  24866. cfg = new LexerATNConfig({ state: trans.target }, config);
  24867. }
  24868. }
  24869. }
  24870. return cfg;
  24871. };
  24872. // Evaluate a predicate specified in the lexer.
  24873. //
  24874. // <p>If {@code speculative} is {@code true}, this method was called before
  24875. // {@link //consume} for the matched character. This method should call
  24876. // {@link //consume} before evaluating the predicate to ensure position
  24877. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  24878. // and {@link Lexer//getcolumn}, properly reflect the current
  24879. // lexer state. This method should restore {@code input} and the simulator
  24880. // to the original state before returning (i.e. undo the actions made by the
  24881. // call to {@link //consume}.</p>
  24882. //
  24883. // @param input The input stream.
  24884. // @param ruleIndex The rule containing the predicate.
  24885. // @param predIndex The index of the predicate within the rule.
  24886. // @param speculative {@code true} if the current index in {@code input} is
  24887. // one character before the predicate's location.
  24888. //
  24889. // @return {@code true} if the specified predicate evaluates to
  24890. // {@code true}.
  24891. // /
  24892. LexerATNSimulator.prototype.evaluatePredicate = function (input, ruleIndex, predIndex, speculative) {
  24893. // assume true if no recognizer was provided
  24894. if (this.recog === null) {
  24895. return true;
  24896. }
  24897. if (!speculative) {
  24898. return this.recog.sempred(null, ruleIndex, predIndex);
  24899. }
  24900. var savedcolumn = this.column;
  24901. var savedLine = this.line;
  24902. var index = input.index;
  24903. var marker = input.mark();
  24904. try {
  24905. this.consume(input);
  24906. return this.recog.sempred(null, ruleIndex, predIndex);
  24907. } finally {
  24908. this.column = savedcolumn;
  24909. this.line = savedLine;
  24910. input.seek(index);
  24911. input.release(marker);
  24912. }
  24913. };
  24914. LexerATNSimulator.prototype.captureSimState = function (settings, input, dfaState) {
  24915. settings.index = input.index;
  24916. settings.line = this.line;
  24917. settings.column = this.column;
  24918. settings.dfaState = dfaState;
  24919. };
  24920. LexerATNSimulator.prototype.addDFAEdge = function (from_, tk, to, cfgs) {
  24921. if (to === undefined) {
  24922. to = null;
  24923. }
  24924. if (cfgs === undefined) {
  24925. cfgs = null;
  24926. }
  24927. if (to === null && cfgs !== null) {
  24928. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  24929. // marker indicating dynamic predicate evaluation makes this edge
  24930. // dependent on the specific input sequence, so the static edge in the
  24931. // DFA should be omitted. The target DFAState is still created since
  24932. // execATN has the ability to resynchronize with the DFA state cache
  24933. // following the predicate evaluation step.
  24934. //
  24935. // TJP notes: next time through the DFA, we see a pred again and eval.
  24936. // If that gets us to a previously created (but dangling) DFA
  24937. // state, we can continue in pure DFA mode from there.
  24938. // /
  24939. var suppressEdge = cfgs.hasSemanticContext;
  24940. cfgs.hasSemanticContext = false;
  24941. to = this.addDFAState(cfgs);
  24942. if (suppressEdge) {
  24943. return to;
  24944. }
  24945. }
  24946. // add the edge
  24947. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  24948. // Only track edges within the DFA bounds
  24949. return to;
  24950. }
  24951. if (LexerATNSimulator.debug) {
  24952. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  24953. }
  24954. if (from_.edges === null) {
  24955. // make room for tokens 1..n and -1 masquerading as index 0
  24956. from_.edges = [];
  24957. }
  24958. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  24959. return to;
  24960. };
  24961. // Add a new DFA state if there isn't one with this set of
  24962. // configurations already. This method also detects the first
  24963. // configuration containing an ATN rule stop state. Later, when
  24964. // traversing the DFA, we will know which rule to accept.
  24965. LexerATNSimulator.prototype.addDFAState = function (configs) {
  24966. var proposed = new DFAState(null, configs);
  24967. var firstConfigWithRuleStopState = null;
  24968. for (var i = 0; i < configs.items.length; i++) {
  24969. var cfg = configs.items[i];
  24970. if (cfg.state instanceof RuleStopState) {
  24971. firstConfigWithRuleStopState = cfg;
  24972. break;
  24973. }
  24974. }
  24975. if (firstConfigWithRuleStopState !== null) {
  24976. proposed.isAcceptState = true;
  24977. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  24978. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  24979. }
  24980. var dfa = this.decisionToDFA[this.mode];
  24981. var existing = dfa.states.get(proposed);
  24982. if (existing !== null) {
  24983. return existing;
  24984. }
  24985. var newState = proposed;
  24986. newState.stateNumber = dfa.states.length;
  24987. configs.setReadonly(true);
  24988. newState.configs = configs;
  24989. dfa.states.add(newState);
  24990. return newState;
  24991. };
  24992. LexerATNSimulator.prototype.getDFA = function (mode) {
  24993. return this.decisionToDFA[mode];
  24994. };
  24995. // Get the text matched so far for the current token.
  24996. LexerATNSimulator.prototype.getText = function (input) {
  24997. // index is first lookahead char, don't include.
  24998. return input.getText(this.startIndex, input.index - 1);
  24999. };
  25000. LexerATNSimulator.prototype.consume = function (input) {
  25001. var curChar = input.LA(1);
  25002. if (curChar === "\n".charCodeAt(0)) {
  25003. this.line += 1;
  25004. this.column = 0;
  25005. } else {
  25006. this.column += 1;
  25007. }
  25008. input.consume();
  25009. };
  25010. LexerATNSimulator.prototype.getTokenName = function (tt) {
  25011. if (tt === -1) {
  25012. return "EOF";
  25013. } else {
  25014. return "'" + String.fromCharCode(tt) + "'";
  25015. }
  25016. };
  25017. exports.LexerATNSimulator = LexerATNSimulator;
  25018. /***/ }),
  25019. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  25020. /*!************************************************!*\
  25021. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  25022. \************************************************/
  25023. /*! no static exports found */
  25024. /***/ (function(module, exports, __webpack_require__) {
  25025. "use strict";
  25026. //
  25027. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25028. * Use of this file is governed by the BSD 3-clause license that
  25029. * can be found in the LICENSE.txt file in the project root.
  25030. */
  25031. //
  25032. function LexerActionType() {}
  25033. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  25034. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  25035. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  25036. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  25037. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  25038. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  25039. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  25040. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  25041. function LexerAction(action) {
  25042. this.actionType = action;
  25043. this.isPositionDependent = false;
  25044. return this;
  25045. }
  25046. LexerAction.prototype.hashCode = function () {
  25047. var hash = new Hash();
  25048. this.updateHashCode(hash);
  25049. return hash.finish();
  25050. };
  25051. LexerAction.prototype.updateHashCode = function (hash) {
  25052. hash.update(this.actionType);
  25053. };
  25054. LexerAction.prototype.equals = function (other) {
  25055. return this === other;
  25056. };
  25057. //
  25058. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  25059. //
  25060. // <p>The {@code skip} command does not have any parameters, so this action is
  25061. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  25062. function LexerSkipAction() {
  25063. LexerAction.call(this, LexerActionType.SKIP);
  25064. return this;
  25065. }
  25066. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  25067. LexerSkipAction.prototype.constructor = LexerSkipAction;
  25068. // Provides a singleton instance of this parameterless lexer action.
  25069. LexerSkipAction.INSTANCE = new LexerSkipAction();
  25070. LexerSkipAction.prototype.execute = function (lexer) {
  25071. lexer.skip();
  25072. };
  25073. LexerSkipAction.prototype.toString = function () {
  25074. return "skip";
  25075. };
  25076. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  25077. // with the assigned type.
  25078. function LexerTypeAction(type) {
  25079. LexerAction.call(this, LexerActionType.TYPE);
  25080. this.type = type;
  25081. return this;
  25082. }
  25083. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  25084. LexerTypeAction.prototype.constructor = LexerTypeAction;
  25085. LexerTypeAction.prototype.execute = function (lexer) {
  25086. lexer.type = this.type;
  25087. };
  25088. LexerTypeAction.prototype.updateHashCode = function (hash) {
  25089. hash.update(this.actionType, this.type);
  25090. };
  25091. LexerTypeAction.prototype.equals = function (other) {
  25092. if (this === other) {
  25093. return true;
  25094. } else if (!(other instanceof LexerTypeAction)) {
  25095. return false;
  25096. } else {
  25097. return this.type === other.type;
  25098. }
  25099. };
  25100. LexerTypeAction.prototype.toString = function () {
  25101. return "type(" + this.type + ")";
  25102. };
  25103. // Implements the {@code pushMode} lexer action by calling
  25104. // {@link Lexer//pushMode} with the assigned mode.
  25105. function LexerPushModeAction(mode) {
  25106. LexerAction.call(this, LexerActionType.PUSH_MODE);
  25107. this.mode = mode;
  25108. return this;
  25109. }
  25110. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  25111. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  25112. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  25113. // value provided by {@link //getMode}.</p>
  25114. LexerPushModeAction.prototype.execute = function (lexer) {
  25115. lexer.pushMode(this.mode);
  25116. };
  25117. LexerPushModeAction.prototype.updateHashCode = function (hash) {
  25118. hash.update(this.actionType, this.mode);
  25119. };
  25120. LexerPushModeAction.prototype.equals = function (other) {
  25121. if (this === other) {
  25122. return true;
  25123. } else if (!(other instanceof LexerPushModeAction)) {
  25124. return false;
  25125. } else {
  25126. return this.mode === other.mode;
  25127. }
  25128. };
  25129. LexerPushModeAction.prototype.toString = function () {
  25130. return "pushMode(" + this.mode + ")";
  25131. };
  25132. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  25133. //
  25134. // <p>The {@code popMode} command does not have any parameters, so this action is
  25135. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  25136. function LexerPopModeAction() {
  25137. LexerAction.call(this, LexerActionType.POP_MODE);
  25138. return this;
  25139. }
  25140. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  25141. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  25142. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  25143. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  25144. LexerPopModeAction.prototype.execute = function (lexer) {
  25145. lexer.popMode();
  25146. };
  25147. LexerPopModeAction.prototype.toString = function () {
  25148. return "popMode";
  25149. };
  25150. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  25151. //
  25152. // <p>The {@code more} command does not have any parameters, so this action is
  25153. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  25154. function LexerMoreAction() {
  25155. LexerAction.call(this, LexerActionType.MORE);
  25156. return this;
  25157. }
  25158. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  25159. LexerMoreAction.prototype.constructor = LexerMoreAction;
  25160. LexerMoreAction.INSTANCE = new LexerMoreAction();
  25161. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  25162. LexerMoreAction.prototype.execute = function (lexer) {
  25163. lexer.more();
  25164. };
  25165. LexerMoreAction.prototype.toString = function () {
  25166. return "more";
  25167. };
  25168. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  25169. // the assigned mode.
  25170. function LexerModeAction(mode) {
  25171. LexerAction.call(this, LexerActionType.MODE);
  25172. this.mode = mode;
  25173. return this;
  25174. }
  25175. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  25176. LexerModeAction.prototype.constructor = LexerModeAction;
  25177. // <p>This action is implemented by calling {@link Lexer//mode} with the
  25178. // value provided by {@link //getMode}.</p>
  25179. LexerModeAction.prototype.execute = function (lexer) {
  25180. lexer.mode(this.mode);
  25181. };
  25182. LexerModeAction.prototype.updateHashCode = function (hash) {
  25183. hash.update(this.actionType, this.mode);
  25184. };
  25185. LexerModeAction.prototype.equals = function (other) {
  25186. if (this === other) {
  25187. return true;
  25188. } else if (!(other instanceof LexerModeAction)) {
  25189. return false;
  25190. } else {
  25191. return this.mode === other.mode;
  25192. }
  25193. };
  25194. LexerModeAction.prototype.toString = function () {
  25195. return "mode(" + this.mode + ")";
  25196. };
  25197. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  25198. // rule and action indexes assigned to the custom action. The implementation of
  25199. // a custom action is added to the generated code for the lexer in an override
  25200. // of {@link Recognizer//action} when the grammar is compiled.
  25201. //
  25202. // <p>This class may represent embedded actions created with the <code>{...}</code>
  25203. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  25204. // command argument could not be evaluated when the grammar was compiled.</p>
  25205. // Constructs a custom lexer action with the specified rule and action
  25206. // indexes.
  25207. //
  25208. // @param ruleIndex The rule index to use for calls to
  25209. // {@link Recognizer//action}.
  25210. // @param actionIndex The action index to use for calls to
  25211. // {@link Recognizer//action}.
  25212. function LexerCustomAction(ruleIndex, actionIndex) {
  25213. LexerAction.call(this, LexerActionType.CUSTOM);
  25214. this.ruleIndex = ruleIndex;
  25215. this.actionIndex = actionIndex;
  25216. this.isPositionDependent = true;
  25217. return this;
  25218. }
  25219. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  25220. LexerCustomAction.prototype.constructor = LexerCustomAction;
  25221. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  25222. // appropriate rule and action indexes.</p>
  25223. LexerCustomAction.prototype.execute = function (lexer) {
  25224. lexer.action(null, this.ruleIndex, this.actionIndex);
  25225. };
  25226. LexerCustomAction.prototype.updateHashCode = function (hash) {
  25227. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  25228. };
  25229. LexerCustomAction.prototype.equals = function (other) {
  25230. if (this === other) {
  25231. return true;
  25232. } else if (!(other instanceof LexerCustomAction)) {
  25233. return false;
  25234. } else {
  25235. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  25236. }
  25237. };
  25238. // Implements the {@code channel} lexer action by calling
  25239. // {@link Lexer//setChannel} with the assigned channel.
  25240. // Constructs a new {@code channel} action with the specified channel value.
  25241. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  25242. function LexerChannelAction(channel) {
  25243. LexerAction.call(this, LexerActionType.CHANNEL);
  25244. this.channel = channel;
  25245. return this;
  25246. }
  25247. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  25248. LexerChannelAction.prototype.constructor = LexerChannelAction;
  25249. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  25250. // value provided by {@link //getChannel}.</p>
  25251. LexerChannelAction.prototype.execute = function (lexer) {
  25252. lexer._channel = this.channel;
  25253. };
  25254. LexerChannelAction.prototype.updateHashCode = function (hash) {
  25255. hash.update(this.actionType, this.channel);
  25256. };
  25257. LexerChannelAction.prototype.equals = function (other) {
  25258. if (this === other) {
  25259. return true;
  25260. } else if (!(other instanceof LexerChannelAction)) {
  25261. return false;
  25262. } else {
  25263. return this.channel === other.channel;
  25264. }
  25265. };
  25266. LexerChannelAction.prototype.toString = function () {
  25267. return "channel(" + this.channel + ")";
  25268. };
  25269. // This implementation of {@link LexerAction} is used for tracking input offsets
  25270. // for position-dependent actions within a {@link LexerActionExecutor}.
  25271. //
  25272. // <p>This action is not serialized as part of the ATN, and is only required for
  25273. // position-dependent lexer actions which appear at a location other than the
  25274. // end of a rule. For more information about DFA optimizations employed for
  25275. // lexer actions, see {@link LexerActionExecutor//append} and
  25276. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  25277. // Constructs a new indexed custom action by associating a character offset
  25278. // with a {@link LexerAction}.
  25279. //
  25280. // <p>Note: This class is only required for lexer actions for which
  25281. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  25282. //
  25283. // @param offset The offset into the input {@link CharStream}, relative to
  25284. // the token start index, at which the specified lexer action should be
  25285. // executed.
  25286. // @param action The lexer action to execute at a particular offset in the
  25287. // input {@link CharStream}.
  25288. function LexerIndexedCustomAction(offset, action) {
  25289. LexerAction.call(this, action.actionType);
  25290. this.offset = offset;
  25291. this.action = action;
  25292. this.isPositionDependent = true;
  25293. return this;
  25294. }
  25295. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  25296. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  25297. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  25298. // using the provided {@code lexer}.</p>
  25299. LexerIndexedCustomAction.prototype.execute = function (lexer) {
  25300. // assume the input stream position was properly set by the calling code
  25301. this.action.execute(lexer);
  25302. };
  25303. LexerIndexedCustomAction.prototype.updateHashCode = function (hash) {
  25304. hash.update(this.actionType, this.offset, this.action);
  25305. };
  25306. LexerIndexedCustomAction.prototype.equals = function (other) {
  25307. if (this === other) {
  25308. return true;
  25309. } else if (!(other instanceof LexerIndexedCustomAction)) {
  25310. return false;
  25311. } else {
  25312. return this.offset === other.offset && this.action === other.action;
  25313. }
  25314. };
  25315. exports.LexerActionType = LexerActionType;
  25316. exports.LexerSkipAction = LexerSkipAction;
  25317. exports.LexerChannelAction = LexerChannelAction;
  25318. exports.LexerCustomAction = LexerCustomAction;
  25319. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  25320. exports.LexerMoreAction = LexerMoreAction;
  25321. exports.LexerTypeAction = LexerTypeAction;
  25322. exports.LexerPushModeAction = LexerPushModeAction;
  25323. exports.LexerPopModeAction = LexerPopModeAction;
  25324. exports.LexerModeAction = LexerModeAction;
  25325. /***/ }),
  25326. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  25327. /*!********************************************************!*\
  25328. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  25329. \********************************************************/
  25330. /*! no static exports found */
  25331. /***/ (function(module, exports, __webpack_require__) {
  25332. "use strict";
  25333. //
  25334. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25335. * Use of this file is governed by the BSD 3-clause license that
  25336. * can be found in the LICENSE.txt file in the project root.
  25337. */
  25338. ///
  25339. // Represents an executor for a sequence of lexer actions which traversed during
  25340. // the matching operation of a lexer rule (token).
  25341. //
  25342. // <p>The executor tracks position information for position-dependent lexer actions
  25343. // efficiently, ensuring that actions appearing only at the end of the rule do
  25344. // not cause bloating of the {@link DFA} created for the lexer.</p>
  25345. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  25346. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  25347. function LexerActionExecutor(lexerActions) {
  25348. this.lexerActions = lexerActions === null ? [] : lexerActions;
  25349. // Caches the result of {@link //hashCode} since the hash code is an element
  25350. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  25351. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  25352. // lexerActions]))
  25353. return this;
  25354. }
  25355. // Creates a {@link LexerActionExecutor} which executes the actions for
  25356. // the input {@code lexerActionExecutor} followed by a specified
  25357. // {@code lexerAction}.
  25358. //
  25359. // @param lexerActionExecutor The executor for actions already traversed by
  25360. // the lexer while matching a token within a particular
  25361. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  25362. // though it were an empty executor.
  25363. // @param lexerAction The lexer action to execute after the actions
  25364. // specified in {@code lexerActionExecutor}.
  25365. //
  25366. // @return A {@link LexerActionExecutor} for executing the combine actions
  25367. // of {@code lexerActionExecutor} and {@code lexerAction}.
  25368. LexerActionExecutor.append = function (lexerActionExecutor, lexerAction) {
  25369. if (lexerActionExecutor === null) {
  25370. return new LexerActionExecutor([lexerAction]);
  25371. }
  25372. var lexerActions = lexerActionExecutor.lexerActions.concat([lexerAction]);
  25373. return new LexerActionExecutor(lexerActions);
  25374. };
  25375. // Creates a {@link LexerActionExecutor} which encodes the current offset
  25376. // for position-dependent lexer actions.
  25377. //
  25378. // <p>Normally, when the executor encounters lexer actions where
  25379. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  25380. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  25381. // position to the <em>end</em> of the current token. This behavior provides
  25382. // for efficient DFA representation of lexer actions which appear at the end
  25383. // of a lexer rule, even when the lexer rule matches a variable number of
  25384. // characters.</p>
  25385. //
  25386. // <p>Prior to traversing a match transition in the ATN, the current offset
  25387. // from the token start index is assigned to all position-dependent lexer
  25388. // actions which have not already been assigned a fixed offset. By storing
  25389. // the offsets relative to the token start index, the DFA representation of
  25390. // lexer actions which appear in the middle of tokens remains efficient due
  25391. // to sharing among tokens of the same length, regardless of their absolute
  25392. // position in the input stream.</p>
  25393. //
  25394. // <p>If the current executor already has offsets assigned to all
  25395. // position-dependent lexer actions, the method returns {@code this}.</p>
  25396. //
  25397. // @param offset The current offset to assign to all position-dependent
  25398. // lexer actions which do not already have offsets assigned.
  25399. //
  25400. // @return A {@link LexerActionExecutor} which stores input stream offsets
  25401. // for all position-dependent lexer actions.
  25402. // /
  25403. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function (offset) {
  25404. var updatedLexerActions = null;
  25405. for (var i = 0; i < this.lexerActions.length; i++) {
  25406. if (this.lexerActions[i].isPositionDependent && !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  25407. if (updatedLexerActions === null) {
  25408. updatedLexerActions = this.lexerActions.concat([]);
  25409. }
  25410. updatedLexerActions[i] = new LexerIndexedCustomAction(offset, this.lexerActions[i]);
  25411. }
  25412. }
  25413. if (updatedLexerActions === null) {
  25414. return this;
  25415. } else {
  25416. return new LexerActionExecutor(updatedLexerActions);
  25417. }
  25418. };
  25419. // Execute the actions encapsulated by this executor within the context of a
  25420. // particular {@link Lexer}.
  25421. //
  25422. // <p>This method calls {@link IntStream//seek} to set the position of the
  25423. // {@code input} {@link CharStream} prior to calling
  25424. // {@link LexerAction//execute} on a position-dependent action. Before the
  25425. // method returns, the input position will be restored to the same position
  25426. // it was in when the method was invoked.</p>
  25427. //
  25428. // @param lexer The lexer instance.
  25429. // @param input The input stream which is the source for the current token.
  25430. // When this method is called, the current {@link IntStream//index} for
  25431. // {@code input} should be the start of the following token, i.e. 1
  25432. // character past the end of the current token.
  25433. // @param startIndex The token start index. This value may be passed to
  25434. // {@link IntStream//seek} to set the {@code input} position to the beginning
  25435. // of the token.
  25436. // /
  25437. LexerActionExecutor.prototype.execute = function (lexer, input, startIndex) {
  25438. var requiresSeek = false;
  25439. var stopIndex = input.index;
  25440. try {
  25441. for (var i = 0; i < this.lexerActions.length; i++) {
  25442. var lexerAction = this.lexerActions[i];
  25443. if (lexerAction instanceof LexerIndexedCustomAction) {
  25444. var offset = lexerAction.offset;
  25445. input.seek(startIndex + offset);
  25446. lexerAction = lexerAction.action;
  25447. requiresSeek = startIndex + offset !== stopIndex;
  25448. } else if (lexerAction.isPositionDependent) {
  25449. input.seek(stopIndex);
  25450. requiresSeek = false;
  25451. }
  25452. lexerAction.execute(lexer);
  25453. }
  25454. } finally {
  25455. if (requiresSeek) {
  25456. input.seek(stopIndex);
  25457. }
  25458. }
  25459. };
  25460. LexerActionExecutor.prototype.hashCode = function () {
  25461. return this.cachedHashCode;
  25462. };
  25463. LexerActionExecutor.prototype.updateHashCode = function (hash) {
  25464. hash.update(this.cachedHashCode);
  25465. };
  25466. LexerActionExecutor.prototype.equals = function (other) {
  25467. if (this === other) {
  25468. return true;
  25469. } else if (!(other instanceof LexerActionExecutor)) {
  25470. return false;
  25471. } else if (this.cachedHashCode != other.cachedHashCode) {
  25472. return false;
  25473. } else if (this.lexerActions.length != other.lexerActions.length) {
  25474. return false;
  25475. } else {
  25476. var numActions = this.lexerActions.length;
  25477. for (var idx = 0; idx < numActions; ++idx) {
  25478. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  25479. return false;
  25480. }
  25481. }
  25482. return true;
  25483. }
  25484. };
  25485. exports.LexerActionExecutor = LexerActionExecutor;
  25486. /***/ }),
  25487. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  25488. /*!*******************************************************!*\
  25489. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  25490. \*******************************************************/
  25491. /*! no static exports found */
  25492. /***/ (function(module, exports, __webpack_require__) {
  25493. "use strict";
  25494. //
  25495. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25496. * Use of this file is governed by the BSD 3-clause license that
  25497. * can be found in the LICENSE.txt file in the project root.
  25498. */
  25499. //
  25500. //
  25501. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  25502. //
  25503. // <p>
  25504. // The basic complexity of the adaptive strategy makes it harder to understand.
  25505. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  25506. // requests go through the DFA first. If they reach a state without an edge for
  25507. // the current symbol, the algorithm fails over to the ATN simulation to
  25508. // complete the DFA path for the current input (until it finds a conflict state
  25509. // or uniquely predicting state).</p>
  25510. //
  25511. // <p>
  25512. // All of that is done without using the outer context because we want to create
  25513. // a DFA that is not dependent upon the rule invocation stack when we do a
  25514. // prediction. One DFA works in all contexts. We avoid using context not
  25515. // necessarily because it's slower, although it can be, but because of the DFA
  25516. // caching problem. The closure routine only considers the rule invocation stack
  25517. // created during prediction beginning in the decision rule. For example, if
  25518. // prediction occurs without invoking another rule's ATN, there are no context
  25519. // stacks in the configurations. When lack of context leads to a conflict, we
  25520. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  25521. // strategy (versus full LL(*)).</p>
  25522. //
  25523. // <p>
  25524. // When SLL yields a configuration set with conflict, we rewind the input and
  25525. // retry the ATN simulation, this time using full outer context without adding
  25526. // to the DFA. Configuration context stacks will be the full invocation stacks
  25527. // from the start rule. If we get a conflict using full context, then we can
  25528. // definitively say we have a true ambiguity for that input sequence. If we
  25529. // don't get a conflict, it implies that the decision is sensitive to the outer
  25530. // context. (It is not context-sensitive in the sense of context-sensitive
  25531. // grammars.)</p>
  25532. //
  25533. // <p>
  25534. // The next time we reach this DFA state with an SLL conflict, through DFA
  25535. // simulation, we will again retry the ATN simulation using full context mode.
  25536. // This is slow because we can't save the results and have to "interpret" the
  25537. // ATN each time we get that input.</p>
  25538. //
  25539. // <p>
  25540. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  25541. //
  25542. // <p>
  25543. // We could cache results from full context to predicted alternative easily and
  25544. // that saves a lot of time but doesn't work in presence of predicates. The set
  25545. // of visible predicates from the ATN start state changes depending on the
  25546. // context, because closure can fall off the end of a rule. I tried to cache
  25547. // tuples (stack context, semantic context, predicted alt) but it was slower
  25548. // than interpreting and much more complicated. Also required a huge amount of
  25549. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  25550. // to keep this algorithm simple. By launching multiple threads, we can improve
  25551. // the speed of parsing across a large number of files.</p>
  25552. //
  25553. // <p>
  25554. // There is no strict ordering between the amount of input used by SLL vs LL,
  25555. // which makes it really hard to build a cache for full context. Let's say that
  25556. // we have input A B C that leads to an SLL conflict with full context X. That
  25557. // implies that using X we might only use A B but we could also use A B C D to
  25558. // resolve conflict. Input A B C D could predict alternative 1 in one position
  25559. // in the input and A B C E could predict alternative 2 in another position in
  25560. // input. The conflicting SLL configurations could still be non-unique in the
  25561. // full context prediction, which would lead us to requiring more input than the
  25562. // original A B C. To make a prediction cache work, we have to track the exact
  25563. // input used during the previous prediction. That amounts to a cache that maps
  25564. // X to a specific DFA for that context.</p>
  25565. //
  25566. // <p>
  25567. // Something should be done for left-recursive expression predictions. They are
  25568. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  25569. // with full LL thing Sam does.</p>
  25570. //
  25571. // <p>
  25572. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  25573. //
  25574. // <p>
  25575. // We avoid doing full context retry when the outer context is empty, we did not
  25576. // dip into the outer context by falling off the end of the decision state rule,
  25577. // or when we force SLL mode.</p>
  25578. //
  25579. // <p>
  25580. // As an example of the not dip into outer context case, consider as super
  25581. // constructor calls versus function calls. One grammar might look like
  25582. // this:</p>
  25583. //
  25584. // <pre>
  25585. // ctorBody
  25586. // : '{' superCall? stat* '}'
  25587. // ;
  25588. // </pre>
  25589. //
  25590. // <p>
  25591. // Or, you might see something like</p>
  25592. //
  25593. // <pre>
  25594. // stat
  25595. // : superCall ';'
  25596. // | expression ';'
  25597. // | ...
  25598. // ;
  25599. // </pre>
  25600. //
  25601. // <p>
  25602. // In both cases I believe that no closure operations will dip into the outer
  25603. // context. In the first case ctorBody in the worst case will stop at the '}'.
  25604. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  25605. // entry rule and not dip into the outer context.</p>
  25606. //
  25607. // <p>
  25608. // <strong>PREDICATES</strong></p>
  25609. //
  25610. // <p>
  25611. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  25612. // LL simulation deals with predicates differently. SLL collects predicates as
  25613. // it performs closure operations like ANTLR v3 did. It delays predicate
  25614. // evaluation until it reaches and accept state. This allows us to cache the SLL
  25615. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  25616. // closure, the DFA state configuration sets would be different and we couldn't
  25617. // build up a suitable DFA.</p>
  25618. //
  25619. // <p>
  25620. // When building a DFA accept state during ATN simulation, we evaluate any
  25621. // predicates and return the sole semantically valid alternative. If there is
  25622. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  25623. // we throw an exception. Alternatives without predicates act like they have
  25624. // true predicates. The simple way to think about it is to strip away all
  25625. // alternatives with false predicates and choose the minimum alternative that
  25626. // remains.</p>
  25627. //
  25628. // <p>
  25629. // When we start in the DFA and reach an accept state that's predicated, we test
  25630. // those and return the minimum semantically viable alternative. If no
  25631. // alternatives are viable, we throw an exception.</p>
  25632. //
  25633. // <p>
  25634. // During full LL ATN simulation, closure always evaluates predicates and
  25635. // on-the-fly. This is crucial to reducing the configuration set size during
  25636. // closure. It hits a landmine when parsing with the Java grammar, for example,
  25637. // without this on-the-fly evaluation.</p>
  25638. //
  25639. // <p>
  25640. // <strong>SHARING DFA</strong></p>
  25641. //
  25642. // <p>
  25643. // All instances of the same parser share the same decision DFAs through a
  25644. // static field. Each instance gets its own ATN simulator but they share the
  25645. // same {@link //decisionToDFA} field. They also share a
  25646. // {@link PredictionContextCache} object that makes sure that all
  25647. // {@link PredictionContext} objects are shared among the DFA states. This makes
  25648. // a big size difference.</p>
  25649. //
  25650. // <p>
  25651. // <strong>THREAD SAFETY</strong></p>
  25652. //
  25653. // <p>
  25654. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  25655. // it adds a new DFA object to that array. {@link //addDFAEdge}
  25656. // locks on the DFA for the current decision when setting the
  25657. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  25658. // the DFA for the current decision when looking up a DFA state to see if it
  25659. // already exists. We must make sure that all requests to add DFA states that
  25660. // are equivalent result in the same shared DFA object. This is because lots of
  25661. // threads will be trying to update the DFA at once. The
  25662. // {@link //addDFAState} method also locks inside the DFA lock
  25663. // but this time on the shared context cache when it rebuilds the
  25664. // configurations' {@link PredictionContext} objects using cached
  25665. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  25666. // safe as long as we can guarantee that all threads referencing
  25667. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  25668. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  25669. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  25670. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  25671. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  25672. // {@code dfa.edges[t]} to be non-null. The
  25673. // {@link //addDFAEdge} method could be racing to set the field
  25674. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  25675. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  25676. // way it will work because it's not doing a test and set operation.</p>
  25677. //
  25678. // <p>
  25679. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  25680. // Parsing)</strong></p>
  25681. //
  25682. // <p>
  25683. // Sam pointed out that if SLL does not give a syntax error, then there is no
  25684. // point in doing full LL, which is slower. We only have to try LL if we get a
  25685. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  25686. // mode with the {@link BailErrorStrategy}:</p>
  25687. //
  25688. // <pre>
  25689. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  25690. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  25691. // </pre>
  25692. //
  25693. // <p>
  25694. // If it does not get a syntax error, then we're done. If it does get a syntax
  25695. // error, we need to retry with the combined SLL/LL strategy.</p>
  25696. //
  25697. // <p>
  25698. // The reason this works is as follows. If there are no SLL conflicts, then the
  25699. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  25700. // the full LL analysis must yield a set of viable alternatives which is a
  25701. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  25702. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  25703. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  25704. // is truly ambiguous on the current input. If the LL set is smaller, then the
  25705. // SLL conflict resolution might choose an alternative that the full LL would
  25706. // rule out as a possibility based upon better context information. If that's
  25707. // the case, then the SLL parse will definitely get an error because the full LL
  25708. // analysis says it's not viable. If SLL conflict resolution chooses an
  25709. // alternative within the LL set, them both SLL and LL would choose the same
  25710. // alternative because they both choose the minimum of multiple conflicting
  25711. // alternatives.</p>
  25712. //
  25713. // <p>
  25714. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  25715. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  25716. // parsing will get an error because SLL will pursue alternative 1. If
  25717. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  25718. // choose the same alternative because alternative one is the minimum of either
  25719. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  25720. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  25721. //
  25722. // <p>
  25723. // Of course, if the input is invalid, then we will get an error for sure in
  25724. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  25725. // the input.</p>
  25726. //
  25727. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  25728. var Set = Utils.Set;
  25729. var BitSet = Utils.BitSet;
  25730. var DoubleDict = Utils.DoubleDict;
  25731. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  25732. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  25733. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  25734. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  25735. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  25736. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  25737. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  25738. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  25739. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  25740. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  25741. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  25742. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  25743. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  25744. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  25745. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  25746. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  25747. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  25748. var Transition = Transitions.Transition;
  25749. var SetTransition = Transitions.SetTransition;
  25750. var NotSetTransition = Transitions.NotSetTransition;
  25751. var RuleTransition = Transitions.RuleTransition;
  25752. var ActionTransition = Transitions.ActionTransition;
  25753. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  25754. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  25755. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  25756. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  25757. ATNSimulator.call(this, atn, sharedContextCache);
  25758. this.parser = parser;
  25759. this.decisionToDFA = decisionToDFA;
  25760. // SLL, LL, or LL + exact ambig detection?//
  25761. this.predictionMode = PredictionMode.LL;
  25762. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  25763. this._input = null;
  25764. this._startIndex = 0;
  25765. this._outerContext = null;
  25766. this._dfa = null;
  25767. // Each prediction operation uses a cache for merge of prediction contexts.
  25768. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  25769. // isn't synchronized but we're ok since two threads shouldn't reuse same
  25770. // parser/atnsim object because it can only handle one input at a time.
  25771. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  25772. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  25773. // also be examined during cache lookup.
  25774. //
  25775. this.mergeCache = null;
  25776. return this;
  25777. }
  25778. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  25779. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  25780. ParserATNSimulator.prototype.debug = false;
  25781. ParserATNSimulator.prototype.debug_closure = false;
  25782. ParserATNSimulator.prototype.debug_add = false;
  25783. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  25784. ParserATNSimulator.prototype.dfa_debug = false;
  25785. ParserATNSimulator.prototype.retry_debug = false;
  25786. ParserATNSimulator.prototype.reset = function () {};
  25787. ParserATNSimulator.prototype.adaptivePredict = function (input, decision, outerContext) {
  25788. if (this.debug || this.debug_list_atn_decisions) {
  25789. console.log("adaptivePredict decision " + decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  25790. }
  25791. this._input = input;
  25792. this._startIndex = input.index;
  25793. this._outerContext = outerContext;
  25794. var dfa = this.decisionToDFA[decision];
  25795. this._dfa = dfa;
  25796. var m = input.mark();
  25797. var index = input.index;
  25798. // Now we are certain to have a specific decision's DFA
  25799. // But, do we still need an initial state?
  25800. try {
  25801. var s0;
  25802. if (dfa.precedenceDfa) {
  25803. // the start state for a precedence DFA depends on the current
  25804. // parser precedence, and is provided by a DFA method.
  25805. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  25806. } else {
  25807. // the start state for a "regular" DFA is just s0
  25808. s0 = dfa.s0;
  25809. }
  25810. if (s0 === null) {
  25811. if (outerContext === null) {
  25812. outerContext = RuleContext.EMPTY;
  25813. }
  25814. if (this.debug || this.debug_list_atn_decisions) {
  25815. console.log("predictATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  25816. }
  25817. var fullCtx = false;
  25818. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  25819. if (dfa.precedenceDfa) {
  25820. // If this is a precedence DFA, we use applyPrecedenceFilter
  25821. // to convert the computed start state to a precedence start
  25822. // state. We then use DFA.setPrecedenceStartState to set the
  25823. // appropriate start state for the precedence level rather
  25824. // than simply setting DFA.s0.
  25825. //
  25826. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  25827. s0_closure = this.applyPrecedenceFilter(s0_closure);
  25828. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  25829. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  25830. } else {
  25831. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  25832. dfa.s0 = s0;
  25833. }
  25834. }
  25835. var alt = this.execATN(dfa, s0, input, index, outerContext);
  25836. if (this.debug) {
  25837. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  25838. }
  25839. return alt;
  25840. } finally {
  25841. this._dfa = null;
  25842. this.mergeCache = null; // wack cache after each prediction
  25843. input.seek(index);
  25844. input.release(m);
  25845. }
  25846. };
  25847. // Performs ATN simulation to compute a predicted alternative based
  25848. // upon the remaining input, but also updates the DFA cache to avoid
  25849. // having to traverse the ATN again for the same input sequence.
  25850. // There are some key conditions we're looking for after computing a new
  25851. // set of ATN configs (proposed DFA state):
  25852. // if the set is empty, there is no viable alternative for current symbol
  25853. // does the state uniquely predict an alternative?
  25854. // does the state have a conflict that would prevent us from
  25855. // putting it on the work list?
  25856. // We also have some key operations to do:
  25857. // add an edge from previous DFA state to potentially new DFA state, D,
  25858. // upon current symbol but only if adding to work list, which means in all
  25859. // cases except no viable alternative (and possibly non-greedy decisions?)
  25860. // collecting predicates and adding semantic context to DFA accept states
  25861. // adding rule context to context-sensitive DFA accept states
  25862. // consuming an input symbol
  25863. // reporting a conflict
  25864. // reporting an ambiguity
  25865. // reporting a context sensitivity
  25866. // reporting insufficient predicates
  25867. // cover these cases:
  25868. // dead end
  25869. // single alt
  25870. // single alt + preds
  25871. // conflict
  25872. // conflict + preds
  25873. //
  25874. ParserATNSimulator.prototype.execATN = function (dfa, s0, input, startIndex, outerContext) {
  25875. if (this.debug || this.debug_list_atn_decisions) {
  25876. console.log("execATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  25877. }
  25878. var alt;
  25879. var previousD = s0;
  25880. if (this.debug) {
  25881. console.log("s0 = " + s0);
  25882. }
  25883. var t = input.LA(1);
  25884. while (true) {
  25885. // while more work
  25886. var D = this.getExistingTargetState(previousD, t);
  25887. if (D === null) {
  25888. D = this.computeTargetState(dfa, previousD, t);
  25889. }
  25890. if (D === ATNSimulator.ERROR) {
  25891. // if any configs in previous dipped into outer context, that
  25892. // means that input up to t actually finished entry rule
  25893. // at least for SLL decision. Full LL doesn't dip into outer
  25894. // so don't need special case.
  25895. // We will get an error no matter what so delay until after
  25896. // decision; better error message. Also, no reachable target
  25897. // ATN states in SLL implies LL will also get nowhere.
  25898. // If conflict in states that dip out, choose min since we
  25899. // will get error no matter what.
  25900. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  25901. input.seek(startIndex);
  25902. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  25903. if (alt !== ATN.INVALID_ALT_NUMBER) {
  25904. return alt;
  25905. } else {
  25906. throw e;
  25907. }
  25908. }
  25909. if (D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  25910. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  25911. var conflictingAlts = null;
  25912. if (D.predicates !== null) {
  25913. if (this.debug) {
  25914. console.log("DFA state has preds in DFA sim LL failover");
  25915. }
  25916. var conflictIndex = input.index;
  25917. if (conflictIndex !== startIndex) {
  25918. input.seek(startIndex);
  25919. }
  25920. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  25921. if (conflictingAlts.length === 1) {
  25922. if (this.debug) {
  25923. console.log("Full LL avoided");
  25924. }
  25925. return conflictingAlts.minValue();
  25926. }
  25927. if (conflictIndex !== startIndex) {
  25928. // restore the index so reporting the fallback to full
  25929. // context occurs with the index at the correct spot
  25930. input.seek(conflictIndex);
  25931. }
  25932. }
  25933. if (this.dfa_debug) {
  25934. console.log("ctx sensitive state " + outerContext + " in " + D);
  25935. }
  25936. var fullCtx = true;
  25937. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  25938. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  25939. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  25940. return alt;
  25941. }
  25942. if (D.isAcceptState) {
  25943. if (D.predicates === null) {
  25944. return D.prediction;
  25945. }
  25946. var stopIndex = input.index;
  25947. input.seek(startIndex);
  25948. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  25949. if (alts.length === 0) {
  25950. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  25951. } else if (alts.length === 1) {
  25952. return alts.minValue();
  25953. } else {
  25954. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  25955. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  25956. return alts.minValue();
  25957. }
  25958. }
  25959. previousD = D;
  25960. if (t !== Token.EOF) {
  25961. input.consume();
  25962. t = input.LA(1);
  25963. }
  25964. }
  25965. };
  25966. //
  25967. // Get an existing target state for an edge in the DFA. If the target state
  25968. // for the edge has not yet been computed or is otherwise not available,
  25969. // this method returns {@code null}.
  25970. //
  25971. // @param previousD The current DFA state
  25972. // @param t The next input symbol
  25973. // @return The existing target DFA state for the given input symbol
  25974. // {@code t}, or {@code null} if the target state for this edge is not
  25975. // already cached
  25976. //
  25977. ParserATNSimulator.prototype.getExistingTargetState = function (previousD, t) {
  25978. var edges = previousD.edges;
  25979. if (edges === null) {
  25980. return null;
  25981. } else {
  25982. return edges[t + 1] || null;
  25983. }
  25984. };
  25985. //
  25986. // Compute a target state for an edge in the DFA, and attempt to add the
  25987. // computed state and corresponding edge to the DFA.
  25988. //
  25989. // @param dfa The DFA
  25990. // @param previousD The current DFA state
  25991. // @param t The next input symbol
  25992. //
  25993. // @return The computed target DFA state for the given input symbol
  25994. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  25995. // returns {@link //ERROR}.
  25996. //
  25997. ParserATNSimulator.prototype.computeTargetState = function (dfa, previousD, t) {
  25998. var reach = this.computeReachSet(previousD.configs, t, false);
  25999. if (reach === null) {
  26000. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  26001. return ATNSimulator.ERROR;
  26002. }
  26003. // create new target state; we'll add to DFA after it's complete
  26004. var D = new DFAState(null, reach);
  26005. var predictedAlt = this.getUniqueAlt(reach);
  26006. if (this.debug) {
  26007. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  26008. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) + ", previous=" + previousD.configs + ", configs=" + reach + ", predict=" + predictedAlt + ", allSubsetsConflict=" + PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" + this.getConflictingAlts(reach));
  26009. }
  26010. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  26011. // NO CONFLICT, UNIQUELY PREDICTED ALT
  26012. D.isAcceptState = true;
  26013. D.configs.uniqueAlt = predictedAlt;
  26014. D.prediction = predictedAlt;
  26015. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  26016. // MORE THAN ONE VIABLE ALTERNATIVE
  26017. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  26018. D.requiresFullContext = true;
  26019. // in SLL-only mode, we will stop at this state and return the minimum alt
  26020. D.isAcceptState = true;
  26021. D.prediction = D.configs.conflictingAlts.minValue();
  26022. }
  26023. if (D.isAcceptState && D.configs.hasSemanticContext) {
  26024. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  26025. if (D.predicates !== null) {
  26026. D.prediction = ATN.INVALID_ALT_NUMBER;
  26027. }
  26028. }
  26029. // all adds to dfa are done after we've created full D state
  26030. D = this.addDFAEdge(dfa, previousD, t, D);
  26031. return D;
  26032. };
  26033. ParserATNSimulator.prototype.predicateDFAState = function (dfaState, decisionState) {
  26034. // We need to test all predicates, even in DFA states that
  26035. // uniquely predict alternative.
  26036. var nalts = decisionState.transitions.length;
  26037. // Update DFA so reach becomes accept state with (predicate,alt)
  26038. // pairs if preds found for conflicting alts
  26039. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  26040. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  26041. if (altToPred !== null) {
  26042. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  26043. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  26044. } else {
  26045. // There are preds in configs but they might go away
  26046. // when OR'd together like {p}? || NONE == NONE. If neither
  26047. // alt has preds, resolve to min alt
  26048. dfaState.prediction = altsToCollectPredsFrom.minValue();
  26049. }
  26050. };
  26051. // comes back with reach.uniqueAlt set to a valid alt
  26052. ParserATNSimulator.prototype.execATNWithFullContext = function (dfa, D, // how far we got before failing over
  26053. s0, input, startIndex, outerContext) {
  26054. if (this.debug || this.debug_list_atn_decisions) {
  26055. console.log("execATNWithFullContext " + s0);
  26056. }
  26057. var fullCtx = true;
  26058. var foundExactAmbig = false;
  26059. var reach = null;
  26060. var previous = s0;
  26061. input.seek(startIndex);
  26062. var t = input.LA(1);
  26063. var predictedAlt = -1;
  26064. while (true) {
  26065. // while more work
  26066. reach = this.computeReachSet(previous, t, fullCtx);
  26067. if (reach === null) {
  26068. // if any configs in previous dipped into outer context, that
  26069. // means that input up to t actually finished entry rule
  26070. // at least for LL decision. Full LL doesn't dip into outer
  26071. // so don't need special case.
  26072. // We will get an error no matter what so delay until after
  26073. // decision; better error message. Also, no reachable target
  26074. // ATN states in SLL implies LL will also get nowhere.
  26075. // If conflict in states that dip out, choose min since we
  26076. // will get error no matter what.
  26077. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  26078. input.seek(startIndex);
  26079. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  26080. if (alt !== ATN.INVALID_ALT_NUMBER) {
  26081. return alt;
  26082. } else {
  26083. throw e;
  26084. }
  26085. }
  26086. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  26087. if (this.debug) {
  26088. console.log("LL altSubSets=" + altSubSets + ", predict=" + PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" + PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  26089. }
  26090. reach.uniqueAlt = this.getUniqueAlt(reach);
  26091. // unique prediction?
  26092. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  26093. predictedAlt = reach.uniqueAlt;
  26094. break;
  26095. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  26096. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  26097. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  26098. break;
  26099. }
  26100. } else {
  26101. // In exact ambiguity mode, we never try to terminate early.
  26102. // Just keeps scarfing until we know what the conflict is
  26103. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  26104. foundExactAmbig = true;
  26105. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  26106. break;
  26107. }
  26108. // else there are multiple non-conflicting subsets or
  26109. // we're not sure what the ambiguity is yet.
  26110. // So, keep going.
  26111. }
  26112. previous = reach;
  26113. if (t !== Token.EOF) {
  26114. input.consume();
  26115. t = input.LA(1);
  26116. }
  26117. }
  26118. // If the configuration set uniquely predicts an alternative,
  26119. // without conflict, then we know that it's a full LL decision
  26120. // not SLL.
  26121. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  26122. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  26123. return predictedAlt;
  26124. }
  26125. // We do not check predicates here because we have checked them
  26126. // on-the-fly when doing full context prediction.
  26127. //
  26128. // In non-exact ambiguity detection mode, we might actually be able to
  26129. // detect an exact ambiguity, but I'm not going to spend the cycles
  26130. // needed to check. We only emit ambiguity warnings in exact ambiguity
  26131. // mode.
  26132. //
  26133. // For example, we might know that we have conflicting configurations.
  26134. // But, that does not mean that there is no way forward without a
  26135. // conflict. It's possible to have nonconflicting alt subsets as in:
  26136. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  26137. // from
  26138. //
  26139. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  26140. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  26141. //
  26142. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  26143. // would resolve this without conflict to alternative 1. Any other viable
  26144. // next sequence, however, is associated with a conflict. We stop
  26145. // looking for input because no amount of further lookahead will alter
  26146. // the fact that we should predict alternative 1. We just can't say for
  26147. // sure that there is an ambiguity without looking further.
  26148. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  26149. return predictedAlt;
  26150. };
  26151. ParserATNSimulator.prototype.computeReachSet = function (closure, t, fullCtx) {
  26152. if (this.debug) {
  26153. console.log("in computeReachSet, starting closure: " + closure);
  26154. }
  26155. if (this.mergeCache === null) {
  26156. this.mergeCache = new DoubleDict();
  26157. }
  26158. var intermediate = new ATNConfigSet(fullCtx);
  26159. // Configurations already in a rule stop state indicate reaching the end
  26160. // of the decision rule (local context) or end of the start rule (full
  26161. // context). Once reached, these configurations are never updated by a
  26162. // closure operation, so they are handled separately for the performance
  26163. // advantage of having a smaller intermediate set when calling closure.
  26164. //
  26165. // For full-context reach operations, separate handling is required to
  26166. // ensure that the alternative matching the longest overall sequence is
  26167. // chosen when multiple such configurations can match the input.
  26168. var skippedStopStates = null;
  26169. // First figure out where we can reach on input t
  26170. for (var i = 0; i < closure.items.length; i++) {
  26171. var c = closure.items[i];
  26172. if (this.debug_add) {
  26173. console.log("testing " + this.getTokenName(t) + " at " + c);
  26174. }
  26175. if (c.state instanceof RuleStopState) {
  26176. if (fullCtx || t === Token.EOF) {
  26177. if (skippedStopStates === null) {
  26178. skippedStopStates = [];
  26179. }
  26180. skippedStopStates.push(c);
  26181. if (this.debug_add) {
  26182. console.log("added " + c + " to skippedStopStates");
  26183. }
  26184. }
  26185. continue;
  26186. }
  26187. for (var j = 0; j < c.state.transitions.length; j++) {
  26188. var trans = c.state.transitions[j];
  26189. var target = this.getReachableTarget(trans, t);
  26190. if (target !== null) {
  26191. var cfg = new ATNConfig({ state: target }, c);
  26192. intermediate.add(cfg, this.mergeCache);
  26193. if (this.debug_add) {
  26194. console.log("added " + cfg + " to intermediate");
  26195. }
  26196. }
  26197. }
  26198. }
  26199. // Now figure out where the reach operation can take us...
  26200. var reach = null;
  26201. // This block optimizes the reach operation for intermediate sets which
  26202. // trivially indicate a termination state for the overall
  26203. // adaptivePredict operation.
  26204. //
  26205. // The conditions assume that intermediate
  26206. // contains all configurations relevant to the reach set, but this
  26207. // condition is not true when one or more configurations have been
  26208. // withheld in skippedStopStates, or when the current symbol is EOF.
  26209. //
  26210. if (skippedStopStates === null && t !== Token.EOF) {
  26211. if (intermediate.items.length === 1) {
  26212. // Don't pursue the closure if there is just one state.
  26213. // It can only have one alternative; just add to result
  26214. // Also don't pursue the closure if there is unique alternative
  26215. // among the configurations.
  26216. reach = intermediate;
  26217. } else if (this.getUniqueAlt(intermediate) !== ATN.INVALID_ALT_NUMBER) {
  26218. // Also don't pursue the closure if there is unique alternative
  26219. // among the configurations.
  26220. reach = intermediate;
  26221. }
  26222. }
  26223. // If the reach set could not be trivially determined, perform a closure
  26224. // operation on the intermediate set to compute its initial value.
  26225. //
  26226. if (reach === null) {
  26227. reach = new ATNConfigSet(fullCtx);
  26228. var closureBusy = new Set();
  26229. var treatEofAsEpsilon = t === Token.EOF;
  26230. for (var k = 0; k < intermediate.items.length; k++) {
  26231. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  26232. }
  26233. }
  26234. if (t === Token.EOF) {
  26235. // After consuming EOF no additional input is possible, so we are
  26236. // only interested in configurations which reached the end of the
  26237. // decision rule (local context) or end of the start rule (full
  26238. // context). Update reach to contain only these configurations. This
  26239. // handles both explicit EOF transitions in the grammar and implicit
  26240. // EOF transitions following the end of the decision or start rule.
  26241. //
  26242. // When reach==intermediate, no closure operation was performed. In
  26243. // this case, removeAllConfigsNotInRuleStopState needs to check for
  26244. // reachable rule stop states as well as configurations already in
  26245. // a rule stop state.
  26246. //
  26247. // This is handled before the configurations in skippedStopStates,
  26248. // because any configurations potentially added from that list are
  26249. // already guaranteed to meet this condition whether or not it's
  26250. // required.
  26251. //
  26252. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  26253. }
  26254. // If skippedStopStates!==null, then it contains at least one
  26255. // configuration. For full-context reach operations, these
  26256. // configurations reached the end of the start rule, in which case we
  26257. // only add them back to reach if no configuration during the current
  26258. // closure operation reached such a state. This ensures adaptivePredict
  26259. // chooses an alternative matching the longest overall sequence when
  26260. // multiple alternatives are viable.
  26261. //
  26262. if (skippedStopStates !== null && (!fullCtx || !PredictionMode.hasConfigInRuleStopState(reach))) {
  26263. for (var l = 0; l < skippedStopStates.length; l++) {
  26264. reach.add(skippedStopStates[l], this.mergeCache);
  26265. }
  26266. }
  26267. if (reach.items.length === 0) {
  26268. return null;
  26269. } else {
  26270. return reach;
  26271. }
  26272. };
  26273. //
  26274. // Return a configuration set containing only the configurations from
  26275. // {@code configs} which are in a {@link RuleStopState}. If all
  26276. // configurations in {@code configs} are already in a rule stop state, this
  26277. // method simply returns {@code configs}.
  26278. //
  26279. // <p>When {@code lookToEndOfRule} is true, this method uses
  26280. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  26281. // not already in a rule stop state to see if a rule stop state is reachable
  26282. // from the configuration via epsilon-only transitions.</p>
  26283. //
  26284. // @param configs the configuration set to update
  26285. // @param lookToEndOfRule when true, this method checks for rule stop states
  26286. // reachable by epsilon-only transitions from each configuration in
  26287. // {@code configs}.
  26288. //
  26289. // @return {@code configs} if all configurations in {@code configs} are in a
  26290. // rule stop state, otherwise return a new configuration set containing only
  26291. // the configurations from {@code configs} which are in a rule stop state
  26292. //
  26293. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function (configs, lookToEndOfRule) {
  26294. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  26295. return configs;
  26296. }
  26297. var result = new ATNConfigSet(configs.fullCtx);
  26298. for (var i = 0; i < configs.items.length; i++) {
  26299. var config = configs.items[i];
  26300. if (config.state instanceof RuleStopState) {
  26301. result.add(config, this.mergeCache);
  26302. continue;
  26303. }
  26304. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  26305. var nextTokens = this.atn.nextTokens(config.state);
  26306. if (nextTokens.contains(Token.EPSILON)) {
  26307. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  26308. result.add(new ATNConfig({ state: endOfRuleState }, config), this.mergeCache);
  26309. }
  26310. }
  26311. }
  26312. return result;
  26313. };
  26314. ParserATNSimulator.prototype.computeStartState = function (p, ctx, fullCtx) {
  26315. // always at least the implicit call to start rule
  26316. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  26317. var configs = new ATNConfigSet(fullCtx);
  26318. for (var i = 0; i < p.transitions.length; i++) {
  26319. var target = p.transitions[i].target;
  26320. var c = new ATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  26321. var closureBusy = new Set();
  26322. this.closure(c, configs, closureBusy, true, fullCtx, false);
  26323. }
  26324. return configs;
  26325. };
  26326. //
  26327. // This method transforms the start state computed by
  26328. // {@link //computeStartState} to the special start state used by a
  26329. // precedence DFA for a particular precedence value. The transformation
  26330. // process applies the following changes to the start state's configuration
  26331. // set.
  26332. //
  26333. // <ol>
  26334. // <li>Evaluate the precedence predicates for each configuration using
  26335. // {@link SemanticContext//evalPrecedence}.</li>
  26336. // <li>Remove all configurations which predict an alternative greater than
  26337. // 1, for which another configuration that predicts alternative 1 is in the
  26338. // same ATN state with the same prediction context. This transformation is
  26339. // valid for the following reasons:
  26340. // <ul>
  26341. // <li>The closure block cannot contain any epsilon transitions which bypass
  26342. // the body of the closure, so all states reachable via alternative 1 are
  26343. // part of the precedence alternatives of the transformed left-recursive
  26344. // rule.</li>
  26345. // <li>The "primary" portion of a left recursive rule cannot contain an
  26346. // epsilon transition, so the only way an alternative other than 1 can exist
  26347. // in a state that is also reachable via alternative 1 is by nesting calls
  26348. // to the left-recursive rule, with the outer calls not being at the
  26349. // preferred precedence level.</li>
  26350. // </ul>
  26351. // </li>
  26352. // </ol>
  26353. //
  26354. // <p>
  26355. // The prediction context must be considered by this filter to address
  26356. // situations like the following.
  26357. // </p>
  26358. // <code>
  26359. // <pre>
  26360. // grammar TA;
  26361. // prog: statement* EOF;
  26362. // statement: letterA | statement letterA 'b' ;
  26363. // letterA: 'a';
  26364. // </pre>
  26365. // </code>
  26366. // <p>
  26367. // If the above grammar, the ATN state immediately before the token
  26368. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  26369. // of both the primary and closure blocks of the left-recursive rule
  26370. // {@code statement}. The prediction context associated with each of these
  26371. // configurations distinguishes between them, and prevents the alternative
  26372. // which stepped out to {@code prog} (and then back in to {@code statement}
  26373. // from being eliminated by the filter.
  26374. // </p>
  26375. //
  26376. // @param configs The configuration set computed by
  26377. // {@link //computeStartState} as the start state for the DFA.
  26378. // @return The transformed configuration set representing the start state
  26379. // for a precedence DFA at a particular precedence level (determined by
  26380. // calling {@link Parser//getPrecedence}).
  26381. //
  26382. ParserATNSimulator.prototype.applyPrecedenceFilter = function (configs) {
  26383. var config;
  26384. var statesFromAlt1 = [];
  26385. var configSet = new ATNConfigSet(configs.fullCtx);
  26386. for (var i = 0; i < configs.items.length; i++) {
  26387. config = configs.items[i];
  26388. // handle alt 1 first
  26389. if (config.alt !== 1) {
  26390. continue;
  26391. }
  26392. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  26393. if (updatedContext === null) {
  26394. // the configuration was eliminated
  26395. continue;
  26396. }
  26397. statesFromAlt1[config.state.stateNumber] = config.context;
  26398. if (updatedContext !== config.semanticContext) {
  26399. configSet.add(new ATNConfig({ semanticContext: updatedContext }, config), this.mergeCache);
  26400. } else {
  26401. configSet.add(config, this.mergeCache);
  26402. }
  26403. }
  26404. for (i = 0; i < configs.items.length; i++) {
  26405. config = configs.items[i];
  26406. if (config.alt === 1) {
  26407. // already handled
  26408. continue;
  26409. }
  26410. // In the future, this elimination step could be updated to also
  26411. // filter the prediction context for alternatives predicting alt>1
  26412. // (basically a graph subtraction algorithm).
  26413. if (!config.precedenceFilterSuppressed) {
  26414. var context = statesFromAlt1[config.state.stateNumber] || null;
  26415. if (context !== null && context.equals(config.context)) {
  26416. // eliminated
  26417. continue;
  26418. }
  26419. }
  26420. configSet.add(config, this.mergeCache);
  26421. }
  26422. return configSet;
  26423. };
  26424. ParserATNSimulator.prototype.getReachableTarget = function (trans, ttype) {
  26425. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  26426. return trans.target;
  26427. } else {
  26428. return null;
  26429. }
  26430. };
  26431. ParserATNSimulator.prototype.getPredsForAmbigAlts = function (ambigAlts, configs, nalts) {
  26432. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  26433. // altToPred starts as an array of all null contexts. The entry at index i
  26434. // corresponds to alternative i. altToPred[i] may have one of three values:
  26435. // 1. null: no ATNConfig c is found such that c.alt==i
  26436. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  26437. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  26438. // alt i has at least one unpredicated config.
  26439. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  26440. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  26441. //
  26442. // From this, it is clear that NONE||anything==NONE.
  26443. //
  26444. var altToPred = [];
  26445. for (var i = 0; i < configs.items.length; i++) {
  26446. var c = configs.items[i];
  26447. if (ambigAlts.contains(c.alt)) {
  26448. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  26449. }
  26450. }
  26451. var nPredAlts = 0;
  26452. for (i = 1; i < nalts + 1; i++) {
  26453. var pred = altToPred[i] || null;
  26454. if (pred === null) {
  26455. altToPred[i] = SemanticContext.NONE;
  26456. } else if (pred !== SemanticContext.NONE) {
  26457. nPredAlts += 1;
  26458. }
  26459. }
  26460. // nonambig alts are null in altToPred
  26461. if (nPredAlts === 0) {
  26462. altToPred = null;
  26463. }
  26464. if (this.debug) {
  26465. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  26466. }
  26467. return altToPred;
  26468. };
  26469. ParserATNSimulator.prototype.getPredicatePredictions = function (ambigAlts, altToPred) {
  26470. var pairs = [];
  26471. var containsPredicate = false;
  26472. for (var i = 1; i < altToPred.length; i++) {
  26473. var pred = altToPred[i];
  26474. // unpredicated is indicated by SemanticContext.NONE
  26475. if (ambigAlts !== null && ambigAlts.contains(i)) {
  26476. pairs.push(new PredPrediction(pred, i));
  26477. }
  26478. if (pred !== SemanticContext.NONE) {
  26479. containsPredicate = true;
  26480. }
  26481. }
  26482. if (!containsPredicate) {
  26483. return null;
  26484. }
  26485. return pairs;
  26486. };
  26487. //
  26488. // This method is used to improve the localization of error messages by
  26489. // choosing an alternative rather than throwing a
  26490. // {@link NoViableAltException} in particular prediction scenarios where the
  26491. // {@link //ERROR} state was reached during ATN simulation.
  26492. //
  26493. // <p>
  26494. // The default implementation of this method uses the following
  26495. // algorithm to identify an ATN configuration which successfully parsed the
  26496. // decision entry rule. Choosing such an alternative ensures that the
  26497. // {@link ParserRuleContext} returned by the calling rule will be complete
  26498. // and valid, and the syntax error will be reported later at a more
  26499. // localized location.</p>
  26500. //
  26501. // <ul>
  26502. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  26503. // they are semantically valid if predicated, return the min associated alt.</li>
  26504. // <li>Else, if a semantically invalid but syntactically valid path exist
  26505. // or paths exist, return the minimum associated alt.
  26506. // </li>
  26507. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  26508. // </ul>
  26509. //
  26510. // <p>
  26511. // In some scenarios, the algorithm described above could predict an
  26512. // alternative which will result in a {@link FailedPredicateException} in
  26513. // the parser. Specifically, this could occur if the <em>only</em> configuration
  26514. // capable of successfully parsing to the end of the decision rule is
  26515. // blocked by a semantic predicate. By choosing this alternative within
  26516. // {@link //adaptivePredict} instead of throwing a
  26517. // {@link NoViableAltException}, the resulting
  26518. // {@link FailedPredicateException} in the parser will identify the specific
  26519. // predicate which is preventing the parser from successfully parsing the
  26520. // decision rule, which helps developers identify and correct logic errors
  26521. // in semantic predicates.
  26522. // </p>
  26523. //
  26524. // @param configs The ATN configurations which were valid immediately before
  26525. // the {@link //ERROR} state was reached
  26526. // @param outerContext The is the \gamma_0 initial parser context from the paper
  26527. // or the parser stack at the instant before prediction commences.
  26528. //
  26529. // @return The value to return from {@link //adaptivePredict}, or
  26530. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  26531. // identified and {@link //adaptivePredict} should report an error instead.
  26532. //
  26533. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function (configs, outerContext) {
  26534. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  26535. var semValidConfigs = cfgs[0];
  26536. var semInvalidConfigs = cfgs[1];
  26537. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  26538. if (alt !== ATN.INVALID_ALT_NUMBER) {
  26539. // semantically/syntactically viable path exists
  26540. return alt;
  26541. }
  26542. // Is there a syntactically valid path with a failed pred?
  26543. if (semInvalidConfigs.items.length > 0) {
  26544. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  26545. if (alt !== ATN.INVALID_ALT_NUMBER) {
  26546. // syntactically viable path exists
  26547. return alt;
  26548. }
  26549. }
  26550. return ATN.INVALID_ALT_NUMBER;
  26551. };
  26552. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function (configs) {
  26553. var alts = [];
  26554. for (var i = 0; i < configs.items.length; i++) {
  26555. var c = configs.items[i];
  26556. if (c.reachesIntoOuterContext > 0 || c.state instanceof RuleStopState && c.context.hasEmptyPath()) {
  26557. if (alts.indexOf(c.alt) < 0) {
  26558. alts.push(c.alt);
  26559. }
  26560. }
  26561. }
  26562. if (alts.length === 0) {
  26563. return ATN.INVALID_ALT_NUMBER;
  26564. } else {
  26565. return Math.min.apply(null, alts);
  26566. }
  26567. };
  26568. // Walk the list of configurations and split them according to
  26569. // those that have preds evaluating to true/false. If no pred, assume
  26570. // true pred and include in succeeded set. Returns Pair of sets.
  26571. //
  26572. // Create a new set so as not to alter the incoming parameter.
  26573. //
  26574. // Assumption: the input stream has been restored to the starting point
  26575. // prediction, which is where predicates need to evaluate.
  26576. //
  26577. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function (configs, outerContext) {
  26578. var succeeded = new ATNConfigSet(configs.fullCtx);
  26579. var failed = new ATNConfigSet(configs.fullCtx);
  26580. for (var i = 0; i < configs.items.length; i++) {
  26581. var c = configs.items[i];
  26582. if (c.semanticContext !== SemanticContext.NONE) {
  26583. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  26584. if (predicateEvaluationResult) {
  26585. succeeded.add(c);
  26586. } else {
  26587. failed.add(c);
  26588. }
  26589. } else {
  26590. succeeded.add(c);
  26591. }
  26592. }
  26593. return [succeeded, failed];
  26594. };
  26595. // Look through a list of predicate/alt pairs, returning alts for the
  26596. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  26597. // unpredicated config which behaves as "always true." If !complete
  26598. // then we stop at the first predicate that evaluates to true. This
  26599. // includes pairs with null predicates.
  26600. //
  26601. ParserATNSimulator.prototype.evalSemanticContext = function (predPredictions, outerContext, complete) {
  26602. var predictions = new BitSet();
  26603. for (var i = 0; i < predPredictions.length; i++) {
  26604. var pair = predPredictions[i];
  26605. if (pair.pred === SemanticContext.NONE) {
  26606. predictions.add(pair.alt);
  26607. if (!complete) {
  26608. break;
  26609. }
  26610. continue;
  26611. }
  26612. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  26613. if (this.debug || this.dfa_debug) {
  26614. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  26615. }
  26616. if (predicateEvaluationResult) {
  26617. if (this.debug || this.dfa_debug) {
  26618. console.log("PREDICT " + pair.alt);
  26619. }
  26620. predictions.add(pair.alt);
  26621. if (!complete) {
  26622. break;
  26623. }
  26624. }
  26625. }
  26626. return predictions;
  26627. };
  26628. // TODO: If we are doing predicates, there is no point in pursuing
  26629. // closure operations if we reach a DFA state that uniquely predicts
  26630. // alternative. We will not be caching that DFA state and it is a
  26631. // waste to pursue the closure. Might have to advance when we do
  26632. // ambig detection thought :(
  26633. //
  26634. ParserATNSimulator.prototype.closure = function (config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  26635. var initialDepth = 0;
  26636. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates, fullCtx, initialDepth, treatEofAsEpsilon);
  26637. };
  26638. ParserATNSimulator.prototype.closureCheckingStopState = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  26639. if (this.debug || this.debug_closure) {
  26640. console.log("closure(" + config.toString(this.parser, true) + ")");
  26641. // console.log("configs(" + configs.toString() + ")");
  26642. if (config.reachesIntoOuterContext > 50) {
  26643. throw "problem";
  26644. }
  26645. }
  26646. if (config.state instanceof RuleStopState) {
  26647. // We hit rule end. If we have context info, use it
  26648. // run thru all possible stack tops in ctx
  26649. if (!config.context.isEmpty()) {
  26650. for (var i = 0; i < config.context.length; i++) {
  26651. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  26652. if (fullCtx) {
  26653. configs.add(new ATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config), this.mergeCache);
  26654. continue;
  26655. } else {
  26656. // we have no context info, just chase follow links (if greedy)
  26657. if (this.debug) {
  26658. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  26659. }
  26660. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  26661. }
  26662. continue;
  26663. }
  26664. var returnState = this.atn.states[config.context.getReturnState(i)];
  26665. var newContext = config.context.getParent(i); // "pop" return state
  26666. var parms = { state: returnState, alt: config.alt, context: newContext, semanticContext: config.semanticContext };
  26667. var c = new ATNConfig(parms, null);
  26668. // While we have context to pop back from, we may have
  26669. // gotten that context AFTER having falling off a rule.
  26670. // Make sure we track that we are now out of context.
  26671. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  26672. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  26673. }
  26674. return;
  26675. } else if (fullCtx) {
  26676. // reached end of start rule
  26677. configs.add(config, this.mergeCache);
  26678. return;
  26679. } else {
  26680. // else if we have no context info, just chase follow links (if greedy)
  26681. if (this.debug) {
  26682. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  26683. }
  26684. }
  26685. }
  26686. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  26687. };
  26688. // Do the actual work of walking epsilon edges//
  26689. ParserATNSimulator.prototype.closure_ = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  26690. var p = config.state;
  26691. // optimization
  26692. if (!p.epsilonOnlyTransitions) {
  26693. configs.add(config, this.mergeCache);
  26694. // make sure to not return here, because EOF transitions can act as
  26695. // both epsilon transitions and non-epsilon transitions.
  26696. }
  26697. for (var i = 0; i < p.transitions.length; i++) {
  26698. if (i == 0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config)) continue;
  26699. var t = p.transitions[i];
  26700. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  26701. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  26702. if (c !== null) {
  26703. if (!t.isEpsilon && closureBusy.add(c) !== c) {
  26704. // avoid infinite recursion for EOF* and EOF+
  26705. continue;
  26706. }
  26707. var newDepth = depth;
  26708. if (config.state instanceof RuleStopState) {
  26709. // target fell off end of rule; mark resulting c as having dipped into outer context
  26710. // We can't get here if incoming config was rule stop and we had context
  26711. // track how far we dip into outer context. Might
  26712. // come in handy and we avoid evaluating context dependent
  26713. // preds if this is > 0.
  26714. if (closureBusy.add(c) !== c) {
  26715. // avoid infinite recursion for right-recursive rules
  26716. continue;
  26717. }
  26718. if (this._dfa !== null && this._dfa.precedenceDfa) {
  26719. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  26720. c.precedenceFilterSuppressed = true;
  26721. }
  26722. }
  26723. c.reachesIntoOuterContext += 1;
  26724. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  26725. newDepth -= 1;
  26726. if (this.debug) {
  26727. console.log("dips into outer ctx: " + c);
  26728. }
  26729. } else if (t instanceof RuleTransition) {
  26730. // latch when newDepth goes negative - once we step out of the entry context we can't return
  26731. if (newDepth >= 0) {
  26732. newDepth += 1;
  26733. }
  26734. }
  26735. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  26736. }
  26737. }
  26738. };
  26739. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function (config) {
  26740. // return False
  26741. var p = config.state;
  26742. // First check to see if we are in StarLoopEntryState generated during
  26743. // left-recursion elimination. For efficiency, also check if
  26744. // the context has an empty stack case. If so, it would mean
  26745. // global FOLLOW so we can't perform optimization
  26746. // Are we the special loop entry/exit state? or SLL wildcard
  26747. if (p.stateType != ATNState.STAR_LOOP_ENTRY) return false;
  26748. if (p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision || config.context.isEmpty() || config.context.hasEmptyPath()) return false;
  26749. // Require all return states to return back to the same rule that p is in.
  26750. var numCtxs = config.context.length;
  26751. for (var i = 0; i < numCtxs; i++) {
  26752. // for each stack context
  26753. var returnState = this.atn.states[config.context.getReturnState(i)];
  26754. if (returnState.ruleIndex != p.ruleIndex) return false;
  26755. }
  26756. var decisionStartState = p.transitions[0].target;
  26757. var blockEndStateNum = decisionStartState.endState.stateNumber;
  26758. var blockEndState = this.atn.states[blockEndStateNum];
  26759. // Verify that the top of each stack context leads to loop entry/exit
  26760. // state through epsilon edges and w/o leaving rule.
  26761. for (var i = 0; i < numCtxs; i++) {
  26762. // for each stack context
  26763. var returnStateNumber = config.context.getReturnState(i);
  26764. var returnState = this.atn.states[returnStateNumber];
  26765. // all states must have single outgoing epsilon edge
  26766. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon) return false;
  26767. // Look for prefix op case like 'not expr', (' type ')' expr
  26768. var returnStateTarget = returnState.transitions[0].target;
  26769. if (returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p) continue;
  26770. // Look for 'expr op expr' or case where expr's return state is block end
  26771. // of (...)* internal block; the block end points to loop back
  26772. // which points to p but we don't need to check that
  26773. if (returnState == blockEndState) continue;
  26774. // Look for ternary expr ? expr : expr. The return state points at block end,
  26775. // which points at loop entry state
  26776. if (returnStateTarget == blockEndState) continue;
  26777. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  26778. // return state points at block end state of (...)* internal block
  26779. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1 && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p) continue;
  26780. // anything else ain't conforming
  26781. return false;
  26782. }
  26783. return true;
  26784. };
  26785. ParserATNSimulator.prototype.getRuleName = function (index) {
  26786. if (this.parser !== null && index >= 0) {
  26787. return this.parser.ruleNames[index];
  26788. } else {
  26789. return "<rule " + index + ">";
  26790. }
  26791. };
  26792. ParserATNSimulator.prototype.getEpsilonTarget = function (config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  26793. switch (t.serializationType) {
  26794. case Transition.RULE:
  26795. return this.ruleTransition(config, t);
  26796. case Transition.PRECEDENCE:
  26797. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  26798. case Transition.PREDICATE:
  26799. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  26800. case Transition.ACTION:
  26801. return this.actionTransition(config, t);
  26802. case Transition.EPSILON:
  26803. return new ATNConfig({ state: t.target }, config);
  26804. case Transition.ATOM:
  26805. case Transition.RANGE:
  26806. case Transition.SET:
  26807. // EOF transitions act like epsilon transitions after the first EOF
  26808. // transition is traversed
  26809. if (treatEofAsEpsilon) {
  26810. if (t.matches(Token.EOF, 0, 1)) {
  26811. return new ATNConfig({ state: t.target }, config);
  26812. }
  26813. }
  26814. return null;
  26815. default:
  26816. return null;
  26817. }
  26818. };
  26819. ParserATNSimulator.prototype.actionTransition = function (config, t) {
  26820. if (this.debug) {
  26821. var index = t.actionIndex == -1 ? 65535 : t.actionIndex;
  26822. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  26823. }
  26824. return new ATNConfig({ state: t.target }, config);
  26825. };
  26826. ParserATNSimulator.prototype.precedenceTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  26827. if (this.debug) {
  26828. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.precedence + ">=_p, ctx dependent=true");
  26829. if (this.parser !== null) {
  26830. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  26831. }
  26832. }
  26833. var c = null;
  26834. if (collectPredicates && inContext) {
  26835. if (fullCtx) {
  26836. // In full context mode, we can evaluate predicates on-the-fly
  26837. // during closure, which dramatically reduces the size of
  26838. // the config sets. It also obviates the need to test predicates
  26839. // later during conflict resolution.
  26840. var currentPosition = this._input.index;
  26841. this._input.seek(this._startIndex);
  26842. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  26843. this._input.seek(currentPosition);
  26844. if (predSucceeds) {
  26845. c = new ATNConfig({ state: pt.target }, config); // no pred context
  26846. }
  26847. } else {
  26848. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  26849. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  26850. }
  26851. } else {
  26852. c = new ATNConfig({ state: pt.target }, config);
  26853. }
  26854. if (this.debug) {
  26855. console.log("config from pred transition=" + c);
  26856. }
  26857. return c;
  26858. };
  26859. ParserATNSimulator.prototype.predTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  26860. if (this.debug) {
  26861. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex + ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  26862. if (this.parser !== null) {
  26863. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  26864. }
  26865. }
  26866. var c = null;
  26867. if (collectPredicates && (pt.isCtxDependent && inContext || !pt.isCtxDependent)) {
  26868. if (fullCtx) {
  26869. // In full context mode, we can evaluate predicates on-the-fly
  26870. // during closure, which dramatically reduces the size of
  26871. // the config sets. It also obviates the need to test predicates
  26872. // later during conflict resolution.
  26873. var currentPosition = this._input.index;
  26874. this._input.seek(this._startIndex);
  26875. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  26876. this._input.seek(currentPosition);
  26877. if (predSucceeds) {
  26878. c = new ATNConfig({ state: pt.target }, config); // no pred context
  26879. }
  26880. } else {
  26881. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  26882. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  26883. }
  26884. } else {
  26885. c = new ATNConfig({ state: pt.target }, config);
  26886. }
  26887. if (this.debug) {
  26888. console.log("config from pred transition=" + c);
  26889. }
  26890. return c;
  26891. };
  26892. ParserATNSimulator.prototype.ruleTransition = function (config, t) {
  26893. if (this.debug) {
  26894. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  26895. }
  26896. var returnState = t.followState;
  26897. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  26898. return new ATNConfig({ state: t.target, context: newContext }, config);
  26899. };
  26900. ParserATNSimulator.prototype.getConflictingAlts = function (configs) {
  26901. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  26902. return PredictionMode.getAlts(altsets);
  26903. };
  26904. // Sam pointed out a problem with the previous definition, v3, of
  26905. // ambiguous states. If we have another state associated with conflicting
  26906. // alternatives, we should keep going. For example, the following grammar
  26907. //
  26908. // s : (ID | ID ID?) ';' ;
  26909. //
  26910. // When the ATN simulation reaches the state before ';', it has a DFA
  26911. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  26912. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  26913. // because alternative to has another way to continue, via [6|2|[]].
  26914. // The key is that we have a single state that has config's only associated
  26915. // with a single alternative, 2, and crucially the state transitions
  26916. // among the configurations are all non-epsilon transitions. That means
  26917. // we don't consider any conflicts that include alternative 2. So, we
  26918. // ignore the conflict between alts 1 and 2. We ignore a set of
  26919. // conflicting alts when there is an intersection with an alternative
  26920. // associated with a single alt state in the state&rarr;config-list map.
  26921. //
  26922. // It's also the case that we might have two conflicting configurations but
  26923. // also a 3rd nonconflicting configuration for a different alternative:
  26924. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  26925. //
  26926. // a : A | A | A B ;
  26927. //
  26928. // After matching input A, we reach the stop state for rule A, state 1.
  26929. // State 8 is the state right before B. Clearly alternatives 1 and 2
  26930. // conflict and no amount of further lookahead will separate the two.
  26931. // However, alternative 3 will be able to continue and so we do not
  26932. // stop working on this state. In the previous example, we're concerned
  26933. // with states associated with the conflicting alternatives. Here alt
  26934. // 3 is not associated with the conflicting configs, but since we can continue
  26935. // looking for input reasonably, I don't declare the state done. We
  26936. // ignore a set of conflicting alts when we have an alternative
  26937. // that we still need to pursue.
  26938. //
  26939. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function (configs) {
  26940. var conflictingAlts = null;
  26941. if (configs.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  26942. conflictingAlts = new BitSet();
  26943. conflictingAlts.add(configs.uniqueAlt);
  26944. } else {
  26945. conflictingAlts = configs.conflictingAlts;
  26946. }
  26947. return conflictingAlts;
  26948. };
  26949. ParserATNSimulator.prototype.getTokenName = function (t) {
  26950. if (t === Token.EOF) {
  26951. return "EOF";
  26952. }
  26953. if (this.parser !== null && this.parser.literalNames !== null) {
  26954. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  26955. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  26956. console.log("" + this.parser.getInputStream().getTokens());
  26957. } else {
  26958. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  26959. return name + "<" + t + ">";
  26960. }
  26961. }
  26962. return "" + t;
  26963. };
  26964. ParserATNSimulator.prototype.getLookaheadName = function (input) {
  26965. return this.getTokenName(input.LA(1));
  26966. };
  26967. // Used for debugging in adaptivePredict around execATN but I cut
  26968. // it out for clarity now that alg. works well. We can leave this
  26969. // "dead" code for a bit.
  26970. //
  26971. ParserATNSimulator.prototype.dumpDeadEndConfigs = function (nvae) {
  26972. console.log("dead end configs: ");
  26973. var decs = nvae.getDeadEndConfigs();
  26974. for (var i = 0; i < decs.length; i++) {
  26975. var c = decs[i];
  26976. var trans = "no edges";
  26977. if (c.state.transitions.length > 0) {
  26978. var t = c.state.transitions[0];
  26979. if (t instanceof AtomTransition) {
  26980. trans = "Atom " + this.getTokenName(t.label);
  26981. } else if (t instanceof SetTransition) {
  26982. var neg = t instanceof NotSetTransition;
  26983. trans = (neg ? "~" : "") + "Set " + t.set;
  26984. }
  26985. }
  26986. console.error(c.toString(this.parser, true) + ":" + trans);
  26987. }
  26988. };
  26989. ParserATNSimulator.prototype.noViableAlt = function (input, outerContext, configs, startIndex) {
  26990. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  26991. };
  26992. ParserATNSimulator.prototype.getUniqueAlt = function (configs) {
  26993. var alt = ATN.INVALID_ALT_NUMBER;
  26994. for (var i = 0; i < configs.items.length; i++) {
  26995. var c = configs.items[i];
  26996. if (alt === ATN.INVALID_ALT_NUMBER) {
  26997. alt = c.alt; // found first alt
  26998. } else if (c.alt !== alt) {
  26999. return ATN.INVALID_ALT_NUMBER;
  27000. }
  27001. }
  27002. return alt;
  27003. };
  27004. //
  27005. // Add an edge to the DFA, if possible. This method calls
  27006. // {@link //addDFAState} to ensure the {@code to} state is present in the
  27007. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  27008. // range of edges that can be represented in the DFA tables, this method
  27009. // returns without adding the edge to the DFA.
  27010. //
  27011. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  27012. // Otherwise, this method returns the {@link DFAState} returned by calling
  27013. // {@link //addDFAState} for the {@code to} state.</p>
  27014. //
  27015. // @param dfa The DFA
  27016. // @param from The source state for the edge
  27017. // @param t The input symbol
  27018. // @param to The target state for the edge
  27019. //
  27020. // @return If {@code to} is {@code null}, this method returns {@code null};
  27021. // otherwise this method returns the result of calling {@link //addDFAState}
  27022. // on {@code to}
  27023. //
  27024. ParserATNSimulator.prototype.addDFAEdge = function (dfa, from_, t, to) {
  27025. if (this.debug) {
  27026. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  27027. }
  27028. if (to === null) {
  27029. return null;
  27030. }
  27031. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  27032. if (from_ === null || t < -1 || t > this.atn.maxTokenType) {
  27033. return to;
  27034. }
  27035. if (from_.edges === null) {
  27036. from_.edges = [];
  27037. }
  27038. from_.edges[t + 1] = to; // connect
  27039. if (this.debug) {
  27040. var literalNames = this.parser === null ? null : this.parser.literalNames;
  27041. var symbolicNames = this.parser === null ? null : this.parser.symbolicNames;
  27042. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  27043. }
  27044. return to;
  27045. };
  27046. //
  27047. // Add state {@code D} to the DFA if it is not already present, and return
  27048. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  27049. // is already in the DFA, the existing state is returned. Otherwise this
  27050. // method returns {@code D} after adding it to the DFA.
  27051. //
  27052. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  27053. // does not change the DFA.</p>
  27054. //
  27055. // @param dfa The dfa
  27056. // @param D The DFA state to add
  27057. // @return The state stored in the DFA. This will be either the existing
  27058. // state if {@code D} is already in the DFA, or {@code D} itself if the
  27059. // state was not already present.
  27060. //
  27061. ParserATNSimulator.prototype.addDFAState = function (dfa, D) {
  27062. if (D == ATNSimulator.ERROR) {
  27063. return D;
  27064. }
  27065. var existing = dfa.states.get(D);
  27066. if (existing !== null) {
  27067. return existing;
  27068. }
  27069. D.stateNumber = dfa.states.length;
  27070. if (!D.configs.readOnly) {
  27071. D.configs.optimizeConfigs(this);
  27072. D.configs.setReadonly(true);
  27073. }
  27074. dfa.states.add(D);
  27075. if (this.debug) {
  27076. console.log("adding new DFA state: " + D);
  27077. }
  27078. return D;
  27079. };
  27080. ParserATNSimulator.prototype.reportAttemptingFullContext = function (dfa, conflictingAlts, configs, startIndex, stopIndex) {
  27081. if (this.debug || this.retry_debug) {
  27082. var interval = new Interval(startIndex, stopIndex + 1);
  27083. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  27084. }
  27085. if (this.parser !== null) {
  27086. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  27087. }
  27088. };
  27089. ParserATNSimulator.prototype.reportContextSensitivity = function (dfa, prediction, configs, startIndex, stopIndex) {
  27090. if (this.debug || this.retry_debug) {
  27091. var interval = new Interval(startIndex, stopIndex + 1);
  27092. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  27093. }
  27094. if (this.parser !== null) {
  27095. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  27096. }
  27097. };
  27098. // If context sensitive parsing, we know it's ambiguity not conflict//
  27099. ParserATNSimulator.prototype.reportAmbiguity = function (dfa, D, startIndex, stopIndex, exact, ambigAlts, configs) {
  27100. if (this.debug || this.retry_debug) {
  27101. var interval = new Interval(startIndex, stopIndex + 1);
  27102. console.log("reportAmbiguity " + ambigAlts + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  27103. }
  27104. if (this.parser !== null) {
  27105. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  27106. }
  27107. };
  27108. exports.ParserATNSimulator = ParserATNSimulator;
  27109. /***/ }),
  27110. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  27111. /*!***************************************************!*\
  27112. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  27113. \***************************************************/
  27114. /*! no static exports found */
  27115. /***/ (function(module, exports, __webpack_require__) {
  27116. "use strict";
  27117. //
  27118. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27119. * Use of this file is governed by the BSD 3-clause license that
  27120. * can be found in the LICENSE.txt file in the project root.
  27121. */
  27122. //
  27123. //
  27124. // This enumeration defines the prediction modes available in ANTLR 4 along with
  27125. // utility methods for analyzing configuration sets for conflicts and/or
  27126. // ambiguities.
  27127. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  27128. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  27129. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  27130. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  27131. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  27132. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  27133. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  27134. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  27135. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  27136. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  27137. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  27138. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  27139. function PredictionMode() {
  27140. return this;
  27141. }
  27142. //
  27143. // The SLL(*) prediction mode. This prediction mode ignores the current
  27144. // parser context when making predictions. This is the fastest prediction
  27145. // mode, and provides correct results for many grammars. This prediction
  27146. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  27147. // may result in syntax errors for grammar and input combinations which are
  27148. // not SLL.
  27149. //
  27150. // <p>
  27151. // When using this prediction mode, the parser will either return a correct
  27152. // parse tree (i.e. the same parse tree that would be returned with the
  27153. // {@link //LL} prediction mode), or it will report a syntax error. If a
  27154. // syntax error is encountered when using the {@link //SLL} prediction mode,
  27155. // it may be due to either an actual syntax error in the input or indicate
  27156. // that the particular combination of grammar and input requires the more
  27157. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  27158. //
  27159. // <p>
  27160. // This prediction mode does not provide any guarantees for prediction
  27161. // behavior for syntactically-incorrect inputs.</p>
  27162. //
  27163. PredictionMode.SLL = 0;
  27164. //
  27165. // The LL(*) prediction mode. This prediction mode allows the current parser
  27166. // context to be used for resolving SLL conflicts that occur during
  27167. // prediction. This is the fastest prediction mode that guarantees correct
  27168. // parse results for all combinations of grammars with syntactically correct
  27169. // inputs.
  27170. //
  27171. // <p>
  27172. // When using this prediction mode, the parser will make correct decisions
  27173. // for all syntactically-correct grammar and input combinations. However, in
  27174. // cases where the grammar is truly ambiguous this prediction mode might not
  27175. // report a precise answer for <em>exactly which</em> alternatives are
  27176. // ambiguous.</p>
  27177. //
  27178. // <p>
  27179. // This prediction mode does not provide any guarantees for prediction
  27180. // behavior for syntactically-incorrect inputs.</p>
  27181. //
  27182. PredictionMode.LL = 1;
  27183. //
  27184. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  27185. // the correctness guarantees provided by the {@link //LL} prediction mode,
  27186. // this prediction mode instructs the prediction algorithm to determine the
  27187. // complete and exact set of ambiguous alternatives for every ambiguous
  27188. // decision encountered while parsing.
  27189. //
  27190. // <p>
  27191. // This prediction mode may be used for diagnosing ambiguities during
  27192. // grammar development. Due to the performance overhead of calculating sets
  27193. // of ambiguous alternatives, this prediction mode should be avoided when
  27194. // the exact results are not necessary.</p>
  27195. //
  27196. // <p>
  27197. // This prediction mode does not provide any guarantees for prediction
  27198. // behavior for syntactically-incorrect inputs.</p>
  27199. //
  27200. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  27201. //
  27202. // Computes the SLL prediction termination condition.
  27203. //
  27204. // <p>
  27205. // This method computes the SLL prediction termination condition for both of
  27206. // the following cases.</p>
  27207. //
  27208. // <ul>
  27209. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  27210. // <li>Pure SLL without LL fallback</li>
  27211. // </ul>
  27212. //
  27213. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  27214. //
  27215. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  27216. // ensured regardless of how the termination condition is computed by this
  27217. // method. Due to the substantially higher cost of LL prediction, the
  27218. // prediction should only fall back to LL when the additional lookahead
  27219. // cannot lead to a unique SLL prediction.</p>
  27220. //
  27221. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  27222. // conflicting subsets should fall back to full LL, even if the
  27223. // configuration sets don't resolve to the same alternative (e.g.
  27224. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  27225. // configuration, SLL could continue with the hopes that more lookahead will
  27226. // resolve via one of those non-conflicting configurations.</p>
  27227. //
  27228. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  27229. // stops when it sees only conflicting configuration subsets. In contrast,
  27230. // full LL keeps going when there is uncertainty.</p>
  27231. //
  27232. // <p><strong>HEURISTIC</strong></p>
  27233. //
  27234. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  27235. // unless we see a state that only has one alternative associated with it.
  27236. // The single-alt-state thing lets prediction continue upon rules like
  27237. // (otherwise, it would admit defeat too soon):</p>
  27238. //
  27239. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  27240. //
  27241. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  27242. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  27243. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  27244. // processing this node because alternative to has another way to continue,
  27245. // via {@code [6|2|[]]}.</p>
  27246. //
  27247. // <p>It also let's us continue for this rule:</p>
  27248. //
  27249. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  27250. //
  27251. // <p>After matching input A, we reach the stop state for rule A, state 1.
  27252. // State 8 is the state right before B. Clearly alternatives 1 and 2
  27253. // conflict and no amount of further lookahead will separate the two.
  27254. // However, alternative 3 will be able to continue and so we do not stop
  27255. // working on this state. In the previous example, we're concerned with
  27256. // states associated with the conflicting alternatives. Here alt 3 is not
  27257. // associated with the conflicting configs, but since we can continue
  27258. // looking for input reasonably, don't declare the state done.</p>
  27259. //
  27260. // <p><strong>PURE SLL PARSING</strong></p>
  27261. //
  27262. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  27263. // combine stack contexts for configurations that differ only by semantic
  27264. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  27265. //
  27266. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  27267. //
  27268. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  27269. // states because they need to create the DFA cache that works in all
  27270. // semantic situations. In contrast, full LL evaluates predicates collected
  27271. // during start state computation so it can ignore predicates thereafter.
  27272. // This means that SLL termination detection can totally ignore semantic
  27273. // predicates.</p>
  27274. //
  27275. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  27276. // semantic predicate contexts so we might see two configurations like the
  27277. // following.</p>
  27278. //
  27279. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  27280. //
  27281. // <p>Before testing these configurations against others, we have to merge
  27282. // {@code x} and {@code x'} (without modifying the existing configurations).
  27283. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  27284. // the following configurations.</p>
  27285. //
  27286. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  27287. //
  27288. // <p>If the configuration set has predicates (as indicated by
  27289. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  27290. // the configurations to strip out all of the predicates so that a standard
  27291. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  27292. //
  27293. PredictionMode.hasSLLConflictTerminatingPrediction = function (mode, configs) {
  27294. // Configs in rule stop states indicate reaching the end of the decision
  27295. // rule (local context) or end of start rule (full context). If all
  27296. // configs meet this condition, then none of the configurations is able
  27297. // to match additional input so we terminate prediction.
  27298. //
  27299. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  27300. return true;
  27301. }
  27302. // pure SLL mode parsing
  27303. if (mode === PredictionMode.SLL) {
  27304. // Don't bother with combining configs from different semantic
  27305. // contexts if we can fail over to full LL; costs more time
  27306. // since we'll often fail over anyway.
  27307. if (configs.hasSemanticContext) {
  27308. // dup configs, tossing out semantic predicates
  27309. var dup = new ATNConfigSet();
  27310. for (var i = 0; i < configs.items.length; i++) {
  27311. var c = configs.items[i];
  27312. c = new ATNConfig({ semanticContext: SemanticContext.NONE }, c);
  27313. dup.add(c);
  27314. }
  27315. configs = dup;
  27316. }
  27317. // now we have combined contexts for configs with dissimilar preds
  27318. }
  27319. // pure SLL or combined SLL+LL mode parsing
  27320. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  27321. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  27322. };
  27323. // Checks if any configuration in {@code configs} is in a
  27324. // {@link RuleStopState}. Configurations meeting this condition have reached
  27325. // the end of the decision rule (local context) or end of start rule (full
  27326. // context).
  27327. //
  27328. // @param configs the configuration set to test
  27329. // @return {@code true} if any configuration in {@code configs} is in a
  27330. // {@link RuleStopState}, otherwise {@code false}
  27331. PredictionMode.hasConfigInRuleStopState = function (configs) {
  27332. for (var i = 0; i < configs.items.length; i++) {
  27333. var c = configs.items[i];
  27334. if (c.state instanceof RuleStopState) {
  27335. return true;
  27336. }
  27337. }
  27338. return false;
  27339. };
  27340. // Checks if all configurations in {@code configs} are in a
  27341. // {@link RuleStopState}. Configurations meeting this condition have reached
  27342. // the end of the decision rule (local context) or end of start rule (full
  27343. // context).
  27344. //
  27345. // @param configs the configuration set to test
  27346. // @return {@code true} if all configurations in {@code configs} are in a
  27347. // {@link RuleStopState}, otherwise {@code false}
  27348. PredictionMode.allConfigsInRuleStopStates = function (configs) {
  27349. for (var i = 0; i < configs.items.length; i++) {
  27350. var c = configs.items[i];
  27351. if (!(c.state instanceof RuleStopState)) {
  27352. return false;
  27353. }
  27354. }
  27355. return true;
  27356. };
  27357. //
  27358. // Full LL prediction termination.
  27359. //
  27360. // <p>Can we stop looking ahead during ATN simulation or is there some
  27361. // uncertainty as to which alternative we will ultimately pick, after
  27362. // consuming more input? Even if there are partial conflicts, we might know
  27363. // that everything is going to resolve to the same minimum alternative. That
  27364. // means we can stop since no more lookahead will change that fact. On the
  27365. // other hand, there might be multiple conflicts that resolve to different
  27366. // minimums. That means we need more look ahead to decide which of those
  27367. // alternatives we should predict.</p>
  27368. //
  27369. // <p>The basic idea is to split the set of configurations {@code C}, into
  27370. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  27371. // non-conflicting configurations. Two configurations conflict if they have
  27372. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  27373. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  27374. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  27375. //
  27376. // <p>Reduce these configuration subsets to the set of possible alternatives.
  27377. // You can compute the alternative subsets in one pass as follows:</p>
  27378. //
  27379. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  27380. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  27381. //
  27382. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  27383. //
  27384. // <pre>
  27385. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  27386. // alt and not pred
  27387. // </pre>
  27388. //
  27389. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  27390. //
  27391. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  27392. // {@code s} and {@code ctx}.</p>
  27393. //
  27394. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  27395. // the union of these alternative subsets is a singleton, then no amount of
  27396. // more lookahead will help us. We will always pick that alternative. If,
  27397. // however, there is more than one alternative, then we are uncertain which
  27398. // alternative to predict and must continue looking for resolution. We may
  27399. // or may not discover an ambiguity in the future, even if there are no
  27400. // conflicting subsets this round.</p>
  27401. //
  27402. // <p>The biggest sin is to terminate early because it means we've made a
  27403. // decision but were uncertain as to the eventual outcome. We haven't used
  27404. // enough lookahead. On the other hand, announcing a conflict too late is no
  27405. // big deal; you will still have the conflict. It's just inefficient. It
  27406. // might even look until the end of file.</p>
  27407. //
  27408. // <p>No special consideration for semantic predicates is required because
  27409. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  27410. // no configuration contains a semantic context during the termination
  27411. // check.</p>
  27412. //
  27413. // <p><strong>CONFLICTING CONFIGS</strong></p>
  27414. //
  27415. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  27416. // when {@code i!=j} but {@code x=x'}. Because we merge all
  27417. // {@code (s, i, _)} configurations together, that means that there are at
  27418. // most {@code n} configurations associated with state {@code s} for
  27419. // {@code n} possible alternatives in the decision. The merged stacks
  27420. // complicate the comparison of configuration contexts {@code x} and
  27421. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  27422. // merge and checking to see if the merged result is either {@code x} or
  27423. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  27424. // is the superset, then {@code i} is the only possible prediction since the
  27425. // others resolve to {@code min(i)} as well. However, if {@code x} is
  27426. // associated with {@code j>i} then at least one stack configuration for
  27427. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  27428. // should keep going, looking for more lookahead due to the uncertainty.</p>
  27429. //
  27430. // <p>For simplicity, I'm doing a equality check between {@code x} and
  27431. // {@code x'} that lets the algorithm continue to consume lookahead longer
  27432. // than necessary. The reason I like the equality is of course the
  27433. // simplicity but also because that is the test you need to detect the
  27434. // alternatives that are actually in conflict.</p>
  27435. //
  27436. // <p><strong>CONTINUE/STOP RULE</strong></p>
  27437. //
  27438. // <p>Continue if union of resolved alternative sets from non-conflicting and
  27439. // conflicting alternative subsets has more than one alternative. We are
  27440. // uncertain about which alternative to predict.</p>
  27441. //
  27442. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  27443. // alternatives are still in the running for the amount of input we've
  27444. // consumed at this point. The conflicting sets let us to strip away
  27445. // configurations that won't lead to more states because we resolve
  27446. // conflicts to the configuration with a minimum alternate for the
  27447. // conflicting set.</p>
  27448. //
  27449. // <p><strong>CASES</strong></p>
  27450. //
  27451. // <ul>
  27452. //
  27453. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  27454. //
  27455. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  27456. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  27457. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  27458. // {@code {1,3}} =&gt; continue
  27459. // </li>
  27460. //
  27461. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  27462. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  27463. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  27464. // {@code {1}} =&gt; stop and predict 1</li>
  27465. //
  27466. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  27467. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  27468. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  27469. // ambiguity {@code {1,2}}</li>
  27470. //
  27471. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  27472. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  27473. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  27474. //
  27475. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  27476. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  27477. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  27478. //
  27479. // </ul>
  27480. //
  27481. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  27482. //
  27483. // <p>If all states report the same conflicting set of alternatives, then we
  27484. // know we have the exact ambiguity set.</p>
  27485. //
  27486. // <p><code>|A_<em>i</em>|&gt;1</code> and
  27487. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  27488. //
  27489. // <p>In other words, we continue examining lookahead until all {@code A_i}
  27490. // have more than one alternative and all {@code A_i} are the same. If
  27491. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  27492. // because the resolved set is {@code {1}}. To determine what the real
  27493. // ambiguity is, we have to know whether the ambiguity is between one and
  27494. // two or one and three so we keep going. We can only stop prediction when
  27495. // we need exact ambiguity detection when the sets look like
  27496. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  27497. //
  27498. PredictionMode.resolvesToJustOneViableAlt = function (altsets) {
  27499. return PredictionMode.getSingleViableAlt(altsets);
  27500. };
  27501. //
  27502. // Determines if every alternative subset in {@code altsets} contains more
  27503. // than one alternative.
  27504. //
  27505. // @param altsets a collection of alternative subsets
  27506. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  27507. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  27508. //
  27509. PredictionMode.allSubsetsConflict = function (altsets) {
  27510. return !PredictionMode.hasNonConflictingAltSet(altsets);
  27511. };
  27512. //
  27513. // Determines if any single alternative subset in {@code altsets} contains
  27514. // exactly one alternative.
  27515. //
  27516. // @param altsets a collection of alternative subsets
  27517. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  27518. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  27519. //
  27520. PredictionMode.hasNonConflictingAltSet = function (altsets) {
  27521. for (var i = 0; i < altsets.length; i++) {
  27522. var alts = altsets[i];
  27523. if (alts.length === 1) {
  27524. return true;
  27525. }
  27526. }
  27527. return false;
  27528. };
  27529. //
  27530. // Determines if any single alternative subset in {@code altsets} contains
  27531. // more than one alternative.
  27532. //
  27533. // @param altsets a collection of alternative subsets
  27534. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  27535. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  27536. //
  27537. PredictionMode.hasConflictingAltSet = function (altsets) {
  27538. for (var i = 0; i < altsets.length; i++) {
  27539. var alts = altsets[i];
  27540. if (alts.length > 1) {
  27541. return true;
  27542. }
  27543. }
  27544. return false;
  27545. };
  27546. //
  27547. // Determines if every alternative subset in {@code altsets} is equivalent.
  27548. //
  27549. // @param altsets a collection of alternative subsets
  27550. // @return {@code true} if every member of {@code altsets} is equal to the
  27551. // others, otherwise {@code false}
  27552. //
  27553. PredictionMode.allSubsetsEqual = function (altsets) {
  27554. var first = null;
  27555. for (var i = 0; i < altsets.length; i++) {
  27556. var alts = altsets[i];
  27557. if (first === null) {
  27558. first = alts;
  27559. } else if (alts !== first) {
  27560. return false;
  27561. }
  27562. }
  27563. return true;
  27564. };
  27565. //
  27566. // Returns the unique alternative predicted by all alternative subsets in
  27567. // {@code altsets}. If no such alternative exists, this method returns
  27568. // {@link ATN//INVALID_ALT_NUMBER}.
  27569. //
  27570. // @param altsets a collection of alternative subsets
  27571. //
  27572. PredictionMode.getUniqueAlt = function (altsets) {
  27573. var all = PredictionMode.getAlts(altsets);
  27574. if (all.length === 1) {
  27575. return all.minValue();
  27576. } else {
  27577. return ATN.INVALID_ALT_NUMBER;
  27578. }
  27579. };
  27580. // Gets the complete set of represented alternatives for a collection of
  27581. // alternative subsets. This method returns the union of each {@link BitSet}
  27582. // in {@code altsets}.
  27583. //
  27584. // @param altsets a collection of alternative subsets
  27585. // @return the set of represented alternatives in {@code altsets}
  27586. //
  27587. PredictionMode.getAlts = function (altsets) {
  27588. var all = new BitSet();
  27589. altsets.map(function (alts) {
  27590. all.or(alts);
  27591. });
  27592. return all;
  27593. };
  27594. //
  27595. // This function gets the conflicting alt subsets from a configuration set.
  27596. // For each configuration {@code c} in {@code configs}:
  27597. //
  27598. // <pre>
  27599. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  27600. // alt and not pred
  27601. // </pre>
  27602. PredictionMode.getConflictingAltSubsets = function (configs) {
  27603. var configToAlts = new Map();
  27604. configToAlts.hashFunction = function (cfg) {
  27605. hashStuff(cfg.state.stateNumber, cfg.context);
  27606. };
  27607. configToAlts.equalsFunction = function (c1, c2) {
  27608. return c1.state.stateNumber == c2.state.stateNumber && c1.context.equals(c2.context);
  27609. };
  27610. configs.items.map(function (cfg) {
  27611. var alts = configToAlts.get(cfg);
  27612. if (alts === null) {
  27613. alts = new BitSet();
  27614. configToAlts.put(cfg, alts);
  27615. }
  27616. alts.add(cfg.alt);
  27617. });
  27618. return configToAlts.getValues();
  27619. };
  27620. //
  27621. // Get a map from state to alt subset from a configuration set. For each
  27622. // configuration {@code c} in {@code configs}:
  27623. //
  27624. // <pre>
  27625. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  27626. // </pre>
  27627. //
  27628. PredictionMode.getStateToAltMap = function (configs) {
  27629. var m = new AltDict();
  27630. configs.items.map(function (c) {
  27631. var alts = m.get(c.state);
  27632. if (alts === null) {
  27633. alts = new BitSet();
  27634. m.put(c.state, alts);
  27635. }
  27636. alts.add(c.alt);
  27637. });
  27638. return m;
  27639. };
  27640. PredictionMode.hasStateAssociatedWithOneAlt = function (configs) {
  27641. var values = PredictionMode.getStateToAltMap(configs).values();
  27642. for (var i = 0; i < values.length; i++) {
  27643. if (values[i].length === 1) {
  27644. return true;
  27645. }
  27646. }
  27647. return false;
  27648. };
  27649. PredictionMode.getSingleViableAlt = function (altsets) {
  27650. var result = null;
  27651. for (var i = 0; i < altsets.length; i++) {
  27652. var alts = altsets[i];
  27653. var minAlt = alts.minValue();
  27654. if (result === null) {
  27655. result = minAlt;
  27656. } else if (result !== minAlt) {
  27657. // more than 1 viable alt
  27658. return ATN.INVALID_ALT_NUMBER;
  27659. }
  27660. }
  27661. return result;
  27662. };
  27663. exports.PredictionMode = PredictionMode;
  27664. /***/ }),
  27665. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  27666. /*!****************************************************!*\
  27667. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  27668. \****************************************************/
  27669. /*! no static exports found */
  27670. /***/ (function(module, exports, __webpack_require__) {
  27671. "use strict";
  27672. //
  27673. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27674. * Use of this file is governed by the BSD 3-clause license that
  27675. * can be found in the LICENSE.txt file in the project root.
  27676. */
  27677. //
  27678. // A tree structure used to record the semantic context in which
  27679. // an ATN configuration is valid. It's either a single predicate,
  27680. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  27681. //
  27682. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  27683. // {@link SemanticContext} within the scope of this outer class.</p>
  27684. //
  27685. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  27686. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  27687. function SemanticContext() {
  27688. return this;
  27689. }
  27690. SemanticContext.prototype.hashCode = function () {
  27691. var hash = new Hash();
  27692. this.updateHashCode(hash);
  27693. return hash.finish();
  27694. };
  27695. // For context independent predicates, we evaluate them without a local
  27696. // context (i.e., null context). That way, we can evaluate them without
  27697. // having to create proper rule-specific context during prediction (as
  27698. // opposed to the parser, which creates them naturally). In a practical
  27699. // sense, this avoids a cast exception from RuleContext to myruleContext.
  27700. //
  27701. // <p>For context dependent predicates, we must pass in a local context so that
  27702. // references such as $arg evaluate properly as _localctx.arg. We only
  27703. // capture context dependent predicates in the context in which we begin
  27704. // prediction, so we passed in the outer context here in case of context
  27705. // dependent predicate evaluation.</p>
  27706. //
  27707. SemanticContext.prototype.evaluate = function (parser, outerContext) {};
  27708. //
  27709. // Evaluate the precedence predicates for the context and reduce the result.
  27710. //
  27711. // @param parser The parser instance.
  27712. // @param outerContext The current parser context object.
  27713. // @return The simplified semantic context after precedence predicates are
  27714. // evaluated, which will be one of the following values.
  27715. // <ul>
  27716. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  27717. // precedence predicates are evaluated.</li>
  27718. // <li>{@code null}: if the predicate simplifies to {@code false} after
  27719. // precedence predicates are evaluated.</li>
  27720. // <li>{@code this}: if the semantic context is not changed as a result of
  27721. // precedence predicate evaluation.</li>
  27722. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  27723. // semantic context after precedence predicates are evaluated.</li>
  27724. // </ul>
  27725. //
  27726. SemanticContext.prototype.evalPrecedence = function (parser, outerContext) {
  27727. return this;
  27728. };
  27729. SemanticContext.andContext = function (a, b) {
  27730. if (a === null || a === SemanticContext.NONE) {
  27731. return b;
  27732. }
  27733. if (b === null || b === SemanticContext.NONE) {
  27734. return a;
  27735. }
  27736. var result = new AND(a, b);
  27737. if (result.opnds.length === 1) {
  27738. return result.opnds[0];
  27739. } else {
  27740. return result;
  27741. }
  27742. };
  27743. SemanticContext.orContext = function (a, b) {
  27744. if (a === null) {
  27745. return b;
  27746. }
  27747. if (b === null) {
  27748. return a;
  27749. }
  27750. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  27751. return SemanticContext.NONE;
  27752. }
  27753. var result = new OR(a, b);
  27754. if (result.opnds.length === 1) {
  27755. return result.opnds[0];
  27756. } else {
  27757. return result;
  27758. }
  27759. };
  27760. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  27761. SemanticContext.call(this);
  27762. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  27763. this.predIndex = predIndex === undefined ? -1 : predIndex;
  27764. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  27765. return this;
  27766. }
  27767. Predicate.prototype = Object.create(SemanticContext.prototype);
  27768. Predicate.prototype.constructor = Predicate;
  27769. //The default {@link SemanticContext}, which is semantically equivalent to
  27770. //a predicate of the form {@code {true}?}.
  27771. //
  27772. SemanticContext.NONE = new Predicate();
  27773. Predicate.prototype.evaluate = function (parser, outerContext) {
  27774. var localctx = this.isCtxDependent ? outerContext : null;
  27775. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  27776. };
  27777. Predicate.prototype.updateHashCode = function (hash) {
  27778. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  27779. };
  27780. Predicate.prototype.equals = function (other) {
  27781. if (this === other) {
  27782. return true;
  27783. } else if (!(other instanceof Predicate)) {
  27784. return false;
  27785. } else {
  27786. return this.ruleIndex === other.ruleIndex && this.predIndex === other.predIndex && this.isCtxDependent === other.isCtxDependent;
  27787. }
  27788. };
  27789. Predicate.prototype.toString = function () {
  27790. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  27791. };
  27792. function PrecedencePredicate(precedence) {
  27793. SemanticContext.call(this);
  27794. this.precedence = precedence === undefined ? 0 : precedence;
  27795. }
  27796. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  27797. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  27798. PrecedencePredicate.prototype.evaluate = function (parser, outerContext) {
  27799. return parser.precpred(outerContext, this.precedence);
  27800. };
  27801. PrecedencePredicate.prototype.evalPrecedence = function (parser, outerContext) {
  27802. if (parser.precpred(outerContext, this.precedence)) {
  27803. return SemanticContext.NONE;
  27804. } else {
  27805. return null;
  27806. }
  27807. };
  27808. PrecedencePredicate.prototype.compareTo = function (other) {
  27809. return this.precedence - other.precedence;
  27810. };
  27811. PrecedencePredicate.prototype.updateHashCode = function (hash) {
  27812. hash.update(31);
  27813. };
  27814. PrecedencePredicate.prototype.equals = function (other) {
  27815. if (this === other) {
  27816. return true;
  27817. } else if (!(other instanceof PrecedencePredicate)) {
  27818. return false;
  27819. } else {
  27820. return this.precedence === other.precedence;
  27821. }
  27822. };
  27823. PrecedencePredicate.prototype.toString = function () {
  27824. return "{" + this.precedence + ">=prec}?";
  27825. };
  27826. PrecedencePredicate.filterPrecedencePredicates = function (set) {
  27827. var result = [];
  27828. set.values().map(function (context) {
  27829. if (context instanceof PrecedencePredicate) {
  27830. result.push(context);
  27831. }
  27832. });
  27833. return result;
  27834. };
  27835. // A semantic context which is true whenever none of the contained contexts
  27836. // is false.
  27837. //
  27838. function AND(a, b) {
  27839. SemanticContext.call(this);
  27840. var operands = new Set();
  27841. if (a instanceof AND) {
  27842. a.opnds.map(function (o) {
  27843. operands.add(o);
  27844. });
  27845. } else {
  27846. operands.add(a);
  27847. }
  27848. if (b instanceof AND) {
  27849. b.opnds.map(function (o) {
  27850. operands.add(o);
  27851. });
  27852. } else {
  27853. operands.add(b);
  27854. }
  27855. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  27856. if (precedencePredicates.length > 0) {
  27857. // interested in the transition with the lowest precedence
  27858. var reduced = null;
  27859. precedencePredicates.map(function (p) {
  27860. if (reduced === null || p.precedence < reduced.precedence) {
  27861. reduced = p;
  27862. }
  27863. });
  27864. operands.add(reduced);
  27865. }
  27866. this.opnds = operands.values();
  27867. return this;
  27868. }
  27869. AND.prototype = Object.create(SemanticContext.prototype);
  27870. AND.prototype.constructor = AND;
  27871. AND.prototype.equals = function (other) {
  27872. if (this === other) {
  27873. return true;
  27874. } else if (!(other instanceof AND)) {
  27875. return false;
  27876. } else {
  27877. return this.opnds === other.opnds;
  27878. }
  27879. };
  27880. AND.prototype.updateHashCode = function (hash) {
  27881. hash.update(this.opnds, "AND");
  27882. };
  27883. //
  27884. // {@inheritDoc}
  27885. //
  27886. // <p>
  27887. // The evaluation of predicates by this context is short-circuiting, but
  27888. // unordered.</p>
  27889. //
  27890. AND.prototype.evaluate = function (parser, outerContext) {
  27891. for (var i = 0; i < this.opnds.length; i++) {
  27892. if (!this.opnds[i].evaluate(parser, outerContext)) {
  27893. return false;
  27894. }
  27895. }
  27896. return true;
  27897. };
  27898. AND.prototype.evalPrecedence = function (parser, outerContext) {
  27899. var differs = false;
  27900. var operands = [];
  27901. for (var i = 0; i < this.opnds.length; i++) {
  27902. var context = this.opnds[i];
  27903. var evaluated = context.evalPrecedence(parser, outerContext);
  27904. differs |= evaluated !== context;
  27905. if (evaluated === null) {
  27906. // The AND context is false if any element is false
  27907. return null;
  27908. } else if (evaluated !== SemanticContext.NONE) {
  27909. // Reduce the result by skipping true elements
  27910. operands.push(evaluated);
  27911. }
  27912. }
  27913. if (!differs) {
  27914. return this;
  27915. }
  27916. if (operands.length === 0) {
  27917. // all elements were true, so the AND context is true
  27918. return SemanticContext.NONE;
  27919. }
  27920. var result = null;
  27921. operands.map(function (o) {
  27922. result = result === null ? o : SemanticContext.andContext(result, o);
  27923. });
  27924. return result;
  27925. };
  27926. AND.prototype.toString = function () {
  27927. var s = "";
  27928. this.opnds.map(function (o) {
  27929. s += "&& " + o.toString();
  27930. });
  27931. return s.length > 3 ? s.slice(3) : s;
  27932. };
  27933. //
  27934. // A semantic context which is true whenever at least one of the contained
  27935. // contexts is true.
  27936. //
  27937. function OR(a, b) {
  27938. SemanticContext.call(this);
  27939. var operands = new Set();
  27940. if (a instanceof OR) {
  27941. a.opnds.map(function (o) {
  27942. operands.add(o);
  27943. });
  27944. } else {
  27945. operands.add(a);
  27946. }
  27947. if (b instanceof OR) {
  27948. b.opnds.map(function (o) {
  27949. operands.add(o);
  27950. });
  27951. } else {
  27952. operands.add(b);
  27953. }
  27954. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  27955. if (precedencePredicates.length > 0) {
  27956. // interested in the transition with the highest precedence
  27957. var s = precedencePredicates.sort(function (a, b) {
  27958. return a.compareTo(b);
  27959. });
  27960. var reduced = s[s.length - 1];
  27961. operands.add(reduced);
  27962. }
  27963. this.opnds = operands.values();
  27964. return this;
  27965. }
  27966. OR.prototype = Object.create(SemanticContext.prototype);
  27967. OR.prototype.constructor = OR;
  27968. OR.prototype.constructor = function (other) {
  27969. if (this === other) {
  27970. return true;
  27971. } else if (!(other instanceof OR)) {
  27972. return false;
  27973. } else {
  27974. return this.opnds === other.opnds;
  27975. }
  27976. };
  27977. OR.prototype.updateHashCode = function (hash) {
  27978. hash.update(this.opnds, "OR");
  27979. };
  27980. // <p>
  27981. // The evaluation of predicates by this context is short-circuiting, but
  27982. // unordered.</p>
  27983. //
  27984. OR.prototype.evaluate = function (parser, outerContext) {
  27985. for (var i = 0; i < this.opnds.length; i++) {
  27986. if (this.opnds[i].evaluate(parser, outerContext)) {
  27987. return true;
  27988. }
  27989. }
  27990. return false;
  27991. };
  27992. OR.prototype.evalPrecedence = function (parser, outerContext) {
  27993. var differs = false;
  27994. var operands = [];
  27995. for (var i = 0; i < this.opnds.length; i++) {
  27996. var context = this.opnds[i];
  27997. var evaluated = context.evalPrecedence(parser, outerContext);
  27998. differs |= evaluated !== context;
  27999. if (evaluated === SemanticContext.NONE) {
  28000. // The OR context is true if any element is true
  28001. return SemanticContext.NONE;
  28002. } else if (evaluated !== null) {
  28003. // Reduce the result by skipping false elements
  28004. operands.push(evaluated);
  28005. }
  28006. }
  28007. if (!differs) {
  28008. return this;
  28009. }
  28010. if (operands.length === 0) {
  28011. // all elements were false, so the OR context is false
  28012. return null;
  28013. }
  28014. var result = null;
  28015. operands.map(function (o) {
  28016. return result === null ? o : SemanticContext.orContext(result, o);
  28017. });
  28018. return result;
  28019. };
  28020. OR.prototype.toString = function () {
  28021. var s = "";
  28022. this.opnds.map(function (o) {
  28023. s += "|| " + o.toString();
  28024. });
  28025. return s.length > 3 ? s.slice(3) : s;
  28026. };
  28027. exports.SemanticContext = SemanticContext;
  28028. exports.PrecedencePredicate = PrecedencePredicate;
  28029. exports.Predicate = Predicate;
  28030. /***/ }),
  28031. /***/ "./node_modules/antlr4/atn/Transition.js":
  28032. /*!***********************************************!*\
  28033. !*** ./node_modules/antlr4/atn/Transition.js ***!
  28034. \***********************************************/
  28035. /*! no static exports found */
  28036. /***/ (function(module, exports, __webpack_require__) {
  28037. "use strict";
  28038. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28039. * Use of this file is governed by the BSD 3-clause license that
  28040. * can be found in the LICENSE.txt file in the project root.
  28041. */
  28042. //
  28043. // An ATN transition between any two ATN states. Subclasses define
  28044. // atom, set, epsilon, action, predicate, rule transitions.
  28045. //
  28046. // <p>This is a one way link. It emanates from a state (usually via a list of
  28047. // transitions) and has a target state.</p>
  28048. //
  28049. // <p>Since we never have to change the ATN transitions once we construct it,
  28050. // we can fix these transitions as specific classes. The DFA transitions
  28051. // on the other hand need to update the labels as it adds transitions to
  28052. // the states. We'll use the term Edge for the DFA to distinguish them from
  28053. // ATN transitions.</p>
  28054. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  28055. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  28056. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  28057. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  28058. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  28059. function Transition(target) {
  28060. // The target of this transition.
  28061. if (target === undefined || target === null) {
  28062. throw "target cannot be null.";
  28063. }
  28064. this.target = target;
  28065. // Are we epsilon, action, sempred?
  28066. this.isEpsilon = false;
  28067. this.label = null;
  28068. return this;
  28069. }
  28070. // constants for serialization
  28071. Transition.EPSILON = 1;
  28072. Transition.RANGE = 2;
  28073. Transition.RULE = 3;
  28074. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  28075. Transition.ATOM = 5;
  28076. Transition.ACTION = 6;
  28077. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  28078. Transition.NOT_SET = 8;
  28079. Transition.WILDCARD = 9;
  28080. Transition.PRECEDENCE = 10;
  28081. Transition.serializationNames = ["INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE"];
  28082. Transition.serializationTypes = {
  28083. EpsilonTransition: Transition.EPSILON,
  28084. RangeTransition: Transition.RANGE,
  28085. RuleTransition: Transition.RULE,
  28086. PredicateTransition: Transition.PREDICATE,
  28087. AtomTransition: Transition.ATOM,
  28088. ActionTransition: Transition.ACTION,
  28089. SetTransition: Transition.SET,
  28090. NotSetTransition: Transition.NOT_SET,
  28091. WildcardTransition: Transition.WILDCARD,
  28092. PrecedencePredicateTransition: Transition.PRECEDENCE
  28093. };
  28094. // TODO: make all transitions sets? no, should remove set edges
  28095. function AtomTransition(target, label) {
  28096. Transition.call(this, target);
  28097. this.label_ = label; // The token type or character value; or, signifies special label.
  28098. this.label = this.makeLabel();
  28099. this.serializationType = Transition.ATOM;
  28100. return this;
  28101. }
  28102. AtomTransition.prototype = Object.create(Transition.prototype);
  28103. AtomTransition.prototype.constructor = AtomTransition;
  28104. AtomTransition.prototype.makeLabel = function () {
  28105. var s = new IntervalSet();
  28106. s.addOne(this.label_);
  28107. return s;
  28108. };
  28109. AtomTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  28110. return this.label_ === symbol;
  28111. };
  28112. AtomTransition.prototype.toString = function () {
  28113. return this.label_;
  28114. };
  28115. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  28116. Transition.call(this, ruleStart);
  28117. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  28118. this.precedence = precedence;
  28119. this.followState = followState; // what node to begin computations following ref to rule
  28120. this.serializationType = Transition.RULE;
  28121. this.isEpsilon = true;
  28122. return this;
  28123. }
  28124. RuleTransition.prototype = Object.create(Transition.prototype);
  28125. RuleTransition.prototype.constructor = RuleTransition;
  28126. RuleTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  28127. return false;
  28128. };
  28129. function EpsilonTransition(target, outermostPrecedenceReturn) {
  28130. Transition.call(this, target);
  28131. this.serializationType = Transition.EPSILON;
  28132. this.isEpsilon = true;
  28133. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  28134. return this;
  28135. }
  28136. EpsilonTransition.prototype = Object.create(Transition.prototype);
  28137. EpsilonTransition.prototype.constructor = EpsilonTransition;
  28138. EpsilonTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  28139. return false;
  28140. };
  28141. EpsilonTransition.prototype.toString = function () {
  28142. return "epsilon";
  28143. };
  28144. function RangeTransition(target, start, stop) {
  28145. Transition.call(this, target);
  28146. this.serializationType = Transition.RANGE;
  28147. this.start = start;
  28148. this.stop = stop;
  28149. this.label = this.makeLabel();
  28150. return this;
  28151. }
  28152. RangeTransition.prototype = Object.create(Transition.prototype);
  28153. RangeTransition.prototype.constructor = RangeTransition;
  28154. RangeTransition.prototype.makeLabel = function () {
  28155. var s = new IntervalSet();
  28156. s.addRange(this.start, this.stop);
  28157. return s;
  28158. };
  28159. RangeTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  28160. return symbol >= this.start && symbol <= this.stop;
  28161. };
  28162. RangeTransition.prototype.toString = function () {
  28163. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  28164. };
  28165. function AbstractPredicateTransition(target) {
  28166. Transition.call(this, target);
  28167. return this;
  28168. }
  28169. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  28170. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  28171. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  28172. AbstractPredicateTransition.call(this, target);
  28173. this.serializationType = Transition.PREDICATE;
  28174. this.ruleIndex = ruleIndex;
  28175. this.predIndex = predIndex;
  28176. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  28177. this.isEpsilon = true;
  28178. return this;
  28179. }
  28180. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  28181. PredicateTransition.prototype.constructor = PredicateTransition;
  28182. PredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  28183. return false;
  28184. };
  28185. PredicateTransition.prototype.getPredicate = function () {
  28186. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  28187. };
  28188. PredicateTransition.prototype.toString = function () {
  28189. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  28190. };
  28191. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  28192. Transition.call(this, target);
  28193. this.serializationType = Transition.ACTION;
  28194. this.ruleIndex = ruleIndex;
  28195. this.actionIndex = actionIndex === undefined ? -1 : actionIndex;
  28196. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  28197. this.isEpsilon = true;
  28198. return this;
  28199. }
  28200. ActionTransition.prototype = Object.create(Transition.prototype);
  28201. ActionTransition.prototype.constructor = ActionTransition;
  28202. ActionTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  28203. return false;
  28204. };
  28205. ActionTransition.prototype.toString = function () {
  28206. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  28207. };
  28208. // A transition containing a set of values.
  28209. function SetTransition(target, set) {
  28210. Transition.call(this, target);
  28211. this.serializationType = Transition.SET;
  28212. if (set !== undefined && set !== null) {
  28213. this.label = set;
  28214. } else {
  28215. this.label = new IntervalSet();
  28216. this.label.addOne(Token.INVALID_TYPE);
  28217. }
  28218. return this;
  28219. }
  28220. SetTransition.prototype = Object.create(Transition.prototype);
  28221. SetTransition.prototype.constructor = SetTransition;
  28222. SetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  28223. return this.label.contains(symbol);
  28224. };
  28225. SetTransition.prototype.toString = function () {
  28226. return this.label.toString();
  28227. };
  28228. function NotSetTransition(target, set) {
  28229. SetTransition.call(this, target, set);
  28230. this.serializationType = Transition.NOT_SET;
  28231. return this;
  28232. }
  28233. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  28234. NotSetTransition.prototype.constructor = NotSetTransition;
  28235. NotSetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  28236. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol && !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  28237. };
  28238. NotSetTransition.prototype.toString = function () {
  28239. return '~' + SetTransition.prototype.toString.call(this);
  28240. };
  28241. function WildcardTransition(target) {
  28242. Transition.call(this, target);
  28243. this.serializationType = Transition.WILDCARD;
  28244. return this;
  28245. }
  28246. WildcardTransition.prototype = Object.create(Transition.prototype);
  28247. WildcardTransition.prototype.constructor = WildcardTransition;
  28248. WildcardTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  28249. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  28250. };
  28251. WildcardTransition.prototype.toString = function () {
  28252. return ".";
  28253. };
  28254. function PrecedencePredicateTransition(target, precedence) {
  28255. AbstractPredicateTransition.call(this, target);
  28256. this.serializationType = Transition.PRECEDENCE;
  28257. this.precedence = precedence;
  28258. this.isEpsilon = true;
  28259. return this;
  28260. }
  28261. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  28262. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  28263. PrecedencePredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  28264. return false;
  28265. };
  28266. PrecedencePredicateTransition.prototype.getPredicate = function () {
  28267. return new PrecedencePredicate(this.precedence);
  28268. };
  28269. PrecedencePredicateTransition.prototype.toString = function () {
  28270. return this.precedence + " >= _p";
  28271. };
  28272. exports.Transition = Transition;
  28273. exports.AtomTransition = AtomTransition;
  28274. exports.SetTransition = SetTransition;
  28275. exports.NotSetTransition = NotSetTransition;
  28276. exports.RuleTransition = RuleTransition;
  28277. exports.ActionTransition = ActionTransition;
  28278. exports.EpsilonTransition = EpsilonTransition;
  28279. exports.RangeTransition = RangeTransition;
  28280. exports.WildcardTransition = WildcardTransition;
  28281. exports.PredicateTransition = PredicateTransition;
  28282. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  28283. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  28284. /***/ }),
  28285. /***/ "./node_modules/antlr4/atn/index.js":
  28286. /*!******************************************!*\
  28287. !*** ./node_modules/antlr4/atn/index.js ***!
  28288. \******************************************/
  28289. /*! no static exports found */
  28290. /***/ (function(module, exports, __webpack_require__) {
  28291. "use strict";
  28292. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28293. * Use of this file is governed by the BSD 3-clause license that
  28294. * can be found in the LICENSE.txt file in the project root.
  28295. */
  28296. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  28297. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  28298. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  28299. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  28300. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  28301. /***/ }),
  28302. /***/ "./node_modules/antlr4/dfa/DFA.js":
  28303. /*!****************************************!*\
  28304. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  28305. \****************************************/
  28306. /*! no static exports found */
  28307. /***/ (function(module, exports, __webpack_require__) {
  28308. "use strict";
  28309. //
  28310. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28311. * Use of this file is governed by the BSD 3-clause license that
  28312. * can be found in the LICENSE.txt file in the project root.
  28313. */
  28314. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  28315. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  28316. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  28317. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  28318. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  28319. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  28320. function DFA(atnStartState, decision) {
  28321. if (decision === undefined) {
  28322. decision = 0;
  28323. }
  28324. // From which ATN state did we create this DFA?
  28325. this.atnStartState = atnStartState;
  28326. this.decision = decision;
  28327. // A set of all DFA states. Use {@link Map} so we can get old state back
  28328. // ({@link Set} only allows you to see if it's there).
  28329. this._states = new Set();
  28330. this.s0 = null;
  28331. // {@code true} if this DFA is for a precedence decision; otherwise,
  28332. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  28333. // {@link //setPrecedenceDfa}.
  28334. this.precedenceDfa = false;
  28335. if (atnStartState instanceof StarLoopEntryState) {
  28336. if (atnStartState.isPrecedenceDecision) {
  28337. this.precedenceDfa = true;
  28338. var precedenceState = new DFAState(null, new ATNConfigSet());
  28339. precedenceState.edges = [];
  28340. precedenceState.isAcceptState = false;
  28341. precedenceState.requiresFullContext = false;
  28342. this.s0 = precedenceState;
  28343. }
  28344. }
  28345. return this;
  28346. }
  28347. // Get the start state for a specific precedence value.
  28348. //
  28349. // @param precedence The current precedence.
  28350. // @return The start state corresponding to the specified precedence, or
  28351. // {@code null} if no start state exists for the specified precedence.
  28352. //
  28353. // @throws IllegalStateException if this is not a precedence DFA.
  28354. // @see //isPrecedenceDfa()
  28355. DFA.prototype.getPrecedenceStartState = function (precedence) {
  28356. if (!this.precedenceDfa) {
  28357. throw "Only precedence DFAs may contain a precedence start state.";
  28358. }
  28359. // s0.edges is never null for a precedence DFA
  28360. if (precedence < 0 || precedence >= this.s0.edges.length) {
  28361. return null;
  28362. }
  28363. return this.s0.edges[precedence] || null;
  28364. };
  28365. // Set the start state for a specific precedence value.
  28366. //
  28367. // @param precedence The current precedence.
  28368. // @param startState The start state corresponding to the specified
  28369. // precedence.
  28370. //
  28371. // @throws IllegalStateException if this is not a precedence DFA.
  28372. // @see //isPrecedenceDfa()
  28373. //
  28374. DFA.prototype.setPrecedenceStartState = function (precedence, startState) {
  28375. if (!this.precedenceDfa) {
  28376. throw "Only precedence DFAs may contain a precedence start state.";
  28377. }
  28378. if (precedence < 0) {
  28379. return;
  28380. }
  28381. // synchronization on s0 here is ok. when the DFA is turned into a
  28382. // precedence DFA, s0 will be initialized once and not updated again
  28383. // s0.edges is never null for a precedence DFA
  28384. this.s0.edges[precedence] = startState;
  28385. };
  28386. //
  28387. // Sets whether this is a precedence DFA. If the specified value differs
  28388. // from the current DFA configuration, the following actions are taken;
  28389. // otherwise no changes are made to the current DFA.
  28390. //
  28391. // <ul>
  28392. // <li>The {@link //states} map is cleared</li>
  28393. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  28394. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  28395. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  28396. // store the start states for individual precedence values.</li>
  28397. // <li>The {@link //precedenceDfa} field is updated</li>
  28398. // </ul>
  28399. //
  28400. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  28401. // {@code false}
  28402. DFA.prototype.setPrecedenceDfa = function (precedenceDfa) {
  28403. if (this.precedenceDfa !== precedenceDfa) {
  28404. this._states = new DFAStatesSet();
  28405. if (precedenceDfa) {
  28406. var precedenceState = new DFAState(null, new ATNConfigSet());
  28407. precedenceState.edges = [];
  28408. precedenceState.isAcceptState = false;
  28409. precedenceState.requiresFullContext = false;
  28410. this.s0 = precedenceState;
  28411. } else {
  28412. this.s0 = null;
  28413. }
  28414. this.precedenceDfa = precedenceDfa;
  28415. }
  28416. };
  28417. Object.defineProperty(DFA.prototype, "states", {
  28418. get: function get() {
  28419. return this._states;
  28420. }
  28421. });
  28422. // Return a list of all states in this DFA, ordered by state number.
  28423. DFA.prototype.sortedStates = function () {
  28424. var list = this._states.values();
  28425. return list.sort(function (a, b) {
  28426. return a.stateNumber - b.stateNumber;
  28427. });
  28428. };
  28429. DFA.prototype.toString = function (literalNames, symbolicNames) {
  28430. literalNames = literalNames || null;
  28431. symbolicNames = symbolicNames || null;
  28432. if (this.s0 === null) {
  28433. return "";
  28434. }
  28435. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  28436. return serializer.toString();
  28437. };
  28438. DFA.prototype.toLexerString = function () {
  28439. if (this.s0 === null) {
  28440. return "";
  28441. }
  28442. var serializer = new LexerDFASerializer(this);
  28443. return serializer.toString();
  28444. };
  28445. exports.DFA = DFA;
  28446. /***/ }),
  28447. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  28448. /*!**************************************************!*\
  28449. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  28450. \**************************************************/
  28451. /*! no static exports found */
  28452. /***/ (function(module, exports, __webpack_require__) {
  28453. "use strict";
  28454. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28455. * Use of this file is governed by the BSD 3-clause license that
  28456. * can be found in the LICENSE.txt file in the project root.
  28457. */
  28458. // A DFA walker that knows how to dump them to serialized strings.#/
  28459. function DFASerializer(dfa, literalNames, symbolicNames) {
  28460. this.dfa = dfa;
  28461. this.literalNames = literalNames || [];
  28462. this.symbolicNames = symbolicNames || [];
  28463. return this;
  28464. }
  28465. DFASerializer.prototype.toString = function () {
  28466. if (this.dfa.s0 === null) {
  28467. return null;
  28468. }
  28469. var buf = "";
  28470. var states = this.dfa.sortedStates();
  28471. for (var i = 0; i < states.length; i++) {
  28472. var s = states[i];
  28473. if (s.edges !== null) {
  28474. var n = s.edges.length;
  28475. for (var j = 0; j < n; j++) {
  28476. var t = s.edges[j] || null;
  28477. if (t !== null && t.stateNumber !== 0x7FFFFFFF) {
  28478. buf = buf.concat(this.getStateString(s));
  28479. buf = buf.concat("-");
  28480. buf = buf.concat(this.getEdgeLabel(j));
  28481. buf = buf.concat("->");
  28482. buf = buf.concat(this.getStateString(t));
  28483. buf = buf.concat('\n');
  28484. }
  28485. }
  28486. }
  28487. }
  28488. return buf.length === 0 ? null : buf;
  28489. };
  28490. DFASerializer.prototype.getEdgeLabel = function (i) {
  28491. if (i === 0) {
  28492. return "EOF";
  28493. } else if (this.literalNames !== null || this.symbolicNames !== null) {
  28494. return this.literalNames[i - 1] || this.symbolicNames[i - 1];
  28495. } else {
  28496. return String.fromCharCode(i - 1);
  28497. }
  28498. };
  28499. DFASerializer.prototype.getStateString = function (s) {
  28500. var baseStateStr = (s.isAcceptState ? ":" : "") + "s" + s.stateNumber + (s.requiresFullContext ? "^" : "");
  28501. if (s.isAcceptState) {
  28502. if (s.predicates !== null) {
  28503. return baseStateStr + "=>" + s.predicates.toString();
  28504. } else {
  28505. return baseStateStr + "=>" + s.prediction.toString();
  28506. }
  28507. } else {
  28508. return baseStateStr;
  28509. }
  28510. };
  28511. function LexerDFASerializer(dfa) {
  28512. DFASerializer.call(this, dfa, null);
  28513. return this;
  28514. }
  28515. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  28516. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  28517. LexerDFASerializer.prototype.getEdgeLabel = function (i) {
  28518. return "'" + String.fromCharCode(i) + "'";
  28519. };
  28520. exports.DFASerializer = DFASerializer;
  28521. exports.LexerDFASerializer = LexerDFASerializer;
  28522. /***/ }),
  28523. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  28524. /*!*********************************************!*\
  28525. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  28526. \*********************************************/
  28527. /*! no static exports found */
  28528. /***/ (function(module, exports, __webpack_require__) {
  28529. "use strict";
  28530. //
  28531. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28532. * Use of this file is governed by the BSD 3-clause license that
  28533. * can be found in the LICENSE.txt file in the project root.
  28534. */
  28535. ///
  28536. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  28537. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  28538. var Hash = Utils.Hash;
  28539. var Set = Utils.Set;
  28540. // Map a predicate to a predicted alternative.///
  28541. function PredPrediction(pred, alt) {
  28542. this.alt = alt;
  28543. this.pred = pred;
  28544. return this;
  28545. }
  28546. PredPrediction.prototype.toString = function () {
  28547. return "(" + this.pred + ", " + this.alt + ")";
  28548. };
  28549. // A DFA state represents a set of possible ATN configurations.
  28550. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  28551. // to keep track of all possible states the ATN can be in after
  28552. // reading each input symbol. That is to say, after reading
  28553. // input a1a2..an, the DFA is in a state that represents the
  28554. // subset T of the states of the ATN that are reachable from the
  28555. // ATN's start state along some path labeled a1a2..an."
  28556. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  28557. // would be a bitset representing the set of states the
  28558. // ATN could be in. We need to track the alt predicted by each
  28559. // state as well, however. More importantly, we need to maintain
  28560. // a stack of states, tracking the closure operations as they
  28561. // jump from rule to rule, emulating rule invocations (method calls).
  28562. // I have to add a stack to simulate the proper lookahead sequences for
  28563. // the underlying LL grammar from which the ATN was derived.
  28564. //
  28565. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  28566. // is both a state (ala normal conversion) and a RuleContext describing
  28567. // the chain of rules (if any) followed to arrive at that state.</p>
  28568. //
  28569. // <p>A DFA state may have multiple references to a particular state,
  28570. // but with different ATN contexts (with same or different alts)
  28571. // meaning that state was reached via a different set of rule invocations.</p>
  28572. // /
  28573. function DFAState(stateNumber, configs) {
  28574. if (stateNumber === null) {
  28575. stateNumber = -1;
  28576. }
  28577. if (configs === null) {
  28578. configs = new ATNConfigSet();
  28579. }
  28580. this.stateNumber = stateNumber;
  28581. this.configs = configs;
  28582. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  28583. // {@link Token//EOF} maps to {@code edges[0]}.
  28584. this.edges = null;
  28585. this.isAcceptState = false;
  28586. // if accept state, what ttype do we match or alt do we predict?
  28587. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  28588. // //predicates}{@code !=null} or
  28589. // {@link //requiresFullContext}.
  28590. this.prediction = 0;
  28591. this.lexerActionExecutor = null;
  28592. // Indicates that this state was created during SLL prediction that
  28593. // discovered a conflict between the configurations in the state. Future
  28594. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  28595. // full context prediction if this field is true.
  28596. this.requiresFullContext = false;
  28597. // During SLL parsing, this is a list of predicates associated with the
  28598. // ATN configurations of the DFA state. When we have predicates,
  28599. // {@link //requiresFullContext} is {@code false} since full context
  28600. // prediction evaluates predicates
  28601. // on-the-fly. If this is not null, then {@link //prediction} is
  28602. // {@link ATN//INVALID_ALT_NUMBER}.
  28603. //
  28604. // <p>We only use these for non-{@link //requiresFullContext} but
  28605. // conflicting states. That
  28606. // means we know from the context (it's $ or we don't dip into outer
  28607. // context) that it's an ambiguity not a conflict.</p>
  28608. //
  28609. // <p>This list is computed by {@link
  28610. // ParserATNSimulator//predicateDFAState}.</p>
  28611. this.predicates = null;
  28612. return this;
  28613. }
  28614. // Get the set of all alts mentioned by all ATN configurations in this
  28615. // DFA state.
  28616. DFAState.prototype.getAltSet = function () {
  28617. var alts = new Set();
  28618. if (this.configs !== null) {
  28619. for (var i = 0; i < this.configs.length; i++) {
  28620. var c = this.configs[i];
  28621. alts.add(c.alt);
  28622. }
  28623. }
  28624. if (alts.length === 0) {
  28625. return null;
  28626. } else {
  28627. return alts;
  28628. }
  28629. };
  28630. // Two {@link DFAState} instances are equal if their ATN configuration sets
  28631. // are the same. This method is used to see if a state already exists.
  28632. //
  28633. // <p>Because the number of alternatives and number of ATN configurations are
  28634. // finite, there is a finite number of DFA states that can be processed.
  28635. // This is necessary to show that the algorithm terminates.</p>
  28636. //
  28637. // <p>Cannot test the DFA state numbers here because in
  28638. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  28639. // exists that has this exact set of ATN configurations. The
  28640. // {@link //stateNumber} is irrelevant.</p>
  28641. DFAState.prototype.equals = function (other) {
  28642. // compare set of ATN configurations in this set with other
  28643. return this === other || other instanceof DFAState && this.configs.equals(other.configs);
  28644. };
  28645. DFAState.prototype.toString = function () {
  28646. var s = "" + this.stateNumber + ":" + this.configs;
  28647. if (this.isAcceptState) {
  28648. s = s + "=>";
  28649. if (this.predicates !== null) s = s + this.predicates;else s = s + this.prediction;
  28650. }
  28651. return s;
  28652. };
  28653. DFAState.prototype.hashCode = function () {
  28654. var hash = new Hash();
  28655. hash.update(this.configs);
  28656. if (this.isAcceptState) {
  28657. if (this.predicates !== null) hash.update(this.predicates);else hash.update(this.prediction);
  28658. }
  28659. return hash.finish();
  28660. };
  28661. exports.DFAState = DFAState;
  28662. exports.PredPrediction = PredPrediction;
  28663. /***/ }),
  28664. /***/ "./node_modules/antlr4/dfa/index.js":
  28665. /*!******************************************!*\
  28666. !*** ./node_modules/antlr4/dfa/index.js ***!
  28667. \******************************************/
  28668. /*! no static exports found */
  28669. /***/ (function(module, exports, __webpack_require__) {
  28670. "use strict";
  28671. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28672. * Use of this file is governed by the BSD 3-clause license that
  28673. * can be found in the LICENSE.txt file in the project root.
  28674. */
  28675. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  28676. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  28677. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  28678. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  28679. /***/ }),
  28680. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  28681. /*!**************************************************************!*\
  28682. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  28683. \**************************************************************/
  28684. /*! no static exports found */
  28685. /***/ (function(module, exports, __webpack_require__) {
  28686. "use strict";
  28687. //
  28688. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28689. * Use of this file is governed by the BSD 3-clause license that
  28690. * can be found in the LICENSE.txt file in the project root.
  28691. */
  28692. //
  28693. //
  28694. // This implementation of {@link ANTLRErrorListener} can be used to identify
  28695. // certain potential correctness and performance problems in grammars. "Reports"
  28696. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  28697. // message.
  28698. //
  28699. // <ul>
  28700. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  28701. // grammar can match the input.</li>
  28702. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  28703. // prediction resolved an SLL conflict to a unique alternative which equaled the
  28704. // minimum alternative of the SLL conflict.</li>
  28705. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  28706. // full-context prediction resolved an SLL conflict to a unique alternative,
  28707. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  28708. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  28709. // this situation occurs.</li>
  28710. // </ul>
  28711. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  28712. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  28713. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  28714. function DiagnosticErrorListener(exactOnly) {
  28715. ErrorListener.call(this);
  28716. exactOnly = exactOnly || true;
  28717. // whether all ambiguities or only exact ambiguities are reported.
  28718. this.exactOnly = exactOnly;
  28719. return this;
  28720. }
  28721. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  28722. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  28723. DiagnosticErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  28724. if (this.exactOnly && !exact) {
  28725. return;
  28726. }
  28727. var msg = "reportAmbiguity d=" + this.getDecisionDescription(recognizer, dfa) + ": ambigAlts=" + this.getConflictingAlts(ambigAlts, configs) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  28728. recognizer.notifyErrorListeners(msg);
  28729. };
  28730. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  28731. var msg = "reportAttemptingFullContext d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  28732. recognizer.notifyErrorListeners(msg);
  28733. };
  28734. DiagnosticErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  28735. var msg = "reportContextSensitivity d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  28736. recognizer.notifyErrorListeners(msg);
  28737. };
  28738. DiagnosticErrorListener.prototype.getDecisionDescription = function (recognizer, dfa) {
  28739. var decision = dfa.decision;
  28740. var ruleIndex = dfa.atnStartState.ruleIndex;
  28741. var ruleNames = recognizer.ruleNames;
  28742. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  28743. return "" + decision;
  28744. }
  28745. var ruleName = ruleNames[ruleIndex] || null;
  28746. if (ruleName === null || ruleName.length === 0) {
  28747. return "" + decision;
  28748. }
  28749. return "" + decision + " (" + ruleName + ")";
  28750. };
  28751. //
  28752. // Computes the set of conflicting or ambiguous alternatives from a
  28753. // configuration set, if that information was not already provided by the
  28754. // parser.
  28755. //
  28756. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  28757. // reported by the parser.
  28758. // @param configs The conflicting or ambiguous configuration set.
  28759. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  28760. // returns the set of alternatives represented in {@code configs}.
  28761. //
  28762. DiagnosticErrorListener.prototype.getConflictingAlts = function (reportedAlts, configs) {
  28763. if (reportedAlts !== null) {
  28764. return reportedAlts;
  28765. }
  28766. var result = new BitSet();
  28767. for (var i = 0; i < configs.items.length; i++) {
  28768. result.add(configs.items[i].alt);
  28769. }
  28770. return "{" + result.values().join(", ") + "}";
  28771. };
  28772. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  28773. /***/ }),
  28774. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  28775. /*!****************************************************!*\
  28776. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  28777. \****************************************************/
  28778. /*! no static exports found */
  28779. /***/ (function(module, exports, __webpack_require__) {
  28780. "use strict";
  28781. //
  28782. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28783. * Use of this file is governed by the BSD 3-clause license that
  28784. * can be found in the LICENSE.txt file in the project root.
  28785. */
  28786. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  28787. // default implementation of each method does nothing, but can be overridden as
  28788. // necessary.
  28789. function ErrorListener() {
  28790. return this;
  28791. }
  28792. ErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {};
  28793. ErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {};
  28794. ErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {};
  28795. ErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {};
  28796. function ConsoleErrorListener() {
  28797. ErrorListener.call(this);
  28798. return this;
  28799. }
  28800. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  28801. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  28802. //
  28803. // Provides a default instance of {@link ConsoleErrorListener}.
  28804. //
  28805. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  28806. //
  28807. // {@inheritDoc}
  28808. //
  28809. // <p>
  28810. // This implementation prints messages to {@link System//err} containing the
  28811. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  28812. // the following format.</p>
  28813. //
  28814. // <pre>
  28815. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  28816. // </pre>
  28817. //
  28818. ConsoleErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  28819. console.error("line " + line + ":" + column + " " + msg);
  28820. };
  28821. function ProxyErrorListener(delegates) {
  28822. ErrorListener.call(this);
  28823. if (delegates === null) {
  28824. throw "delegates";
  28825. }
  28826. this.delegates = delegates;
  28827. return this;
  28828. }
  28829. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  28830. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  28831. ProxyErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  28832. this.delegates.map(function (d) {
  28833. d.syntaxError(recognizer, offendingSymbol, line, column, msg, e);
  28834. });
  28835. };
  28836. ProxyErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  28837. this.delegates.map(function (d) {
  28838. d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  28839. });
  28840. };
  28841. ProxyErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  28842. this.delegates.map(function (d) {
  28843. d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
  28844. });
  28845. };
  28846. ProxyErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  28847. this.delegates.map(function (d) {
  28848. d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs);
  28849. });
  28850. };
  28851. exports.ErrorListener = ErrorListener;
  28852. exports.ConsoleErrorListener = ConsoleErrorListener;
  28853. exports.ProxyErrorListener = ProxyErrorListener;
  28854. /***/ }),
  28855. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  28856. /*!****************************************************!*\
  28857. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  28858. \****************************************************/
  28859. /*! no static exports found */
  28860. /***/ (function(module, exports, __webpack_require__) {
  28861. "use strict";
  28862. //
  28863. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28864. * Use of this file is governed by the BSD 3-clause license that
  28865. * can be found in the LICENSE.txt file in the project root.
  28866. */
  28867. //
  28868. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  28869. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  28870. var NoViableAltException = Errors.NoViableAltException;
  28871. var InputMismatchException = Errors.InputMismatchException;
  28872. var FailedPredicateException = Errors.FailedPredicateException;
  28873. var ParseCancellationException = Errors.ParseCancellationException;
  28874. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  28875. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  28876. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  28877. function ErrorStrategy() {}
  28878. ErrorStrategy.prototype.reset = function (recognizer) {};
  28879. ErrorStrategy.prototype.recoverInline = function (recognizer) {};
  28880. ErrorStrategy.prototype.recover = function (recognizer, e) {};
  28881. ErrorStrategy.prototype.sync = function (recognizer) {};
  28882. ErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {};
  28883. ErrorStrategy.prototype.reportError = function (recognizer) {};
  28884. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  28885. // error reporting and recovery in ANTLR parsers.
  28886. //
  28887. function DefaultErrorStrategy() {
  28888. ErrorStrategy.call(this);
  28889. // Indicates whether the error strategy is currently "recovering from an
  28890. // error". This is used to suppress reporting multiple error messages while
  28891. // attempting to recover from a detected syntax error.
  28892. //
  28893. // @see //inErrorRecoveryMode
  28894. //
  28895. this.errorRecoveryMode = false;
  28896. // The index into the input stream where the last error occurred.
  28897. // This is used to prevent infinite loops where an error is found
  28898. // but no token is consumed during recovery...another error is found,
  28899. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  28900. // one token/tree node is consumed for two errors.
  28901. //
  28902. this.lastErrorIndex = -1;
  28903. this.lastErrorStates = null;
  28904. return this;
  28905. }
  28906. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  28907. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  28908. // <p>The default implementation simply calls {@link //endErrorCondition} to
  28909. // ensure that the handler is not in error recovery mode.</p>
  28910. DefaultErrorStrategy.prototype.reset = function (recognizer) {
  28911. this.endErrorCondition(recognizer);
  28912. };
  28913. //
  28914. // This method is called to enter error recovery mode when a recognition
  28915. // exception is reported.
  28916. //
  28917. // @param recognizer the parser instance
  28918. //
  28919. DefaultErrorStrategy.prototype.beginErrorCondition = function (recognizer) {
  28920. this.errorRecoveryMode = true;
  28921. };
  28922. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {
  28923. return this.errorRecoveryMode;
  28924. };
  28925. //
  28926. // This method is called to leave error recovery mode after recovering from
  28927. // a recognition exception.
  28928. //
  28929. // @param recognizer
  28930. //
  28931. DefaultErrorStrategy.prototype.endErrorCondition = function (recognizer) {
  28932. this.errorRecoveryMode = false;
  28933. this.lastErrorStates = null;
  28934. this.lastErrorIndex = -1;
  28935. };
  28936. //
  28937. // {@inheritDoc}
  28938. //
  28939. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  28940. //
  28941. DefaultErrorStrategy.prototype.reportMatch = function (recognizer) {
  28942. this.endErrorCondition(recognizer);
  28943. };
  28944. //
  28945. // {@inheritDoc}
  28946. //
  28947. // <p>The default implementation returns immediately if the handler is already
  28948. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  28949. // and dispatches the reporting task based on the runtime type of {@code e}
  28950. // according to the following table.</p>
  28951. //
  28952. // <ul>
  28953. // <li>{@link NoViableAltException}: Dispatches the call to
  28954. // {@link //reportNoViableAlternative}</li>
  28955. // <li>{@link InputMismatchException}: Dispatches the call to
  28956. // {@link //reportInputMismatch}</li>
  28957. // <li>{@link FailedPredicateException}: Dispatches the call to
  28958. // {@link //reportFailedPredicate}</li>
  28959. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  28960. // the exception</li>
  28961. // </ul>
  28962. //
  28963. DefaultErrorStrategy.prototype.reportError = function (recognizer, e) {
  28964. // if we've already reported an error and have not matched a token
  28965. // yet successfully, don't report any errors.
  28966. if (this.inErrorRecoveryMode(recognizer)) {
  28967. return; // don't report spurious errors
  28968. }
  28969. this.beginErrorCondition(recognizer);
  28970. if (e instanceof NoViableAltException) {
  28971. this.reportNoViableAlternative(recognizer, e);
  28972. } else if (e instanceof InputMismatchException) {
  28973. this.reportInputMismatch(recognizer, e);
  28974. } else if (e instanceof FailedPredicateException) {
  28975. this.reportFailedPredicate(recognizer, e);
  28976. } else {
  28977. console.log("unknown recognition error type: " + e.constructor.name);
  28978. console.log(e.stack);
  28979. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  28980. }
  28981. };
  28982. //
  28983. // {@inheritDoc}
  28984. //
  28985. // <p>The default implementation resynchronizes the parser by consuming tokens
  28986. // until we find one in the resynchronization set--loosely the set of tokens
  28987. // that can follow the current rule.</p>
  28988. //
  28989. DefaultErrorStrategy.prototype.recover = function (recognizer, e) {
  28990. if (this.lastErrorIndex === recognizer.getInputStream().index && this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state) >= 0) {
  28991. // uh oh, another error at same token index and previously-visited
  28992. // state in ATN; must be a case where LT(1) is in the recovery
  28993. // token set so nothing got consumed. Consume a single token
  28994. // at least to prevent an infinite loop; this is a failsafe.
  28995. recognizer.consume();
  28996. }
  28997. this.lastErrorIndex = recognizer._input.index;
  28998. if (this.lastErrorStates === null) {
  28999. this.lastErrorStates = [];
  29000. }
  29001. this.lastErrorStates.push(recognizer.state);
  29002. var followSet = this.getErrorRecoverySet(recognizer);
  29003. this.consumeUntil(recognizer, followSet);
  29004. };
  29005. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  29006. // that the current lookahead symbol is consistent with what were expecting
  29007. // at this point in the ATN. You can call this anytime but ANTLR only
  29008. // generates code to check before subrules/loops and each iteration.
  29009. //
  29010. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  29011. // subrules. E.g.,</p>
  29012. //
  29013. // <pre>
  29014. // a : sync ( stuff sync )* ;
  29015. // sync : {consume to what can follow sync} ;
  29016. // </pre>
  29017. //
  29018. // At the start of a sub rule upon error, {@link //sync} performs single
  29019. // token deletion, if possible. If it can't do that, it bails on the current
  29020. // rule and uses the default error recovery, which consumes until the
  29021. // resynchronization set of the current rule.
  29022. //
  29023. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  29024. // with an empty alternative), then the expected set includes what follows
  29025. // the subrule.</p>
  29026. //
  29027. // <p>During loop iteration, it consumes until it sees a token that can start a
  29028. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  29029. // stay in the loop as long as possible.</p>
  29030. //
  29031. // <p><strong>ORIGINS</strong></p>
  29032. //
  29033. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  29034. // A single mismatch token or missing token would force the parser to bail
  29035. // out of the entire rules surrounding the loop. So, for rule</p>
  29036. //
  29037. // <pre>
  29038. // classDef : 'class' ID '{' member* '}'
  29039. // </pre>
  29040. //
  29041. // input with an extra token between members would force the parser to
  29042. // consume until it found the next class definition rather than the next
  29043. // member definition of the current class.
  29044. //
  29045. // <p>This functionality cost a little bit of effort because the parser has to
  29046. // compare token set at the start of the loop and at each iteration. If for
  29047. // some reason speed is suffering for you, you can turn off this
  29048. // functionality by simply overriding this method as a blank { }.</p>
  29049. //
  29050. DefaultErrorStrategy.prototype.sync = function (recognizer) {
  29051. // If already recovering, don't try to sync
  29052. if (this.inErrorRecoveryMode(recognizer)) {
  29053. return;
  29054. }
  29055. var s = recognizer._interp.atn.states[recognizer.state];
  29056. var la = recognizer.getTokenStream().LA(1);
  29057. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  29058. var nextTokens = recognizer.atn.nextTokens(s);
  29059. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  29060. return;
  29061. }
  29062. switch (s.stateType) {
  29063. case ATNState.BLOCK_START:
  29064. case ATNState.STAR_BLOCK_START:
  29065. case ATNState.PLUS_BLOCK_START:
  29066. case ATNState.STAR_LOOP_ENTRY:
  29067. // report error and recover if possible
  29068. if (this.singleTokenDeletion(recognizer) !== null) {
  29069. return;
  29070. } else {
  29071. throw new InputMismatchException(recognizer);
  29072. }
  29073. break;
  29074. case ATNState.PLUS_LOOP_BACK:
  29075. case ATNState.STAR_LOOP_BACK:
  29076. this.reportUnwantedToken(recognizer);
  29077. var expecting = new IntervalSet();
  29078. expecting.addSet(recognizer.getExpectedTokens());
  29079. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  29080. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  29081. break;
  29082. default:
  29083. // do nothing if we can't identify the exact kind of ATN state
  29084. }
  29085. };
  29086. // This is called by {@link //reportError} when the exception is a
  29087. // {@link NoViableAltException}.
  29088. //
  29089. // @see //reportError
  29090. //
  29091. // @param recognizer the parser instance
  29092. // @param e the recognition exception
  29093. //
  29094. DefaultErrorStrategy.prototype.reportNoViableAlternative = function (recognizer, e) {
  29095. var tokens = recognizer.getTokenStream();
  29096. var input;
  29097. if (tokens !== null) {
  29098. if (e.startToken.type === Token.EOF) {
  29099. input = "<EOF>";
  29100. } else {
  29101. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  29102. }
  29103. } else {
  29104. input = "<unknown input>";
  29105. }
  29106. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  29107. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  29108. };
  29109. //
  29110. // This is called by {@link //reportError} when the exception is an
  29111. // {@link InputMismatchException}.
  29112. //
  29113. // @see //reportError
  29114. //
  29115. // @param recognizer the parser instance
  29116. // @param e the recognition exception
  29117. //
  29118. DefaultErrorStrategy.prototype.reportInputMismatch = function (recognizer, e) {
  29119. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) + " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  29120. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  29121. };
  29122. //
  29123. // This is called by {@link //reportError} when the exception is a
  29124. // {@link FailedPredicateException}.
  29125. //
  29126. // @see //reportError
  29127. //
  29128. // @param recognizer the parser instance
  29129. // @param e the recognition exception
  29130. //
  29131. DefaultErrorStrategy.prototype.reportFailedPredicate = function (recognizer, e) {
  29132. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  29133. var msg = "rule " + ruleName + " " + e.message;
  29134. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  29135. };
  29136. // This method is called to report a syntax error which requires the removal
  29137. // of a token from the input stream. At the time this method is called, the
  29138. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  29139. // removed from the input stream. When this method returns,
  29140. // {@code recognizer} is in error recovery mode.
  29141. //
  29142. // <p>This method is called when {@link //singleTokenDeletion} identifies
  29143. // single-token deletion as a viable recovery strategy for a mismatched
  29144. // input error.</p>
  29145. //
  29146. // <p>The default implementation simply returns if the handler is already in
  29147. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  29148. // enter error recovery mode, followed by calling
  29149. // {@link Parser//notifyErrorListeners}.</p>
  29150. //
  29151. // @param recognizer the parser instance
  29152. //
  29153. DefaultErrorStrategy.prototype.reportUnwantedToken = function (recognizer) {
  29154. if (this.inErrorRecoveryMode(recognizer)) {
  29155. return;
  29156. }
  29157. this.beginErrorCondition(recognizer);
  29158. var t = recognizer.getCurrentToken();
  29159. var tokenName = this.getTokenErrorDisplay(t);
  29160. var expecting = this.getExpectedTokens(recognizer);
  29161. var msg = "extraneous input " + tokenName + " expecting " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  29162. recognizer.notifyErrorListeners(msg, t, null);
  29163. };
  29164. // This method is called to report a syntax error which requires the
  29165. // insertion of a missing token into the input stream. At the time this
  29166. // method is called, the missing token has not yet been inserted. When this
  29167. // method returns, {@code recognizer} is in error recovery mode.
  29168. //
  29169. // <p>This method is called when {@link //singleTokenInsertion} identifies
  29170. // single-token insertion as a viable recovery strategy for a mismatched
  29171. // input error.</p>
  29172. //
  29173. // <p>The default implementation simply returns if the handler is already in
  29174. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  29175. // enter error recovery mode, followed by calling
  29176. // {@link Parser//notifyErrorListeners}.</p>
  29177. //
  29178. // @param recognizer the parser instance
  29179. //
  29180. DefaultErrorStrategy.prototype.reportMissingToken = function (recognizer) {
  29181. if (this.inErrorRecoveryMode(recognizer)) {
  29182. return;
  29183. }
  29184. this.beginErrorCondition(recognizer);
  29185. var t = recognizer.getCurrentToken();
  29186. var expecting = this.getExpectedTokens(recognizer);
  29187. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) + " at " + this.getTokenErrorDisplay(t);
  29188. recognizer.notifyErrorListeners(msg, t, null);
  29189. };
  29190. // <p>The default implementation attempts to recover from the mismatched input
  29191. // by using single token insertion and deletion as described below. If the
  29192. // recovery attempt fails, this method throws an
  29193. // {@link InputMismatchException}.</p>
  29194. //
  29195. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  29196. //
  29197. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  29198. // right token, however, then assume {@code LA(1)} is some extra spurious
  29199. // token and delete it. Then consume and return the next token (which was
  29200. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  29201. //
  29202. // <p>This recovery strategy is implemented by {@link
  29203. // //singleTokenDeletion}.</p>
  29204. //
  29205. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  29206. //
  29207. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  29208. // after the expected {@code LA(1)} token, then assume the token is missing
  29209. // and use the parser's {@link TokenFactory} to create it on the fly. The
  29210. // "insertion" is performed by returning the created token as the successful
  29211. // result of the match operation.</p>
  29212. //
  29213. // <p>This recovery strategy is implemented by {@link
  29214. // //singleTokenInsertion}.</p>
  29215. //
  29216. // <p><strong>EXAMPLE</strong></p>
  29217. //
  29218. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  29219. // the parser returns from the nested call to {@code expr}, it will have
  29220. // call chain:</p>
  29221. //
  29222. // <pre>
  29223. // stat &rarr; expr &rarr; atom
  29224. // </pre>
  29225. //
  29226. // and it will be trying to match the {@code ')'} at this point in the
  29227. // derivation:
  29228. //
  29229. // <pre>
  29230. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  29231. // ^
  29232. // </pre>
  29233. //
  29234. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  29235. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  29236. // is in the set of tokens that can follow the {@code ')'} token reference
  29237. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  29238. //
  29239. DefaultErrorStrategy.prototype.recoverInline = function (recognizer) {
  29240. // SINGLE TOKEN DELETION
  29241. var matchedSymbol = this.singleTokenDeletion(recognizer);
  29242. if (matchedSymbol !== null) {
  29243. // we have deleted the extra token.
  29244. // now, move past ttype token as if all were ok
  29245. recognizer.consume();
  29246. return matchedSymbol;
  29247. }
  29248. // SINGLE TOKEN INSERTION
  29249. if (this.singleTokenInsertion(recognizer)) {
  29250. return this.getMissingSymbol(recognizer);
  29251. }
  29252. // even that didn't work; must throw the exception
  29253. throw new InputMismatchException(recognizer);
  29254. };
  29255. //
  29256. // This method implements the single-token insertion inline error recovery
  29257. // strategy. It is called by {@link //recoverInline} if the single-token
  29258. // deletion strategy fails to recover from the mismatched input. If this
  29259. // method returns {@code true}, {@code recognizer} will be in error recovery
  29260. // mode.
  29261. //
  29262. // <p>This method determines whether or not single-token insertion is viable by
  29263. // checking if the {@code LA(1)} input symbol could be successfully matched
  29264. // if it were instead the {@code LA(2)} symbol. If this method returns
  29265. // {@code true}, the caller is responsible for creating and inserting a
  29266. // token with the correct type to produce this behavior.</p>
  29267. //
  29268. // @param recognizer the parser instance
  29269. // @return {@code true} if single-token insertion is a viable recovery
  29270. // strategy for the current mismatched input, otherwise {@code false}
  29271. //
  29272. DefaultErrorStrategy.prototype.singleTokenInsertion = function (recognizer) {
  29273. var currentSymbolType = recognizer.getTokenStream().LA(1);
  29274. // if current token is consistent with what could come after current
  29275. // ATN state, then we know we're missing a token; error recovery
  29276. // is free to conjure up and insert the missing token
  29277. var atn = recognizer._interp.atn;
  29278. var currentState = atn.states[recognizer.state];
  29279. var next = currentState.transitions[0].target;
  29280. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  29281. if (expectingAtLL2.contains(currentSymbolType)) {
  29282. this.reportMissingToken(recognizer);
  29283. return true;
  29284. } else {
  29285. return false;
  29286. }
  29287. };
  29288. // This method implements the single-token deletion inline error recovery
  29289. // strategy. It is called by {@link //recoverInline} to attempt to recover
  29290. // from mismatched input. If this method returns null, the parser and error
  29291. // handler state will not have changed. If this method returns non-null,
  29292. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  29293. // returned token was a successful match.
  29294. //
  29295. // <p>If the single-token deletion is successful, this method calls
  29296. // {@link //reportUnwantedToken} to report the error, followed by
  29297. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  29298. // before returning {@link //reportMatch} is called to signal a successful
  29299. // match.</p>
  29300. //
  29301. // @param recognizer the parser instance
  29302. // @return the successfully matched {@link Token} instance if single-token
  29303. // deletion successfully recovers from the mismatched input, otherwise
  29304. // {@code null}
  29305. //
  29306. DefaultErrorStrategy.prototype.singleTokenDeletion = function (recognizer) {
  29307. var nextTokenType = recognizer.getTokenStream().LA(2);
  29308. var expecting = this.getExpectedTokens(recognizer);
  29309. if (expecting.contains(nextTokenType)) {
  29310. this.reportUnwantedToken(recognizer);
  29311. // print("recoverFromMismatchedToken deleting " \
  29312. // + str(recognizer.getTokenStream().LT(1)) \
  29313. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  29314. // + " is what we want", file=sys.stderr)
  29315. recognizer.consume(); // simply delete extra token
  29316. // we want to return the token we're actually matching
  29317. var matchedSymbol = recognizer.getCurrentToken();
  29318. this.reportMatch(recognizer); // we know current token is correct
  29319. return matchedSymbol;
  29320. } else {
  29321. return null;
  29322. }
  29323. };
  29324. // Conjure up a missing token during error recovery.
  29325. //
  29326. // The recognizer attempts to recover from single missing
  29327. // symbols. But, actions might refer to that missing symbol.
  29328. // For example, x=ID {f($x);}. The action clearly assumes
  29329. // that there has been an identifier matched previously and that
  29330. // $x points at that token. If that token is missing, but
  29331. // the next token in the stream is what we want we assume that
  29332. // this token is missing and we keep going. Because we
  29333. // have to return some token to replace the missing token,
  29334. // we have to conjure one up. This method gives the user control
  29335. // over the tokens returned for missing tokens. Mostly,
  29336. // you will want to create something special for identifier
  29337. // tokens. For literals such as '{' and ',', the default
  29338. // action in the parser or tree parser works. It simply creates
  29339. // a CommonToken of the appropriate type. The text will be the token.
  29340. // If you change what tokens must be created by the lexer,
  29341. // override this method to create the appropriate tokens.
  29342. //
  29343. DefaultErrorStrategy.prototype.getMissingSymbol = function (recognizer) {
  29344. var currentSymbol = recognizer.getCurrentToken();
  29345. var expecting = this.getExpectedTokens(recognizer);
  29346. var expectedTokenType = expecting.first(); // get any element
  29347. var tokenText;
  29348. if (expectedTokenType === Token.EOF) {
  29349. tokenText = "<missing EOF>";
  29350. } else {
  29351. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  29352. }
  29353. var current = currentSymbol;
  29354. var lookback = recognizer.getTokenStream().LT(-1);
  29355. if (current.type === Token.EOF && lookback !== null) {
  29356. current = lookback;
  29357. }
  29358. return recognizer.getTokenFactory().create(current.source, expectedTokenType, tokenText, Token.DEFAULT_CHANNEL, -1, -1, current.line, current.column);
  29359. };
  29360. DefaultErrorStrategy.prototype.getExpectedTokens = function (recognizer) {
  29361. return recognizer.getExpectedTokens();
  29362. };
  29363. // How should a token be displayed in an error message? The default
  29364. // is to display just the text, but during development you might
  29365. // want to have a lot of information spit out. Override in that case
  29366. // to use t.toString() (which, for CommonToken, dumps everything about
  29367. // the token). This is better than forcing you to override a method in
  29368. // your token objects because you don't have to go modify your lexer
  29369. // so that it creates a new Java type.
  29370. //
  29371. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function (t) {
  29372. if (t === null) {
  29373. return "<no token>";
  29374. }
  29375. var s = t.text;
  29376. if (s === null) {
  29377. if (t.type === Token.EOF) {
  29378. s = "<EOF>";
  29379. } else {
  29380. s = "<" + t.type + ">";
  29381. }
  29382. }
  29383. return this.escapeWSAndQuote(s);
  29384. };
  29385. DefaultErrorStrategy.prototype.escapeWSAndQuote = function (s) {
  29386. s = s.replace(/\n/g, "\\n");
  29387. s = s.replace(/\r/g, "\\r");
  29388. s = s.replace(/\t/g, "\\t");
  29389. return "'" + s + "'";
  29390. };
  29391. // Compute the error recovery set for the current rule. During
  29392. // rule invocation, the parser pushes the set of tokens that can
  29393. // follow that rule reference on the stack; this amounts to
  29394. // computing FIRST of what follows the rule reference in the
  29395. // enclosing rule. See LinearApproximator.FIRST().
  29396. // This local follow set only includes tokens
  29397. // from within the rule; i.e., the FIRST computation done by
  29398. // ANTLR stops at the end of a rule.
  29399. //
  29400. // EXAMPLE
  29401. //
  29402. // When you find a "no viable alt exception", the input is not
  29403. // consistent with any of the alternatives for rule r. The best
  29404. // thing to do is to consume tokens until you see something that
  29405. // can legally follow a call to r//or* any rule that called r.
  29406. // You don't want the exact set of viable next tokens because the
  29407. // input might just be missing a token--you might consume the
  29408. // rest of the input looking for one of the missing tokens.
  29409. //
  29410. // Consider grammar:
  29411. //
  29412. // a : '[' b ']'
  29413. // | '(' b ')'
  29414. // ;
  29415. // b : c '^' INT ;
  29416. // c : ID
  29417. // | INT
  29418. // ;
  29419. //
  29420. // At each rule invocation, the set of tokens that could follow
  29421. // that rule is pushed on a stack. Here are the various
  29422. // context-sensitive follow sets:
  29423. //
  29424. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  29425. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  29426. // FOLLOW(c_in_b) = FIRST('^') = '^'
  29427. //
  29428. // Upon erroneous input "[]", the call chain is
  29429. //
  29430. // a -> b -> c
  29431. //
  29432. // and, hence, the follow context stack is:
  29433. //
  29434. // depth follow set start of rule execution
  29435. // 0 <EOF> a (from main())
  29436. // 1 ']' b
  29437. // 2 '^' c
  29438. //
  29439. // Notice that ')' is not included, because b would have to have
  29440. // been called from a different context in rule a for ')' to be
  29441. // included.
  29442. //
  29443. // For error recovery, we cannot consider FOLLOW(c)
  29444. // (context-sensitive or otherwise). We need the combined set of
  29445. // all context-sensitive FOLLOW sets--the set of all tokens that
  29446. // could follow any reference in the call chain. We need to
  29447. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  29448. // we resync'd to that token, we'd consume until EOF. We need to
  29449. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  29450. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  29451. // not consume anything. After printing an error, rule c would
  29452. // return normally. Rule b would not find the required '^' though.
  29453. // At this point, it gets a mismatched token error and throws an
  29454. // exception (since LA(1) is not in the viable following token
  29455. // set). The rule exception handler tries to recover, but finds
  29456. // the same recovery set and doesn't consume anything. Rule b
  29457. // exits normally returning to rule a. Now it finds the ']' (and
  29458. // with the successful match exits errorRecovery mode).
  29459. //
  29460. // So, you can see that the parser walks up the call chain looking
  29461. // for the token that was a member of the recovery set.
  29462. //
  29463. // Errors are not generated in errorRecovery mode.
  29464. //
  29465. // ANTLR's error recovery mechanism is based upon original ideas:
  29466. //
  29467. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  29468. //
  29469. // and
  29470. //
  29471. // "A note on error recovery in recursive descent parsers":
  29472. // http://portal.acm.org/citation.cfm?id=947902.947905
  29473. //
  29474. // Later, Josef Grosch had some good ideas:
  29475. //
  29476. // "Efficient and Comfortable Error Recovery in Recursive Descent
  29477. // Parsers":
  29478. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  29479. //
  29480. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  29481. // at run-time upon error to avoid overhead during parsing.
  29482. //
  29483. DefaultErrorStrategy.prototype.getErrorRecoverySet = function (recognizer) {
  29484. var atn = recognizer._interp.atn;
  29485. var ctx = recognizer._ctx;
  29486. var recoverSet = new IntervalSet();
  29487. while (ctx !== null && ctx.invokingState >= 0) {
  29488. // compute what follows who invoked us
  29489. var invokingState = atn.states[ctx.invokingState];
  29490. var rt = invokingState.transitions[0];
  29491. var follow = atn.nextTokens(rt.followState);
  29492. recoverSet.addSet(follow);
  29493. ctx = ctx.parentCtx;
  29494. }
  29495. recoverSet.removeOne(Token.EPSILON);
  29496. return recoverSet;
  29497. };
  29498. // Consume tokens until one matches the given token set.//
  29499. DefaultErrorStrategy.prototype.consumeUntil = function (recognizer, set) {
  29500. var ttype = recognizer.getTokenStream().LA(1);
  29501. while (ttype !== Token.EOF && !set.contains(ttype)) {
  29502. recognizer.consume();
  29503. ttype = recognizer.getTokenStream().LA(1);
  29504. }
  29505. };
  29506. //
  29507. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  29508. // by immediately canceling the parse operation with a
  29509. // {@link ParseCancellationException}. The implementation ensures that the
  29510. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  29511. // that were not completed prior to encountering the error.
  29512. //
  29513. // <p>
  29514. // This error strategy is useful in the following scenarios.</p>
  29515. //
  29516. // <ul>
  29517. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  29518. // stage of two-stage parsing to immediately terminate if an error is
  29519. // encountered, and immediately fall back to the second stage. In addition to
  29520. // avoiding wasted work by attempting to recover from errors here, the empty
  29521. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  29522. // the first stage.</li>
  29523. // <li><strong>Silent validation:</strong> When syntax errors are not being
  29524. // reported or logged, and the parse result is simply ignored if errors occur,
  29525. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  29526. // when the result will be ignored either way.</li>
  29527. // </ul>
  29528. //
  29529. // <p>
  29530. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  29531. //
  29532. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  29533. //
  29534. function BailErrorStrategy() {
  29535. DefaultErrorStrategy.call(this);
  29536. return this;
  29537. }
  29538. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  29539. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  29540. // Instead of recovering from exception {@code e}, re-throw it wrapped
  29541. // in a {@link ParseCancellationException} so it is not caught by the
  29542. // rule function catches. Use {@link Exception//getCause()} to get the
  29543. // original {@link RecognitionException}.
  29544. //
  29545. BailErrorStrategy.prototype.recover = function (recognizer, e) {
  29546. var context = recognizer._ctx;
  29547. while (context !== null) {
  29548. context.exception = e;
  29549. context = context.parentCtx;
  29550. }
  29551. throw new ParseCancellationException(e);
  29552. };
  29553. // Make sure we don't attempt to recover inline; if the parser
  29554. // successfully recovers, it won't throw an exception.
  29555. //
  29556. BailErrorStrategy.prototype.recoverInline = function (recognizer) {
  29557. this.recover(recognizer, new InputMismatchException(recognizer));
  29558. };
  29559. // Make sure we don't attempt to recover from problems in subrules.//
  29560. BailErrorStrategy.prototype.sync = function (recognizer) {
  29561. // pass
  29562. };
  29563. exports.BailErrorStrategy = BailErrorStrategy;
  29564. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  29565. /***/ }),
  29566. /***/ "./node_modules/antlr4/error/Errors.js":
  29567. /*!*********************************************!*\
  29568. !*** ./node_modules/antlr4/error/Errors.js ***!
  29569. \*********************************************/
  29570. /*! no static exports found */
  29571. /***/ (function(module, exports, __webpack_require__) {
  29572. "use strict";
  29573. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29574. * Use of this file is governed by the BSD 3-clause license that
  29575. * can be found in the LICENSE.txt file in the project root.
  29576. */
  29577. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  29578. // 3 kinds of errors: prediction errors, failed predicate errors, and
  29579. // mismatched input errors. In each case, the parser knows where it is
  29580. // in the input, where it is in the ATN, the rule invocation stack,
  29581. // and what kind of problem occurred.
  29582. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  29583. function RecognitionException(params) {
  29584. Error.call(this);
  29585. if (!!Error.captureStackTrace) {
  29586. Error.captureStackTrace(this, RecognitionException);
  29587. } else {
  29588. var stack = new Error().stack;
  29589. }
  29590. this.message = params.message;
  29591. this.recognizer = params.recognizer;
  29592. this.input = params.input;
  29593. this.ctx = params.ctx;
  29594. // The current {@link Token} when an error occurred. Since not all streams
  29595. // support accessing symbols by index, we have to track the {@link Token}
  29596. // instance itself.
  29597. this.offendingToken = null;
  29598. // Get the ATN state number the parser was in at the time the error
  29599. // occurred. For {@link NoViableAltException} and
  29600. // {@link LexerNoViableAltException} exceptions, this is the
  29601. // {@link DecisionState} number. For others, it is the state whose outgoing
  29602. // edge we couldn't match.
  29603. this.offendingState = -1;
  29604. if (this.recognizer !== null) {
  29605. this.offendingState = this.recognizer.state;
  29606. }
  29607. return this;
  29608. }
  29609. RecognitionException.prototype = Object.create(Error.prototype);
  29610. RecognitionException.prototype.constructor = RecognitionException;
  29611. // <p>If the state number is not known, this method returns -1.</p>
  29612. //
  29613. // Gets the set of input symbols which could potentially follow the
  29614. // previously matched symbol at the time this exception was thrown.
  29615. //
  29616. // <p>If the set of expected tokens is not known and could not be computed,
  29617. // this method returns {@code null}.</p>
  29618. //
  29619. // @return The set of token types that could potentially follow the current
  29620. // state in the ATN, or {@code null} if the information is not available.
  29621. // /
  29622. RecognitionException.prototype.getExpectedTokens = function () {
  29623. if (this.recognizer !== null) {
  29624. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  29625. } else {
  29626. return null;
  29627. }
  29628. };
  29629. RecognitionException.prototype.toString = function () {
  29630. return this.message;
  29631. };
  29632. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  29633. RecognitionException.call(this, { message: "", recognizer: lexer, input: input, ctx: null });
  29634. this.startIndex = startIndex;
  29635. this.deadEndConfigs = deadEndConfigs;
  29636. return this;
  29637. }
  29638. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  29639. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  29640. LexerNoViableAltException.prototype.toString = function () {
  29641. var symbol = "";
  29642. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  29643. symbol = this.input.getText((this.startIndex, this.startIndex));
  29644. }
  29645. return "LexerNoViableAltException" + symbol;
  29646. };
  29647. // Indicates that the parser could not decide which of two or more paths
  29648. // to take based upon the remaining input. It tracks the starting token
  29649. // of the offending input and also knows where the parser was
  29650. // in the various paths when the error. Reported by reportNoViableAlternative()
  29651. //
  29652. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  29653. ctx = ctx || recognizer._ctx;
  29654. offendingToken = offendingToken || recognizer.getCurrentToken();
  29655. startToken = startToken || recognizer.getCurrentToken();
  29656. input = input || recognizer.getInputStream();
  29657. RecognitionException.call(this, { message: "", recognizer: recognizer, input: input, ctx: ctx });
  29658. // Which configurations did we try at input.index() that couldn't match
  29659. // input.LT(1)?//
  29660. this.deadEndConfigs = deadEndConfigs;
  29661. // The token object at the start index; the input stream might
  29662. // not be buffering tokens so get a reference to it. (At the
  29663. // time the error occurred, of course the stream needs to keep a
  29664. // buffer all of the tokens but later we might not have access to those.)
  29665. this.startToken = startToken;
  29666. this.offendingToken = offendingToken;
  29667. }
  29668. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  29669. NoViableAltException.prototype.constructor = NoViableAltException;
  29670. // This signifies any kind of mismatched input exceptions such as
  29671. // when the current input does not match the expected token.
  29672. //
  29673. function InputMismatchException(recognizer) {
  29674. RecognitionException.call(this, { message: "", recognizer: recognizer, input: recognizer.getInputStream(), ctx: recognizer._ctx });
  29675. this.offendingToken = recognizer.getCurrentToken();
  29676. }
  29677. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  29678. InputMismatchException.prototype.constructor = InputMismatchException;
  29679. // A semantic predicate failed during validation. Validation of predicates
  29680. // occurs when normally parsing the alternative just like matching a token.
  29681. // Disambiguating predicate evaluation occurs when we test a predicate during
  29682. // prediction.
  29683. function FailedPredicateException(recognizer, predicate, message) {
  29684. RecognitionException.call(this, { message: this.formatMessage(predicate, message || null), recognizer: recognizer,
  29685. input: recognizer.getInputStream(), ctx: recognizer._ctx });
  29686. var s = recognizer._interp.atn.states[recognizer.state];
  29687. var trans = s.transitions[0];
  29688. if (trans instanceof PredicateTransition) {
  29689. this.ruleIndex = trans.ruleIndex;
  29690. this.predicateIndex = trans.predIndex;
  29691. } else {
  29692. this.ruleIndex = 0;
  29693. this.predicateIndex = 0;
  29694. }
  29695. this.predicate = predicate;
  29696. this.offendingToken = recognizer.getCurrentToken();
  29697. return this;
  29698. }
  29699. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  29700. FailedPredicateException.prototype.constructor = FailedPredicateException;
  29701. FailedPredicateException.prototype.formatMessage = function (predicate, message) {
  29702. if (message !== null) {
  29703. return message;
  29704. } else {
  29705. return "failed predicate: {" + predicate + "}?";
  29706. }
  29707. };
  29708. function ParseCancellationException() {
  29709. Error.call(this);
  29710. Error.captureStackTrace(this, ParseCancellationException);
  29711. return this;
  29712. }
  29713. ParseCancellationException.prototype = Object.create(Error.prototype);
  29714. ParseCancellationException.prototype.constructor = ParseCancellationException;
  29715. exports.RecognitionException = RecognitionException;
  29716. exports.NoViableAltException = NoViableAltException;
  29717. exports.LexerNoViableAltException = LexerNoViableAltException;
  29718. exports.InputMismatchException = InputMismatchException;
  29719. exports.FailedPredicateException = FailedPredicateException;
  29720. exports.ParseCancellationException = ParseCancellationException;
  29721. /***/ }),
  29722. /***/ "./node_modules/antlr4/error/index.js":
  29723. /*!********************************************!*\
  29724. !*** ./node_modules/antlr4/error/index.js ***!
  29725. \********************************************/
  29726. /*! no static exports found */
  29727. /***/ (function(module, exports, __webpack_require__) {
  29728. "use strict";
  29729. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29730. * Use of this file is governed by the BSD 3-clause license that
  29731. * can be found in the LICENSE.txt file in the project root.
  29732. */
  29733. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  29734. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  29735. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  29736. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  29737. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  29738. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  29739. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  29740. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  29741. /***/ }),
  29742. /***/ "./node_modules/antlr4/index.js":
  29743. /*!**************************************!*\
  29744. !*** ./node_modules/antlr4/index.js ***!
  29745. \**************************************/
  29746. /*! no static exports found */
  29747. /***/ (function(module, exports, __webpack_require__) {
  29748. "use strict";
  29749. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29750. * Use of this file is governed by the BSD 3-clause license that
  29751. * can be found in the LICENSE.txt file in the project root.
  29752. */
  29753. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  29754. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  29755. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  29756. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  29757. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  29758. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  29759. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  29760. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  29761. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  29762. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  29763. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  29764. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  29765. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  29766. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  29767. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  29768. exports.PredictionContextCache = pc.PredictionContextCache;
  29769. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  29770. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  29771. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  29772. /***/ }),
  29773. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  29774. /*!******************************************************!*\
  29775. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  29776. \******************************************************/
  29777. /*! no static exports found */
  29778. /***/ (function(module, exports, __webpack_require__) {
  29779. "use strict";
  29780. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  29781. if (!String.prototype.codePointAt) {
  29782. (function () {
  29783. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  29784. var defineProperty = function () {
  29785. // IE 8 only supports `Object.defineProperty` on DOM elements
  29786. try {
  29787. var object = {};
  29788. var $defineProperty = Object.defineProperty;
  29789. var result = $defineProperty(object, object, object) && $defineProperty;
  29790. } catch (error) {}
  29791. return result;
  29792. }();
  29793. var codePointAt = function codePointAt(position) {
  29794. if (this == null) {
  29795. throw TypeError();
  29796. }
  29797. var string = String(this);
  29798. var size = string.length;
  29799. // `ToInteger`
  29800. var index = position ? Number(position) : 0;
  29801. if (index != index) {
  29802. // better `isNaN`
  29803. index = 0;
  29804. }
  29805. // Account for out-of-bounds indices:
  29806. if (index < 0 || index >= size) {
  29807. return undefined;
  29808. }
  29809. // Get the first code unit
  29810. var first = string.charCodeAt(index);
  29811. var second;
  29812. if ( // check if it’s the start of a surrogate pair
  29813. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  29814. size > index + 1 // there is a next code unit
  29815. ) {
  29816. second = string.charCodeAt(index + 1);
  29817. if (second >= 0xDC00 && second <= 0xDFFF) {
  29818. // low surrogate
  29819. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  29820. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  29821. }
  29822. }
  29823. return first;
  29824. };
  29825. if (defineProperty) {
  29826. defineProperty(String.prototype, 'codePointAt', {
  29827. 'value': codePointAt,
  29828. 'configurable': true,
  29829. 'writable': true
  29830. });
  29831. } else {
  29832. String.prototype.codePointAt = codePointAt;
  29833. }
  29834. })();
  29835. }
  29836. /***/ }),
  29837. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  29838. /*!********************************************************!*\
  29839. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  29840. \********************************************************/
  29841. /*! no static exports found */
  29842. /***/ (function(module, exports, __webpack_require__) {
  29843. "use strict";
  29844. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  29845. if (!String.fromCodePoint) {
  29846. (function () {
  29847. var defineProperty = function () {
  29848. // IE 8 only supports `Object.defineProperty` on DOM elements
  29849. try {
  29850. var object = {};
  29851. var $defineProperty = Object.defineProperty;
  29852. var result = $defineProperty(object, object, object) && $defineProperty;
  29853. } catch (error) {}
  29854. return result;
  29855. }();
  29856. var stringFromCharCode = String.fromCharCode;
  29857. var floor = Math.floor;
  29858. var fromCodePoint = function fromCodePoint(_) {
  29859. var MAX_SIZE = 0x4000;
  29860. var codeUnits = [];
  29861. var highSurrogate;
  29862. var lowSurrogate;
  29863. var index = -1;
  29864. var length = arguments.length;
  29865. if (!length) {
  29866. return '';
  29867. }
  29868. var result = '';
  29869. while (++index < length) {
  29870. var codePoint = Number(arguments[index]);
  29871. if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  29872. codePoint < 0 || // not a valid Unicode code point
  29873. codePoint > 0x10FFFF || // not a valid Unicode code point
  29874. floor(codePoint) != codePoint // not an integer
  29875. ) {
  29876. throw RangeError('Invalid code point: ' + codePoint);
  29877. }
  29878. if (codePoint <= 0xFFFF) {
  29879. // BMP code point
  29880. codeUnits.push(codePoint);
  29881. } else {
  29882. // Astral code point; split in surrogate halves
  29883. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  29884. codePoint -= 0x10000;
  29885. highSurrogate = (codePoint >> 10) + 0xD800;
  29886. lowSurrogate = codePoint % 0x400 + 0xDC00;
  29887. codeUnits.push(highSurrogate, lowSurrogate);
  29888. }
  29889. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  29890. result += stringFromCharCode.apply(null, codeUnits);
  29891. codeUnits.length = 0;
  29892. }
  29893. }
  29894. return result;
  29895. };
  29896. if (defineProperty) {
  29897. defineProperty(String, 'fromCodePoint', {
  29898. 'value': fromCodePoint,
  29899. 'configurable': true,
  29900. 'writable': true
  29901. });
  29902. } else {
  29903. String.fromCodePoint = fromCodePoint;
  29904. }
  29905. })();
  29906. }
  29907. /***/ }),
  29908. /***/ "./node_modules/antlr4/tree/Tree.js":
  29909. /*!******************************************!*\
  29910. !*** ./node_modules/antlr4/tree/Tree.js ***!
  29911. \******************************************/
  29912. /*! no static exports found */
  29913. /***/ (function(module, exports, __webpack_require__) {
  29914. "use strict";
  29915. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29916. * Use of this file is governed by the BSD 3-clause license that
  29917. * can be found in the LICENSE.txt file in the project root.
  29918. */
  29919. ///
  29920. // The basic notion of a tree has a parent, a payload, and a list of children.
  29921. // It is the most abstract interface for all the trees used by ANTLR.
  29922. ///
  29923. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  29924. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  29925. var INVALID_INTERVAL = new Interval(-1, -2);
  29926. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  29927. function Tree() {
  29928. return this;
  29929. }
  29930. function SyntaxTree() {
  29931. Tree.call(this);
  29932. return this;
  29933. }
  29934. SyntaxTree.prototype = Object.create(Tree.prototype);
  29935. SyntaxTree.prototype.constructor = SyntaxTree;
  29936. function ParseTree() {
  29937. SyntaxTree.call(this);
  29938. return this;
  29939. }
  29940. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  29941. ParseTree.prototype.constructor = ParseTree;
  29942. function RuleNode() {
  29943. ParseTree.call(this);
  29944. return this;
  29945. }
  29946. RuleNode.prototype = Object.create(ParseTree.prototype);
  29947. RuleNode.prototype.constructor = RuleNode;
  29948. function TerminalNode() {
  29949. ParseTree.call(this);
  29950. return this;
  29951. }
  29952. TerminalNode.prototype = Object.create(ParseTree.prototype);
  29953. TerminalNode.prototype.constructor = TerminalNode;
  29954. function ErrorNode() {
  29955. TerminalNode.call(this);
  29956. return this;
  29957. }
  29958. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  29959. ErrorNode.prototype.constructor = ErrorNode;
  29960. function ParseTreeVisitor() {
  29961. return this;
  29962. }
  29963. ParseTreeVisitor.prototype.visit = function (ctx) {
  29964. if (Array.isArray(ctx)) {
  29965. return ctx.map(function (child) {
  29966. return child.accept(this);
  29967. }, this);
  29968. } else {
  29969. return ctx.accept(this);
  29970. }
  29971. };
  29972. ParseTreeVisitor.prototype.visitChildren = function (ctx) {
  29973. return this.visit(ctx.children);
  29974. };
  29975. ParseTreeVisitor.prototype.visitTerminal = function (node) {};
  29976. ParseTreeVisitor.prototype.visitErrorNode = function (node) {};
  29977. function ParseTreeListener() {
  29978. return this;
  29979. }
  29980. ParseTreeListener.prototype.visitTerminal = function (node) {};
  29981. ParseTreeListener.prototype.visitErrorNode = function (node) {};
  29982. ParseTreeListener.prototype.enterEveryRule = function (node) {};
  29983. ParseTreeListener.prototype.exitEveryRule = function (node) {};
  29984. function TerminalNodeImpl(symbol) {
  29985. TerminalNode.call(this);
  29986. this.parentCtx = null;
  29987. this.symbol = symbol;
  29988. return this;
  29989. }
  29990. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  29991. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  29992. TerminalNodeImpl.prototype.getChild = function (i) {
  29993. return null;
  29994. };
  29995. TerminalNodeImpl.prototype.getSymbol = function () {
  29996. return this.symbol;
  29997. };
  29998. TerminalNodeImpl.prototype.getParent = function () {
  29999. return this.parentCtx;
  30000. };
  30001. TerminalNodeImpl.prototype.getPayload = function () {
  30002. return this.symbol;
  30003. };
  30004. TerminalNodeImpl.prototype.getSourceInterval = function () {
  30005. if (this.symbol === null) {
  30006. return INVALID_INTERVAL;
  30007. }
  30008. var tokenIndex = this.symbol.tokenIndex;
  30009. return new Interval(tokenIndex, tokenIndex);
  30010. };
  30011. TerminalNodeImpl.prototype.getChildCount = function () {
  30012. return 0;
  30013. };
  30014. TerminalNodeImpl.prototype.accept = function (visitor) {
  30015. return visitor.visitTerminal(this);
  30016. };
  30017. TerminalNodeImpl.prototype.getText = function () {
  30018. return this.symbol.text;
  30019. };
  30020. TerminalNodeImpl.prototype.toString = function () {
  30021. if (this.symbol.type === Token.EOF) {
  30022. return "<EOF>";
  30023. } else {
  30024. return this.symbol.text;
  30025. }
  30026. };
  30027. // Represents a token that was consumed during resynchronization
  30028. // rather than during a valid match operation. For example,
  30029. // we will create this kind of a node during single token insertion
  30030. // and deletion as well as during "consume until error recovery set"
  30031. // upon no viable alternative exceptions.
  30032. function ErrorNodeImpl(token) {
  30033. TerminalNodeImpl.call(this, token);
  30034. return this;
  30035. }
  30036. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  30037. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  30038. ErrorNodeImpl.prototype.isErrorNode = function () {
  30039. return true;
  30040. };
  30041. ErrorNodeImpl.prototype.accept = function (visitor) {
  30042. return visitor.visitErrorNode(this);
  30043. };
  30044. function ParseTreeWalker() {
  30045. return this;
  30046. }
  30047. ParseTreeWalker.prototype.walk = function (listener, t) {
  30048. var errorNode = t instanceof ErrorNode || t.isErrorNode !== undefined && t.isErrorNode();
  30049. if (errorNode) {
  30050. listener.visitErrorNode(t);
  30051. } else if (t instanceof TerminalNode) {
  30052. listener.visitTerminal(t);
  30053. } else {
  30054. this.enterRule(listener, t);
  30055. for (var i = 0; i < t.getChildCount(); i++) {
  30056. var child = t.getChild(i);
  30057. this.walk(listener, child);
  30058. }
  30059. this.exitRule(listener, t);
  30060. }
  30061. };
  30062. //
  30063. // The discovery of a rule node, involves sending two events: the generic
  30064. // {@link ParseTreeListener//enterEveryRule} and a
  30065. // {@link RuleContext}-specific event. First we trigger the generic and then
  30066. // the rule specific. We to them in reverse order upon finishing the node.
  30067. //
  30068. ParseTreeWalker.prototype.enterRule = function (listener, r) {
  30069. var ctx = r.getRuleContext();
  30070. listener.enterEveryRule(ctx);
  30071. ctx.enterRule(listener);
  30072. };
  30073. ParseTreeWalker.prototype.exitRule = function (listener, r) {
  30074. var ctx = r.getRuleContext();
  30075. ctx.exitRule(listener);
  30076. listener.exitEveryRule(ctx);
  30077. };
  30078. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  30079. exports.RuleNode = RuleNode;
  30080. exports.ErrorNode = ErrorNode;
  30081. exports.TerminalNode = TerminalNode;
  30082. exports.ErrorNodeImpl = ErrorNodeImpl;
  30083. exports.TerminalNodeImpl = TerminalNodeImpl;
  30084. exports.ParseTreeListener = ParseTreeListener;
  30085. exports.ParseTreeVisitor = ParseTreeVisitor;
  30086. exports.ParseTreeWalker = ParseTreeWalker;
  30087. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  30088. /***/ }),
  30089. /***/ "./node_modules/antlr4/tree/Trees.js":
  30090. /*!*******************************************!*\
  30091. !*** ./node_modules/antlr4/tree/Trees.js ***!
  30092. \*******************************************/
  30093. /*! no static exports found */
  30094. /***/ (function(module, exports, __webpack_require__) {
  30095. "use strict";
  30096. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30097. * Use of this file is governed by the BSD 3-clause license that
  30098. * can be found in the LICENSE.txt file in the project root.
  30099. */
  30100. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  30101. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  30102. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  30103. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  30104. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  30105. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  30106. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  30107. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  30108. /** A set of utility routines useful for all kinds of ANTLR trees. */
  30109. function Trees() {}
  30110. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  30111. // node payloads to get the text for the nodes. Detect
  30112. // parse trees and extract data appropriately.
  30113. Trees.toStringTree = function (tree, ruleNames, recog) {
  30114. ruleNames = ruleNames || null;
  30115. recog = recog || null;
  30116. if (recog !== null) {
  30117. ruleNames = recog.ruleNames;
  30118. }
  30119. var s = Trees.getNodeText(tree, ruleNames);
  30120. s = Utils.escapeWhitespace(s, false);
  30121. var c = tree.getChildCount();
  30122. if (c === 0) {
  30123. return s;
  30124. }
  30125. var res = "(" + s + ' ';
  30126. if (c > 0) {
  30127. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  30128. res = res.concat(s);
  30129. }
  30130. for (var i = 1; i < c; i++) {
  30131. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  30132. res = res.concat(' ' + s);
  30133. }
  30134. res = res.concat(")");
  30135. return res;
  30136. };
  30137. Trees.getNodeText = function (t, ruleNames, recog) {
  30138. ruleNames = ruleNames || null;
  30139. recog = recog || null;
  30140. if (recog !== null) {
  30141. ruleNames = recog.ruleNames;
  30142. }
  30143. if (ruleNames !== null) {
  30144. if (t instanceof RuleContext) {
  30145. var altNumber = t.getAltNumber();
  30146. if (altNumber != INVALID_ALT_NUMBER) {
  30147. return ruleNames[t.ruleIndex] + ":" + altNumber;
  30148. }
  30149. return ruleNames[t.ruleIndex];
  30150. } else if (t instanceof ErrorNode) {
  30151. return t.toString();
  30152. } else if (t instanceof TerminalNode) {
  30153. if (t.symbol !== null) {
  30154. return t.symbol.text;
  30155. }
  30156. }
  30157. }
  30158. // no recog for rule names
  30159. var payload = t.getPayload();
  30160. if (payload instanceof Token) {
  30161. return payload.text;
  30162. }
  30163. return t.getPayload().toString();
  30164. };
  30165. // Return ordered list of all children of this node
  30166. Trees.getChildren = function (t) {
  30167. var list = [];
  30168. for (var i = 0; i < t.getChildCount(); i++) {
  30169. list.push(t.getChild(i));
  30170. }
  30171. return list;
  30172. };
  30173. // Return a list of all ancestors of this node. The first node of
  30174. // list is the root and the last is the parent of this node.
  30175. //
  30176. Trees.getAncestors = function (t) {
  30177. var ancestors = [];
  30178. t = t.getParent();
  30179. while (t !== null) {
  30180. ancestors = [t].concat(ancestors);
  30181. t = t.getParent();
  30182. }
  30183. return ancestors;
  30184. };
  30185. Trees.findAllTokenNodes = function (t, ttype) {
  30186. return Trees.findAllNodes(t, ttype, true);
  30187. };
  30188. Trees.findAllRuleNodes = function (t, ruleIndex) {
  30189. return Trees.findAllNodes(t, ruleIndex, false);
  30190. };
  30191. Trees.findAllNodes = function (t, index, findTokens) {
  30192. var nodes = [];
  30193. Trees._findAllNodes(t, index, findTokens, nodes);
  30194. return nodes;
  30195. };
  30196. Trees._findAllNodes = function (t, index, findTokens, nodes) {
  30197. // check this node (the root) first
  30198. if (findTokens && t instanceof TerminalNode) {
  30199. if (t.symbol.type === index) {
  30200. nodes.push(t);
  30201. }
  30202. } else if (!findTokens && t instanceof ParserRuleContext) {
  30203. if (t.ruleIndex === index) {
  30204. nodes.push(t);
  30205. }
  30206. }
  30207. // check children
  30208. for (var i = 0; i < t.getChildCount(); i++) {
  30209. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  30210. }
  30211. };
  30212. Trees.descendants = function (t) {
  30213. var nodes = [t];
  30214. for (var i = 0; i < t.getChildCount(); i++) {
  30215. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  30216. }
  30217. return nodes;
  30218. };
  30219. exports.Trees = Trees;
  30220. /***/ }),
  30221. /***/ "./node_modules/antlr4/tree/index.js":
  30222. /*!*******************************************!*\
  30223. !*** ./node_modules/antlr4/tree/index.js ***!
  30224. \*******************************************/
  30225. /*! no static exports found */
  30226. /***/ (function(module, exports, __webpack_require__) {
  30227. "use strict";
  30228. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30229. * Use of this file is governed by the BSD 3-clause license that
  30230. * can be found in the LICENSE.txt file in the project root.
  30231. */
  30232. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  30233. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  30234. exports.RuleNode = Tree.RuleNode;
  30235. exports.ParseTreeListener = Tree.ParseTreeListener;
  30236. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  30237. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  30238. /***/ }),
  30239. /***/ "./node_modules/decimal.js/decimal.js":
  30240. /*!********************************************!*\
  30241. !*** ./node_modules/decimal.js/decimal.js ***!
  30242. \********************************************/
  30243. /*! no static exports found */
  30244. /***/ (function(module, exports, __webpack_require__) {
  30245. "use strict";
  30246. var __WEBPACK_AMD_DEFINE_RESULT__;
  30247. 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; };
  30248. /*! decimal.js v10.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
  30249. ;(function (globalScope) {
  30250. 'use strict';
  30251. /*
  30252. * decimal.js v10.0.1
  30253. * An arbitrary-precision Decimal type for JavaScript.
  30254. * https://github.com/MikeMcl/decimal.js
  30255. * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
  30256. * MIT Licence
  30257. */
  30258. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  30259. // The maximum exponent magnitude.
  30260. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  30261. var EXP_LIMIT = 9e15,
  30262. // 0 to 9e15
  30263. // The limit on the value of `precision`, and on the value of the first argument to
  30264. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  30265. MAX_DIGITS = 1e9,
  30266. // 0 to 1e9
  30267. // Base conversion alphabet.
  30268. NUMERALS = '0123456789abcdef',
  30269. // The natural logarithm of 10 (1025 digits).
  30270. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  30271. // Pi (1025 digits).
  30272. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  30273. // The initial configuration properties of the Decimal constructor.
  30274. DEFAULTS = {
  30275. // These values must be integers within the stated ranges (inclusive).
  30276. // Most of these values can be changed at run-time using the `Decimal.config` method.
  30277. // The maximum number of significant digits of the result of a calculation or base conversion.
  30278. // E.g. `Decimal.config({ precision: 20 });`
  30279. precision: 20, // 1 to MAX_DIGITS
  30280. // The rounding mode used when rounding to `precision`.
  30281. //
  30282. // ROUND_UP 0 Away from zero.
  30283. // ROUND_DOWN 1 Towards zero.
  30284. // ROUND_CEIL 2 Towards +Infinity.
  30285. // ROUND_FLOOR 3 Towards -Infinity.
  30286. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  30287. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  30288. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  30289. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  30290. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  30291. //
  30292. // E.g.
  30293. // `Decimal.rounding = 4;`
  30294. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  30295. rounding: 4, // 0 to 8
  30296. // The modulo mode used when calculating the modulus: a mod n.
  30297. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  30298. // The remainder (r) is calculated as: r = a - n * q.
  30299. //
  30300. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  30301. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  30302. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  30303. // HALF_EVEN 6 The IEEE 754 remainder function.
  30304. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  30305. //
  30306. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  30307. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  30308. // be used, but they may not give useful results.
  30309. modulo: 1, // 0 to 9
  30310. // The exponent value at and beneath which `toString` returns exponential notation.
  30311. // JavaScript numbers: -7
  30312. toExpNeg: -7, // 0 to -EXP_LIMIT
  30313. // The exponent value at and above which `toString` returns exponential notation.
  30314. // JavaScript numbers: 21
  30315. toExpPos: 21, // 0 to EXP_LIMIT
  30316. // The minimum exponent value, beneath which underflow to zero occurs.
  30317. // JavaScript numbers: -324 (5e-324)
  30318. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  30319. // The maximum exponent value, above which overflow to Infinity occurs.
  30320. // JavaScript numbers: 308 (1.7976931348623157e+308)
  30321. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  30322. // Whether to use cryptographically-secure random number generation, if available.
  30323. crypto: false // true/false
  30324. },
  30325. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  30326. Decimal,
  30327. inexact,
  30328. noConflict,
  30329. quadrant,
  30330. external = true,
  30331. decimalError = '[DecimalError] ',
  30332. invalidArgument = decimalError + 'Invalid argument: ',
  30333. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  30334. cryptoUnavailable = decimalError + 'crypto unavailable',
  30335. mathfloor = Math.floor,
  30336. mathpow = Math.pow,
  30337. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  30338. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  30339. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  30340. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  30341. BASE = 1e7,
  30342. LOG_BASE = 7,
  30343. MAX_SAFE_INTEGER = 9007199254740991,
  30344. LN10_PRECISION = LN10.length - 1,
  30345. PI_PRECISION = PI.length - 1,
  30346. // Decimal.prototype object
  30347. P = { name: '[object Decimal]' };
  30348. // Decimal prototype methods
  30349. /*
  30350. * absoluteValue abs
  30351. * ceil
  30352. * comparedTo cmp
  30353. * cosine cos
  30354. * cubeRoot cbrt
  30355. * decimalPlaces dp
  30356. * dividedBy div
  30357. * dividedToIntegerBy divToInt
  30358. * equals eq
  30359. * floor
  30360. * greaterThan gt
  30361. * greaterThanOrEqualTo gte
  30362. * hyperbolicCosine cosh
  30363. * hyperbolicSine sinh
  30364. * hyperbolicTangent tanh
  30365. * inverseCosine acos
  30366. * inverseHyperbolicCosine acosh
  30367. * inverseHyperbolicSine asinh
  30368. * inverseHyperbolicTangent atanh
  30369. * inverseSine asin
  30370. * inverseTangent atan
  30371. * isFinite
  30372. * isInteger isInt
  30373. * isNaN
  30374. * isNegative isNeg
  30375. * isPositive isPos
  30376. * isZero
  30377. * lessThan lt
  30378. * lessThanOrEqualTo lte
  30379. * logarithm log
  30380. * [maximum] [max]
  30381. * [minimum] [min]
  30382. * minus sub
  30383. * modulo mod
  30384. * naturalExponential exp
  30385. * naturalLogarithm ln
  30386. * negated neg
  30387. * plus add
  30388. * precision sd
  30389. * round
  30390. * sine sin
  30391. * squareRoot sqrt
  30392. * tangent tan
  30393. * times mul
  30394. * toBinary
  30395. * toDecimalPlaces toDP
  30396. * toExponential
  30397. * toFixed
  30398. * toFraction
  30399. * toHexadecimal toHex
  30400. * toNearest
  30401. * toNumber
  30402. * toOctal
  30403. * toPower pow
  30404. * toPrecision
  30405. * toSignificantDigits toSD
  30406. * toString
  30407. * truncated trunc
  30408. * valueOf toJSON
  30409. */
  30410. /*
  30411. * Return a new Decimal whose value is the absolute value of this Decimal.
  30412. *
  30413. */
  30414. P.absoluteValue = P.abs = function () {
  30415. var x = new this.constructor(this);
  30416. if (x.s < 0) x.s = 1;
  30417. return finalise(x);
  30418. };
  30419. /*
  30420. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  30421. * direction of positive Infinity.
  30422. *
  30423. */
  30424. P.ceil = function () {
  30425. return finalise(new this.constructor(this), this.e + 1, 2);
  30426. };
  30427. /*
  30428. * Return
  30429. * 1 if the value of this Decimal is greater than the value of `y`,
  30430. * -1 if the value of this Decimal is less than the value of `y`,
  30431. * 0 if they have the same value,
  30432. * NaN if the value of either Decimal is NaN.
  30433. *
  30434. */
  30435. P.comparedTo = P.cmp = function (y) {
  30436. var i,
  30437. j,
  30438. xdL,
  30439. ydL,
  30440. x = this,
  30441. xd = x.d,
  30442. yd = (y = new x.constructor(y)).d,
  30443. xs = x.s,
  30444. ys = y.s;
  30445. // Either NaN or ±Infinity?
  30446. if (!xd || !yd) {
  30447. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  30448. }
  30449. // Either zero?
  30450. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  30451. // Signs differ?
  30452. if (xs !== ys) return xs;
  30453. // Compare exponents.
  30454. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  30455. xdL = xd.length;
  30456. ydL = yd.length;
  30457. // Compare digit by digit.
  30458. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  30459. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  30460. }
  30461. // Compare lengths.
  30462. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  30463. };
  30464. /*
  30465. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  30466. *
  30467. * Domain: [-Infinity, Infinity]
  30468. * Range: [-1, 1]
  30469. *
  30470. * cos(0) = 1
  30471. * cos(-0) = 1
  30472. * cos(Infinity) = NaN
  30473. * cos(-Infinity) = NaN
  30474. * cos(NaN) = NaN
  30475. *
  30476. */
  30477. P.cosine = P.cos = function () {
  30478. var pr,
  30479. rm,
  30480. x = this,
  30481. Ctor = x.constructor;
  30482. if (!x.d) return new Ctor(NaN);
  30483. // cos(0) = cos(-0) = 1
  30484. if (!x.d[0]) return new Ctor(1);
  30485. pr = Ctor.precision;
  30486. rm = Ctor.rounding;
  30487. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  30488. Ctor.rounding = 1;
  30489. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  30490. Ctor.precision = pr;
  30491. Ctor.rounding = rm;
  30492. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  30493. };
  30494. /*
  30495. *
  30496. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  30497. * `precision` significant digits using rounding mode `rounding`.
  30498. *
  30499. * cbrt(0) = 0
  30500. * cbrt(-0) = -0
  30501. * cbrt(1) = 1
  30502. * cbrt(-1) = -1
  30503. * cbrt(N) = N
  30504. * cbrt(-I) = -I
  30505. * cbrt(I) = I
  30506. *
  30507. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  30508. *
  30509. */
  30510. P.cubeRoot = P.cbrt = function () {
  30511. var e,
  30512. m,
  30513. n,
  30514. r,
  30515. rep,
  30516. s,
  30517. sd,
  30518. t,
  30519. t3,
  30520. t3plusx,
  30521. x = this,
  30522. Ctor = x.constructor;
  30523. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  30524. external = false;
  30525. // Initial estimate.
  30526. s = x.s * Math.pow(x.s * x, 1 / 3);
  30527. // Math.cbrt underflow/overflow?
  30528. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  30529. if (!s || Math.abs(s) == 1 / 0) {
  30530. n = digitsToString(x.d);
  30531. e = x.e;
  30532. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  30533. if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? '0' : '00';
  30534. s = Math.pow(n, 1 / 3);
  30535. // Rarely, e may be one less than the result exponent value.
  30536. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  30537. if (s == 1 / 0) {
  30538. n = '5e' + e;
  30539. } else {
  30540. n = s.toExponential();
  30541. n = n.slice(0, n.indexOf('e') + 1) + e;
  30542. }
  30543. r = new Ctor(n);
  30544. r.s = x.s;
  30545. } else {
  30546. r = new Ctor(s.toString());
  30547. }
  30548. sd = (e = Ctor.precision) + 3;
  30549. // Halley's method.
  30550. // TODO? Compare Newton's method.
  30551. for (;;) {
  30552. t = r;
  30553. t3 = t.times(t).times(t);
  30554. t3plusx = t3.plus(x);
  30555. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  30556. // TODO? Replace with for-loop and checkRoundingDigits.
  30557. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  30558. n = n.slice(sd - 3, sd + 1);
  30559. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  30560. // , i.e. approaching a rounding boundary, continue the iteration.
  30561. if (n == '9999' || !rep && n == '4999') {
  30562. // On the first iteration only, check to see if rounding up gives the exact result as the
  30563. // nines may infinitely repeat.
  30564. if (!rep) {
  30565. finalise(t, e + 1, 0);
  30566. if (t.times(t).times(t).eq(x)) {
  30567. r = t;
  30568. break;
  30569. }
  30570. }
  30571. sd += 4;
  30572. rep = 1;
  30573. } else {
  30574. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  30575. // If not, then there are further digits and m will be truthy.
  30576. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  30577. // Truncate to the first rounding digit.
  30578. finalise(r, e + 1, 1);
  30579. m = !r.times(r).times(r).eq(x);
  30580. }
  30581. break;
  30582. }
  30583. }
  30584. }
  30585. external = true;
  30586. return finalise(r, e, Ctor.rounding, m);
  30587. };
  30588. /*
  30589. * Return the number of decimal places of the value of this Decimal.
  30590. *
  30591. */
  30592. P.decimalPlaces = P.dp = function () {
  30593. var w,
  30594. d = this.d,
  30595. n = NaN;
  30596. if (d) {
  30597. w = d.length - 1;
  30598. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  30599. // Subtract the number of trailing zeros of the last word.
  30600. w = d[w];
  30601. if (w) for (; w % 10 == 0; w /= 10) {
  30602. n--;
  30603. }if (n < 0) n = 0;
  30604. }
  30605. return n;
  30606. };
  30607. /*
  30608. * n / 0 = I
  30609. * n / N = N
  30610. * n / I = 0
  30611. * 0 / n = 0
  30612. * 0 / 0 = N
  30613. * 0 / N = N
  30614. * 0 / I = 0
  30615. * N / n = N
  30616. * N / 0 = N
  30617. * N / N = N
  30618. * N / I = N
  30619. * I / n = I
  30620. * I / 0 = I
  30621. * I / N = N
  30622. * I / I = N
  30623. *
  30624. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  30625. * `precision` significant digits using rounding mode `rounding`.
  30626. *
  30627. */
  30628. P.dividedBy = P.div = function (y) {
  30629. return divide(this, new this.constructor(y));
  30630. };
  30631. /*
  30632. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  30633. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  30634. *
  30635. */
  30636. P.dividedToIntegerBy = P.divToInt = function (y) {
  30637. var x = this,
  30638. Ctor = x.constructor;
  30639. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  30640. };
  30641. /*
  30642. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  30643. *
  30644. */
  30645. P.equals = P.eq = function (y) {
  30646. return this.cmp(y) === 0;
  30647. };
  30648. /*
  30649. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  30650. * direction of negative Infinity.
  30651. *
  30652. */
  30653. P.floor = function () {
  30654. return finalise(new this.constructor(this), this.e + 1, 3);
  30655. };
  30656. /*
  30657. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  30658. * false.
  30659. *
  30660. */
  30661. P.greaterThan = P.gt = function (y) {
  30662. return this.cmp(y) > 0;
  30663. };
  30664. /*
  30665. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  30666. * otherwise return false.
  30667. *
  30668. */
  30669. P.greaterThanOrEqualTo = P.gte = function (y) {
  30670. var k = this.cmp(y);
  30671. return k == 1 || k === 0;
  30672. };
  30673. /*
  30674. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  30675. * Decimal.
  30676. *
  30677. * Domain: [-Infinity, Infinity]
  30678. * Range: [1, Infinity]
  30679. *
  30680. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  30681. *
  30682. * cosh(0) = 1
  30683. * cosh(-0) = 1
  30684. * cosh(Infinity) = Infinity
  30685. * cosh(-Infinity) = Infinity
  30686. * cosh(NaN) = NaN
  30687. *
  30688. * x time taken (ms) result
  30689. * 1000 9 9.8503555700852349694e+433
  30690. * 10000 25 4.4034091128314607936e+4342
  30691. * 100000 171 1.4033316802130615897e+43429
  30692. * 1000000 3817 1.5166076984010437725e+434294
  30693. * 10000000 abandoned after 2 minute wait
  30694. *
  30695. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  30696. *
  30697. */
  30698. P.hyperbolicCosine = P.cosh = function () {
  30699. var k,
  30700. n,
  30701. pr,
  30702. rm,
  30703. len,
  30704. x = this,
  30705. Ctor = x.constructor,
  30706. one = new Ctor(1);
  30707. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  30708. if (x.isZero()) return one;
  30709. pr = Ctor.precision;
  30710. rm = Ctor.rounding;
  30711. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  30712. Ctor.rounding = 1;
  30713. len = x.d.length;
  30714. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  30715. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  30716. // Estimate the optimum number of times to use the argument reduction.
  30717. // TODO? Estimation reused from cosine() and may not be optimal here.
  30718. if (len < 32) {
  30719. k = Math.ceil(len / 3);
  30720. n = Math.pow(4, -k).toString();
  30721. } else {
  30722. k = 16;
  30723. n = '2.3283064365386962890625e-10';
  30724. }
  30725. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  30726. // Reverse argument reduction
  30727. var cosh2_x,
  30728. i = k,
  30729. d8 = new Ctor(8);
  30730. for (; i--;) {
  30731. cosh2_x = x.times(x);
  30732. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  30733. }
  30734. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  30735. };
  30736. /*
  30737. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  30738. * Decimal.
  30739. *
  30740. * Domain: [-Infinity, Infinity]
  30741. * Range: [-Infinity, Infinity]
  30742. *
  30743. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  30744. *
  30745. * sinh(0) = 0
  30746. * sinh(-0) = -0
  30747. * sinh(Infinity) = Infinity
  30748. * sinh(-Infinity) = -Infinity
  30749. * sinh(NaN) = NaN
  30750. *
  30751. * x time taken (ms)
  30752. * 10 2 ms
  30753. * 100 5 ms
  30754. * 1000 14 ms
  30755. * 10000 82 ms
  30756. * 100000 886 ms 1.4033316802130615897e+43429
  30757. * 200000 2613 ms
  30758. * 300000 5407 ms
  30759. * 400000 8824 ms
  30760. * 500000 13026 ms 8.7080643612718084129e+217146
  30761. * 1000000 48543 ms
  30762. *
  30763. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  30764. *
  30765. */
  30766. P.hyperbolicSine = P.sinh = function () {
  30767. var k,
  30768. pr,
  30769. rm,
  30770. len,
  30771. x = this,
  30772. Ctor = x.constructor;
  30773. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  30774. pr = Ctor.precision;
  30775. rm = Ctor.rounding;
  30776. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  30777. Ctor.rounding = 1;
  30778. len = x.d.length;
  30779. if (len < 3) {
  30780. x = taylorSeries(Ctor, 2, x, x, true);
  30781. } else {
  30782. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  30783. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  30784. // 3 multiplications and 1 addition
  30785. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  30786. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  30787. // 4 multiplications and 2 additions
  30788. // Estimate the optimum number of times to use the argument reduction.
  30789. k = 1.4 * Math.sqrt(len);
  30790. k = k > 16 ? 16 : k | 0;
  30791. x = x.times(Math.pow(5, -k));
  30792. x = taylorSeries(Ctor, 2, x, x, true);
  30793. // Reverse argument reduction
  30794. var sinh2_x,
  30795. d5 = new Ctor(5),
  30796. d16 = new Ctor(16),
  30797. d20 = new Ctor(20);
  30798. for (; k--;) {
  30799. sinh2_x = x.times(x);
  30800. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  30801. }
  30802. }
  30803. Ctor.precision = pr;
  30804. Ctor.rounding = rm;
  30805. return finalise(x, pr, rm, true);
  30806. };
  30807. /*
  30808. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  30809. * Decimal.
  30810. *
  30811. * Domain: [-Infinity, Infinity]
  30812. * Range: [-1, 1]
  30813. *
  30814. * tanh(x) = sinh(x) / cosh(x)
  30815. *
  30816. * tanh(0) = 0
  30817. * tanh(-0) = -0
  30818. * tanh(Infinity) = 1
  30819. * tanh(-Infinity) = -1
  30820. * tanh(NaN) = NaN
  30821. *
  30822. */
  30823. P.hyperbolicTangent = P.tanh = function () {
  30824. var pr,
  30825. rm,
  30826. x = this,
  30827. Ctor = x.constructor;
  30828. if (!x.isFinite()) return new Ctor(x.s);
  30829. if (x.isZero()) return new Ctor(x);
  30830. pr = Ctor.precision;
  30831. rm = Ctor.rounding;
  30832. Ctor.precision = pr + 7;
  30833. Ctor.rounding = 1;
  30834. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  30835. };
  30836. /*
  30837. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  30838. * this Decimal.
  30839. *
  30840. * Domain: [-1, 1]
  30841. * Range: [0, pi]
  30842. *
  30843. * acos(x) = pi/2 - asin(x)
  30844. *
  30845. * acos(0) = pi/2
  30846. * acos(-0) = pi/2
  30847. * acos(1) = 0
  30848. * acos(-1) = pi
  30849. * acos(1/2) = pi/3
  30850. * acos(-1/2) = 2*pi/3
  30851. * acos(|x| > 1) = NaN
  30852. * acos(NaN) = NaN
  30853. *
  30854. */
  30855. P.inverseCosine = P.acos = function () {
  30856. var halfPi,
  30857. x = this,
  30858. Ctor = x.constructor,
  30859. k = x.abs().cmp(1),
  30860. pr = Ctor.precision,
  30861. rm = Ctor.rounding;
  30862. if (k !== -1) {
  30863. return k === 0
  30864. // |x| is 1
  30865. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  30866. // |x| > 1 or x is NaN
  30867. : new Ctor(NaN);
  30868. }
  30869. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  30870. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  30871. Ctor.precision = pr + 6;
  30872. Ctor.rounding = 1;
  30873. x = x.asin();
  30874. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  30875. Ctor.precision = pr;
  30876. Ctor.rounding = rm;
  30877. return halfPi.minus(x);
  30878. };
  30879. /*
  30880. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  30881. * value of this Decimal.
  30882. *
  30883. * Domain: [1, Infinity]
  30884. * Range: [0, Infinity]
  30885. *
  30886. * acosh(x) = ln(x + sqrt(x^2 - 1))
  30887. *
  30888. * acosh(x < 1) = NaN
  30889. * acosh(NaN) = NaN
  30890. * acosh(Infinity) = Infinity
  30891. * acosh(-Infinity) = NaN
  30892. * acosh(0) = NaN
  30893. * acosh(-0) = NaN
  30894. * acosh(1) = 0
  30895. * acosh(-1) = NaN
  30896. *
  30897. */
  30898. P.inverseHyperbolicCosine = P.acosh = function () {
  30899. var pr,
  30900. rm,
  30901. x = this,
  30902. Ctor = x.constructor;
  30903. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  30904. if (!x.isFinite()) return new Ctor(x);
  30905. pr = Ctor.precision;
  30906. rm = Ctor.rounding;
  30907. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  30908. Ctor.rounding = 1;
  30909. external = false;
  30910. x = x.times(x).minus(1).sqrt().plus(x);
  30911. external = true;
  30912. Ctor.precision = pr;
  30913. Ctor.rounding = rm;
  30914. return x.ln();
  30915. };
  30916. /*
  30917. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  30918. * of this Decimal.
  30919. *
  30920. * Domain: [-Infinity, Infinity]
  30921. * Range: [-Infinity, Infinity]
  30922. *
  30923. * asinh(x) = ln(x + sqrt(x^2 + 1))
  30924. *
  30925. * asinh(NaN) = NaN
  30926. * asinh(Infinity) = Infinity
  30927. * asinh(-Infinity) = -Infinity
  30928. * asinh(0) = 0
  30929. * asinh(-0) = -0
  30930. *
  30931. */
  30932. P.inverseHyperbolicSine = P.asinh = function () {
  30933. var pr,
  30934. rm,
  30935. x = this,
  30936. Ctor = x.constructor;
  30937. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  30938. pr = Ctor.precision;
  30939. rm = Ctor.rounding;
  30940. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  30941. Ctor.rounding = 1;
  30942. external = false;
  30943. x = x.times(x).plus(1).sqrt().plus(x);
  30944. external = true;
  30945. Ctor.precision = pr;
  30946. Ctor.rounding = rm;
  30947. return x.ln();
  30948. };
  30949. /*
  30950. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  30951. * value of this Decimal.
  30952. *
  30953. * Domain: [-1, 1]
  30954. * Range: [-Infinity, Infinity]
  30955. *
  30956. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  30957. *
  30958. * atanh(|x| > 1) = NaN
  30959. * atanh(NaN) = NaN
  30960. * atanh(Infinity) = NaN
  30961. * atanh(-Infinity) = NaN
  30962. * atanh(0) = 0
  30963. * atanh(-0) = -0
  30964. * atanh(1) = Infinity
  30965. * atanh(-1) = -Infinity
  30966. *
  30967. */
  30968. P.inverseHyperbolicTangent = P.atanh = function () {
  30969. var pr,
  30970. rm,
  30971. wpr,
  30972. xsd,
  30973. x = this,
  30974. Ctor = x.constructor;
  30975. if (!x.isFinite()) return new Ctor(NaN);
  30976. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  30977. pr = Ctor.precision;
  30978. rm = Ctor.rounding;
  30979. xsd = x.sd();
  30980. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  30981. Ctor.precision = wpr = xsd - x.e;
  30982. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  30983. Ctor.precision = pr + 4;
  30984. Ctor.rounding = 1;
  30985. x = x.ln();
  30986. Ctor.precision = pr;
  30987. Ctor.rounding = rm;
  30988. return x.times(0.5);
  30989. };
  30990. /*
  30991. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  30992. * Decimal.
  30993. *
  30994. * Domain: [-Infinity, Infinity]
  30995. * Range: [-pi/2, pi/2]
  30996. *
  30997. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  30998. *
  30999. * asin(0) = 0
  31000. * asin(-0) = -0
  31001. * asin(1/2) = pi/6
  31002. * asin(-1/2) = -pi/6
  31003. * asin(1) = pi/2
  31004. * asin(-1) = -pi/2
  31005. * asin(|x| > 1) = NaN
  31006. * asin(NaN) = NaN
  31007. *
  31008. * TODO? Compare performance of Taylor series.
  31009. *
  31010. */
  31011. P.inverseSine = P.asin = function () {
  31012. var halfPi,
  31013. k,
  31014. pr,
  31015. rm,
  31016. x = this,
  31017. Ctor = x.constructor;
  31018. if (x.isZero()) return new Ctor(x);
  31019. k = x.abs().cmp(1);
  31020. pr = Ctor.precision;
  31021. rm = Ctor.rounding;
  31022. if (k !== -1) {
  31023. // |x| is 1
  31024. if (k === 0) {
  31025. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  31026. halfPi.s = x.s;
  31027. return halfPi;
  31028. }
  31029. // |x| > 1 or x is NaN
  31030. return new Ctor(NaN);
  31031. }
  31032. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  31033. Ctor.precision = pr + 6;
  31034. Ctor.rounding = 1;
  31035. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  31036. Ctor.precision = pr;
  31037. Ctor.rounding = rm;
  31038. return x.times(2);
  31039. };
  31040. /*
  31041. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  31042. * of this Decimal.
  31043. *
  31044. * Domain: [-Infinity, Infinity]
  31045. * Range: [-pi/2, pi/2]
  31046. *
  31047. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  31048. *
  31049. * atan(0) = 0
  31050. * atan(-0) = -0
  31051. * atan(1) = pi/4
  31052. * atan(-1) = -pi/4
  31053. * atan(Infinity) = pi/2
  31054. * atan(-Infinity) = -pi/2
  31055. * atan(NaN) = NaN
  31056. *
  31057. */
  31058. P.inverseTangent = P.atan = function () {
  31059. var i,
  31060. j,
  31061. k,
  31062. n,
  31063. px,
  31064. t,
  31065. r,
  31066. wpr,
  31067. x2,
  31068. x = this,
  31069. Ctor = x.constructor,
  31070. pr = Ctor.precision,
  31071. rm = Ctor.rounding;
  31072. if (!x.isFinite()) {
  31073. if (!x.s) return new Ctor(NaN);
  31074. if (pr + 4 <= PI_PRECISION) {
  31075. r = getPi(Ctor, pr + 4, rm).times(0.5);
  31076. r.s = x.s;
  31077. return r;
  31078. }
  31079. } else if (x.isZero()) {
  31080. return new Ctor(x);
  31081. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  31082. r = getPi(Ctor, pr + 4, rm).times(0.25);
  31083. r.s = x.s;
  31084. return r;
  31085. }
  31086. Ctor.precision = wpr = pr + 10;
  31087. Ctor.rounding = 1;
  31088. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  31089. // Argument reduction
  31090. // Ensure |x| < 0.42
  31091. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  31092. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  31093. for (i = k; i; --i) {
  31094. x = x.div(x.times(x).plus(1).sqrt().plus(1));
  31095. }external = false;
  31096. j = Math.ceil(wpr / LOG_BASE);
  31097. n = 1;
  31098. x2 = x.times(x);
  31099. r = new Ctor(x);
  31100. px = x;
  31101. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  31102. for (; i !== -1;) {
  31103. px = px.times(x2);
  31104. t = r.minus(px.div(n += 2));
  31105. px = px.times(x2);
  31106. r = t.plus(px.div(n += 2));
  31107. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;) {}
  31108. }
  31109. if (k) r = r.times(2 << k - 1);
  31110. external = true;
  31111. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  31112. };
  31113. /*
  31114. * Return true if the value of this Decimal is a finite number, otherwise return false.
  31115. *
  31116. */
  31117. P.isFinite = function () {
  31118. return !!this.d;
  31119. };
  31120. /*
  31121. * Return true if the value of this Decimal is an integer, otherwise return false.
  31122. *
  31123. */
  31124. P.isInteger = P.isInt = function () {
  31125. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  31126. };
  31127. /*
  31128. * Return true if the value of this Decimal is NaN, otherwise return false.
  31129. *
  31130. */
  31131. P.isNaN = function () {
  31132. return !this.s;
  31133. };
  31134. /*
  31135. * Return true if the value of this Decimal is negative, otherwise return false.
  31136. *
  31137. */
  31138. P.isNegative = P.isNeg = function () {
  31139. return this.s < 0;
  31140. };
  31141. /*
  31142. * Return true if the value of this Decimal is positive, otherwise return false.
  31143. *
  31144. */
  31145. P.isPositive = P.isPos = function () {
  31146. return this.s > 0;
  31147. };
  31148. /*
  31149. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  31150. *
  31151. */
  31152. P.isZero = function () {
  31153. return !!this.d && this.d[0] === 0;
  31154. };
  31155. /*
  31156. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  31157. *
  31158. */
  31159. P.lessThan = P.lt = function (y) {
  31160. return this.cmp(y) < 0;
  31161. };
  31162. /*
  31163. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  31164. *
  31165. */
  31166. P.lessThanOrEqualTo = P.lte = function (y) {
  31167. return this.cmp(y) < 1;
  31168. };
  31169. /*
  31170. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  31171. * significant digits using rounding mode `rounding`.
  31172. *
  31173. * If no base is specified, return log[10](arg).
  31174. *
  31175. * log[base](arg) = ln(arg) / ln(base)
  31176. *
  31177. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  31178. * otherwise:
  31179. *
  31180. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  31181. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  31182. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  31183. *
  31184. * log[-b](a) = NaN
  31185. * log[0](a) = NaN
  31186. * log[1](a) = NaN
  31187. * log[NaN](a) = NaN
  31188. * log[Infinity](a) = NaN
  31189. * log[b](0) = -Infinity
  31190. * log[b](-0) = -Infinity
  31191. * log[b](-a) = NaN
  31192. * log[b](1) = 0
  31193. * log[b](Infinity) = Infinity
  31194. * log[b](NaN) = NaN
  31195. *
  31196. * [base] {number|string|Decimal} The base of the logarithm.
  31197. *
  31198. */
  31199. P.logarithm = P.log = function (base) {
  31200. var isBase10,
  31201. d,
  31202. denominator,
  31203. k,
  31204. inf,
  31205. num,
  31206. sd,
  31207. r,
  31208. arg = this,
  31209. Ctor = arg.constructor,
  31210. pr = Ctor.precision,
  31211. rm = Ctor.rounding,
  31212. guard = 5;
  31213. // Default base is 10.
  31214. if (base == null) {
  31215. base = new Ctor(10);
  31216. isBase10 = true;
  31217. } else {
  31218. base = new Ctor(base);
  31219. d = base.d;
  31220. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  31221. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  31222. isBase10 = base.eq(10);
  31223. }
  31224. d = arg.d;
  31225. // Is arg negative, non-finite, 0 or 1?
  31226. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  31227. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  31228. }
  31229. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  31230. // integer power of 10.
  31231. if (isBase10) {
  31232. if (d.length > 1) {
  31233. inf = true;
  31234. } else {
  31235. for (k = d[0]; k % 10 === 0;) {
  31236. k /= 10;
  31237. }inf = k !== 1;
  31238. }
  31239. }
  31240. external = false;
  31241. sd = pr + guard;
  31242. num = naturalLogarithm(arg, sd);
  31243. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  31244. // The result will have 5 rounding digits.
  31245. r = divide(num, denominator, sd, 1);
  31246. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  31247. // calculate 10 further digits.
  31248. //
  31249. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  31250. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  31251. // further digits, the last 14 are nines, round up and assume the result is exact.
  31252. // Also assume the result is exact if the last 14 are zero.
  31253. //
  31254. // Example of a result that will be incorrectly rounded:
  31255. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  31256. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  31257. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  31258. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  31259. // place is still 2.6.
  31260. if (checkRoundingDigits(r.d, k = pr, rm)) {
  31261. do {
  31262. sd += 10;
  31263. num = naturalLogarithm(arg, sd);
  31264. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  31265. r = divide(num, denominator, sd, 1);
  31266. if (!inf) {
  31267. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  31268. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  31269. r = finalise(r, pr + 1, 0);
  31270. }
  31271. break;
  31272. }
  31273. } while (checkRoundingDigits(r.d, k += 10, rm));
  31274. }
  31275. external = true;
  31276. return finalise(r, pr, rm);
  31277. };
  31278. /*
  31279. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  31280. *
  31281. * arguments {number|string|Decimal}
  31282. *
  31283. P.max = function () {
  31284. Array.prototype.push.call(arguments, this);
  31285. return maxOrMin(this.constructor, arguments, 'lt');
  31286. };
  31287. */
  31288. /*
  31289. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  31290. *
  31291. * arguments {number|string|Decimal}
  31292. *
  31293. P.min = function () {
  31294. Array.prototype.push.call(arguments, this);
  31295. return maxOrMin(this.constructor, arguments, 'gt');
  31296. };
  31297. */
  31298. /*
  31299. * n - 0 = n
  31300. * n - N = N
  31301. * n - I = -I
  31302. * 0 - n = -n
  31303. * 0 - 0 = 0
  31304. * 0 - N = N
  31305. * 0 - I = -I
  31306. * N - n = N
  31307. * N - 0 = N
  31308. * N - N = N
  31309. * N - I = N
  31310. * I - n = I
  31311. * I - 0 = I
  31312. * I - N = N
  31313. * I - I = N
  31314. *
  31315. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  31316. * significant digits using rounding mode `rounding`.
  31317. *
  31318. */
  31319. P.minus = P.sub = function (y) {
  31320. var d,
  31321. e,
  31322. i,
  31323. j,
  31324. k,
  31325. len,
  31326. pr,
  31327. rm,
  31328. xd,
  31329. xe,
  31330. xLTy,
  31331. yd,
  31332. x = this,
  31333. Ctor = x.constructor;
  31334. y = new Ctor(y);
  31335. // If either is not finite...
  31336. if (!x.d || !y.d) {
  31337. // Return NaN if either is NaN.
  31338. if (!x.s || !y.s) y = new Ctor(NaN);
  31339. // Return y negated if x is finite and y is ±Infinity.
  31340. else if (x.d) y.s = -y.s;
  31341. // Return x if y is finite and x is ±Infinity.
  31342. // Return x if both are ±Infinity with different signs.
  31343. // Return NaN if both are ±Infinity with the same sign.
  31344. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  31345. return y;
  31346. }
  31347. // If signs differ...
  31348. if (x.s != y.s) {
  31349. y.s = -y.s;
  31350. return x.plus(y);
  31351. }
  31352. xd = x.d;
  31353. yd = y.d;
  31354. pr = Ctor.precision;
  31355. rm = Ctor.rounding;
  31356. // If either is zero...
  31357. if (!xd[0] || !yd[0]) {
  31358. // Return y negated if x is zero and y is non-zero.
  31359. if (yd[0]) y.s = -y.s;
  31360. // Return x if y is zero and x is non-zero.
  31361. else if (xd[0]) y = new Ctor(x);
  31362. // Return zero if both are zero.
  31363. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  31364. else return new Ctor(rm === 3 ? -0 : 0);
  31365. return external ? finalise(y, pr, rm) : y;
  31366. }
  31367. // x and y are finite, non-zero numbers with the same sign.
  31368. // Calculate base 1e7 exponents.
  31369. e = mathfloor(y.e / LOG_BASE);
  31370. xe = mathfloor(x.e / LOG_BASE);
  31371. xd = xd.slice();
  31372. k = xe - e;
  31373. // If base 1e7 exponents differ...
  31374. if (k) {
  31375. xLTy = k < 0;
  31376. if (xLTy) {
  31377. d = xd;
  31378. k = -k;
  31379. len = yd.length;
  31380. } else {
  31381. d = yd;
  31382. e = xe;
  31383. len = xd.length;
  31384. }
  31385. // Numbers with massively different exponents would result in a very high number of
  31386. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  31387. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  31388. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  31389. if (k > i) {
  31390. k = i;
  31391. d.length = 1;
  31392. }
  31393. // Prepend zeros to equalise exponents.
  31394. d.reverse();
  31395. for (i = k; i--;) {
  31396. d.push(0);
  31397. }d.reverse();
  31398. // Base 1e7 exponents equal.
  31399. } else {
  31400. // Check digits to determine which is the bigger number.
  31401. i = xd.length;
  31402. len = yd.length;
  31403. xLTy = i < len;
  31404. if (xLTy) len = i;
  31405. for (i = 0; i < len; i++) {
  31406. if (xd[i] != yd[i]) {
  31407. xLTy = xd[i] < yd[i];
  31408. break;
  31409. }
  31410. }
  31411. k = 0;
  31412. }
  31413. if (xLTy) {
  31414. d = xd;
  31415. xd = yd;
  31416. yd = d;
  31417. y.s = -y.s;
  31418. }
  31419. len = xd.length;
  31420. // Append zeros to `xd` if shorter.
  31421. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  31422. for (i = yd.length - len; i > 0; --i) {
  31423. xd[len++] = 0;
  31424. } // Subtract yd from xd.
  31425. for (i = yd.length; i > k;) {
  31426. if (xd[--i] < yd[i]) {
  31427. for (j = i; j && xd[--j] === 0;) {
  31428. xd[j] = BASE - 1;
  31429. }--xd[j];
  31430. xd[i] += BASE;
  31431. }
  31432. xd[i] -= yd[i];
  31433. }
  31434. // Remove trailing zeros.
  31435. for (; xd[--len] === 0;) {
  31436. xd.pop();
  31437. } // Remove leading zeros and adjust exponent accordingly.
  31438. for (; xd[0] === 0; xd.shift()) {
  31439. --e;
  31440. } // Zero?
  31441. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  31442. y.d = xd;
  31443. y.e = getBase10Exponent(xd, e);
  31444. return external ? finalise(y, pr, rm) : y;
  31445. };
  31446. /*
  31447. * n % 0 = N
  31448. * n % N = N
  31449. * n % I = n
  31450. * 0 % n = 0
  31451. * -0 % n = -0
  31452. * 0 % 0 = N
  31453. * 0 % N = N
  31454. * 0 % I = 0
  31455. * N % n = N
  31456. * N % 0 = N
  31457. * N % N = N
  31458. * N % I = N
  31459. * I % n = N
  31460. * I % 0 = N
  31461. * I % N = N
  31462. * I % I = N
  31463. *
  31464. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  31465. * `precision` significant digits using rounding mode `rounding`.
  31466. *
  31467. * The result depends on the modulo mode.
  31468. *
  31469. */
  31470. P.modulo = P.mod = function (y) {
  31471. var q,
  31472. x = this,
  31473. Ctor = x.constructor;
  31474. y = new Ctor(y);
  31475. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  31476. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  31477. // Return x if y is ±Infinity or x is ±0.
  31478. if (!y.d || x.d && !x.d[0]) {
  31479. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  31480. }
  31481. // Prevent rounding of intermediate calculations.
  31482. external = false;
  31483. if (Ctor.modulo == 9) {
  31484. // Euclidian division: q = sign(y) * floor(x / abs(y))
  31485. // result = x - q * y where 0 <= result < abs(y)
  31486. q = divide(x, y.abs(), 0, 3, 1);
  31487. q.s *= y.s;
  31488. } else {
  31489. q = divide(x, y, 0, Ctor.modulo, 1);
  31490. }
  31491. q = q.times(y);
  31492. external = true;
  31493. return x.minus(q);
  31494. };
  31495. /*
  31496. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  31497. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  31498. * significant digits using rounding mode `rounding`.
  31499. *
  31500. */
  31501. P.naturalExponential = P.exp = function () {
  31502. return naturalExponential(this);
  31503. };
  31504. /*
  31505. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  31506. * rounded to `precision` significant digits using rounding mode `rounding`.
  31507. *
  31508. */
  31509. P.naturalLogarithm = P.ln = function () {
  31510. return naturalLogarithm(this);
  31511. };
  31512. /*
  31513. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  31514. * -1.
  31515. *
  31516. */
  31517. P.negated = P.neg = function () {
  31518. var x = new this.constructor(this);
  31519. x.s = -x.s;
  31520. return finalise(x);
  31521. };
  31522. /*
  31523. * n + 0 = n
  31524. * n + N = N
  31525. * n + I = I
  31526. * 0 + n = n
  31527. * 0 + 0 = 0
  31528. * 0 + N = N
  31529. * 0 + I = I
  31530. * N + n = N
  31531. * N + 0 = N
  31532. * N + N = N
  31533. * N + I = N
  31534. * I + n = I
  31535. * I + 0 = I
  31536. * I + N = N
  31537. * I + I = I
  31538. *
  31539. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  31540. * significant digits using rounding mode `rounding`.
  31541. *
  31542. */
  31543. P.plus = P.add = function (y) {
  31544. var carry,
  31545. d,
  31546. e,
  31547. i,
  31548. k,
  31549. len,
  31550. pr,
  31551. rm,
  31552. xd,
  31553. yd,
  31554. x = this,
  31555. Ctor = x.constructor;
  31556. y = new Ctor(y);
  31557. // If either is not finite...
  31558. if (!x.d || !y.d) {
  31559. // Return NaN if either is NaN.
  31560. if (!x.s || !y.s) y = new Ctor(NaN);
  31561. // Return x if y is finite and x is ±Infinity.
  31562. // Return x if both are ±Infinity with the same sign.
  31563. // Return NaN if both are ±Infinity with different signs.
  31564. // Return y if x is finite and y is ±Infinity.
  31565. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  31566. return y;
  31567. }
  31568. // If signs differ...
  31569. if (x.s != y.s) {
  31570. y.s = -y.s;
  31571. return x.minus(y);
  31572. }
  31573. xd = x.d;
  31574. yd = y.d;
  31575. pr = Ctor.precision;
  31576. rm = Ctor.rounding;
  31577. // If either is zero...
  31578. if (!xd[0] || !yd[0]) {
  31579. // Return x if y is zero.
  31580. // Return y if y is non-zero.
  31581. if (!yd[0]) y = new Ctor(x);
  31582. return external ? finalise(y, pr, rm) : y;
  31583. }
  31584. // x and y are finite, non-zero numbers with the same sign.
  31585. // Calculate base 1e7 exponents.
  31586. k = mathfloor(x.e / LOG_BASE);
  31587. e = mathfloor(y.e / LOG_BASE);
  31588. xd = xd.slice();
  31589. i = k - e;
  31590. // If base 1e7 exponents differ...
  31591. if (i) {
  31592. if (i < 0) {
  31593. d = xd;
  31594. i = -i;
  31595. len = yd.length;
  31596. } else {
  31597. d = yd;
  31598. e = k;
  31599. len = xd.length;
  31600. }
  31601. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  31602. k = Math.ceil(pr / LOG_BASE);
  31603. len = k > len ? k + 1 : len + 1;
  31604. if (i > len) {
  31605. i = len;
  31606. d.length = 1;
  31607. }
  31608. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  31609. d.reverse();
  31610. for (; i--;) {
  31611. d.push(0);
  31612. }d.reverse();
  31613. }
  31614. len = xd.length;
  31615. i = yd.length;
  31616. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  31617. if (len - i < 0) {
  31618. i = len;
  31619. d = yd;
  31620. yd = xd;
  31621. xd = d;
  31622. }
  31623. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  31624. for (carry = 0; i;) {
  31625. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  31626. xd[i] %= BASE;
  31627. }
  31628. if (carry) {
  31629. xd.unshift(carry);
  31630. ++e;
  31631. }
  31632. // Remove trailing zeros.
  31633. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  31634. for (len = xd.length; xd[--len] == 0;) {
  31635. xd.pop();
  31636. }y.d = xd;
  31637. y.e = getBase10Exponent(xd, e);
  31638. return external ? finalise(y, pr, rm) : y;
  31639. };
  31640. /*
  31641. * Return the number of significant digits of the value of this Decimal.
  31642. *
  31643. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  31644. *
  31645. */
  31646. P.precision = P.sd = function (z) {
  31647. var k,
  31648. x = this;
  31649. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  31650. if (x.d) {
  31651. k = getPrecision(x.d);
  31652. if (z && x.e + 1 > k) k = x.e + 1;
  31653. } else {
  31654. k = NaN;
  31655. }
  31656. return k;
  31657. };
  31658. /*
  31659. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  31660. * rounding mode `rounding`.
  31661. *
  31662. */
  31663. P.round = function () {
  31664. var x = this,
  31665. Ctor = x.constructor;
  31666. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  31667. };
  31668. /*
  31669. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  31670. *
  31671. * Domain: [-Infinity, Infinity]
  31672. * Range: [-1, 1]
  31673. *
  31674. * sin(x) = x - x^3/3! + x^5/5! - ...
  31675. *
  31676. * sin(0) = 0
  31677. * sin(-0) = -0
  31678. * sin(Infinity) = NaN
  31679. * sin(-Infinity) = NaN
  31680. * sin(NaN) = NaN
  31681. *
  31682. */
  31683. P.sine = P.sin = function () {
  31684. var pr,
  31685. rm,
  31686. x = this,
  31687. Ctor = x.constructor;
  31688. if (!x.isFinite()) return new Ctor(NaN);
  31689. if (x.isZero()) return new Ctor(x);
  31690. pr = Ctor.precision;
  31691. rm = Ctor.rounding;
  31692. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  31693. Ctor.rounding = 1;
  31694. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  31695. Ctor.precision = pr;
  31696. Ctor.rounding = rm;
  31697. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  31698. };
  31699. /*
  31700. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  31701. * significant digits using rounding mode `rounding`.
  31702. *
  31703. * sqrt(-n) = N
  31704. * sqrt(N) = N
  31705. * sqrt(-I) = N
  31706. * sqrt(I) = I
  31707. * sqrt(0) = 0
  31708. * sqrt(-0) = -0
  31709. *
  31710. */
  31711. P.squareRoot = P.sqrt = function () {
  31712. var m,
  31713. n,
  31714. sd,
  31715. r,
  31716. rep,
  31717. t,
  31718. x = this,
  31719. d = x.d,
  31720. e = x.e,
  31721. s = x.s,
  31722. Ctor = x.constructor;
  31723. // Negative/NaN/Infinity/zero?
  31724. if (s !== 1 || !d || !d[0]) {
  31725. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  31726. }
  31727. external = false;
  31728. // Initial estimate.
  31729. s = Math.sqrt(+x);
  31730. // Math.sqrt underflow/overflow?
  31731. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  31732. if (s == 0 || s == 1 / 0) {
  31733. n = digitsToString(d);
  31734. if ((n.length + e) % 2 == 0) n += '0';
  31735. s = Math.sqrt(n);
  31736. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  31737. if (s == 1 / 0) {
  31738. n = '1e' + e;
  31739. } else {
  31740. n = s.toExponential();
  31741. n = n.slice(0, n.indexOf('e') + 1) + e;
  31742. }
  31743. r = new Ctor(n);
  31744. } else {
  31745. r = new Ctor(s.toString());
  31746. }
  31747. sd = (e = Ctor.precision) + 3;
  31748. // Newton-Raphson iteration.
  31749. for (;;) {
  31750. t = r;
  31751. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  31752. // TODO? Replace with for-loop and checkRoundingDigits.
  31753. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  31754. n = n.slice(sd - 3, sd + 1);
  31755. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  31756. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  31757. if (n == '9999' || !rep && n == '4999') {
  31758. // On the first iteration only, check to see if rounding up gives the exact result as the
  31759. // nines may infinitely repeat.
  31760. if (!rep) {
  31761. finalise(t, e + 1, 0);
  31762. if (t.times(t).eq(x)) {
  31763. r = t;
  31764. break;
  31765. }
  31766. }
  31767. sd += 4;
  31768. rep = 1;
  31769. } else {
  31770. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  31771. // If not, then there are further digits and m will be truthy.
  31772. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  31773. // Truncate to the first rounding digit.
  31774. finalise(r, e + 1, 1);
  31775. m = !r.times(r).eq(x);
  31776. }
  31777. break;
  31778. }
  31779. }
  31780. }
  31781. external = true;
  31782. return finalise(r, e, Ctor.rounding, m);
  31783. };
  31784. /*
  31785. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  31786. *
  31787. * Domain: [-Infinity, Infinity]
  31788. * Range: [-Infinity, Infinity]
  31789. *
  31790. * tan(0) = 0
  31791. * tan(-0) = -0
  31792. * tan(Infinity) = NaN
  31793. * tan(-Infinity) = NaN
  31794. * tan(NaN) = NaN
  31795. *
  31796. */
  31797. P.tangent = P.tan = function () {
  31798. var pr,
  31799. rm,
  31800. x = this,
  31801. Ctor = x.constructor;
  31802. if (!x.isFinite()) return new Ctor(NaN);
  31803. if (x.isZero()) return new Ctor(x);
  31804. pr = Ctor.precision;
  31805. rm = Ctor.rounding;
  31806. Ctor.precision = pr + 10;
  31807. Ctor.rounding = 1;
  31808. x = x.sin();
  31809. x.s = 1;
  31810. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  31811. Ctor.precision = pr;
  31812. Ctor.rounding = rm;
  31813. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  31814. };
  31815. /*
  31816. * n * 0 = 0
  31817. * n * N = N
  31818. * n * I = I
  31819. * 0 * n = 0
  31820. * 0 * 0 = 0
  31821. * 0 * N = N
  31822. * 0 * I = N
  31823. * N * n = N
  31824. * N * 0 = N
  31825. * N * N = N
  31826. * N * I = N
  31827. * I * n = I
  31828. * I * 0 = N
  31829. * I * N = N
  31830. * I * I = I
  31831. *
  31832. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  31833. * digits using rounding mode `rounding`.
  31834. *
  31835. */
  31836. P.times = P.mul = function (y) {
  31837. var carry,
  31838. e,
  31839. i,
  31840. k,
  31841. r,
  31842. rL,
  31843. t,
  31844. xdL,
  31845. ydL,
  31846. x = this,
  31847. Ctor = x.constructor,
  31848. xd = x.d,
  31849. yd = (y = new Ctor(y)).d;
  31850. y.s *= x.s;
  31851. // If either is NaN, ±Infinity or ±0...
  31852. if (!xd || !xd[0] || !yd || !yd[0]) {
  31853. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  31854. // Return NaN if either is NaN.
  31855. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  31856. ? NaN
  31857. // Return ±Infinity if either is ±Infinity.
  31858. // Return ±0 if either is ±0.
  31859. : !xd || !yd ? y.s / 0 : y.s * 0);
  31860. }
  31861. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  31862. xdL = xd.length;
  31863. ydL = yd.length;
  31864. // Ensure xd points to the longer array.
  31865. if (xdL < ydL) {
  31866. r = xd;
  31867. xd = yd;
  31868. yd = r;
  31869. rL = xdL;
  31870. xdL = ydL;
  31871. ydL = rL;
  31872. }
  31873. // Initialise the result array with zeros.
  31874. r = [];
  31875. rL = xdL + ydL;
  31876. for (i = rL; i--;) {
  31877. r.push(0);
  31878. } // Multiply!
  31879. for (i = ydL; --i >= 0;) {
  31880. carry = 0;
  31881. for (k = xdL + i; k > i;) {
  31882. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  31883. r[k--] = t % BASE | 0;
  31884. carry = t / BASE | 0;
  31885. }
  31886. r[k] = (r[k] + carry) % BASE | 0;
  31887. }
  31888. // Remove trailing zeros.
  31889. for (; !r[--rL];) {
  31890. r.pop();
  31891. }if (carry) ++e;else r.shift();
  31892. y.d = r;
  31893. y.e = getBase10Exponent(r, e);
  31894. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  31895. };
  31896. /*
  31897. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  31898. * digits using rounding mode `rm`.
  31899. *
  31900. * If the optional `sd` argument is present then return binary exponential notation.
  31901. *
  31902. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  31903. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  31904. *
  31905. */
  31906. P.toBinary = function (sd, rm) {
  31907. return toStringBinary(this, 2, sd, rm);
  31908. };
  31909. /*
  31910. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  31911. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  31912. *
  31913. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  31914. *
  31915. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  31916. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  31917. *
  31918. */
  31919. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  31920. var x = this,
  31921. Ctor = x.constructor;
  31922. x = new Ctor(x);
  31923. if (dp === void 0) return x;
  31924. checkInt32(dp, 0, MAX_DIGITS);
  31925. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  31926. return finalise(x, dp + x.e + 1, rm);
  31927. };
  31928. /*
  31929. * Return a string representing the value of this Decimal in exponential notation rounded to
  31930. * `dp` fixed decimal places using rounding mode `rounding`.
  31931. *
  31932. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  31933. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  31934. *
  31935. */
  31936. P.toExponential = function (dp, rm) {
  31937. var str,
  31938. x = this,
  31939. Ctor = x.constructor;
  31940. if (dp === void 0) {
  31941. str = finiteToString(x, true);
  31942. } else {
  31943. checkInt32(dp, 0, MAX_DIGITS);
  31944. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  31945. x = finalise(new Ctor(x), dp + 1, rm);
  31946. str = finiteToString(x, true, dp + 1);
  31947. }
  31948. return x.isNeg() && !x.isZero() ? '-' + str : str;
  31949. };
  31950. /*
  31951. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  31952. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  31953. * omitted.
  31954. *
  31955. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  31956. *
  31957. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  31958. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  31959. *
  31960. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  31961. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  31962. * (-0).toFixed(3) is '0.000'.
  31963. * (-0.5).toFixed(0) is '-0'.
  31964. *
  31965. */
  31966. P.toFixed = function (dp, rm) {
  31967. var str,
  31968. y,
  31969. x = this,
  31970. Ctor = x.constructor;
  31971. if (dp === void 0) {
  31972. str = finiteToString(x);
  31973. } else {
  31974. checkInt32(dp, 0, MAX_DIGITS);
  31975. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  31976. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  31977. str = finiteToString(y, false, dp + y.e + 1);
  31978. }
  31979. // To determine whether to add the minus sign look at the value before it was rounded,
  31980. // i.e. look at `x` rather than `y`.
  31981. return x.isNeg() && !x.isZero() ? '-' + str : str;
  31982. };
  31983. /*
  31984. * Return an array representing the value of this Decimal as a simple fraction with an integer
  31985. * numerator and an integer denominator.
  31986. *
  31987. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  31988. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  31989. * value necessary to represent the number exactly.
  31990. *
  31991. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  31992. *
  31993. */
  31994. P.toFraction = function (maxD) {
  31995. var d,
  31996. d0,
  31997. d1,
  31998. d2,
  31999. e,
  32000. k,
  32001. n,
  32002. n0,
  32003. n1,
  32004. pr,
  32005. q,
  32006. r,
  32007. x = this,
  32008. xd = x.d,
  32009. Ctor = x.constructor;
  32010. if (!xd) return new Ctor(x);
  32011. n1 = d0 = new Ctor(1);
  32012. d1 = n0 = new Ctor(0);
  32013. d = new Ctor(d1);
  32014. e = d.e = getPrecision(xd) - x.e - 1;
  32015. k = e % LOG_BASE;
  32016. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  32017. if (maxD == null) {
  32018. // d is 10**e, the minimum max-denominator needed.
  32019. maxD = e > 0 ? d : n1;
  32020. } else {
  32021. n = new Ctor(maxD);
  32022. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  32023. maxD = n.gt(d) ? e > 0 ? d : n1 : n;
  32024. }
  32025. external = false;
  32026. n = new Ctor(digitsToString(xd));
  32027. pr = Ctor.precision;
  32028. Ctor.precision = e = xd.length * LOG_BASE * 2;
  32029. for (;;) {
  32030. q = divide(n, d, 0, 1, 1);
  32031. d2 = d0.plus(q.times(d1));
  32032. if (d2.cmp(maxD) == 1) break;
  32033. d0 = d1;
  32034. d1 = d2;
  32035. d2 = n1;
  32036. n1 = n0.plus(q.times(d2));
  32037. n0 = d2;
  32038. d2 = d;
  32039. d = n.minus(q.times(d2));
  32040. n = d2;
  32041. }
  32042. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  32043. n0 = n0.plus(d2.times(n1));
  32044. d0 = d0.plus(d2.times(d1));
  32045. n0.s = n1.s = x.s;
  32046. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  32047. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
  32048. Ctor.precision = pr;
  32049. external = true;
  32050. return r;
  32051. };
  32052. /*
  32053. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  32054. * digits using rounding mode `rm`.
  32055. *
  32056. * If the optional `sd` argument is present then return binary exponential notation.
  32057. *
  32058. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  32059. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  32060. *
  32061. */
  32062. P.toHexadecimal = P.toHex = function (sd, rm) {
  32063. return toStringBinary(this, 16, sd, rm);
  32064. };
  32065. /*
  32066. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  32067. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  32068. *
  32069. * The return value will always have the same sign as this Decimal, unless either this Decimal
  32070. * or `y` is NaN, in which case the return value will be also be NaN.
  32071. *
  32072. * The return value is not affected by the value of `precision`.
  32073. *
  32074. * y {number|string|Decimal} The magnitude to round to a multiple of.
  32075. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  32076. *
  32077. * 'toNearest() rounding mode not an integer: {rm}'
  32078. * 'toNearest() rounding mode out of range: {rm}'
  32079. *
  32080. */
  32081. P.toNearest = function (y, rm) {
  32082. var x = this,
  32083. Ctor = x.constructor;
  32084. x = new Ctor(x);
  32085. if (y == null) {
  32086. // If x is not finite, return x.
  32087. if (!x.d) return x;
  32088. y = new Ctor(1);
  32089. rm = Ctor.rounding;
  32090. } else {
  32091. y = new Ctor(y);
  32092. if (rm === void 0) {
  32093. rm = Ctor.rounding;
  32094. } else {
  32095. checkInt32(rm, 0, 8);
  32096. }
  32097. // If x is not finite, return x if y is not NaN, else NaN.
  32098. if (!x.d) return y.s ? x : y;
  32099. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  32100. if (!y.d) {
  32101. if (y.s) y.s = x.s;
  32102. return y;
  32103. }
  32104. }
  32105. // If y is not zero, calculate the nearest multiple of y to x.
  32106. if (y.d[0]) {
  32107. external = false;
  32108. x = divide(x, y, 0, rm, 1).times(y);
  32109. external = true;
  32110. finalise(x);
  32111. // If y is zero, return zero with the sign of x.
  32112. } else {
  32113. y.s = x.s;
  32114. x = y;
  32115. }
  32116. return x;
  32117. };
  32118. /*
  32119. * Return the value of this Decimal converted to a number primitive.
  32120. * Zero keeps its sign.
  32121. *
  32122. */
  32123. P.toNumber = function () {
  32124. return +this;
  32125. };
  32126. /*
  32127. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  32128. * digits using rounding mode `rm`.
  32129. *
  32130. * If the optional `sd` argument is present then return binary exponential notation.
  32131. *
  32132. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  32133. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  32134. *
  32135. */
  32136. P.toOctal = function (sd, rm) {
  32137. return toStringBinary(this, 8, sd, rm);
  32138. };
  32139. /*
  32140. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  32141. * to `precision` significant digits using rounding mode `rounding`.
  32142. *
  32143. * ECMAScript compliant.
  32144. *
  32145. * pow(x, NaN) = NaN
  32146. * pow(x, ±0) = 1
  32147. * pow(NaN, non-zero) = NaN
  32148. * pow(abs(x) > 1, +Infinity) = +Infinity
  32149. * pow(abs(x) > 1, -Infinity) = +0
  32150. * pow(abs(x) == 1, ±Infinity) = NaN
  32151. * pow(abs(x) < 1, +Infinity) = +0
  32152. * pow(abs(x) < 1, -Infinity) = +Infinity
  32153. * pow(+Infinity, y > 0) = +Infinity
  32154. * pow(+Infinity, y < 0) = +0
  32155. * pow(-Infinity, odd integer > 0) = -Infinity
  32156. * pow(-Infinity, even integer > 0) = +Infinity
  32157. * pow(-Infinity, odd integer < 0) = -0
  32158. * pow(-Infinity, even integer < 0) = +0
  32159. * pow(+0, y > 0) = +0
  32160. * pow(+0, y < 0) = +Infinity
  32161. * pow(-0, odd integer > 0) = -0
  32162. * pow(-0, even integer > 0) = +0
  32163. * pow(-0, odd integer < 0) = -Infinity
  32164. * pow(-0, even integer < 0) = +Infinity
  32165. * pow(finite x < 0, finite non-integer) = NaN
  32166. *
  32167. * For non-integer or very large exponents pow(x, y) is calculated using
  32168. *
  32169. * x^y = exp(y*ln(x))
  32170. *
  32171. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  32172. * probability of an incorrectly rounded result
  32173. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  32174. * i.e. 1 in 250,000,000,000,000
  32175. *
  32176. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  32177. *
  32178. * y {number|string|Decimal} The power to which to raise this Decimal.
  32179. *
  32180. */
  32181. P.toPower = P.pow = function (y) {
  32182. var e,
  32183. k,
  32184. pr,
  32185. r,
  32186. rm,
  32187. s,
  32188. x = this,
  32189. Ctor = x.constructor,
  32190. yn = +(y = new Ctor(y));
  32191. // Either ±Infinity, NaN or ±0?
  32192. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  32193. x = new Ctor(x);
  32194. if (x.eq(1)) return x;
  32195. pr = Ctor.precision;
  32196. rm = Ctor.rounding;
  32197. if (y.eq(1)) return finalise(x, pr, rm);
  32198. // y exponent
  32199. e = mathfloor(y.e / LOG_BASE);
  32200. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  32201. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  32202. r = intPow(Ctor, x, k, pr);
  32203. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  32204. }
  32205. s = x.s;
  32206. // if x is negative
  32207. if (s < 0) {
  32208. // if y is not an integer
  32209. if (e < y.d.length - 1) return new Ctor(NaN);
  32210. // Result is positive if x is negative and the last digit of integer y is even.
  32211. if ((y.d[e] & 1) == 0) s = 1;
  32212. // if x.eq(-1)
  32213. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  32214. x.s = s;
  32215. return x;
  32216. }
  32217. }
  32218. // Estimate result exponent.
  32219. // x^y = 10^e, where e = y * log10(x)
  32220. // log10(x) = log10(x_significand) + x_exponent
  32221. // log10(x_significand) = ln(x_significand) / ln(10)
  32222. k = mathpow(+x, yn);
  32223. e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + '').e;
  32224. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  32225. // Overflow/underflow?
  32226. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  32227. external = false;
  32228. Ctor.rounding = x.s = 1;
  32229. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  32230. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  32231. // new Decimal(2.32456).pow('2087987436534566.46411')
  32232. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  32233. k = Math.min(12, (e + '').length);
  32234. // r = x^y = exp(y*ln(x))
  32235. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  32236. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  32237. if (r.d) {
  32238. // Truncate to the required precision plus five rounding digits.
  32239. r = finalise(r, pr + 5, 1);
  32240. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  32241. // the result.
  32242. if (checkRoundingDigits(r.d, pr, rm)) {
  32243. e = pr + 10;
  32244. // Truncate to the increased precision plus five rounding digits.
  32245. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  32246. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  32247. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  32248. r = finalise(r, pr + 1, 0);
  32249. }
  32250. }
  32251. }
  32252. r.s = s;
  32253. external = true;
  32254. Ctor.rounding = rm;
  32255. return finalise(r, pr, rm);
  32256. };
  32257. /*
  32258. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  32259. * using rounding mode `rounding`.
  32260. *
  32261. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  32262. * the integer part of the value in normal notation.
  32263. *
  32264. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  32265. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  32266. *
  32267. */
  32268. P.toPrecision = function (sd, rm) {
  32269. var str,
  32270. x = this,
  32271. Ctor = x.constructor;
  32272. if (sd === void 0) {
  32273. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  32274. } else {
  32275. checkInt32(sd, 1, MAX_DIGITS);
  32276. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  32277. x = finalise(new Ctor(x), sd, rm);
  32278. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  32279. }
  32280. return x.isNeg() && !x.isZero() ? '-' + str : str;
  32281. };
  32282. /*
  32283. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  32284. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  32285. * omitted.
  32286. *
  32287. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  32288. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  32289. *
  32290. * 'toSD() digits out of range: {sd}'
  32291. * 'toSD() digits not an integer: {sd}'
  32292. * 'toSD() rounding mode not an integer: {rm}'
  32293. * 'toSD() rounding mode out of range: {rm}'
  32294. *
  32295. */
  32296. P.toSignificantDigits = P.toSD = function (sd, rm) {
  32297. var x = this,
  32298. Ctor = x.constructor;
  32299. if (sd === void 0) {
  32300. sd = Ctor.precision;
  32301. rm = Ctor.rounding;
  32302. } else {
  32303. checkInt32(sd, 1, MAX_DIGITS);
  32304. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  32305. }
  32306. return finalise(new Ctor(x), sd, rm);
  32307. };
  32308. /*
  32309. * Return a string representing the value of this Decimal.
  32310. *
  32311. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  32312. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  32313. *
  32314. */
  32315. P.toString = function () {
  32316. var x = this,
  32317. Ctor = x.constructor,
  32318. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  32319. return x.isNeg() && !x.isZero() ? '-' + str : str;
  32320. };
  32321. /*
  32322. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  32323. *
  32324. */
  32325. P.truncated = P.trunc = function () {
  32326. return finalise(new this.constructor(this), this.e + 1, 1);
  32327. };
  32328. /*
  32329. * Return a string representing the value of this Decimal.
  32330. * Unlike `toString`, negative zero will include the minus sign.
  32331. *
  32332. */
  32333. P.valueOf = P.toJSON = function () {
  32334. var x = this,
  32335. Ctor = x.constructor,
  32336. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  32337. return x.isNeg() ? '-' + str : str;
  32338. };
  32339. /*
  32340. // Add aliases to match BigDecimal method names.
  32341. // P.add = P.plus;
  32342. P.subtract = P.minus;
  32343. P.multiply = P.times;
  32344. P.divide = P.div;
  32345. P.remainder = P.mod;
  32346. P.compareTo = P.cmp;
  32347. P.negate = P.neg;
  32348. */
  32349. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  32350. /*
  32351. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  32352. * finiteToString, naturalExponential, naturalLogarithm
  32353. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  32354. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  32355. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  32356. * convertBase toStringBinary, parseOther
  32357. * cos P.cos
  32358. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  32359. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  32360. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  32361. * taylorSeries, atan2, parseOther
  32362. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  32363. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  32364. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  32365. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  32366. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  32367. * P.truncated, divide, getLn10, getPi, naturalExponential,
  32368. * naturalLogarithm, ceil, floor, round, trunc
  32369. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  32370. * toStringBinary
  32371. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  32372. * getLn10 P.logarithm, naturalLogarithm
  32373. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  32374. * getPrecision P.precision, P.toFraction
  32375. * getZeroString digitsToString, finiteToString
  32376. * intPow P.toPower, parseOther
  32377. * isOdd toLessThanHalfPi
  32378. * maxOrMin max, min
  32379. * naturalExponential P.naturalExponential, P.toPower
  32380. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  32381. * P.toPower, naturalExponential
  32382. * nonFiniteToString finiteToString, toStringBinary
  32383. * parseDecimal Decimal
  32384. * parseOther Decimal
  32385. * sin P.sin
  32386. * taylorSeries P.cosh, P.sinh, cos, sin
  32387. * toLessThanHalfPi P.cos, P.sin
  32388. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  32389. * truncate intPow
  32390. *
  32391. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  32392. * naturalLogarithm, config, parseOther, random, Decimal
  32393. */
  32394. function digitsToString(d) {
  32395. var i,
  32396. k,
  32397. ws,
  32398. indexOfLastWord = d.length - 1,
  32399. str = '',
  32400. w = d[0];
  32401. if (indexOfLastWord > 0) {
  32402. str += w;
  32403. for (i = 1; i < indexOfLastWord; i++) {
  32404. ws = d[i] + '';
  32405. k = LOG_BASE - ws.length;
  32406. if (k) str += getZeroString(k);
  32407. str += ws;
  32408. }
  32409. w = d[i];
  32410. ws = w + '';
  32411. k = LOG_BASE - ws.length;
  32412. if (k) str += getZeroString(k);
  32413. } else if (w === 0) {
  32414. return '0';
  32415. }
  32416. // Remove trailing zeros of last w.
  32417. for (; w % 10 === 0;) {
  32418. w /= 10;
  32419. }return str + w;
  32420. }
  32421. function checkInt32(i, min, max) {
  32422. if (i !== ~~i || i < min || i > max) {
  32423. throw Error(invalidArgument + i);
  32424. }
  32425. }
  32426. /*
  32427. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  32428. * `repeating == null` if caller is `log` or `pow`,
  32429. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  32430. */
  32431. function checkRoundingDigits(d, i, rm, repeating) {
  32432. var di, k, r, rd;
  32433. // Get the length of the first word of the array d.
  32434. for (k = d[0]; k >= 10; k /= 10) {
  32435. --i;
  32436. } // Is the rounding digit in the first word of d?
  32437. if (--i < 0) {
  32438. i += LOG_BASE;
  32439. di = 0;
  32440. } else {
  32441. di = Math.ceil((i + 1) / LOG_BASE);
  32442. i %= LOG_BASE;
  32443. }
  32444. // i is the index (0 - 6) of the rounding digit.
  32445. // E.g. if within the word 3487563 the first rounding digit is 5,
  32446. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  32447. k = mathpow(10, LOG_BASE - i);
  32448. rd = d[di] % k | 0;
  32449. if (repeating == null) {
  32450. if (i < 3) {
  32451. if (i == 0) rd = rd / 100 | 0;else if (i == 1) rd = rd / 10 | 0;
  32452. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  32453. } else {
  32454. 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;
  32455. }
  32456. } else {
  32457. if (i < 4) {
  32458. if (i == 0) rd = rd / 1000 | 0;else if (i == 1) rd = rd / 100 | 0;else if (i == 2) rd = rd / 10 | 0;
  32459. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  32460. } else {
  32461. 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;
  32462. }
  32463. }
  32464. return r;
  32465. }
  32466. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  32467. // Eg. convertBase('255', 10, 16) returns [15, 15].
  32468. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  32469. function convertBase(str, baseIn, baseOut) {
  32470. var j,
  32471. arr = [0],
  32472. arrL,
  32473. i = 0,
  32474. strL = str.length;
  32475. for (; i < strL;) {
  32476. for (arrL = arr.length; arrL--;) {
  32477. arr[arrL] *= baseIn;
  32478. }arr[0] += NUMERALS.indexOf(str.charAt(i++));
  32479. for (j = 0; j < arr.length; j++) {
  32480. if (arr[j] > baseOut - 1) {
  32481. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  32482. arr[j + 1] += arr[j] / baseOut | 0;
  32483. arr[j] %= baseOut;
  32484. }
  32485. }
  32486. }
  32487. return arr.reverse();
  32488. }
  32489. /*
  32490. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  32491. * |x| < pi/2
  32492. *
  32493. */
  32494. function cosine(Ctor, x) {
  32495. var k,
  32496. y,
  32497. len = x.d.length;
  32498. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  32499. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  32500. // Estimate the optimum number of times to use the argument reduction.
  32501. if (len < 32) {
  32502. k = Math.ceil(len / 3);
  32503. y = Math.pow(4, -k).toString();
  32504. } else {
  32505. k = 16;
  32506. y = '2.3283064365386962890625e-10';
  32507. }
  32508. Ctor.precision += k;
  32509. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  32510. // Reverse argument reduction
  32511. for (var i = k; i--;) {
  32512. var cos2x = x.times(x);
  32513. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  32514. }
  32515. Ctor.precision -= k;
  32516. return x;
  32517. }
  32518. /*
  32519. * Perform division in the specified base.
  32520. */
  32521. var divide = function () {
  32522. // Assumes non-zero x and k, and hence non-zero result.
  32523. function multiplyInteger(x, k, base) {
  32524. var temp,
  32525. carry = 0,
  32526. i = x.length;
  32527. for (x = x.slice(); i--;) {
  32528. temp = x[i] * k + carry;
  32529. x[i] = temp % base | 0;
  32530. carry = temp / base | 0;
  32531. }
  32532. if (carry) x.unshift(carry);
  32533. return x;
  32534. }
  32535. function compare(a, b, aL, bL) {
  32536. var i, r;
  32537. if (aL != bL) {
  32538. r = aL > bL ? 1 : -1;
  32539. } else {
  32540. for (i = r = 0; i < aL; i++) {
  32541. if (a[i] != b[i]) {
  32542. r = a[i] > b[i] ? 1 : -1;
  32543. break;
  32544. }
  32545. }
  32546. }
  32547. return r;
  32548. }
  32549. function subtract(a, b, aL, base) {
  32550. var i = 0;
  32551. // Subtract b from a.
  32552. for (; aL--;) {
  32553. a[aL] -= i;
  32554. i = a[aL] < b[aL] ? 1 : 0;
  32555. a[aL] = i * base + a[aL] - b[aL];
  32556. }
  32557. // Remove leading zeros.
  32558. for (; !a[0] && a.length > 1;) {
  32559. a.shift();
  32560. }
  32561. }
  32562. return function (x, y, pr, rm, dp, base) {
  32563. var cmp,
  32564. e,
  32565. i,
  32566. k,
  32567. logBase,
  32568. more,
  32569. prod,
  32570. prodL,
  32571. q,
  32572. qd,
  32573. rem,
  32574. remL,
  32575. rem0,
  32576. sd,
  32577. t,
  32578. xi,
  32579. xL,
  32580. yd0,
  32581. yL,
  32582. yz,
  32583. Ctor = x.constructor,
  32584. sign = x.s == y.s ? 1 : -1,
  32585. xd = x.d,
  32586. yd = y.d;
  32587. // Either NaN, Infinity or 0?
  32588. if (!xd || !xd[0] || !yd || !yd[0]) {
  32589. return new Ctor( // Return NaN if either NaN, or both Infinity or 0.
  32590. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  32591. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  32592. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  32593. }
  32594. if (base) {
  32595. logBase = 1;
  32596. e = x.e - y.e;
  32597. } else {
  32598. base = BASE;
  32599. logBase = LOG_BASE;
  32600. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  32601. }
  32602. yL = yd.length;
  32603. xL = xd.length;
  32604. q = new Ctor(sign);
  32605. qd = q.d = [];
  32606. // Result exponent may be one less than e.
  32607. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  32608. for (i = 0; yd[i] == (xd[i] || 0); i++) {}
  32609. if (yd[i] > (xd[i] || 0)) e--;
  32610. if (pr == null) {
  32611. sd = pr = Ctor.precision;
  32612. rm = Ctor.rounding;
  32613. } else if (dp) {
  32614. sd = pr + (x.e - y.e) + 1;
  32615. } else {
  32616. sd = pr;
  32617. }
  32618. if (sd < 0) {
  32619. qd.push(1);
  32620. more = true;
  32621. } else {
  32622. // Convert precision in number of base 10 digits to base 1e7 digits.
  32623. sd = sd / logBase + 2 | 0;
  32624. i = 0;
  32625. // divisor < 1e7
  32626. if (yL == 1) {
  32627. k = 0;
  32628. yd = yd[0];
  32629. sd++;
  32630. // k is the carry.
  32631. for (; (i < xL || k) && sd--; i++) {
  32632. t = k * base + (xd[i] || 0);
  32633. qd[i] = t / yd | 0;
  32634. k = t % yd | 0;
  32635. }
  32636. more = k || i < xL;
  32637. // divisor >= 1e7
  32638. } else {
  32639. // Normalise xd and yd so highest order digit of yd is >= base/2
  32640. k = base / (yd[0] + 1) | 0;
  32641. if (k > 1) {
  32642. yd = multiplyInteger(yd, k, base);
  32643. xd = multiplyInteger(xd, k, base);
  32644. yL = yd.length;
  32645. xL = xd.length;
  32646. }
  32647. xi = yL;
  32648. rem = xd.slice(0, yL);
  32649. remL = rem.length;
  32650. // Add zeros to make remainder as long as divisor.
  32651. for (; remL < yL;) {
  32652. rem[remL++] = 0;
  32653. }yz = yd.slice();
  32654. yz.unshift(0);
  32655. yd0 = yd[0];
  32656. if (yd[1] >= base / 2) ++yd0;
  32657. do {
  32658. k = 0;
  32659. // Compare divisor and remainder.
  32660. cmp = compare(yd, rem, yL, remL);
  32661. // If divisor < remainder.
  32662. if (cmp < 0) {
  32663. // Calculate trial digit, k.
  32664. rem0 = rem[0];
  32665. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  32666. // k will be how many times the divisor goes into the current remainder.
  32667. k = rem0 / yd0 | 0;
  32668. // Algorithm:
  32669. // 1. product = divisor * trial digit (k)
  32670. // 2. if product > remainder: product -= divisor, k--
  32671. // 3. remainder -= product
  32672. // 4. if product was < remainder at 2:
  32673. // 5. compare new remainder and divisor
  32674. // 6. If remainder > divisor: remainder -= divisor, k++
  32675. if (k > 1) {
  32676. if (k >= base) k = base - 1;
  32677. // product = divisor * trial digit.
  32678. prod = multiplyInteger(yd, k, base);
  32679. prodL = prod.length;
  32680. remL = rem.length;
  32681. // Compare product and remainder.
  32682. cmp = compare(prod, rem, prodL, remL);
  32683. // product > remainder.
  32684. if (cmp == 1) {
  32685. k--;
  32686. // Subtract divisor from product.
  32687. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  32688. }
  32689. } else {
  32690. // cmp is -1.
  32691. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  32692. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  32693. if (k == 0) cmp = k = 1;
  32694. prod = yd.slice();
  32695. }
  32696. prodL = prod.length;
  32697. if (prodL < remL) prod.unshift(0);
  32698. // Subtract product from remainder.
  32699. subtract(rem, prod, remL, base);
  32700. // If product was < previous remainder.
  32701. if (cmp == -1) {
  32702. remL = rem.length;
  32703. // Compare divisor and new remainder.
  32704. cmp = compare(yd, rem, yL, remL);
  32705. // If divisor < new remainder, subtract divisor from remainder.
  32706. if (cmp < 1) {
  32707. k++;
  32708. // Subtract divisor from remainder.
  32709. subtract(rem, yL < remL ? yz : yd, remL, base);
  32710. }
  32711. }
  32712. remL = rem.length;
  32713. } else if (cmp === 0) {
  32714. k++;
  32715. rem = [0];
  32716. } // if cmp === 1, k will be 0
  32717. // Add the next digit, k, to the result array.
  32718. qd[i++] = k;
  32719. // Update the remainder.
  32720. if (cmp && rem[0]) {
  32721. rem[remL++] = xd[xi] || 0;
  32722. } else {
  32723. rem = [xd[xi]];
  32724. remL = 1;
  32725. }
  32726. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  32727. more = rem[0] !== void 0;
  32728. }
  32729. // Leading zero?
  32730. if (!qd[0]) qd.shift();
  32731. }
  32732. // logBase is 1 when divide is being used for base conversion.
  32733. if (logBase == 1) {
  32734. q.e = e;
  32735. inexact = more;
  32736. } else {
  32737. // To calculate q.e, first get the number of digits of qd[0].
  32738. for (i = 1, k = qd[0]; k >= 10; k /= 10) {
  32739. i++;
  32740. }q.e = i + e * logBase - 1;
  32741. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  32742. }
  32743. return q;
  32744. };
  32745. }();
  32746. /*
  32747. * Round `x` to `sd` significant digits using rounding mode `rm`.
  32748. * Check for over/under-flow.
  32749. */
  32750. function finalise(x, sd, rm, isTruncated) {
  32751. var digits,
  32752. i,
  32753. j,
  32754. k,
  32755. rd,
  32756. roundUp,
  32757. w,
  32758. xd,
  32759. xdi,
  32760. Ctor = x.constructor;
  32761. // Don't round if sd is null or undefined.
  32762. out: if (sd != null) {
  32763. xd = x.d;
  32764. // Infinity/NaN.
  32765. if (!xd) return x;
  32766. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  32767. // w: the word of xd containing rd, a base 1e7 number.
  32768. // xdi: the index of w within xd.
  32769. // digits: the number of digits of w.
  32770. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  32771. // they had leading zeros)
  32772. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  32773. // Get the length of the first word of the digits array xd.
  32774. for (digits = 1, k = xd[0]; k >= 10; k /= 10) {
  32775. digits++;
  32776. }i = sd - digits;
  32777. // Is the rounding digit in the first word of xd?
  32778. if (i < 0) {
  32779. i += LOG_BASE;
  32780. j = sd;
  32781. w = xd[xdi = 0];
  32782. // Get the rounding digit at index j of w.
  32783. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  32784. } else {
  32785. xdi = Math.ceil((i + 1) / LOG_BASE);
  32786. k = xd.length;
  32787. if (xdi >= k) {
  32788. if (isTruncated) {
  32789. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  32790. for (; k++ <= xdi;) {
  32791. xd.push(0);
  32792. }w = rd = 0;
  32793. digits = 1;
  32794. i %= LOG_BASE;
  32795. j = i - LOG_BASE + 1;
  32796. } else {
  32797. break out;
  32798. }
  32799. } else {
  32800. w = k = xd[xdi];
  32801. // Get the number of digits of w.
  32802. for (digits = 1; k >= 10; k /= 10) {
  32803. digits++;
  32804. } // Get the index of rd within w.
  32805. i %= LOG_BASE;
  32806. // Get the index of rd within w, adjusted for leading zeros.
  32807. // The number of leading zeros of w is given by LOG_BASE - digits.
  32808. j = i - LOG_BASE + digits;
  32809. // Get the rounding digit at index j of w.
  32810. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  32811. }
  32812. }
  32813. // Are there any non-zero digits after the rounding digit?
  32814. isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  32815. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  32816. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  32817. // will give 714.
  32818. roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  32819. // Check whether the digit to the left of the rounding digit is odd.
  32820. (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
  32821. if (sd < 1 || !xd[0]) {
  32822. xd.length = 0;
  32823. if (roundUp) {
  32824. // Convert sd to decimal places.
  32825. sd -= x.e + 1;
  32826. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  32827. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  32828. x.e = -sd || 0;
  32829. } else {
  32830. // Zero.
  32831. xd[0] = x.e = 0;
  32832. }
  32833. return x;
  32834. }
  32835. // Remove excess digits.
  32836. if (i == 0) {
  32837. xd.length = xdi;
  32838. k = 1;
  32839. xdi--;
  32840. } else {
  32841. xd.length = xdi + 1;
  32842. k = mathpow(10, LOG_BASE - i);
  32843. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  32844. // j > 0 means i > number of leading zeros of w.
  32845. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  32846. }
  32847. if (roundUp) {
  32848. for (;;) {
  32849. // Is the digit to be rounded up in the first word of xd?
  32850. if (xdi == 0) {
  32851. // i will be the length of xd[0] before k is added.
  32852. for (i = 1, j = xd[0]; j >= 10; j /= 10) {
  32853. i++;
  32854. }j = xd[0] += k;
  32855. for (k = 1; j >= 10; j /= 10) {
  32856. k++;
  32857. } // if i != k the length has increased.
  32858. if (i != k) {
  32859. x.e++;
  32860. if (xd[0] == BASE) xd[0] = 1;
  32861. }
  32862. break;
  32863. } else {
  32864. xd[xdi] += k;
  32865. if (xd[xdi] != BASE) break;
  32866. xd[xdi--] = 0;
  32867. k = 1;
  32868. }
  32869. }
  32870. }
  32871. // Remove trailing zeros.
  32872. for (i = xd.length; xd[--i] === 0;) {
  32873. xd.pop();
  32874. }
  32875. }
  32876. if (external) {
  32877. // Overflow?
  32878. if (x.e > Ctor.maxE) {
  32879. // Infinity.
  32880. x.d = null;
  32881. x.e = NaN;
  32882. // Underflow?
  32883. } else if (x.e < Ctor.minE) {
  32884. // Zero.
  32885. x.e = 0;
  32886. x.d = [0];
  32887. // Ctor.underflow = true;
  32888. } // else Ctor.underflow = false;
  32889. }
  32890. return x;
  32891. }
  32892. function finiteToString(x, isExp, sd) {
  32893. if (!x.isFinite()) return nonFiniteToString(x);
  32894. var k,
  32895. e = x.e,
  32896. str = digitsToString(x.d),
  32897. len = str.length;
  32898. if (isExp) {
  32899. if (sd && (k = sd - len) > 0) {
  32900. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  32901. } else if (len > 1) {
  32902. str = str.charAt(0) + '.' + str.slice(1);
  32903. }
  32904. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  32905. } else if (e < 0) {
  32906. str = '0.' + getZeroString(-e - 1) + str;
  32907. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  32908. } else if (e >= len) {
  32909. str += getZeroString(e + 1 - len);
  32910. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  32911. } else {
  32912. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  32913. if (sd && (k = sd - len) > 0) {
  32914. if (e + 1 === len) str += '.';
  32915. str += getZeroString(k);
  32916. }
  32917. }
  32918. return str;
  32919. }
  32920. // Calculate the base 10 exponent from the base 1e7 exponent.
  32921. function getBase10Exponent(digits, e) {
  32922. var w = digits[0];
  32923. // Add the number of digits of the first word of the digits array.
  32924. for (e *= LOG_BASE; w >= 10; w /= 10) {
  32925. e++;
  32926. }return e;
  32927. }
  32928. function getLn10(Ctor, sd, pr) {
  32929. if (sd > LN10_PRECISION) {
  32930. // Reset global state in case the exception is caught.
  32931. external = true;
  32932. if (pr) Ctor.precision = pr;
  32933. throw Error(precisionLimitExceeded);
  32934. }
  32935. return finalise(new Ctor(LN10), sd, 1, true);
  32936. }
  32937. function getPi(Ctor, sd, rm) {
  32938. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  32939. return finalise(new Ctor(PI), sd, rm, true);
  32940. }
  32941. function getPrecision(digits) {
  32942. var w = digits.length - 1,
  32943. len = w * LOG_BASE + 1;
  32944. w = digits[w];
  32945. // If non-zero...
  32946. if (w) {
  32947. // Subtract the number of trailing zeros of the last word.
  32948. for (; w % 10 == 0; w /= 10) {
  32949. len--;
  32950. } // Add the number of digits of the first word.
  32951. for (w = digits[0]; w >= 10; w /= 10) {
  32952. len++;
  32953. }
  32954. }
  32955. return len;
  32956. }
  32957. function getZeroString(k) {
  32958. var zs = '';
  32959. for (; k--;) {
  32960. zs += '0';
  32961. }return zs;
  32962. }
  32963. /*
  32964. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  32965. * integer of type number.
  32966. *
  32967. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  32968. *
  32969. */
  32970. function intPow(Ctor, x, n, pr) {
  32971. var isTruncated,
  32972. r = new Ctor(1),
  32973. // Max n of 9007199254740991 takes 53 loop iterations.
  32974. // Maximum digits array length; leaves [28, 34] guard digits.
  32975. k = Math.ceil(pr / LOG_BASE + 4);
  32976. external = false;
  32977. for (;;) {
  32978. if (n % 2) {
  32979. r = r.times(x);
  32980. if (truncate(r.d, k)) isTruncated = true;
  32981. }
  32982. n = mathfloor(n / 2);
  32983. if (n === 0) {
  32984. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  32985. n = r.d.length - 1;
  32986. if (isTruncated && r.d[n] === 0) ++r.d[n];
  32987. break;
  32988. }
  32989. x = x.times(x);
  32990. truncate(x.d, k);
  32991. }
  32992. external = true;
  32993. return r;
  32994. }
  32995. function isOdd(n) {
  32996. return n.d[n.d.length - 1] & 1;
  32997. }
  32998. /*
  32999. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  33000. */
  33001. function maxOrMin(Ctor, args, ltgt) {
  33002. var y,
  33003. x = new Ctor(args[0]),
  33004. i = 0;
  33005. for (; ++i < args.length;) {
  33006. y = new Ctor(args[i]);
  33007. if (!y.s) {
  33008. x = y;
  33009. break;
  33010. } else if (x[ltgt](y)) {
  33011. x = y;
  33012. }
  33013. }
  33014. return x;
  33015. }
  33016. /*
  33017. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  33018. * digits.
  33019. *
  33020. * Taylor/Maclaurin series.
  33021. *
  33022. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  33023. *
  33024. * Argument reduction:
  33025. * Repeat x = x / 32, k += 5, until |x| < 0.1
  33026. * exp(x) = exp(x / 2^k)^(2^k)
  33027. *
  33028. * Previously, the argument was initially reduced by
  33029. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  33030. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  33031. * found to be slower than just dividing repeatedly by 32 as above.
  33032. *
  33033. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  33034. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  33035. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  33036. *
  33037. * exp(Infinity) = Infinity
  33038. * exp(-Infinity) = 0
  33039. * exp(NaN) = NaN
  33040. * exp(±0) = 1
  33041. *
  33042. * exp(x) is non-terminating for any finite, non-zero x.
  33043. *
  33044. * The result will always be correctly rounded.
  33045. *
  33046. */
  33047. function naturalExponential(x, sd) {
  33048. var denominator,
  33049. guard,
  33050. j,
  33051. pow,
  33052. sum,
  33053. t,
  33054. wpr,
  33055. rep = 0,
  33056. i = 0,
  33057. k = 0,
  33058. Ctor = x.constructor,
  33059. rm = Ctor.rounding,
  33060. pr = Ctor.precision;
  33061. // 0/NaN/Infinity?
  33062. if (!x.d || !x.d[0] || x.e > 17) {
  33063. return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  33064. }
  33065. if (sd == null) {
  33066. external = false;
  33067. wpr = pr;
  33068. } else {
  33069. wpr = sd;
  33070. }
  33071. t = new Ctor(0.03125);
  33072. // while abs(x) >= 0.1
  33073. while (x.e > -2) {
  33074. // x = x / 2^5
  33075. x = x.times(t);
  33076. k += 5;
  33077. }
  33078. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  33079. // necessary to ensure the first 4 rounding digits are correct.
  33080. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  33081. wpr += guard;
  33082. denominator = pow = sum = new Ctor(1);
  33083. Ctor.precision = wpr;
  33084. for (;;) {
  33085. pow = finalise(pow.times(x), wpr, 1);
  33086. denominator = denominator.times(++i);
  33087. t = sum.plus(divide(pow, denominator, wpr, 1));
  33088. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  33089. j = k;
  33090. while (j--) {
  33091. sum = finalise(sum.times(sum), wpr, 1);
  33092. } // Check to see if the first 4 rounding digits are [49]999.
  33093. // If so, repeat the summation with a higher precision, otherwise
  33094. // e.g. with precision: 18, rounding: 1
  33095. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  33096. // `wpr - guard` is the index of first rounding digit.
  33097. if (sd == null) {
  33098. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  33099. Ctor.precision = wpr += 10;
  33100. denominator = pow = t = new Ctor(1);
  33101. i = 0;
  33102. rep++;
  33103. } else {
  33104. return finalise(sum, Ctor.precision = pr, rm, external = true);
  33105. }
  33106. } else {
  33107. Ctor.precision = pr;
  33108. return sum;
  33109. }
  33110. }
  33111. sum = t;
  33112. }
  33113. }
  33114. /*
  33115. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  33116. * digits.
  33117. *
  33118. * ln(-n) = NaN
  33119. * ln(0) = -Infinity
  33120. * ln(-0) = -Infinity
  33121. * ln(1) = 0
  33122. * ln(Infinity) = Infinity
  33123. * ln(-Infinity) = NaN
  33124. * ln(NaN) = NaN
  33125. *
  33126. * ln(n) (n != 1) is non-terminating.
  33127. *
  33128. */
  33129. function naturalLogarithm(y, sd) {
  33130. var c,
  33131. c0,
  33132. denominator,
  33133. e,
  33134. numerator,
  33135. rep,
  33136. sum,
  33137. t,
  33138. wpr,
  33139. x1,
  33140. x2,
  33141. n = 1,
  33142. guard = 10,
  33143. x = y,
  33144. xd = x.d,
  33145. Ctor = x.constructor,
  33146. rm = Ctor.rounding,
  33147. pr = Ctor.precision;
  33148. // Is x negative or Infinity, NaN, 0 or 1?
  33149. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  33150. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  33151. }
  33152. if (sd == null) {
  33153. external = false;
  33154. wpr = pr;
  33155. } else {
  33156. wpr = sd;
  33157. }
  33158. Ctor.precision = wpr += guard;
  33159. c = digitsToString(xd);
  33160. c0 = c.charAt(0);
  33161. if (Math.abs(e = x.e) < 1.5e15) {
  33162. // Argument reduction.
  33163. // The series converges faster the closer the argument is to 1, so using
  33164. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  33165. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  33166. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  33167. // later be divided by this number, then separate out the power of 10 using
  33168. // ln(a*10^b) = ln(a) + b*ln(10).
  33169. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  33170. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  33171. // max n is 6 (gives 0.7 - 1.3)
  33172. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  33173. x = x.times(y);
  33174. c = digitsToString(x.d);
  33175. c0 = c.charAt(0);
  33176. n++;
  33177. }
  33178. e = x.e;
  33179. if (c0 > 1) {
  33180. x = new Ctor('0.' + c);
  33181. e++;
  33182. } else {
  33183. x = new Ctor(c0 + '.' + c.slice(1));
  33184. }
  33185. } else {
  33186. // The argument reduction method above may result in overflow if the argument y is a massive
  33187. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  33188. // function using ln(x*10^e) = ln(x) + e*ln(10).
  33189. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  33190. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  33191. Ctor.precision = pr;
  33192. return sd == null ? finalise(x, pr, rm, external = true) : x;
  33193. }
  33194. // x1 is x reduced to a value near 1.
  33195. x1 = x;
  33196. // Taylor series.
  33197. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  33198. // where x = (y - 1)/(y + 1) (|x| < 1)
  33199. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  33200. x2 = finalise(x.times(x), wpr, 1);
  33201. denominator = 3;
  33202. for (;;) {
  33203. numerator = finalise(numerator.times(x2), wpr, 1);
  33204. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  33205. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  33206. sum = sum.times(2);
  33207. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  33208. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  33209. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  33210. sum = divide(sum, new Ctor(n), wpr, 1);
  33211. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  33212. // been repeated previously) and the first 4 rounding digits 9999?
  33213. // If so, restart the summation with a higher precision, otherwise
  33214. // e.g. with precision: 12, rounding: 1
  33215. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  33216. // `wpr - guard` is the index of first rounding digit.
  33217. if (sd == null) {
  33218. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  33219. Ctor.precision = wpr += guard;
  33220. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  33221. x2 = finalise(x.times(x), wpr, 1);
  33222. denominator = rep = 1;
  33223. } else {
  33224. return finalise(sum, Ctor.precision = pr, rm, external = true);
  33225. }
  33226. } else {
  33227. Ctor.precision = pr;
  33228. return sum;
  33229. }
  33230. }
  33231. sum = t;
  33232. denominator += 2;
  33233. }
  33234. }
  33235. // ±Infinity, NaN.
  33236. function nonFiniteToString(x) {
  33237. // Unsigned.
  33238. return String(x.s * x.s / 0);
  33239. }
  33240. /*
  33241. * Parse the value of a new Decimal `x` from string `str`.
  33242. */
  33243. function parseDecimal(x, str) {
  33244. var e, i, len;
  33245. // Decimal point?
  33246. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  33247. // Exponential form?
  33248. if ((i = str.search(/e/i)) > 0) {
  33249. // Determine exponent.
  33250. if (e < 0) e = i;
  33251. e += +str.slice(i + 1);
  33252. str = str.substring(0, i);
  33253. } else if (e < 0) {
  33254. // Integer.
  33255. e = str.length;
  33256. }
  33257. // Determine leading zeros.
  33258. for (i = 0; str.charCodeAt(i) === 48; i++) {}
  33259. // Determine trailing zeros.
  33260. for (len = str.length; str.charCodeAt(len - 1) === 48; --len) {}
  33261. str = str.slice(i, len);
  33262. if (str) {
  33263. len -= i;
  33264. x.e = e = e - i - 1;
  33265. x.d = [];
  33266. // Transform base
  33267. // e is the base 10 exponent.
  33268. // i is where to slice str to get the first word of the digits array.
  33269. i = (e + 1) % LOG_BASE;
  33270. if (e < 0) i += LOG_BASE;
  33271. if (i < len) {
  33272. if (i) x.d.push(+str.slice(0, i));
  33273. for (len -= LOG_BASE; i < len;) {
  33274. x.d.push(+str.slice(i, i += LOG_BASE));
  33275. }str = str.slice(i);
  33276. i = LOG_BASE - str.length;
  33277. } else {
  33278. i -= len;
  33279. }
  33280. for (; i--;) {
  33281. str += '0';
  33282. }x.d.push(+str);
  33283. if (external) {
  33284. // Overflow?
  33285. if (x.e > x.constructor.maxE) {
  33286. // Infinity.
  33287. x.d = null;
  33288. x.e = NaN;
  33289. // Underflow?
  33290. } else if (x.e < x.constructor.minE) {
  33291. // Zero.
  33292. x.e = 0;
  33293. x.d = [0];
  33294. // x.constructor.underflow = true;
  33295. } // else x.constructor.underflow = false;
  33296. }
  33297. } else {
  33298. // Zero.
  33299. x.e = 0;
  33300. x.d = [0];
  33301. }
  33302. return x;
  33303. }
  33304. /*
  33305. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  33306. */
  33307. function parseOther(x, str) {
  33308. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  33309. if (str === 'Infinity' || str === 'NaN') {
  33310. if (!+str) x.s = NaN;
  33311. x.e = NaN;
  33312. x.d = null;
  33313. return x;
  33314. }
  33315. if (isHex.test(str)) {
  33316. base = 16;
  33317. str = str.toLowerCase();
  33318. } else if (isBinary.test(str)) {
  33319. base = 2;
  33320. } else if (isOctal.test(str)) {
  33321. base = 8;
  33322. } else {
  33323. throw Error(invalidArgument + str);
  33324. }
  33325. // Is there a binary exponent part?
  33326. i = str.search(/p/i);
  33327. if (i > 0) {
  33328. p = +str.slice(i + 1);
  33329. str = str.substring(2, i);
  33330. } else {
  33331. str = str.slice(2);
  33332. }
  33333. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  33334. // fraction part will be restored.
  33335. i = str.indexOf('.');
  33336. isFloat = i >= 0;
  33337. Ctor = x.constructor;
  33338. if (isFloat) {
  33339. str = str.replace('.', '');
  33340. len = str.length;
  33341. i = len - i;
  33342. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  33343. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  33344. }
  33345. xd = convertBase(str, base, BASE);
  33346. xe = xd.length - 1;
  33347. // Remove trailing zeros.
  33348. for (i = xe; xd[i] === 0; --i) {
  33349. xd.pop();
  33350. }if (i < 0) return new Ctor(x.s * 0);
  33351. x.e = getBase10Exponent(xd, xe);
  33352. x.d = xd;
  33353. external = false;
  33354. // At what precision to perform the division to ensure exact conversion?
  33355. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  33356. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  33357. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  33358. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  33359. // Therefore using 4 * the number of digits of str will always be enough.
  33360. if (isFloat) x = divide(x, divisor, len * 4);
  33361. // Multiply by the binary exponent part if present.
  33362. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  33363. external = true;
  33364. return x;
  33365. }
  33366. /*
  33367. * sin(x) = x - x^3/3! + x^5/5! - ...
  33368. * |x| < pi/2
  33369. *
  33370. */
  33371. function sine(Ctor, x) {
  33372. var k,
  33373. len = x.d.length;
  33374. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  33375. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  33376. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  33377. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  33378. // Estimate the optimum number of times to use the argument reduction.
  33379. k = 1.4 * Math.sqrt(len);
  33380. k = k > 16 ? 16 : k | 0;
  33381. // Max k before Math.pow precision loss is 22
  33382. x = x.times(Math.pow(5, -k));
  33383. x = taylorSeries(Ctor, 2, x, x);
  33384. // Reverse argument reduction
  33385. var sin2_x,
  33386. d5 = new Ctor(5),
  33387. d16 = new Ctor(16),
  33388. d20 = new Ctor(20);
  33389. for (; k--;) {
  33390. sin2_x = x.times(x);
  33391. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  33392. }
  33393. return x;
  33394. }
  33395. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  33396. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  33397. var j,
  33398. t,
  33399. u,
  33400. x2,
  33401. i = 1,
  33402. pr = Ctor.precision,
  33403. k = Math.ceil(pr / LOG_BASE);
  33404. external = false;
  33405. x2 = x.times(x);
  33406. u = new Ctor(y);
  33407. for (;;) {
  33408. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  33409. u = isHyperbolic ? y.plus(t) : y.minus(t);
  33410. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  33411. t = u.plus(y);
  33412. if (t.d[k] !== void 0) {
  33413. for (j = k; t.d[j] === u.d[j] && j--;) {}
  33414. if (j == -1) break;
  33415. }
  33416. j = u;
  33417. u = y;
  33418. y = t;
  33419. t = j;
  33420. i++;
  33421. }
  33422. external = true;
  33423. t.d.length = k + 1;
  33424. return t;
  33425. }
  33426. // Return the absolute value of `x` reduced to less than or equal to half pi.
  33427. function toLessThanHalfPi(Ctor, x) {
  33428. var t,
  33429. isNeg = x.s < 0,
  33430. pi = getPi(Ctor, Ctor.precision, 1),
  33431. halfPi = pi.times(0.5);
  33432. x = x.abs();
  33433. if (x.lte(halfPi)) {
  33434. quadrant = isNeg ? 4 : 1;
  33435. return x;
  33436. }
  33437. t = x.divToInt(pi);
  33438. if (t.isZero()) {
  33439. quadrant = isNeg ? 3 : 2;
  33440. } else {
  33441. x = x.minus(t.times(pi));
  33442. // 0 <= x < pi
  33443. if (x.lte(halfPi)) {
  33444. quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1;
  33445. return x;
  33446. }
  33447. quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2;
  33448. }
  33449. return x.minus(pi).abs();
  33450. }
  33451. /*
  33452. * Return the value of Decimal `x` as a string in base `baseOut`.
  33453. *
  33454. * If the optional `sd` argument is present include a binary exponent suffix.
  33455. */
  33456. function toStringBinary(x, baseOut, sd, rm) {
  33457. var base,
  33458. e,
  33459. i,
  33460. k,
  33461. len,
  33462. roundUp,
  33463. str,
  33464. xd,
  33465. y,
  33466. Ctor = x.constructor,
  33467. isExp = sd !== void 0;
  33468. if (isExp) {
  33469. checkInt32(sd, 1, MAX_DIGITS);
  33470. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  33471. } else {
  33472. sd = Ctor.precision;
  33473. rm = Ctor.rounding;
  33474. }
  33475. if (!x.isFinite()) {
  33476. str = nonFiniteToString(x);
  33477. } else {
  33478. str = finiteToString(x);
  33479. i = str.indexOf('.');
  33480. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  33481. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  33482. // minBinaryExponent = floor(decimalExponent * log[2](10))
  33483. // log[2](10) = 3.321928094887362347870319429489390175864
  33484. if (isExp) {
  33485. base = 2;
  33486. if (baseOut == 16) {
  33487. sd = sd * 4 - 3;
  33488. } else if (baseOut == 8) {
  33489. sd = sd * 3 - 2;
  33490. }
  33491. } else {
  33492. base = baseOut;
  33493. }
  33494. // Convert the number as an integer then divide the result by its base raised to a power such
  33495. // that the fraction part will be restored.
  33496. // Non-integer.
  33497. if (i >= 0) {
  33498. str = str.replace('.', '');
  33499. y = new Ctor(1);
  33500. y.e = str.length - i;
  33501. y.d = convertBase(finiteToString(y), 10, base);
  33502. y.e = y.d.length;
  33503. }
  33504. xd = convertBase(str, 10, base);
  33505. e = len = xd.length;
  33506. // Remove trailing zeros.
  33507. for (; xd[--len] == 0;) {
  33508. xd.pop();
  33509. }if (!xd[0]) {
  33510. str = isExp ? '0p+0' : '0';
  33511. } else {
  33512. if (i < 0) {
  33513. e--;
  33514. } else {
  33515. x = new Ctor(x);
  33516. x.d = xd;
  33517. x.e = e;
  33518. x = divide(x, y, sd, rm, 0, base);
  33519. xd = x.d;
  33520. e = x.e;
  33521. roundUp = inexact;
  33522. }
  33523. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  33524. i = xd[sd];
  33525. k = base / 2;
  33526. roundUp = roundUp || xd[sd + 1] !== void 0;
  33527. 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));
  33528. xd.length = sd;
  33529. if (roundUp) {
  33530. // Rounding up may mean the previous digit has to be rounded up and so on.
  33531. for (; ++xd[--sd] > base - 1;) {
  33532. xd[sd] = 0;
  33533. if (!sd) {
  33534. ++e;
  33535. xd.unshift(1);
  33536. }
  33537. }
  33538. }
  33539. // Determine trailing zeros.
  33540. for (len = xd.length; !xd[len - 1]; --len) {}
  33541. // E.g. [4, 11, 15] becomes 4bf.
  33542. for (i = 0, str = ''; i < len; i++) {
  33543. str += NUMERALS.charAt(xd[i]);
  33544. } // Add binary exponent suffix?
  33545. if (isExp) {
  33546. if (len > 1) {
  33547. if (baseOut == 16 || baseOut == 8) {
  33548. i = baseOut == 16 ? 4 : 3;
  33549. for (--len; len % i; len++) {
  33550. str += '0';
  33551. }xd = convertBase(str, base, baseOut);
  33552. for (len = xd.length; !xd[len - 1]; --len) {}
  33553. // xd[0] will always be be 1
  33554. for (i = 1, str = '1.'; i < len; i++) {
  33555. str += NUMERALS.charAt(xd[i]);
  33556. }
  33557. } else {
  33558. str = str.charAt(0) + '.' + str.slice(1);
  33559. }
  33560. }
  33561. str = str + (e < 0 ? 'p' : 'p+') + e;
  33562. } else if (e < 0) {
  33563. for (; ++e;) {
  33564. str = '0' + str;
  33565. }str = '0.' + str;
  33566. } else {
  33567. if (++e > len) for (e -= len; e--;) {
  33568. str += '0';
  33569. } else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  33570. }
  33571. }
  33572. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  33573. }
  33574. return x.s < 0 ? '-' + str : str;
  33575. }
  33576. // Does not strip trailing zeros.
  33577. function truncate(arr, len) {
  33578. if (arr.length > len) {
  33579. arr.length = len;
  33580. return true;
  33581. }
  33582. }
  33583. // Decimal methods
  33584. /*
  33585. * abs
  33586. * acos
  33587. * acosh
  33588. * add
  33589. * asin
  33590. * asinh
  33591. * atan
  33592. * atanh
  33593. * atan2
  33594. * cbrt
  33595. * ceil
  33596. * clone
  33597. * config
  33598. * cos
  33599. * cosh
  33600. * div
  33601. * exp
  33602. * floor
  33603. * hypot
  33604. * ln
  33605. * log
  33606. * log2
  33607. * log10
  33608. * max
  33609. * min
  33610. * mod
  33611. * mul
  33612. * pow
  33613. * random
  33614. * round
  33615. * set
  33616. * sign
  33617. * sin
  33618. * sinh
  33619. * sqrt
  33620. * sub
  33621. * tan
  33622. * tanh
  33623. * trunc
  33624. */
  33625. /*
  33626. * Return a new Decimal whose value is the absolute value of `x`.
  33627. *
  33628. * x {number|string|Decimal}
  33629. *
  33630. */
  33631. function abs(x) {
  33632. return new this(x).abs();
  33633. }
  33634. /*
  33635. * Return a new Decimal whose value is the arccosine in radians of `x`.
  33636. *
  33637. * x {number|string|Decimal}
  33638. *
  33639. */
  33640. function acos(x) {
  33641. return new this(x).acos();
  33642. }
  33643. /*
  33644. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  33645. * `precision` significant digits using rounding mode `rounding`.
  33646. *
  33647. * x {number|string|Decimal} A value in radians.
  33648. *
  33649. */
  33650. function acosh(x) {
  33651. return new this(x).acosh();
  33652. }
  33653. /*
  33654. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  33655. * digits using rounding mode `rounding`.
  33656. *
  33657. * x {number|string|Decimal}
  33658. * y {number|string|Decimal}
  33659. *
  33660. */
  33661. function add(x, y) {
  33662. return new this(x).plus(y);
  33663. }
  33664. /*
  33665. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  33666. * significant digits using rounding mode `rounding`.
  33667. *
  33668. * x {number|string|Decimal}
  33669. *
  33670. */
  33671. function asin(x) {
  33672. return new this(x).asin();
  33673. }
  33674. /*
  33675. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  33676. * `precision` significant digits using rounding mode `rounding`.
  33677. *
  33678. * x {number|string|Decimal} A value in radians.
  33679. *
  33680. */
  33681. function asinh(x) {
  33682. return new this(x).asinh();
  33683. }
  33684. /*
  33685. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  33686. * significant digits using rounding mode `rounding`.
  33687. *
  33688. * x {number|string|Decimal}
  33689. *
  33690. */
  33691. function atan(x) {
  33692. return new this(x).atan();
  33693. }
  33694. /*
  33695. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  33696. * `precision` significant digits using rounding mode `rounding`.
  33697. *
  33698. * x {number|string|Decimal} A value in radians.
  33699. *
  33700. */
  33701. function atanh(x) {
  33702. return new this(x).atanh();
  33703. }
  33704. /*
  33705. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  33706. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  33707. *
  33708. * Domain: [-Infinity, Infinity]
  33709. * Range: [-pi, pi]
  33710. *
  33711. * y {number|string|Decimal} The y-coordinate.
  33712. * x {number|string|Decimal} The x-coordinate.
  33713. *
  33714. * atan2(±0, -0) = ±pi
  33715. * atan2(±0, +0) = ±0
  33716. * atan2(±0, -x) = ±pi for x > 0
  33717. * atan2(±0, x) = ±0 for x > 0
  33718. * atan2(-y, ±0) = -pi/2 for y > 0
  33719. * atan2(y, ±0) = pi/2 for y > 0
  33720. * atan2(±y, -Infinity) = ±pi for finite y > 0
  33721. * atan2(±y, +Infinity) = ±0 for finite y > 0
  33722. * atan2(±Infinity, x) = ±pi/2 for finite x
  33723. * atan2(±Infinity, -Infinity) = ±3*pi/4
  33724. * atan2(±Infinity, +Infinity) = ±pi/4
  33725. * atan2(NaN, x) = NaN
  33726. * atan2(y, NaN) = NaN
  33727. *
  33728. */
  33729. function atan2(y, x) {
  33730. y = new this(y);
  33731. x = new this(x);
  33732. var r,
  33733. pr = this.precision,
  33734. rm = this.rounding,
  33735. wpr = pr + 4;
  33736. // Either NaN
  33737. if (!y.s || !x.s) {
  33738. r = new this(NaN);
  33739. // Both ±Infinity
  33740. } else if (!y.d && !x.d) {
  33741. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  33742. r.s = y.s;
  33743. // x is ±Infinity or y is ±0
  33744. } else if (!x.d || y.isZero()) {
  33745. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  33746. r.s = y.s;
  33747. // y is ±Infinity or x is ±0
  33748. } else if (!y.d || x.isZero()) {
  33749. r = getPi(this, wpr, 1).times(0.5);
  33750. r.s = y.s;
  33751. // Both non-zero and finite
  33752. } else if (x.s < 0) {
  33753. this.precision = wpr;
  33754. this.rounding = 1;
  33755. r = this.atan(divide(y, x, wpr, 1));
  33756. x = getPi(this, wpr, 1);
  33757. this.precision = pr;
  33758. this.rounding = rm;
  33759. r = y.s < 0 ? r.minus(x) : r.plus(x);
  33760. } else {
  33761. r = this.atan(divide(y, x, wpr, 1));
  33762. }
  33763. return r;
  33764. }
  33765. /*
  33766. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  33767. * digits using rounding mode `rounding`.
  33768. *
  33769. * x {number|string|Decimal}
  33770. *
  33771. */
  33772. function cbrt(x) {
  33773. return new this(x).cbrt();
  33774. }
  33775. /*
  33776. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  33777. *
  33778. * x {number|string|Decimal}
  33779. *
  33780. */
  33781. function ceil(x) {
  33782. return finalise(x = new this(x), x.e + 1, 2);
  33783. }
  33784. /*
  33785. * Configure global settings for a Decimal constructor.
  33786. *
  33787. * `obj` is an object with one or more of the following properties,
  33788. *
  33789. * precision {number}
  33790. * rounding {number}
  33791. * toExpNeg {number}
  33792. * toExpPos {number}
  33793. * maxE {number}
  33794. * minE {number}
  33795. * modulo {number}
  33796. * crypto {boolean|number}
  33797. * defaults {true}
  33798. *
  33799. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  33800. *
  33801. */
  33802. function config(obj) {
  33803. if (!obj || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') throw Error(decimalError + 'Object expected');
  33804. var i,
  33805. p,
  33806. v,
  33807. useDefaults = obj.defaults === true,
  33808. 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];
  33809. for (i = 0; i < ps.length; i += 3) {
  33810. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  33811. if ((v = obj[p]) !== void 0) {
  33812. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;else throw Error(invalidArgument + p + ': ' + v);
  33813. }
  33814. }
  33815. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  33816. if ((v = obj[p]) !== void 0) {
  33817. if (v === true || v === false || v === 0 || v === 1) {
  33818. if (v) {
  33819. if (typeof crypto != 'undefined' && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
  33820. this[p] = true;
  33821. } else {
  33822. throw Error(cryptoUnavailable);
  33823. }
  33824. } else {
  33825. this[p] = false;
  33826. }
  33827. } else {
  33828. throw Error(invalidArgument + p + ': ' + v);
  33829. }
  33830. }
  33831. return this;
  33832. }
  33833. /*
  33834. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  33835. * digits using rounding mode `rounding`.
  33836. *
  33837. * x {number|string|Decimal} A value in radians.
  33838. *
  33839. */
  33840. function cos(x) {
  33841. return new this(x).cos();
  33842. }
  33843. /*
  33844. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  33845. * significant digits using rounding mode `rounding`.
  33846. *
  33847. * x {number|string|Decimal} A value in radians.
  33848. *
  33849. */
  33850. function cosh(x) {
  33851. return new this(x).cosh();
  33852. }
  33853. /*
  33854. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  33855. * constructor.
  33856. *
  33857. */
  33858. function clone(obj) {
  33859. var i, p, ps;
  33860. /*
  33861. * The Decimal constructor and exported function.
  33862. * Return a new Decimal instance.
  33863. *
  33864. * v {number|string|Decimal} A numeric value.
  33865. *
  33866. */
  33867. function Decimal(v) {
  33868. var e,
  33869. i,
  33870. t,
  33871. x = this;
  33872. // Decimal called without new.
  33873. if (!(x instanceof Decimal)) return new Decimal(v);
  33874. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  33875. // which points to Object.
  33876. x.constructor = Decimal;
  33877. // Duplicate.
  33878. if (v instanceof Decimal) {
  33879. x.s = v.s;
  33880. x.e = v.e;
  33881. x.d = (v = v.d) ? v.slice() : v;
  33882. return;
  33883. }
  33884. t = typeof v === 'undefined' ? 'undefined' : _typeof(v);
  33885. if (t === 'number') {
  33886. if (v === 0) {
  33887. x.s = 1 / v < 0 ? -1 : 1;
  33888. x.e = 0;
  33889. x.d = [0];
  33890. return;
  33891. }
  33892. if (v < 0) {
  33893. v = -v;
  33894. x.s = -1;
  33895. } else {
  33896. x.s = 1;
  33897. }
  33898. // Fast path for small integers.
  33899. if (v === ~~v && v < 1e7) {
  33900. for (e = 0, i = v; i >= 10; i /= 10) {
  33901. e++;
  33902. }x.e = e;
  33903. x.d = [v];
  33904. return;
  33905. // Infinity, NaN.
  33906. } else if (v * 0 !== 0) {
  33907. if (!v) x.s = NaN;
  33908. x.e = NaN;
  33909. x.d = null;
  33910. return;
  33911. }
  33912. return parseDecimal(x, v.toString());
  33913. } else if (t !== 'string') {
  33914. throw Error(invalidArgument + v);
  33915. }
  33916. // Minus sign?
  33917. if (v.charCodeAt(0) === 45) {
  33918. v = v.slice(1);
  33919. x.s = -1;
  33920. } else {
  33921. x.s = 1;
  33922. }
  33923. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  33924. }
  33925. Decimal.prototype = P;
  33926. Decimal.ROUND_UP = 0;
  33927. Decimal.ROUND_DOWN = 1;
  33928. Decimal.ROUND_CEIL = 2;
  33929. Decimal.ROUND_FLOOR = 3;
  33930. Decimal.ROUND_HALF_UP = 4;
  33931. Decimal.ROUND_HALF_DOWN = 5;
  33932. Decimal.ROUND_HALF_EVEN = 6;
  33933. Decimal.ROUND_HALF_CEIL = 7;
  33934. Decimal.ROUND_HALF_FLOOR = 8;
  33935. Decimal.EUCLID = 9;
  33936. Decimal.config = Decimal.set = config;
  33937. Decimal.clone = clone;
  33938. Decimal.isDecimal = isDecimalInstance;
  33939. Decimal.abs = abs;
  33940. Decimal.acos = acos;
  33941. Decimal.acosh = acosh; // ES6
  33942. Decimal.add = add;
  33943. Decimal.asin = asin;
  33944. Decimal.asinh = asinh; // ES6
  33945. Decimal.atan = atan;
  33946. Decimal.atanh = atanh; // ES6
  33947. Decimal.atan2 = atan2;
  33948. Decimal.cbrt = cbrt; // ES6
  33949. Decimal.ceil = ceil;
  33950. Decimal.cos = cos;
  33951. Decimal.cosh = cosh; // ES6
  33952. Decimal.div = div;
  33953. Decimal.exp = exp;
  33954. Decimal.floor = floor;
  33955. Decimal.hypot = hypot; // ES6
  33956. Decimal.ln = ln;
  33957. Decimal.log = log;
  33958. Decimal.log10 = log10; // ES6
  33959. Decimal.log2 = log2; // ES6
  33960. Decimal.max = max;
  33961. Decimal.min = min;
  33962. Decimal.mod = mod;
  33963. Decimal.mul = mul;
  33964. Decimal.pow = pow;
  33965. Decimal.random = random;
  33966. Decimal.round = round;
  33967. Decimal.sign = sign; // ES6
  33968. Decimal.sin = sin;
  33969. Decimal.sinh = sinh; // ES6
  33970. Decimal.sqrt = sqrt;
  33971. Decimal.sub = sub;
  33972. Decimal.tan = tan;
  33973. Decimal.tanh = tanh; // ES6
  33974. Decimal.trunc = trunc; // ES6
  33975. if (obj === void 0) obj = {};
  33976. if (obj) {
  33977. if (obj.defaults !== true) {
  33978. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  33979. for (i = 0; i < ps.length;) {
  33980. if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  33981. }
  33982. }
  33983. }
  33984. Decimal.config(obj);
  33985. return Decimal;
  33986. }
  33987. /*
  33988. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  33989. * digits using rounding mode `rounding`.
  33990. *
  33991. * x {number|string|Decimal}
  33992. * y {number|string|Decimal}
  33993. *
  33994. */
  33995. function div(x, y) {
  33996. return new this(x).div(y);
  33997. }
  33998. /*
  33999. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  34000. * significant digits using rounding mode `rounding`.
  34001. *
  34002. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  34003. *
  34004. */
  34005. function exp(x) {
  34006. return new this(x).exp();
  34007. }
  34008. /*
  34009. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  34010. *
  34011. * x {number|string|Decimal}
  34012. *
  34013. */
  34014. function floor(x) {
  34015. return finalise(x = new this(x), x.e + 1, 3);
  34016. }
  34017. /*
  34018. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  34019. * rounded to `precision` significant digits using rounding mode `rounding`.
  34020. *
  34021. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  34022. *
  34023. */
  34024. function hypot() {
  34025. var i,
  34026. n,
  34027. t = new this(0);
  34028. external = false;
  34029. for (i = 0; i < arguments.length;) {
  34030. n = new this(arguments[i++]);
  34031. if (!n.d) {
  34032. if (n.s) {
  34033. external = true;
  34034. return new this(1 / 0);
  34035. }
  34036. t = n;
  34037. } else if (t.d) {
  34038. t = t.plus(n.times(n));
  34039. }
  34040. }
  34041. external = true;
  34042. return t.sqrt();
  34043. }
  34044. /*
  34045. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  34046. * otherwise return false.
  34047. *
  34048. */
  34049. function isDecimalInstance(obj) {
  34050. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  34051. }
  34052. /*
  34053. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  34054. * significant digits using rounding mode `rounding`.
  34055. *
  34056. * x {number|string|Decimal}
  34057. *
  34058. */
  34059. function ln(x) {
  34060. return new this(x).ln();
  34061. }
  34062. /*
  34063. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  34064. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  34065. *
  34066. * log[y](x)
  34067. *
  34068. * x {number|string|Decimal} The argument of the logarithm.
  34069. * y {number|string|Decimal} The base of the logarithm.
  34070. *
  34071. */
  34072. function log(x, y) {
  34073. return new this(x).log(y);
  34074. }
  34075. /*
  34076. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  34077. * significant digits using rounding mode `rounding`.
  34078. *
  34079. * x {number|string|Decimal}
  34080. *
  34081. */
  34082. function log2(x) {
  34083. return new this(x).log(2);
  34084. }
  34085. /*
  34086. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  34087. * significant digits using rounding mode `rounding`.
  34088. *
  34089. * x {number|string|Decimal}
  34090. *
  34091. */
  34092. function log10(x) {
  34093. return new this(x).log(10);
  34094. }
  34095. /*
  34096. * Return a new Decimal whose value is the maximum of the arguments.
  34097. *
  34098. * arguments {number|string|Decimal}
  34099. *
  34100. */
  34101. function max() {
  34102. return maxOrMin(this, arguments, 'lt');
  34103. }
  34104. /*
  34105. * Return a new Decimal whose value is the minimum of the arguments.
  34106. *
  34107. * arguments {number|string|Decimal}
  34108. *
  34109. */
  34110. function min() {
  34111. return maxOrMin(this, arguments, 'gt');
  34112. }
  34113. /*
  34114. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  34115. * using rounding mode `rounding`.
  34116. *
  34117. * x {number|string|Decimal}
  34118. * y {number|string|Decimal}
  34119. *
  34120. */
  34121. function mod(x, y) {
  34122. return new this(x).mod(y);
  34123. }
  34124. /*
  34125. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  34126. * digits using rounding mode `rounding`.
  34127. *
  34128. * x {number|string|Decimal}
  34129. * y {number|string|Decimal}
  34130. *
  34131. */
  34132. function mul(x, y) {
  34133. return new this(x).mul(y);
  34134. }
  34135. /*
  34136. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  34137. * significant digits using rounding mode `rounding`.
  34138. *
  34139. * x {number|string|Decimal} The base.
  34140. * y {number|string|Decimal} The exponent.
  34141. *
  34142. */
  34143. function pow(x, y) {
  34144. return new this(x).pow(y);
  34145. }
  34146. /*
  34147. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  34148. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  34149. * are produced).
  34150. *
  34151. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  34152. *
  34153. */
  34154. function random(sd) {
  34155. var d,
  34156. e,
  34157. k,
  34158. n,
  34159. i = 0,
  34160. r = new this(1),
  34161. rd = [];
  34162. if (sd === void 0) sd = this.precision;else checkInt32(sd, 1, MAX_DIGITS);
  34163. k = Math.ceil(sd / LOG_BASE);
  34164. if (!this.crypto) {
  34165. for (; i < k;) {
  34166. rd[i++] = Math.random() * 1e7 | 0;
  34167. } // Browsers supporting crypto.getRandomValues.
  34168. } else if (crypto.getRandomValues) {
  34169. d = crypto.getRandomValues(new Uint32Array(k));
  34170. for (; i < k;) {
  34171. n = d[i];
  34172. // 0 <= n < 4294967296
  34173. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  34174. if (n >= 4.29e9) {
  34175. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  34176. } else {
  34177. // 0 <= n <= 4289999999
  34178. // 0 <= (n % 1e7) <= 9999999
  34179. rd[i++] = n % 1e7;
  34180. }
  34181. }
  34182. // Node.js supporting crypto.randomBytes.
  34183. } else if (crypto.randomBytes) {
  34184. // buffer
  34185. d = crypto.randomBytes(k *= 4);
  34186. for (; i < k;) {
  34187. // 0 <= n < 2147483648
  34188. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  34189. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  34190. if (n >= 2.14e9) {
  34191. crypto.randomBytes(4).copy(d, i);
  34192. } else {
  34193. // 0 <= n <= 2139999999
  34194. // 0 <= (n % 1e7) <= 9999999
  34195. rd.push(n % 1e7);
  34196. i += 4;
  34197. }
  34198. }
  34199. i = k / 4;
  34200. } else {
  34201. throw Error(cryptoUnavailable);
  34202. }
  34203. k = rd[--i];
  34204. sd %= LOG_BASE;
  34205. // Convert trailing digits to zeros according to sd.
  34206. if (k && sd) {
  34207. n = mathpow(10, LOG_BASE - sd);
  34208. rd[i] = (k / n | 0) * n;
  34209. }
  34210. // Remove trailing words which are zero.
  34211. for (; rd[i] === 0; i--) {
  34212. rd.pop();
  34213. } // Zero?
  34214. if (i < 0) {
  34215. e = 0;
  34216. rd = [0];
  34217. } else {
  34218. e = -1;
  34219. // Remove leading words which are zero and adjust exponent accordingly.
  34220. for (; rd[0] === 0; e -= LOG_BASE) {
  34221. rd.shift();
  34222. } // Count the digits of the first word of rd to determine leading zeros.
  34223. for (k = 1, n = rd[0]; n >= 10; n /= 10) {
  34224. k++;
  34225. } // Adjust the exponent for leading zeros of the first word of rd.
  34226. if (k < LOG_BASE) e -= LOG_BASE - k;
  34227. }
  34228. r.e = e;
  34229. r.d = rd;
  34230. return r;
  34231. }
  34232. /*
  34233. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  34234. *
  34235. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  34236. *
  34237. * x {number|string|Decimal}
  34238. *
  34239. */
  34240. function round(x) {
  34241. return finalise(x = new this(x), x.e + 1, this.rounding);
  34242. }
  34243. /*
  34244. * Return
  34245. * 1 if x > 0,
  34246. * -1 if x < 0,
  34247. * 0 if x is 0,
  34248. * -0 if x is -0,
  34249. * NaN otherwise
  34250. *
  34251. */
  34252. function sign(x) {
  34253. x = new this(x);
  34254. return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN;
  34255. }
  34256. /*
  34257. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  34258. * using rounding mode `rounding`.
  34259. *
  34260. * x {number|string|Decimal} A value in radians.
  34261. *
  34262. */
  34263. function sin(x) {
  34264. return new this(x).sin();
  34265. }
  34266. /*
  34267. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  34268. * significant digits using rounding mode `rounding`.
  34269. *
  34270. * x {number|string|Decimal} A value in radians.
  34271. *
  34272. */
  34273. function sinh(x) {
  34274. return new this(x).sinh();
  34275. }
  34276. /*
  34277. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  34278. * digits using rounding mode `rounding`.
  34279. *
  34280. * x {number|string|Decimal}
  34281. *
  34282. */
  34283. function sqrt(x) {
  34284. return new this(x).sqrt();
  34285. }
  34286. /*
  34287. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  34288. * using rounding mode `rounding`.
  34289. *
  34290. * x {number|string|Decimal}
  34291. * y {number|string|Decimal}
  34292. *
  34293. */
  34294. function sub(x, y) {
  34295. return new this(x).sub(y);
  34296. }
  34297. /*
  34298. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  34299. * digits using rounding mode `rounding`.
  34300. *
  34301. * x {number|string|Decimal} A value in radians.
  34302. *
  34303. */
  34304. function tan(x) {
  34305. return new this(x).tan();
  34306. }
  34307. /*
  34308. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  34309. * significant digits using rounding mode `rounding`.
  34310. *
  34311. * x {number|string|Decimal} A value in radians.
  34312. *
  34313. */
  34314. function tanh(x) {
  34315. return new this(x).tanh();
  34316. }
  34317. /*
  34318. * Return a new Decimal whose value is `x` truncated to an integer.
  34319. *
  34320. * x {number|string|Decimal}
  34321. *
  34322. */
  34323. function trunc(x) {
  34324. return finalise(x = new this(x), x.e + 1, 1);
  34325. }
  34326. // Create and configure initial Decimal constructor.
  34327. Decimal = clone(DEFAULTS);
  34328. Decimal['default'] = Decimal.Decimal = Decimal;
  34329. // Create the internal constants from their string values.
  34330. LN10 = new Decimal(LN10);
  34331. PI = new Decimal(PI);
  34332. // Export.
  34333. // AMD.
  34334. if (true) {
  34335. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  34336. return Decimal;
  34337. }).call(exports, __webpack_require__, exports, module),
  34338. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34339. // Node and other environments that support module.exports.
  34340. } else {}
  34341. })(undefined);
  34342. /***/ }),
  34343. /***/ "./node_modules/jquery/dist/jquery.js":
  34344. /*!********************************************!*\
  34345. !*** ./node_modules/jquery/dist/jquery.js ***!
  34346. \********************************************/
  34347. /*! no static exports found */
  34348. /***/ (function(module, exports, __webpack_require__) {
  34349. "use strict";
  34350. /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  34351. 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; };
  34352. /*!
  34353. * jQuery JavaScript Library v3.3.1
  34354. * https://jquery.com/
  34355. *
  34356. * Includes Sizzle.js
  34357. * https://sizzlejs.com/
  34358. *
  34359. * Copyright JS Foundation and other contributors
  34360. * Released under the MIT license
  34361. * https://jquery.org/license
  34362. *
  34363. * Date: 2018-01-20T17:24Z
  34364. */
  34365. (function (global, factory) {
  34366. "use strict";
  34367. if (( false ? undefined : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
  34368. // For CommonJS and CommonJS-like environments where a proper `window`
  34369. // is present, execute the factory and get jQuery.
  34370. // For environments that do not have a `window` with a `document`
  34371. // (such as Node.js), expose a factory as module.exports.
  34372. // This accentuates the need for the creation of a real `window`.
  34373. // e.g. var jQuery = require("jquery")(window);
  34374. // See ticket #14549 for more info.
  34375. module.exports = global.document ? factory(global, true) : function (w) {
  34376. if (!w.document) {
  34377. throw new Error("jQuery requires a window with a document");
  34378. }
  34379. return factory(w);
  34380. };
  34381. } else {
  34382. factory(global);
  34383. }
  34384. // Pass this if window is not defined yet
  34385. })(typeof window !== "undefined" ? window : undefined, function (window, noGlobal) {
  34386. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  34387. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  34388. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  34389. // enough that all such attempts are guarded in a try block.
  34390. "use strict";
  34391. var arr = [];
  34392. var document = window.document;
  34393. var getProto = Object.getPrototypeOf;
  34394. var _slice = arr.slice;
  34395. var concat = arr.concat;
  34396. var push = arr.push;
  34397. var indexOf = arr.indexOf;
  34398. var class2type = {};
  34399. var toString = class2type.toString;
  34400. var hasOwn = class2type.hasOwnProperty;
  34401. var fnToString = hasOwn.toString;
  34402. var ObjectFunctionString = fnToString.call(Object);
  34403. var support = {};
  34404. var isFunction = function isFunction(obj) {
  34405. // Support: Chrome <=57, Firefox <=52
  34406. // In some browsers, typeof returns "function" for HTML <object> elements
  34407. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  34408. // We don't want to classify *any* DOM node as a function.
  34409. return typeof obj === "function" && typeof obj.nodeType !== "number";
  34410. };
  34411. var isWindow = function isWindow(obj) {
  34412. return obj != null && obj === obj.window;
  34413. };
  34414. var preservedScriptAttributes = {
  34415. type: true,
  34416. src: true,
  34417. noModule: true
  34418. };
  34419. function DOMEval(code, doc, node) {
  34420. doc = doc || document;
  34421. var i,
  34422. script = doc.createElement("script");
  34423. script.text = code;
  34424. if (node) {
  34425. for (i in preservedScriptAttributes) {
  34426. if (node[i]) {
  34427. script[i] = node[i];
  34428. }
  34429. }
  34430. }
  34431. doc.head.appendChild(script).parentNode.removeChild(script);
  34432. }
  34433. function toType(obj) {
  34434. if (obj == null) {
  34435. return obj + "";
  34436. }
  34437. // Support: Android <=2.3 only (functionish RegExp)
  34438. return (typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  34439. }
  34440. /* global Symbol */
  34441. // Defining this global in .eslintrc.json would create a danger of using the global
  34442. // unguarded in another place, it seems safer to define global only for this module
  34443. var version = "3.3.1",
  34444. // Define a local copy of jQuery
  34445. jQuery = function jQuery(selector, context) {
  34446. // The jQuery object is actually just the init constructor 'enhanced'
  34447. // Need init if jQuery is called (just allow error to be thrown if not included)
  34448. return new jQuery.fn.init(selector, context);
  34449. },
  34450. // Support: Android <=4.0 only
  34451. // Make sure we trim BOM and NBSP
  34452. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  34453. jQuery.fn = jQuery.prototype = {
  34454. // The current version of jQuery being used
  34455. jquery: version,
  34456. constructor: jQuery,
  34457. // The default length of a jQuery object is 0
  34458. length: 0,
  34459. toArray: function toArray() {
  34460. return _slice.call(this);
  34461. },
  34462. // Get the Nth element in the matched element set OR
  34463. // Get the whole matched element set as a clean array
  34464. get: function get(num) {
  34465. // Return all the elements in a clean array
  34466. if (num == null) {
  34467. return _slice.call(this);
  34468. }
  34469. // Return just the one element from the set
  34470. return num < 0 ? this[num + this.length] : this[num];
  34471. },
  34472. // Take an array of elements and push it onto the stack
  34473. // (returning the new matched element set)
  34474. pushStack: function pushStack(elems) {
  34475. // Build a new jQuery matched element set
  34476. var ret = jQuery.merge(this.constructor(), elems);
  34477. // Add the old object onto the stack (as a reference)
  34478. ret.prevObject = this;
  34479. // Return the newly-formed element set
  34480. return ret;
  34481. },
  34482. // Execute a callback for every element in the matched set.
  34483. each: function each(callback) {
  34484. return jQuery.each(this, callback);
  34485. },
  34486. map: function map(callback) {
  34487. return this.pushStack(jQuery.map(this, function (elem, i) {
  34488. return callback.call(elem, i, elem);
  34489. }));
  34490. },
  34491. slice: function slice() {
  34492. return this.pushStack(_slice.apply(this, arguments));
  34493. },
  34494. first: function first() {
  34495. return this.eq(0);
  34496. },
  34497. last: function last() {
  34498. return this.eq(-1);
  34499. },
  34500. eq: function eq(i) {
  34501. var len = this.length,
  34502. j = +i + (i < 0 ? len : 0);
  34503. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  34504. },
  34505. end: function end() {
  34506. return this.prevObject || this.constructor();
  34507. },
  34508. // For internal use only.
  34509. // Behaves like an Array's method, not like a jQuery method.
  34510. push: push,
  34511. sort: arr.sort,
  34512. splice: arr.splice
  34513. };
  34514. jQuery.extend = jQuery.fn.extend = function () {
  34515. var options,
  34516. name,
  34517. src,
  34518. copy,
  34519. copyIsArray,
  34520. clone,
  34521. target = arguments[0] || {},
  34522. i = 1,
  34523. length = arguments.length,
  34524. deep = false;
  34525. // Handle a deep copy situation
  34526. if (typeof target === "boolean") {
  34527. deep = target;
  34528. // Skip the boolean and the target
  34529. target = arguments[i] || {};
  34530. i++;
  34531. }
  34532. // Handle case when target is a string or something (possible in deep copy)
  34533. if ((typeof target === "undefined" ? "undefined" : _typeof(target)) !== "object" && !isFunction(target)) {
  34534. target = {};
  34535. }
  34536. // Extend jQuery itself if only one argument is passed
  34537. if (i === length) {
  34538. target = this;
  34539. i--;
  34540. }
  34541. for (; i < length; i++) {
  34542. // Only deal with non-null/undefined values
  34543. if ((options = arguments[i]) != null) {
  34544. // Extend the base object
  34545. for (name in options) {
  34546. src = target[name];
  34547. copy = options[name];
  34548. // Prevent never-ending loop
  34549. if (target === copy) {
  34550. continue;
  34551. }
  34552. // Recurse if we're merging plain objects or arrays
  34553. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
  34554. if (copyIsArray) {
  34555. copyIsArray = false;
  34556. clone = src && Array.isArray(src) ? src : [];
  34557. } else {
  34558. clone = src && jQuery.isPlainObject(src) ? src : {};
  34559. }
  34560. // Never move original objects, clone them
  34561. target[name] = jQuery.extend(deep, clone, copy);
  34562. // Don't bring in undefined values
  34563. } else if (copy !== undefined) {
  34564. target[name] = copy;
  34565. }
  34566. }
  34567. }
  34568. }
  34569. // Return the modified object
  34570. return target;
  34571. };
  34572. jQuery.extend({
  34573. // Unique for each copy of jQuery on the page
  34574. expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
  34575. // Assume jQuery is ready without the ready module
  34576. isReady: true,
  34577. error: function error(msg) {
  34578. throw new Error(msg);
  34579. },
  34580. noop: function noop() {},
  34581. isPlainObject: function isPlainObject(obj) {
  34582. var proto, Ctor;
  34583. // Detect obvious negatives
  34584. // Use toString instead of jQuery.type to catch host objects
  34585. if (!obj || toString.call(obj) !== "[object Object]") {
  34586. return false;
  34587. }
  34588. proto = getProto(obj);
  34589. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  34590. if (!proto) {
  34591. return true;
  34592. }
  34593. // Objects with prototype are plain iff they were constructed by a global Object function
  34594. Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
  34595. return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
  34596. },
  34597. isEmptyObject: function isEmptyObject(obj) {
  34598. /* eslint-disable no-unused-vars */
  34599. // See https://github.com/eslint/eslint/issues/6125
  34600. var name;
  34601. for (name in obj) {
  34602. return false;
  34603. }
  34604. return true;
  34605. },
  34606. // Evaluates a script in a global context
  34607. globalEval: function globalEval(code) {
  34608. DOMEval(code);
  34609. },
  34610. each: function each(obj, callback) {
  34611. var length,
  34612. i = 0;
  34613. if (isArrayLike(obj)) {
  34614. length = obj.length;
  34615. for (; i < length; i++) {
  34616. if (callback.call(obj[i], i, obj[i]) === false) {
  34617. break;
  34618. }
  34619. }
  34620. } else {
  34621. for (i in obj) {
  34622. if (callback.call(obj[i], i, obj[i]) === false) {
  34623. break;
  34624. }
  34625. }
  34626. }
  34627. return obj;
  34628. },
  34629. // Support: Android <=4.0 only
  34630. trim: function trim(text) {
  34631. return text == null ? "" : (text + "").replace(rtrim, "");
  34632. },
  34633. // results is for internal usage only
  34634. makeArray: function makeArray(arr, results) {
  34635. var ret = results || [];
  34636. if (arr != null) {
  34637. if (isArrayLike(Object(arr))) {
  34638. jQuery.merge(ret, typeof arr === "string" ? [arr] : arr);
  34639. } else {
  34640. push.call(ret, arr);
  34641. }
  34642. }
  34643. return ret;
  34644. },
  34645. inArray: function inArray(elem, arr, i) {
  34646. return arr == null ? -1 : indexOf.call(arr, elem, i);
  34647. },
  34648. // Support: Android <=4.0 only, PhantomJS 1 only
  34649. // push.apply(_, arraylike) throws on ancient WebKit
  34650. merge: function merge(first, second) {
  34651. var len = +second.length,
  34652. j = 0,
  34653. i = first.length;
  34654. for (; j < len; j++) {
  34655. first[i++] = second[j];
  34656. }
  34657. first.length = i;
  34658. return first;
  34659. },
  34660. grep: function grep(elems, callback, invert) {
  34661. var callbackInverse,
  34662. matches = [],
  34663. i = 0,
  34664. length = elems.length,
  34665. callbackExpect = !invert;
  34666. // Go through the array, only saving the items
  34667. // that pass the validator function
  34668. for (; i < length; i++) {
  34669. callbackInverse = !callback(elems[i], i);
  34670. if (callbackInverse !== callbackExpect) {
  34671. matches.push(elems[i]);
  34672. }
  34673. }
  34674. return matches;
  34675. },
  34676. // arg is for internal usage only
  34677. map: function map(elems, callback, arg) {
  34678. var length,
  34679. value,
  34680. i = 0,
  34681. ret = [];
  34682. // Go through the array, translating each of the items to their new values
  34683. if (isArrayLike(elems)) {
  34684. length = elems.length;
  34685. for (; i < length; i++) {
  34686. value = callback(elems[i], i, arg);
  34687. if (value != null) {
  34688. ret.push(value);
  34689. }
  34690. }
  34691. // Go through every key on the object,
  34692. } else {
  34693. for (i in elems) {
  34694. value = callback(elems[i], i, arg);
  34695. if (value != null) {
  34696. ret.push(value);
  34697. }
  34698. }
  34699. }
  34700. // Flatten any nested arrays
  34701. return concat.apply([], ret);
  34702. },
  34703. // A global GUID counter for objects
  34704. guid: 1,
  34705. // jQuery.support is not used in Core but other projects attach their
  34706. // properties to it so it needs to exist.
  34707. support: support
  34708. });
  34709. if (typeof Symbol === "function") {
  34710. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  34711. }
  34712. // Populate the class2type map
  34713. jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (i, name) {
  34714. class2type["[object " + name + "]"] = name.toLowerCase();
  34715. });
  34716. function isArrayLike(obj) {
  34717. // Support: real iOS 8.2 only (not reproducible in simulator)
  34718. // `in` check used to prevent JIT error (gh-2145)
  34719. // hasOwn isn't used here due to false negatives
  34720. // regarding Nodelist length in IE
  34721. var length = !!obj && "length" in obj && obj.length,
  34722. type = toType(obj);
  34723. if (isFunction(obj) || isWindow(obj)) {
  34724. return false;
  34725. }
  34726. return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  34727. }
  34728. var Sizzle =
  34729. /*!
  34730. * Sizzle CSS Selector Engine v2.3.3
  34731. * https://sizzlejs.com/
  34732. *
  34733. * Copyright jQuery Foundation and other contributors
  34734. * Released under the MIT license
  34735. * http://jquery.org/license
  34736. *
  34737. * Date: 2016-08-08
  34738. */
  34739. function (window) {
  34740. var i,
  34741. support,
  34742. Expr,
  34743. getText,
  34744. isXML,
  34745. tokenize,
  34746. compile,
  34747. select,
  34748. outermostContext,
  34749. sortInput,
  34750. hasDuplicate,
  34751. // Local document vars
  34752. setDocument,
  34753. document,
  34754. docElem,
  34755. documentIsHTML,
  34756. rbuggyQSA,
  34757. rbuggyMatches,
  34758. matches,
  34759. contains,
  34760. // Instance-specific data
  34761. expando = "sizzle" + 1 * new Date(),
  34762. preferredDoc = window.document,
  34763. dirruns = 0,
  34764. done = 0,
  34765. classCache = createCache(),
  34766. tokenCache = createCache(),
  34767. compilerCache = createCache(),
  34768. sortOrder = function sortOrder(a, b) {
  34769. if (a === b) {
  34770. hasDuplicate = true;
  34771. }
  34772. return 0;
  34773. },
  34774. // Instance methods
  34775. hasOwn = {}.hasOwnProperty,
  34776. arr = [],
  34777. pop = arr.pop,
  34778. push_native = arr.push,
  34779. push = arr.push,
  34780. slice = arr.slice,
  34781. // Use a stripped-down indexOf as it's faster than native
  34782. // https://jsperf.com/thor-indexof-vs-for/5
  34783. indexOf = function indexOf(list, elem) {
  34784. var i = 0,
  34785. len = list.length;
  34786. for (; i < len; i++) {
  34787. if (list[i] === elem) {
  34788. return i;
  34789. }
  34790. }
  34791. return -1;
  34792. },
  34793. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  34794. // Regular expressions
  34795. // http://www.w3.org/TR/css3-selectors/#whitespace
  34796. whitespace = "[\\x20\\t\\r\\n\\f]",
  34797. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  34798. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  34799. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  34800. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  34801. // Operator (capture 2)
  34802. "*([*^$|!~]?=)" + whitespace +
  34803. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  34804. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
  34805. pseudos = ":(" + identifier + ")(?:\\((" +
  34806. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  34807. // 1. quoted (capture 3; capture 4 or capture 5)
  34808. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  34809. // 2. simple (capture 6)
  34810. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  34811. // 3. anything else (capture 2)
  34812. ".*" + ")\\)|)",
  34813. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  34814. rwhitespace = new RegExp(whitespace + "+", "g"),
  34815. rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
  34816. rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
  34817. rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
  34818. rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
  34819. rpseudo = new RegExp(pseudos),
  34820. ridentifier = new RegExp("^" + identifier + "$"),
  34821. matchExpr = {
  34822. "ID": new RegExp("^#(" + identifier + ")"),
  34823. "CLASS": new RegExp("^\\.(" + identifier + ")"),
  34824. "TAG": new RegExp("^(" + identifier + "|[*])"),
  34825. "ATTR": new RegExp("^" + attributes),
  34826. "PSEUDO": new RegExp("^" + pseudos),
  34827. "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
  34828. "bool": new RegExp("^(?:" + booleans + ")$", "i"),
  34829. // For use in libraries implementing .is()
  34830. // We use this for POS matching in `select`
  34831. "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  34832. },
  34833. rinputs = /^(?:input|select|textarea|button)$/i,
  34834. rheader = /^h\d$/i,
  34835. rnative = /^[^{]+\{\s*\[native \w/,
  34836. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  34837. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  34838. rsibling = /[+~]/,
  34839. // CSS escapes
  34840. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  34841. runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
  34842. funescape = function funescape(_, escaped, escapedWhitespace) {
  34843. var high = "0x" + escaped - 0x10000;
  34844. // NaN means non-codepoint
  34845. // Support: Firefox<24
  34846. // Workaround erroneous numeric interpretation of +"0x"
  34847. return high !== high || escapedWhitespace ? escaped : high < 0 ?
  34848. // BMP codepoint
  34849. String.fromCharCode(high + 0x10000) :
  34850. // Supplemental Plane codepoint (surrogate pair)
  34851. String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
  34852. },
  34853. // CSS string/identifier serialization
  34854. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  34855. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  34856. fcssescape = function fcssescape(ch, asCodePoint) {
  34857. if (asCodePoint) {
  34858. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  34859. if (ch === "\0") {
  34860. return "\uFFFD";
  34861. }
  34862. // Control characters and (dependent upon position) numbers get escaped as code points
  34863. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  34864. }
  34865. // Other potentially-special ASCII characters get backslash-escaped
  34866. return "\\" + ch;
  34867. },
  34868. // Used for iframes
  34869. // See setDocument()
  34870. // Removing the function wrapper causes a "Permission Denied"
  34871. // error in IE
  34872. unloadHandler = function unloadHandler() {
  34873. setDocument();
  34874. },
  34875. disabledAncestor = addCombinator(function (elem) {
  34876. return elem.disabled === true && ("form" in elem || "label" in elem);
  34877. }, { dir: "parentNode", next: "legend" });
  34878. // Optimize for push.apply( _, NodeList )
  34879. try {
  34880. push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);
  34881. // Support: Android<4.0
  34882. // Detect silently failing push.apply
  34883. arr[preferredDoc.childNodes.length].nodeType;
  34884. } catch (e) {
  34885. push = { apply: arr.length ?
  34886. // Leverage slice if possible
  34887. function (target, els) {
  34888. push_native.apply(target, slice.call(els));
  34889. } :
  34890. // Support: IE<9
  34891. // Otherwise append directly
  34892. function (target, els) {
  34893. var j = target.length,
  34894. i = 0;
  34895. // Can't trust NodeList.length
  34896. while (target[j++] = els[i++]) {}
  34897. target.length = j - 1;
  34898. }
  34899. };
  34900. }
  34901. function Sizzle(selector, context, results, seed) {
  34902. var m,
  34903. i,
  34904. elem,
  34905. nid,
  34906. match,
  34907. groups,
  34908. newSelector,
  34909. newContext = context && context.ownerDocument,
  34910. // nodeType defaults to 9, since context defaults to document
  34911. nodeType = context ? context.nodeType : 9;
  34912. results = results || [];
  34913. // Return early from calls with invalid selector or context
  34914. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  34915. return results;
  34916. }
  34917. // Try to shortcut find operations (as opposed to filters) in HTML documents
  34918. if (!seed) {
  34919. if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
  34920. setDocument(context);
  34921. }
  34922. context = context || document;
  34923. if (documentIsHTML) {
  34924. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  34925. // (excepting DocumentFragment context, where the methods don't exist)
  34926. if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
  34927. // ID selector
  34928. if (m = match[1]) {
  34929. // Document context
  34930. if (nodeType === 9) {
  34931. if (elem = context.getElementById(m)) {
  34932. // Support: IE, Opera, Webkit
  34933. // TODO: identify versions
  34934. // getElementById can match elements by name instead of ID
  34935. if (elem.id === m) {
  34936. results.push(elem);
  34937. return results;
  34938. }
  34939. } else {
  34940. return results;
  34941. }
  34942. // Element context
  34943. } else {
  34944. // Support: IE, Opera, Webkit
  34945. // TODO: identify versions
  34946. // getElementById can match elements by name instead of ID
  34947. if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {
  34948. results.push(elem);
  34949. return results;
  34950. }
  34951. }
  34952. // Type selector
  34953. } else if (match[2]) {
  34954. push.apply(results, context.getElementsByTagName(selector));
  34955. return results;
  34956. // Class selector
  34957. } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {
  34958. push.apply(results, context.getElementsByClassName(m));
  34959. return results;
  34960. }
  34961. }
  34962. // Take advantage of querySelectorAll
  34963. if (support.qsa && !compilerCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  34964. if (nodeType !== 1) {
  34965. newContext = context;
  34966. newSelector = selector;
  34967. // qSA looks outside Element context, which is not what we want
  34968. // Thanks to Andrew Dupont for this workaround technique
  34969. // Support: IE <=8
  34970. // Exclude object elements
  34971. } else if (context.nodeName.toLowerCase() !== "object") {
  34972. // Capture the context ID, setting it first if necessary
  34973. if (nid = context.getAttribute("id")) {
  34974. nid = nid.replace(rcssescape, fcssescape);
  34975. } else {
  34976. context.setAttribute("id", nid = expando);
  34977. }
  34978. // Prefix every selector in the list
  34979. groups = tokenize(selector);
  34980. i = groups.length;
  34981. while (i--) {
  34982. groups[i] = "#" + nid + " " + toSelector(groups[i]);
  34983. }
  34984. newSelector = groups.join(",");
  34985. // Expand context for sibling selectors
  34986. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  34987. }
  34988. if (newSelector) {
  34989. try {
  34990. push.apply(results, newContext.querySelectorAll(newSelector));
  34991. return results;
  34992. } catch (qsaError) {} finally {
  34993. if (nid === expando) {
  34994. context.removeAttribute("id");
  34995. }
  34996. }
  34997. }
  34998. }
  34999. }
  35000. }
  35001. // All others
  35002. return select(selector.replace(rtrim, "$1"), context, results, seed);
  35003. }
  35004. /**
  35005. * Create key-value caches of limited size
  35006. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  35007. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  35008. * deleting the oldest entry
  35009. */
  35010. function createCache() {
  35011. var keys = [];
  35012. function cache(key, value) {
  35013. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  35014. if (keys.push(key + " ") > Expr.cacheLength) {
  35015. // Only keep the most recent entries
  35016. delete cache[keys.shift()];
  35017. }
  35018. return cache[key + " "] = value;
  35019. }
  35020. return cache;
  35021. }
  35022. /**
  35023. * Mark a function for special use by Sizzle
  35024. * @param {Function} fn The function to mark
  35025. */
  35026. function markFunction(fn) {
  35027. fn[expando] = true;
  35028. return fn;
  35029. }
  35030. /**
  35031. * Support testing using an element
  35032. * @param {Function} fn Passed the created element and returns a boolean result
  35033. */
  35034. function assert(fn) {
  35035. var el = document.createElement("fieldset");
  35036. try {
  35037. return !!fn(el);
  35038. } catch (e) {
  35039. return false;
  35040. } finally {
  35041. // Remove from its parent by default
  35042. if (el.parentNode) {
  35043. el.parentNode.removeChild(el);
  35044. }
  35045. // release memory in IE
  35046. el = null;
  35047. }
  35048. }
  35049. /**
  35050. * Adds the same handler for all of the specified attrs
  35051. * @param {String} attrs Pipe-separated list of attributes
  35052. * @param {Function} handler The method that will be applied
  35053. */
  35054. function addHandle(attrs, handler) {
  35055. var arr = attrs.split("|"),
  35056. i = arr.length;
  35057. while (i--) {
  35058. Expr.attrHandle[arr[i]] = handler;
  35059. }
  35060. }
  35061. /**
  35062. * Checks document order of two siblings
  35063. * @param {Element} a
  35064. * @param {Element} b
  35065. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  35066. */
  35067. function siblingCheck(a, b) {
  35068. var cur = b && a,
  35069. diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex;
  35070. // Use IE sourceIndex if available on both nodes
  35071. if (diff) {
  35072. return diff;
  35073. }
  35074. // Check if b follows a
  35075. if (cur) {
  35076. while (cur = cur.nextSibling) {
  35077. if (cur === b) {
  35078. return -1;
  35079. }
  35080. }
  35081. }
  35082. return a ? 1 : -1;
  35083. }
  35084. /**
  35085. * Returns a function to use in pseudos for input types
  35086. * @param {String} type
  35087. */
  35088. function createInputPseudo(type) {
  35089. return function (elem) {
  35090. var name = elem.nodeName.toLowerCase();
  35091. return name === "input" && elem.type === type;
  35092. };
  35093. }
  35094. /**
  35095. * Returns a function to use in pseudos for buttons
  35096. * @param {String} type
  35097. */
  35098. function createButtonPseudo(type) {
  35099. return function (elem) {
  35100. var name = elem.nodeName.toLowerCase();
  35101. return (name === "input" || name === "button") && elem.type === type;
  35102. };
  35103. }
  35104. /**
  35105. * Returns a function to use in pseudos for :enabled/:disabled
  35106. * @param {Boolean} disabled true for :disabled; false for :enabled
  35107. */
  35108. function createDisabledPseudo(disabled) {
  35109. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  35110. return function (elem) {
  35111. // Only certain elements can match :enabled or :disabled
  35112. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  35113. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  35114. if ("form" in elem) {
  35115. // Check for inherited disabledness on relevant non-disabled elements:
  35116. // * listed form-associated elements in a disabled fieldset
  35117. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  35118. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  35119. // * option elements in a disabled optgroup
  35120. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  35121. // All such elements have a "form" property.
  35122. if (elem.parentNode && elem.disabled === false) {
  35123. // Option elements defer to a parent optgroup if present
  35124. if ("label" in elem) {
  35125. if ("label" in elem.parentNode) {
  35126. return elem.parentNode.disabled === disabled;
  35127. } else {
  35128. return elem.disabled === disabled;
  35129. }
  35130. }
  35131. // Support: IE 6 - 11
  35132. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  35133. return elem.isDisabled === disabled ||
  35134. // Where there is no isDisabled, check manually
  35135. /* jshint -W018 */
  35136. elem.isDisabled !== !disabled && disabledAncestor(elem) === disabled;
  35137. }
  35138. return elem.disabled === disabled;
  35139. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  35140. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  35141. // even exist on them, let alone have a boolean value.
  35142. } else if ("label" in elem) {
  35143. return elem.disabled === disabled;
  35144. }
  35145. // Remaining elements are neither :enabled nor :disabled
  35146. return false;
  35147. };
  35148. }
  35149. /**
  35150. * Returns a function to use in pseudos for positionals
  35151. * @param {Function} fn
  35152. */
  35153. function createPositionalPseudo(fn) {
  35154. return markFunction(function (argument) {
  35155. argument = +argument;
  35156. return markFunction(function (seed, matches) {
  35157. var j,
  35158. matchIndexes = fn([], seed.length, argument),
  35159. i = matchIndexes.length;
  35160. // Match elements found at the specified indexes
  35161. while (i--) {
  35162. if (seed[j = matchIndexes[i]]) {
  35163. seed[j] = !(matches[j] = seed[j]);
  35164. }
  35165. }
  35166. });
  35167. });
  35168. }
  35169. /**
  35170. * Checks a node for validity as a Sizzle context
  35171. * @param {Element|Object=} context
  35172. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  35173. */
  35174. function testContext(context) {
  35175. return context && typeof context.getElementsByTagName !== "undefined" && context;
  35176. }
  35177. // Expose support vars for convenience
  35178. support = Sizzle.support = {};
  35179. /**
  35180. * Detects XML nodes
  35181. * @param {Element|Object} elem An element or a document
  35182. * @returns {Boolean} True iff elem is a non-HTML XML node
  35183. */
  35184. isXML = Sizzle.isXML = function (elem) {
  35185. // documentElement is verified for cases where it doesn't yet exist
  35186. // (such as loading iframes in IE - #4833)
  35187. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  35188. return documentElement ? documentElement.nodeName !== "HTML" : false;
  35189. };
  35190. /**
  35191. * Sets document-related variables once based on the current document
  35192. * @param {Element|Object} [doc] An element or document object to use to set the document
  35193. * @returns {Object} Returns the current document
  35194. */
  35195. setDocument = Sizzle.setDocument = function (node) {
  35196. var hasCompare,
  35197. subWindow,
  35198. doc = node ? node.ownerDocument || node : preferredDoc;
  35199. // Return early if doc is invalid or already selected
  35200. if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
  35201. return document;
  35202. }
  35203. // Update global variables
  35204. document = doc;
  35205. docElem = document.documentElement;
  35206. documentIsHTML = !isXML(document);
  35207. // Support: IE 9-11, Edge
  35208. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  35209. if (preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {
  35210. // Support: IE 11, Edge
  35211. if (subWindow.addEventListener) {
  35212. subWindow.addEventListener("unload", unloadHandler, false);
  35213. // Support: IE 9 - 10 only
  35214. } else if (subWindow.attachEvent) {
  35215. subWindow.attachEvent("onunload", unloadHandler);
  35216. }
  35217. }
  35218. /* Attributes
  35219. ---------------------------------------------------------------------- */
  35220. // Support: IE<8
  35221. // Verify that getAttribute really returns attributes and not properties
  35222. // (excepting IE8 booleans)
  35223. support.attributes = assert(function (el) {
  35224. el.className = "i";
  35225. return !el.getAttribute("className");
  35226. });
  35227. /* getElement(s)By*
  35228. ---------------------------------------------------------------------- */
  35229. // Check if getElementsByTagName("*") returns only elements
  35230. support.getElementsByTagName = assert(function (el) {
  35231. el.appendChild(document.createComment(""));
  35232. return !el.getElementsByTagName("*").length;
  35233. });
  35234. // Support: IE<9
  35235. support.getElementsByClassName = rnative.test(document.getElementsByClassName);
  35236. // Support: IE<10
  35237. // Check if getElementById returns elements by name
  35238. // The broken getElementById methods don't pick up programmatically-set names,
  35239. // so use a roundabout getElementsByName test
  35240. support.getById = assert(function (el) {
  35241. docElem.appendChild(el).id = expando;
  35242. return !document.getElementsByName || !document.getElementsByName(expando).length;
  35243. });
  35244. // ID filter and find
  35245. if (support.getById) {
  35246. Expr.filter["ID"] = function (id) {
  35247. var attrId = id.replace(runescape, funescape);
  35248. return function (elem) {
  35249. return elem.getAttribute("id") === attrId;
  35250. };
  35251. };
  35252. Expr.find["ID"] = function (id, context) {
  35253. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  35254. var elem = context.getElementById(id);
  35255. return elem ? [elem] : [];
  35256. }
  35257. };
  35258. } else {
  35259. Expr.filter["ID"] = function (id) {
  35260. var attrId = id.replace(runescape, funescape);
  35261. return function (elem) {
  35262. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  35263. return node && node.value === attrId;
  35264. };
  35265. };
  35266. // Support: IE 6 - 7 only
  35267. // getElementById is not reliable as a find shortcut
  35268. Expr.find["ID"] = function (id, context) {
  35269. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  35270. var node,
  35271. i,
  35272. elems,
  35273. elem = context.getElementById(id);
  35274. if (elem) {
  35275. // Verify the id attribute
  35276. node = elem.getAttributeNode("id");
  35277. if (node && node.value === id) {
  35278. return [elem];
  35279. }
  35280. // Fall back on getElementsByName
  35281. elems = context.getElementsByName(id);
  35282. i = 0;
  35283. while (elem = elems[i++]) {
  35284. node = elem.getAttributeNode("id");
  35285. if (node && node.value === id) {
  35286. return [elem];
  35287. }
  35288. }
  35289. }
  35290. return [];
  35291. }
  35292. };
  35293. }
  35294. // Tag
  35295. Expr.find["TAG"] = support.getElementsByTagName ? function (tag, context) {
  35296. if (typeof context.getElementsByTagName !== "undefined") {
  35297. return context.getElementsByTagName(tag);
  35298. // DocumentFragment nodes don't have gEBTN
  35299. } else if (support.qsa) {
  35300. return context.querySelectorAll(tag);
  35301. }
  35302. } : function (tag, context) {
  35303. var elem,
  35304. tmp = [],
  35305. i = 0,
  35306. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  35307. results = context.getElementsByTagName(tag);
  35308. // Filter out possible comments
  35309. if (tag === "*") {
  35310. while (elem = results[i++]) {
  35311. if (elem.nodeType === 1) {
  35312. tmp.push(elem);
  35313. }
  35314. }
  35315. return tmp;
  35316. }
  35317. return results;
  35318. };
  35319. // Class
  35320. Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
  35321. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  35322. return context.getElementsByClassName(className);
  35323. }
  35324. };
  35325. /* QSA/matchesSelector
  35326. ---------------------------------------------------------------------- */
  35327. // QSA and matchesSelector support
  35328. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  35329. rbuggyMatches = [];
  35330. // qSa(:focus) reports false when true (Chrome 21)
  35331. // We allow this because of a bug in IE8/9 that throws an error
  35332. // whenever `document.activeElement` is accessed on an iframe
  35333. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  35334. // See https://bugs.jquery.com/ticket/13378
  35335. rbuggyQSA = [];
  35336. if (support.qsa = rnative.test(document.querySelectorAll)) {
  35337. // Build QSA regex
  35338. // Regex strategy adopted from Diego Perini
  35339. assert(function (el) {
  35340. // Select is set to empty string on purpose
  35341. // This is to test IE's treatment of not explicitly
  35342. // setting a boolean content attribute,
  35343. // since its presence should be enough
  35344. // https://bugs.jquery.com/ticket/12359
  35345. docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>";
  35346. // Support: IE8, Opera 11-12.16
  35347. // Nothing should be selected when empty strings follow ^= or $= or *=
  35348. // The test attribute must be unknown in Opera but "safe" for WinRT
  35349. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  35350. if (el.querySelectorAll("[msallowcapture^='']").length) {
  35351. rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
  35352. }
  35353. // Support: IE8
  35354. // Boolean attributes and "value" are not treated correctly
  35355. if (!el.querySelectorAll("[selected]").length) {
  35356. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  35357. }
  35358. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  35359. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  35360. rbuggyQSA.push("~=");
  35361. }
  35362. // Webkit/Opera - :checked should return selected option elements
  35363. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  35364. // IE8 throws error here and will not see later tests
  35365. if (!el.querySelectorAll(":checked").length) {
  35366. rbuggyQSA.push(":checked");
  35367. }
  35368. // Support: Safari 8+, iOS 8+
  35369. // https://bugs.webkit.org/show_bug.cgi?id=136851
  35370. // In-page `selector#id sibling-combinator selector` fails
  35371. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  35372. rbuggyQSA.push(".#.+[+~]");
  35373. }
  35374. });
  35375. assert(function (el) {
  35376. el.innerHTML = "<a href='' disabled='disabled'></a>" + "<select disabled='disabled'><option/></select>";
  35377. // Support: Windows 8 Native Apps
  35378. // The type and name attributes are restricted during .innerHTML assignment
  35379. var input = document.createElement("input");
  35380. input.setAttribute("type", "hidden");
  35381. el.appendChild(input).setAttribute("name", "D");
  35382. // Support: IE8
  35383. // Enforce case-sensitivity of name attribute
  35384. if (el.querySelectorAll("[name=d]").length) {
  35385. rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
  35386. }
  35387. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  35388. // IE8 throws error here and will not see later tests
  35389. if (el.querySelectorAll(":enabled").length !== 2) {
  35390. rbuggyQSA.push(":enabled", ":disabled");
  35391. }
  35392. // Support: IE9-11+
  35393. // IE's :disabled selector does not pick up the children of disabled fieldsets
  35394. docElem.appendChild(el).disabled = true;
  35395. if (el.querySelectorAll(":disabled").length !== 2) {
  35396. rbuggyQSA.push(":enabled", ":disabled");
  35397. }
  35398. // Opera 10-11 does not throw on post-comma invalid pseudos
  35399. el.querySelectorAll("*,:x");
  35400. rbuggyQSA.push(",.*:");
  35401. });
  35402. }
  35403. if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) {
  35404. assert(function (el) {
  35405. // Check to see if it's possible to do matchesSelector
  35406. // on a disconnected node (IE 9)
  35407. support.disconnectedMatch = matches.call(el, "*");
  35408. // This should fail with an exception
  35409. // Gecko does not error, returns false instead
  35410. matches.call(el, "[s!='']:x");
  35411. rbuggyMatches.push("!=", pseudos);
  35412. });
  35413. }
  35414. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  35415. rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
  35416. /* Contains
  35417. ---------------------------------------------------------------------- */
  35418. hasCompare = rnative.test(docElem.compareDocumentPosition);
  35419. // Element contains another
  35420. // Purposefully self-exclusive
  35421. // As in, an element does not contain itself
  35422. contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {
  35423. var adown = a.nodeType === 9 ? a.documentElement : a,
  35424. bup = b && b.parentNode;
  35425. return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  35426. } : function (a, b) {
  35427. if (b) {
  35428. while (b = b.parentNode) {
  35429. if (b === a) {
  35430. return true;
  35431. }
  35432. }
  35433. }
  35434. return false;
  35435. };
  35436. /* Sorting
  35437. ---------------------------------------------------------------------- */
  35438. // Document order sorting
  35439. sortOrder = hasCompare ? function (a, b) {
  35440. // Flag for duplicate removal
  35441. if (a === b) {
  35442. hasDuplicate = true;
  35443. return 0;
  35444. }
  35445. // Sort on method existence if only one input has compareDocumentPosition
  35446. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  35447. if (compare) {
  35448. return compare;
  35449. }
  35450. // Calculate position if both inputs belong to the same document
  35451. compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) :
  35452. // Otherwise we know they are disconnected
  35453. 1;
  35454. // Disconnected nodes
  35455. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  35456. // Choose the first element that is related to our preferred document
  35457. if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
  35458. return -1;
  35459. }
  35460. if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
  35461. return 1;
  35462. }
  35463. // Maintain original order
  35464. return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  35465. }
  35466. return compare & 4 ? -1 : 1;
  35467. } : function (a, b) {
  35468. // Exit early if the nodes are identical
  35469. if (a === b) {
  35470. hasDuplicate = true;
  35471. return 0;
  35472. }
  35473. var cur,
  35474. i = 0,
  35475. aup = a.parentNode,
  35476. bup = b.parentNode,
  35477. ap = [a],
  35478. bp = [b];
  35479. // Parentless nodes are either documents or disconnected
  35480. if (!aup || !bup) {
  35481. return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  35482. // If the nodes are siblings, we can do a quick check
  35483. } else if (aup === bup) {
  35484. return siblingCheck(a, b);
  35485. }
  35486. // Otherwise we need full lists of their ancestors for comparison
  35487. cur = a;
  35488. while (cur = cur.parentNode) {
  35489. ap.unshift(cur);
  35490. }
  35491. cur = b;
  35492. while (cur = cur.parentNode) {
  35493. bp.unshift(cur);
  35494. }
  35495. // Walk down the tree looking for a discrepancy
  35496. while (ap[i] === bp[i]) {
  35497. i++;
  35498. }
  35499. return i ?
  35500. // Do a sibling check if the nodes have a common ancestor
  35501. siblingCheck(ap[i], bp[i]) :
  35502. // Otherwise nodes in our document sort first
  35503. ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
  35504. };
  35505. return document;
  35506. };
  35507. Sizzle.matches = function (expr, elements) {
  35508. return Sizzle(expr, null, null, elements);
  35509. };
  35510. Sizzle.matchesSelector = function (elem, expr) {
  35511. // Set document vars if needed
  35512. if ((elem.ownerDocument || elem) !== document) {
  35513. setDocument(elem);
  35514. }
  35515. // Make sure that attribute selectors are quoted
  35516. expr = expr.replace(rattributeQuotes, "='$1']");
  35517. if (support.matchesSelector && documentIsHTML && !compilerCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  35518. try {
  35519. var ret = matches.call(elem, expr);
  35520. // IE 9's matchesSelector returns false on disconnected nodes
  35521. if (ret || support.disconnectedMatch ||
  35522. // As well, disconnected nodes are said to be in a document
  35523. // fragment in IE 9
  35524. elem.document && elem.document.nodeType !== 11) {
  35525. return ret;
  35526. }
  35527. } catch (e) {}
  35528. }
  35529. return Sizzle(expr, document, null, [elem]).length > 0;
  35530. };
  35531. Sizzle.contains = function (context, elem) {
  35532. // Set document vars if needed
  35533. if ((context.ownerDocument || context) !== document) {
  35534. setDocument(context);
  35535. }
  35536. return contains(context, elem);
  35537. };
  35538. Sizzle.attr = function (elem, name) {
  35539. // Set document vars if needed
  35540. if ((elem.ownerDocument || elem) !== document) {
  35541. setDocument(elem);
  35542. }
  35543. var fn = Expr.attrHandle[name.toLowerCase()],
  35544. // Don't get fooled by Object.prototype properties (jQuery #13807)
  35545. val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
  35546. return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  35547. };
  35548. Sizzle.escape = function (sel) {
  35549. return (sel + "").replace(rcssescape, fcssescape);
  35550. };
  35551. Sizzle.error = function (msg) {
  35552. throw new Error("Syntax error, unrecognized expression: " + msg);
  35553. };
  35554. /**
  35555. * Document sorting and removing duplicates
  35556. * @param {ArrayLike} results
  35557. */
  35558. Sizzle.uniqueSort = function (results) {
  35559. var elem,
  35560. duplicates = [],
  35561. j = 0,
  35562. i = 0;
  35563. // Unless we *know* we can detect duplicates, assume their presence
  35564. hasDuplicate = !support.detectDuplicates;
  35565. sortInput = !support.sortStable && results.slice(0);
  35566. results.sort(sortOrder);
  35567. if (hasDuplicate) {
  35568. while (elem = results[i++]) {
  35569. if (elem === results[i]) {
  35570. j = duplicates.push(i);
  35571. }
  35572. }
  35573. while (j--) {
  35574. results.splice(duplicates[j], 1);
  35575. }
  35576. }
  35577. // Clear input after sorting to release objects
  35578. // See https://github.com/jquery/sizzle/pull/225
  35579. sortInput = null;
  35580. return results;
  35581. };
  35582. /**
  35583. * Utility function for retrieving the text value of an array of DOM nodes
  35584. * @param {Array|Element} elem
  35585. */
  35586. getText = Sizzle.getText = function (elem) {
  35587. var node,
  35588. ret = "",
  35589. i = 0,
  35590. nodeType = elem.nodeType;
  35591. if (!nodeType) {
  35592. // If no nodeType, this is expected to be an array
  35593. while (node = elem[i++]) {
  35594. // Do not traverse comment nodes
  35595. ret += getText(node);
  35596. }
  35597. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  35598. // Use textContent for elements
  35599. // innerText usage removed for consistency of new lines (jQuery #11153)
  35600. if (typeof elem.textContent === "string") {
  35601. return elem.textContent;
  35602. } else {
  35603. // Traverse its children
  35604. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  35605. ret += getText(elem);
  35606. }
  35607. }
  35608. } else if (nodeType === 3 || nodeType === 4) {
  35609. return elem.nodeValue;
  35610. }
  35611. // Do not include comment or processing instruction nodes
  35612. return ret;
  35613. };
  35614. Expr = Sizzle.selectors = {
  35615. // Can be adjusted by the user
  35616. cacheLength: 50,
  35617. createPseudo: markFunction,
  35618. match: matchExpr,
  35619. attrHandle: {},
  35620. find: {},
  35621. relative: {
  35622. ">": { dir: "parentNode", first: true },
  35623. " ": { dir: "parentNode" },
  35624. "+": { dir: "previousSibling", first: true },
  35625. "~": { dir: "previousSibling" }
  35626. },
  35627. preFilter: {
  35628. "ATTR": function ATTR(match) {
  35629. match[1] = match[1].replace(runescape, funescape);
  35630. // Move the given value to match[3] whether quoted or unquoted
  35631. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  35632. if (match[2] === "~=") {
  35633. match[3] = " " + match[3] + " ";
  35634. }
  35635. return match.slice(0, 4);
  35636. },
  35637. "CHILD": function CHILD(match) {
  35638. /* matches from matchExpr["CHILD"]
  35639. 1 type (only|nth|...)
  35640. 2 what (child|of-type)
  35641. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  35642. 4 xn-component of xn+y argument ([+-]?\d*n|)
  35643. 5 sign of xn-component
  35644. 6 x of xn-component
  35645. 7 sign of y-component
  35646. 8 y of y-component
  35647. */
  35648. match[1] = match[1].toLowerCase();
  35649. if (match[1].slice(0, 3) === "nth") {
  35650. // nth-* requires argument
  35651. if (!match[3]) {
  35652. Sizzle.error(match[0]);
  35653. }
  35654. // numeric x and y parameters for Expr.filter.CHILD
  35655. // remember that false/true cast respectively to 0/1
  35656. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  35657. match[5] = +(match[7] + match[8] || match[3] === "odd");
  35658. // other types prohibit arguments
  35659. } else if (match[3]) {
  35660. Sizzle.error(match[0]);
  35661. }
  35662. return match;
  35663. },
  35664. "PSEUDO": function PSEUDO(match) {
  35665. var excess,
  35666. unquoted = !match[6] && match[2];
  35667. if (matchExpr["CHILD"].test(match[0])) {
  35668. return null;
  35669. }
  35670. // Accept quoted arguments as-is
  35671. if (match[3]) {
  35672. match[2] = match[4] || match[5] || "";
  35673. // Strip excess characters from unquoted arguments
  35674. } else if (unquoted && rpseudo.test(unquoted) && (
  35675. // Get excess from tokenize (recursively)
  35676. excess = tokenize(unquoted, true)) && (
  35677. // advance to the next closing parenthesis
  35678. excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  35679. // excess is a negative index
  35680. match[0] = match[0].slice(0, excess);
  35681. match[2] = unquoted.slice(0, excess);
  35682. }
  35683. // Return only captures needed by the pseudo filter method (type and argument)
  35684. return match.slice(0, 3);
  35685. }
  35686. },
  35687. filter: {
  35688. "TAG": function TAG(nodeNameSelector) {
  35689. var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  35690. return nodeNameSelector === "*" ? function () {
  35691. return true;
  35692. } : function (elem) {
  35693. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  35694. };
  35695. },
  35696. "CLASS": function CLASS(className) {
  35697. var pattern = classCache[className + " "];
  35698. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) {
  35699. return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
  35700. });
  35701. },
  35702. "ATTR": function ATTR(name, operator, check) {
  35703. return function (elem) {
  35704. var result = Sizzle.attr(elem, name);
  35705. if (result == null) {
  35706. return operator === "!=";
  35707. }
  35708. if (!operator) {
  35709. return true;
  35710. }
  35711. result += "";
  35712. 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;
  35713. };
  35714. },
  35715. "CHILD": function CHILD(type, what, argument, first, last) {
  35716. var simple = type.slice(0, 3) !== "nth",
  35717. forward = type.slice(-4) !== "last",
  35718. ofType = what === "of-type";
  35719. return first === 1 && last === 0 ?
  35720. // Shortcut for :nth-*(n)
  35721. function (elem) {
  35722. return !!elem.parentNode;
  35723. } : function (elem, context, xml) {
  35724. var cache,
  35725. uniqueCache,
  35726. outerCache,
  35727. node,
  35728. nodeIndex,
  35729. start,
  35730. dir = simple !== forward ? "nextSibling" : "previousSibling",
  35731. parent = elem.parentNode,
  35732. name = ofType && elem.nodeName.toLowerCase(),
  35733. useCache = !xml && !ofType,
  35734. diff = false;
  35735. if (parent) {
  35736. // :(first|last|only)-(child|of-type)
  35737. if (simple) {
  35738. while (dir) {
  35739. node = elem;
  35740. while (node = node[dir]) {
  35741. if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
  35742. return false;
  35743. }
  35744. }
  35745. // Reverse direction for :only-* (if we haven't yet done so)
  35746. start = dir = type === "only" && !start && "nextSibling";
  35747. }
  35748. return true;
  35749. }
  35750. start = [forward ? parent.firstChild : parent.lastChild];
  35751. // non-xml :nth-child(...) stores cache data on `parent`
  35752. if (forward && useCache) {
  35753. // Seek `elem` from a previously-cached index
  35754. // ...in a gzip-friendly way
  35755. node = parent;
  35756. outerCache = node[expando] || (node[expando] = {});
  35757. // Support: IE <9 only
  35758. // Defend against cloned attroperties (jQuery gh-1709)
  35759. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  35760. cache = uniqueCache[type] || [];
  35761. nodeIndex = cache[0] === dirruns && cache[1];
  35762. diff = nodeIndex && cache[2];
  35763. node = nodeIndex && parent.childNodes[nodeIndex];
  35764. while (node = ++nodeIndex && node && node[dir] || (
  35765. // Fallback to seeking `elem` from the start
  35766. diff = nodeIndex = 0) || start.pop()) {
  35767. // When found, cache indexes on `parent` and break
  35768. if (node.nodeType === 1 && ++diff && node === elem) {
  35769. uniqueCache[type] = [dirruns, nodeIndex, diff];
  35770. break;
  35771. }
  35772. }
  35773. } else {
  35774. // Use previously-cached element index if available
  35775. if (useCache) {
  35776. // ...in a gzip-friendly way
  35777. node = elem;
  35778. outerCache = node[expando] || (node[expando] = {});
  35779. // Support: IE <9 only
  35780. // Defend against cloned attroperties (jQuery gh-1709)
  35781. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  35782. cache = uniqueCache[type] || [];
  35783. nodeIndex = cache[0] === dirruns && cache[1];
  35784. diff = nodeIndex;
  35785. }
  35786. // xml :nth-child(...)
  35787. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  35788. if (diff === false) {
  35789. // Use the same loop as above to seek `elem` from the start
  35790. while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
  35791. if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
  35792. // Cache the index of each encountered element
  35793. if (useCache) {
  35794. outerCache = node[expando] || (node[expando] = {});
  35795. // Support: IE <9 only
  35796. // Defend against cloned attroperties (jQuery gh-1709)
  35797. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  35798. uniqueCache[type] = [dirruns, diff];
  35799. }
  35800. if (node === elem) {
  35801. break;
  35802. }
  35803. }
  35804. }
  35805. }
  35806. }
  35807. // Incorporate the offset, then check against cycle size
  35808. diff -= last;
  35809. return diff === first || diff % first === 0 && diff / first >= 0;
  35810. }
  35811. };
  35812. },
  35813. "PSEUDO": function PSEUDO(pseudo, argument) {
  35814. // pseudo-class names are case-insensitive
  35815. // http://www.w3.org/TR/selectors/#pseudo-classes
  35816. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  35817. // Remember that setFilters inherits from pseudos
  35818. var args,
  35819. fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
  35820. // The user may use createPseudo to indicate that
  35821. // arguments are needed to create the filter function
  35822. // just as Sizzle does
  35823. if (fn[expando]) {
  35824. return fn(argument);
  35825. }
  35826. // But maintain support for old signatures
  35827. if (fn.length > 1) {
  35828. args = [pseudo, pseudo, "", argument];
  35829. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
  35830. var idx,
  35831. matched = fn(seed, argument),
  35832. i = matched.length;
  35833. while (i--) {
  35834. idx = indexOf(seed, matched[i]);
  35835. seed[idx] = !(matches[idx] = matched[i]);
  35836. }
  35837. }) : function (elem) {
  35838. return fn(elem, 0, args);
  35839. };
  35840. }
  35841. return fn;
  35842. }
  35843. },
  35844. pseudos: {
  35845. // Potentially complex pseudos
  35846. "not": markFunction(function (selector) {
  35847. // Trim the selector passed to compile
  35848. // to avoid treating leading and trailing
  35849. // spaces as combinators
  35850. var input = [],
  35851. results = [],
  35852. matcher = compile(selector.replace(rtrim, "$1"));
  35853. return matcher[expando] ? markFunction(function (seed, matches, context, xml) {
  35854. var elem,
  35855. unmatched = matcher(seed, null, xml, []),
  35856. i = seed.length;
  35857. // Match elements unmatched by `matcher`
  35858. while (i--) {
  35859. if (elem = unmatched[i]) {
  35860. seed[i] = !(matches[i] = elem);
  35861. }
  35862. }
  35863. }) : function (elem, context, xml) {
  35864. input[0] = elem;
  35865. matcher(input, null, xml, results);
  35866. // Don't keep the element (issue #299)
  35867. input[0] = null;
  35868. return !results.pop();
  35869. };
  35870. }),
  35871. "has": markFunction(function (selector) {
  35872. return function (elem) {
  35873. return Sizzle(selector, elem).length > 0;
  35874. };
  35875. }),
  35876. "contains": markFunction(function (text) {
  35877. text = text.replace(runescape, funescape);
  35878. return function (elem) {
  35879. return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
  35880. };
  35881. }),
  35882. // "Whether an element is represented by a :lang() selector
  35883. // is based solely on the element's language value
  35884. // being equal to the identifier C,
  35885. // or beginning with the identifier C immediately followed by "-".
  35886. // The matching of C against the element's language value is performed case-insensitively.
  35887. // The identifier C does not have to be a valid language name."
  35888. // http://www.w3.org/TR/selectors/#lang-pseudo
  35889. "lang": markFunction(function (lang) {
  35890. // lang value must be a valid identifier
  35891. if (!ridentifier.test(lang || "")) {
  35892. Sizzle.error("unsupported lang: " + lang);
  35893. }
  35894. lang = lang.replace(runescape, funescape).toLowerCase();
  35895. return function (elem) {
  35896. var elemLang;
  35897. do {
  35898. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
  35899. elemLang = elemLang.toLowerCase();
  35900. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  35901. }
  35902. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  35903. return false;
  35904. };
  35905. }),
  35906. // Miscellaneous
  35907. "target": function target(elem) {
  35908. var hash = window.location && window.location.hash;
  35909. return hash && hash.slice(1) === elem.id;
  35910. },
  35911. "root": function root(elem) {
  35912. return elem === docElem;
  35913. },
  35914. "focus": function focus(elem) {
  35915. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  35916. },
  35917. // Boolean properties
  35918. "enabled": createDisabledPseudo(false),
  35919. "disabled": createDisabledPseudo(true),
  35920. "checked": function checked(elem) {
  35921. // In CSS3, :checked should return both checked and selected elements
  35922. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  35923. var nodeName = elem.nodeName.toLowerCase();
  35924. return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected;
  35925. },
  35926. "selected": function selected(elem) {
  35927. // Accessing this property makes selected-by-default
  35928. // options in Safari work properly
  35929. if (elem.parentNode) {
  35930. elem.parentNode.selectedIndex;
  35931. }
  35932. return elem.selected === true;
  35933. },
  35934. // Contents
  35935. "empty": function empty(elem) {
  35936. // http://www.w3.org/TR/selectors/#empty-pseudo
  35937. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  35938. // but not by others (comment: 8; processing instruction: 7; etc.)
  35939. // nodeType < 6 works because attributes (2) do not appear as children
  35940. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  35941. if (elem.nodeType < 6) {
  35942. return false;
  35943. }
  35944. }
  35945. return true;
  35946. },
  35947. "parent": function parent(elem) {
  35948. return !Expr.pseudos["empty"](elem);
  35949. },
  35950. // Element/input types
  35951. "header": function header(elem) {
  35952. return rheader.test(elem.nodeName);
  35953. },
  35954. "input": function input(elem) {
  35955. return rinputs.test(elem.nodeName);
  35956. },
  35957. "button": function button(elem) {
  35958. var name = elem.nodeName.toLowerCase();
  35959. return name === "input" && elem.type === "button" || name === "button";
  35960. },
  35961. "text": function text(elem) {
  35962. var attr;
  35963. return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && (
  35964. // Support: IE<8
  35965. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  35966. (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  35967. },
  35968. // Position-in-collection
  35969. "first": createPositionalPseudo(function () {
  35970. return [0];
  35971. }),
  35972. "last": createPositionalPseudo(function (matchIndexes, length) {
  35973. return [length - 1];
  35974. }),
  35975. "eq": createPositionalPseudo(function (matchIndexes, length, argument) {
  35976. return [argument < 0 ? argument + length : argument];
  35977. }),
  35978. "even": createPositionalPseudo(function (matchIndexes, length) {
  35979. var i = 0;
  35980. for (; i < length; i += 2) {
  35981. matchIndexes.push(i);
  35982. }
  35983. return matchIndexes;
  35984. }),
  35985. "odd": createPositionalPseudo(function (matchIndexes, length) {
  35986. var i = 1;
  35987. for (; i < length; i += 2) {
  35988. matchIndexes.push(i);
  35989. }
  35990. return matchIndexes;
  35991. }),
  35992. "lt": createPositionalPseudo(function (matchIndexes, length, argument) {
  35993. var i = argument < 0 ? argument + length : argument;
  35994. for (; --i >= 0;) {
  35995. matchIndexes.push(i);
  35996. }
  35997. return matchIndexes;
  35998. }),
  35999. "gt": createPositionalPseudo(function (matchIndexes, length, argument) {
  36000. var i = argument < 0 ? argument + length : argument;
  36001. for (; ++i < length;) {
  36002. matchIndexes.push(i);
  36003. }
  36004. return matchIndexes;
  36005. })
  36006. }
  36007. };
  36008. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  36009. // Add button/input type pseudos
  36010. for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  36011. Expr.pseudos[i] = createInputPseudo(i);
  36012. }
  36013. for (i in { submit: true, reset: true }) {
  36014. Expr.pseudos[i] = createButtonPseudo(i);
  36015. }
  36016. // Easy API for creating new setFilters
  36017. function setFilters() {}
  36018. setFilters.prototype = Expr.filters = Expr.pseudos;
  36019. Expr.setFilters = new setFilters();
  36020. tokenize = Sizzle.tokenize = function (selector, parseOnly) {
  36021. var matched,
  36022. match,
  36023. tokens,
  36024. type,
  36025. soFar,
  36026. groups,
  36027. preFilters,
  36028. cached = tokenCache[selector + " "];
  36029. if (cached) {
  36030. return parseOnly ? 0 : cached.slice(0);
  36031. }
  36032. soFar = selector;
  36033. groups = [];
  36034. preFilters = Expr.preFilter;
  36035. while (soFar) {
  36036. // Comma and first run
  36037. if (!matched || (match = rcomma.exec(soFar))) {
  36038. if (match) {
  36039. // Don't consume trailing commas as valid
  36040. soFar = soFar.slice(match[0].length) || soFar;
  36041. }
  36042. groups.push(tokens = []);
  36043. }
  36044. matched = false;
  36045. // Combinators
  36046. if (match = rcombinators.exec(soFar)) {
  36047. matched = match.shift();
  36048. tokens.push({
  36049. value: matched,
  36050. // Cast descendant combinators to space
  36051. type: match[0].replace(rtrim, " ")
  36052. });
  36053. soFar = soFar.slice(matched.length);
  36054. }
  36055. // Filters
  36056. for (type in Expr.filter) {
  36057. if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
  36058. matched = match.shift();
  36059. tokens.push({
  36060. value: matched,
  36061. type: type,
  36062. matches: match
  36063. });
  36064. soFar = soFar.slice(matched.length);
  36065. }
  36066. }
  36067. if (!matched) {
  36068. break;
  36069. }
  36070. }
  36071. // Return the length of the invalid excess
  36072. // if we're just parsing
  36073. // Otherwise, throw an error or return tokens
  36074. return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) :
  36075. // Cache the tokens
  36076. tokenCache(selector, groups).slice(0);
  36077. };
  36078. function toSelector(tokens) {
  36079. var i = 0,
  36080. len = tokens.length,
  36081. selector = "";
  36082. for (; i < len; i++) {
  36083. selector += tokens[i].value;
  36084. }
  36085. return selector;
  36086. }
  36087. function addCombinator(matcher, combinator, base) {
  36088. var dir = combinator.dir,
  36089. skip = combinator.next,
  36090. key = skip || dir,
  36091. checkNonElements = base && key === "parentNode",
  36092. doneName = done++;
  36093. return combinator.first ?
  36094. // Check against closest ancestor/preceding element
  36095. function (elem, context, xml) {
  36096. while (elem = elem[dir]) {
  36097. if (elem.nodeType === 1 || checkNonElements) {
  36098. return matcher(elem, context, xml);
  36099. }
  36100. }
  36101. return false;
  36102. } :
  36103. // Check against all ancestor/preceding elements
  36104. function (elem, context, xml) {
  36105. var oldCache,
  36106. uniqueCache,
  36107. outerCache,
  36108. newCache = [dirruns, doneName];
  36109. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  36110. if (xml) {
  36111. while (elem = elem[dir]) {
  36112. if (elem.nodeType === 1 || checkNonElements) {
  36113. if (matcher(elem, context, xml)) {
  36114. return true;
  36115. }
  36116. }
  36117. }
  36118. } else {
  36119. while (elem = elem[dir]) {
  36120. if (elem.nodeType === 1 || checkNonElements) {
  36121. outerCache = elem[expando] || (elem[expando] = {});
  36122. // Support: IE <9 only
  36123. // Defend against cloned attroperties (jQuery gh-1709)
  36124. uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});
  36125. if (skip && skip === elem.nodeName.toLowerCase()) {
  36126. elem = elem[dir] || elem;
  36127. } else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  36128. // Assign to newCache so results back-propagate to previous elements
  36129. return newCache[2] = oldCache[2];
  36130. } else {
  36131. // Reuse newcache so results back-propagate to previous elements
  36132. uniqueCache[key] = newCache;
  36133. // A match means we're done; a fail means we have to keep checking
  36134. if (newCache[2] = matcher(elem, context, xml)) {
  36135. return true;
  36136. }
  36137. }
  36138. }
  36139. }
  36140. }
  36141. return false;
  36142. };
  36143. }
  36144. function elementMatcher(matchers) {
  36145. return matchers.length > 1 ? function (elem, context, xml) {
  36146. var i = matchers.length;
  36147. while (i--) {
  36148. if (!matchers[i](elem, context, xml)) {
  36149. return false;
  36150. }
  36151. }
  36152. return true;
  36153. } : matchers[0];
  36154. }
  36155. function multipleContexts(selector, contexts, results) {
  36156. var i = 0,
  36157. len = contexts.length;
  36158. for (; i < len; i++) {
  36159. Sizzle(selector, contexts[i], results);
  36160. }
  36161. return results;
  36162. }
  36163. function condense(unmatched, map, filter, context, xml) {
  36164. var elem,
  36165. newUnmatched = [],
  36166. i = 0,
  36167. len = unmatched.length,
  36168. mapped = map != null;
  36169. for (; i < len; i++) {
  36170. if (elem = unmatched[i]) {
  36171. if (!filter || filter(elem, context, xml)) {
  36172. newUnmatched.push(elem);
  36173. if (mapped) {
  36174. map.push(i);
  36175. }
  36176. }
  36177. }
  36178. }
  36179. return newUnmatched;
  36180. }
  36181. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  36182. if (postFilter && !postFilter[expando]) {
  36183. postFilter = setMatcher(postFilter);
  36184. }
  36185. if (postFinder && !postFinder[expando]) {
  36186. postFinder = setMatcher(postFinder, postSelector);
  36187. }
  36188. return markFunction(function (seed, results, context, xml) {
  36189. var temp,
  36190. i,
  36191. elem,
  36192. preMap = [],
  36193. postMap = [],
  36194. preexisting = results.length,
  36195. // Get initial elements from seed or context
  36196. elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
  36197. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  36198. matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
  36199. matcherOut = matcher ?
  36200. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  36201. postFinder || (seed ? preFilter : preexisting || postFilter) ?
  36202. // ...intermediate processing is necessary
  36203. [] :
  36204. // ...otherwise use results directly
  36205. results : matcherIn;
  36206. // Find primary matches
  36207. if (matcher) {
  36208. matcher(matcherIn, matcherOut, context, xml);
  36209. }
  36210. // Apply postFilter
  36211. if (postFilter) {
  36212. temp = condense(matcherOut, postMap);
  36213. postFilter(temp, [], context, xml);
  36214. // Un-match failing elements by moving them back to matcherIn
  36215. i = temp.length;
  36216. while (i--) {
  36217. if (elem = temp[i]) {
  36218. matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
  36219. }
  36220. }
  36221. }
  36222. if (seed) {
  36223. if (postFinder || preFilter) {
  36224. if (postFinder) {
  36225. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  36226. temp = [];
  36227. i = matcherOut.length;
  36228. while (i--) {
  36229. if (elem = matcherOut[i]) {
  36230. // Restore matcherIn since elem is not yet a final match
  36231. temp.push(matcherIn[i] = elem);
  36232. }
  36233. }
  36234. postFinder(null, matcherOut = [], temp, xml);
  36235. }
  36236. // Move matched elements from seed to results to keep them synchronized
  36237. i = matcherOut.length;
  36238. while (i--) {
  36239. if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
  36240. seed[temp] = !(results[temp] = elem);
  36241. }
  36242. }
  36243. }
  36244. // Add elements to results, through postFinder if defined
  36245. } else {
  36246. matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
  36247. if (postFinder) {
  36248. postFinder(null, results, matcherOut, xml);
  36249. } else {
  36250. push.apply(results, matcherOut);
  36251. }
  36252. }
  36253. });
  36254. }
  36255. function matcherFromTokens(tokens) {
  36256. var checkContext,
  36257. matcher,
  36258. j,
  36259. len = tokens.length,
  36260. leadingRelative = Expr.relative[tokens[0].type],
  36261. implicitRelative = leadingRelative || Expr.relative[" "],
  36262. i = leadingRelative ? 1 : 0,
  36263. // The foundational matcher ensures that elements are reachable from top-level context(s)
  36264. matchContext = addCombinator(function (elem) {
  36265. return elem === checkContext;
  36266. }, implicitRelative, true),
  36267. matchAnyContext = addCombinator(function (elem) {
  36268. return indexOf(checkContext, elem) > -1;
  36269. }, implicitRelative, true),
  36270. matchers = [function (elem, context, xml) {
  36271. var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  36272. // Avoid hanging onto element (issue #299)
  36273. checkContext = null;
  36274. return ret;
  36275. }];
  36276. for (; i < len; i++) {
  36277. if (matcher = Expr.relative[tokens[i].type]) {
  36278. matchers = [addCombinator(elementMatcher(matchers), matcher)];
  36279. } else {
  36280. matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
  36281. // Return special upon seeing a positional matcher
  36282. if (matcher[expando]) {
  36283. // Find the next relative operator (if any) for proper handling
  36284. j = ++i;
  36285. for (; j < len; j++) {
  36286. if (Expr.relative[tokens[j].type]) {
  36287. break;
  36288. }
  36289. }
  36290. return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(
  36291. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  36292. 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));
  36293. }
  36294. matchers.push(matcher);
  36295. }
  36296. }
  36297. return elementMatcher(matchers);
  36298. }
  36299. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  36300. var bySet = setMatchers.length > 0,
  36301. byElement = elementMatchers.length > 0,
  36302. superMatcher = function superMatcher(seed, context, xml, results, outermost) {
  36303. var elem,
  36304. j,
  36305. matcher,
  36306. matchedCount = 0,
  36307. i = "0",
  36308. unmatched = seed && [],
  36309. setMatched = [],
  36310. contextBackup = outermostContext,
  36311. // We must always have either seed elements or outermost context
  36312. elems = seed || byElement && Expr.find["TAG"]("*", outermost),
  36313. // Use integer dirruns iff this is the outermost matcher
  36314. dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,
  36315. len = elems.length;
  36316. if (outermost) {
  36317. outermostContext = context === document || context || outermost;
  36318. }
  36319. // Add elements passing elementMatchers directly to results
  36320. // Support: IE<9, Safari
  36321. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  36322. for (; i !== len && (elem = elems[i]) != null; i++) {
  36323. if (byElement && elem) {
  36324. j = 0;
  36325. if (!context && elem.ownerDocument !== document) {
  36326. setDocument(elem);
  36327. xml = !documentIsHTML;
  36328. }
  36329. while (matcher = elementMatchers[j++]) {
  36330. if (matcher(elem, context || document, xml)) {
  36331. results.push(elem);
  36332. break;
  36333. }
  36334. }
  36335. if (outermost) {
  36336. dirruns = dirrunsUnique;
  36337. }
  36338. }
  36339. // Track unmatched elements for set filters
  36340. if (bySet) {
  36341. // They will have gone through all possible matchers
  36342. if (elem = !matcher && elem) {
  36343. matchedCount--;
  36344. }
  36345. // Lengthen the array for every element, matched or not
  36346. if (seed) {
  36347. unmatched.push(elem);
  36348. }
  36349. }
  36350. }
  36351. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  36352. // makes the latter nonnegative.
  36353. matchedCount += i;
  36354. // Apply set filters to unmatched elements
  36355. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  36356. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  36357. // no element matchers and no seed.
  36358. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  36359. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  36360. // numerically zero.
  36361. if (bySet && i !== matchedCount) {
  36362. j = 0;
  36363. while (matcher = setMatchers[j++]) {
  36364. matcher(unmatched, setMatched, context, xml);
  36365. }
  36366. if (seed) {
  36367. // Reintegrate element matches to eliminate the need for sorting
  36368. if (matchedCount > 0) {
  36369. while (i--) {
  36370. if (!(unmatched[i] || setMatched[i])) {
  36371. setMatched[i] = pop.call(results);
  36372. }
  36373. }
  36374. }
  36375. // Discard index placeholder values to get only actual matches
  36376. setMatched = condense(setMatched);
  36377. }
  36378. // Add matches to results
  36379. push.apply(results, setMatched);
  36380. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  36381. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  36382. Sizzle.uniqueSort(results);
  36383. }
  36384. }
  36385. // Override manipulation of globals by nested matchers
  36386. if (outermost) {
  36387. dirruns = dirrunsUnique;
  36388. outermostContext = contextBackup;
  36389. }
  36390. return unmatched;
  36391. };
  36392. return bySet ? markFunction(superMatcher) : superMatcher;
  36393. }
  36394. compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
  36395. var i,
  36396. setMatchers = [],
  36397. elementMatchers = [],
  36398. cached = compilerCache[selector + " "];
  36399. if (!cached) {
  36400. // Generate a function of recursive functions that can be used to check each element
  36401. if (!match) {
  36402. match = tokenize(selector);
  36403. }
  36404. i = match.length;
  36405. while (i--) {
  36406. cached = matcherFromTokens(match[i]);
  36407. if (cached[expando]) {
  36408. setMatchers.push(cached);
  36409. } else {
  36410. elementMatchers.push(cached);
  36411. }
  36412. }
  36413. // Cache the compiled function
  36414. cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
  36415. // Save selector and tokenization
  36416. cached.selector = selector;
  36417. }
  36418. return cached;
  36419. };
  36420. /**
  36421. * A low-level selection function that works with Sizzle's compiled
  36422. * selector functions
  36423. * @param {String|Function} selector A selector or a pre-compiled
  36424. * selector function built with Sizzle.compile
  36425. * @param {Element} context
  36426. * @param {Array} [results]
  36427. * @param {Array} [seed] A set of elements to match against
  36428. */
  36429. select = Sizzle.select = function (selector, context, results, seed) {
  36430. var i,
  36431. tokens,
  36432. token,
  36433. type,
  36434. find,
  36435. compiled = typeof selector === "function" && selector,
  36436. match = !seed && tokenize(selector = compiled.selector || selector);
  36437. results = results || [];
  36438. // Try to minimize operations if there is only one selector in the list and no seed
  36439. // (the latter of which guarantees us context)
  36440. if (match.length === 1) {
  36441. // Reduce context if the leading compound selector is an ID
  36442. tokens = match[0] = match[0].slice(0);
  36443. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  36444. context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
  36445. if (!context) {
  36446. return results;
  36447. // Precompiled matchers will still verify ancestry, so step up a level
  36448. } else if (compiled) {
  36449. context = context.parentNode;
  36450. }
  36451. selector = selector.slice(tokens.shift().value.length);
  36452. }
  36453. // Fetch a seed set for right-to-left matching
  36454. i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
  36455. while (i--) {
  36456. token = tokens[i];
  36457. // Abort if we hit a combinator
  36458. if (Expr.relative[type = token.type]) {
  36459. break;
  36460. }
  36461. if (find = Expr.find[type]) {
  36462. // Search, expanding context for leading sibling combinators
  36463. if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
  36464. // If seed is empty or no tokens remain, we can return early
  36465. tokens.splice(i, 1);
  36466. selector = seed.length && toSelector(tokens);
  36467. if (!selector) {
  36468. push.apply(results, seed);
  36469. return results;
  36470. }
  36471. break;
  36472. }
  36473. }
  36474. }
  36475. }
  36476. // Compile and execute a filtering function if one is not provided
  36477. // Provide `match` to avoid retokenization if we modified the selector above
  36478. (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
  36479. return results;
  36480. };
  36481. // One-time assignments
  36482. // Sort stability
  36483. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  36484. // Support: Chrome 14-35+
  36485. // Always assume duplicates if they aren't passed to the comparison function
  36486. support.detectDuplicates = !!hasDuplicate;
  36487. // Initialize against the default document
  36488. setDocument();
  36489. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  36490. // Detached nodes confoundingly follow *each other*
  36491. support.sortDetached = assert(function (el) {
  36492. // Should return 1, but returns 4 (following)
  36493. return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
  36494. });
  36495. // Support: IE<8
  36496. // Prevent attribute/property "interpolation"
  36497. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  36498. if (!assert(function (el) {
  36499. el.innerHTML = "<a href='#'></a>";
  36500. return el.firstChild.getAttribute("href") === "#";
  36501. })) {
  36502. addHandle("type|href|height|width", function (elem, name, isXML) {
  36503. if (!isXML) {
  36504. return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
  36505. }
  36506. });
  36507. }
  36508. // Support: IE<9
  36509. // Use defaultValue in place of getAttribute("value")
  36510. if (!support.attributes || !assert(function (el) {
  36511. el.innerHTML = "<input/>";
  36512. el.firstChild.setAttribute("value", "");
  36513. return el.firstChild.getAttribute("value") === "";
  36514. })) {
  36515. addHandle("value", function (elem, name, isXML) {
  36516. if (!isXML && elem.nodeName.toLowerCase() === "input") {
  36517. return elem.defaultValue;
  36518. }
  36519. });
  36520. }
  36521. // Support: IE<9
  36522. // Use getAttributeNode to fetch booleans when getAttribute lies
  36523. if (!assert(function (el) {
  36524. return el.getAttribute("disabled") == null;
  36525. })) {
  36526. addHandle(booleans, function (elem, name, isXML) {
  36527. var val;
  36528. if (!isXML) {
  36529. return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  36530. }
  36531. });
  36532. }
  36533. return Sizzle;
  36534. }(window);
  36535. jQuery.find = Sizzle;
  36536. jQuery.expr = Sizzle.selectors;
  36537. // Deprecated
  36538. jQuery.expr[":"] = jQuery.expr.pseudos;
  36539. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  36540. jQuery.text = Sizzle.getText;
  36541. jQuery.isXMLDoc = Sizzle.isXML;
  36542. jQuery.contains = Sizzle.contains;
  36543. jQuery.escapeSelector = Sizzle.escape;
  36544. var dir = function dir(elem, _dir, until) {
  36545. var matched = [],
  36546. truncate = until !== undefined;
  36547. while ((elem = elem[_dir]) && elem.nodeType !== 9) {
  36548. if (elem.nodeType === 1) {
  36549. if (truncate && jQuery(elem).is(until)) {
  36550. break;
  36551. }
  36552. matched.push(elem);
  36553. }
  36554. }
  36555. return matched;
  36556. };
  36557. var _siblings = function _siblings(n, elem) {
  36558. var matched = [];
  36559. for (; n; n = n.nextSibling) {
  36560. if (n.nodeType === 1 && n !== elem) {
  36561. matched.push(n);
  36562. }
  36563. }
  36564. return matched;
  36565. };
  36566. var rneedsContext = jQuery.expr.match.needsContext;
  36567. function nodeName(elem, name) {
  36568. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  36569. };
  36570. var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
  36571. // Implement the identical functionality for filter and not
  36572. function winnow(elements, qualifier, not) {
  36573. if (isFunction(qualifier)) {
  36574. return jQuery.grep(elements, function (elem, i) {
  36575. return !!qualifier.call(elem, i, elem) !== not;
  36576. });
  36577. }
  36578. // Single element
  36579. if (qualifier.nodeType) {
  36580. return jQuery.grep(elements, function (elem) {
  36581. return elem === qualifier !== not;
  36582. });
  36583. }
  36584. // Arraylike of elements (jQuery, arguments, Array)
  36585. if (typeof qualifier !== "string") {
  36586. return jQuery.grep(elements, function (elem) {
  36587. return indexOf.call(qualifier, elem) > -1 !== not;
  36588. });
  36589. }
  36590. // Filtered directly for both simple and complex selectors
  36591. return jQuery.filter(qualifier, elements, not);
  36592. }
  36593. jQuery.filter = function (expr, elems, not) {
  36594. var elem = elems[0];
  36595. if (not) {
  36596. expr = ":not(" + expr + ")";
  36597. }
  36598. if (elems.length === 1 && elem.nodeType === 1) {
  36599. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  36600. }
  36601. return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
  36602. return elem.nodeType === 1;
  36603. }));
  36604. };
  36605. jQuery.fn.extend({
  36606. find: function find(selector) {
  36607. var i,
  36608. ret,
  36609. len = this.length,
  36610. self = this;
  36611. if (typeof selector !== "string") {
  36612. return this.pushStack(jQuery(selector).filter(function () {
  36613. for (i = 0; i < len; i++) {
  36614. if (jQuery.contains(self[i], this)) {
  36615. return true;
  36616. }
  36617. }
  36618. }));
  36619. }
  36620. ret = this.pushStack([]);
  36621. for (i = 0; i < len; i++) {
  36622. jQuery.find(selector, self[i], ret);
  36623. }
  36624. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  36625. },
  36626. filter: function filter(selector) {
  36627. return this.pushStack(winnow(this, selector || [], false));
  36628. },
  36629. not: function not(selector) {
  36630. return this.pushStack(winnow(this, selector || [], true));
  36631. },
  36632. is: function is(selector) {
  36633. return !!winnow(this,
  36634. // If this is a positional/relative selector, check membership in the returned set
  36635. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  36636. typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;
  36637. }
  36638. });
  36639. // Initialize a jQuery object
  36640. // A central reference to the root jQuery(document)
  36641. var rootjQuery,
  36642. // A simple way to check for HTML strings
  36643. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  36644. // Strict HTML recognition (#11290: must start with <)
  36645. // Shortcut simple #id case for speed
  36646. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  36647. init = jQuery.fn.init = function (selector, context, root) {
  36648. var match, elem;
  36649. // HANDLE: $(""), $(null), $(undefined), $(false)
  36650. if (!selector) {
  36651. return this;
  36652. }
  36653. // Method init() accepts an alternate rootjQuery
  36654. // so migrate can support jQuery.sub (gh-2101)
  36655. root = root || rootjQuery;
  36656. // Handle HTML strings
  36657. if (typeof selector === "string") {
  36658. if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
  36659. // Assume that strings that start and end with <> are HTML and skip the regex check
  36660. match = [null, selector, null];
  36661. } else {
  36662. match = rquickExpr.exec(selector);
  36663. }
  36664. // Match html or make sure no context is specified for #id
  36665. if (match && (match[1] || !context)) {
  36666. // HANDLE: $(html) -> $(array)
  36667. if (match[1]) {
  36668. context = context instanceof jQuery ? context[0] : context;
  36669. // Option to run scripts is true for back-compat
  36670. // Intentionally let the error be thrown if parseHTML is not present
  36671. jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
  36672. // HANDLE: $(html, props)
  36673. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  36674. for (match in context) {
  36675. // Properties of context are called as methods if possible
  36676. if (isFunction(this[match])) {
  36677. this[match](context[match]);
  36678. // ...and otherwise set as attributes
  36679. } else {
  36680. this.attr(match, context[match]);
  36681. }
  36682. }
  36683. }
  36684. return this;
  36685. // HANDLE: $(#id)
  36686. } else {
  36687. elem = document.getElementById(match[2]);
  36688. if (elem) {
  36689. // Inject the element directly into the jQuery object
  36690. this[0] = elem;
  36691. this.length = 1;
  36692. }
  36693. return this;
  36694. }
  36695. // HANDLE: $(expr, $(...))
  36696. } else if (!context || context.jquery) {
  36697. return (context || root).find(selector);
  36698. // HANDLE: $(expr, context)
  36699. // (which is just equivalent to: $(context).find(expr)
  36700. } else {
  36701. return this.constructor(context).find(selector);
  36702. }
  36703. // HANDLE: $(DOMElement)
  36704. } else if (selector.nodeType) {
  36705. this[0] = selector;
  36706. this.length = 1;
  36707. return this;
  36708. // HANDLE: $(function)
  36709. // Shortcut for document ready
  36710. } else if (isFunction(selector)) {
  36711. return root.ready !== undefined ? root.ready(selector) :
  36712. // Execute immediately if ready is not present
  36713. selector(jQuery);
  36714. }
  36715. return jQuery.makeArray(selector, this);
  36716. };
  36717. // Give the init function the jQuery prototype for later instantiation
  36718. init.prototype = jQuery.fn;
  36719. // Initialize central reference
  36720. rootjQuery = jQuery(document);
  36721. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  36722. // Methods guaranteed to produce a unique set when starting from a unique set
  36723. guaranteedUnique = {
  36724. children: true,
  36725. contents: true,
  36726. next: true,
  36727. prev: true
  36728. };
  36729. jQuery.fn.extend({
  36730. has: function has(target) {
  36731. var targets = jQuery(target, this),
  36732. l = targets.length;
  36733. return this.filter(function () {
  36734. var i = 0;
  36735. for (; i < l; i++) {
  36736. if (jQuery.contains(this, targets[i])) {
  36737. return true;
  36738. }
  36739. }
  36740. });
  36741. },
  36742. closest: function closest(selectors, context) {
  36743. var cur,
  36744. i = 0,
  36745. l = this.length,
  36746. matched = [],
  36747. targets = typeof selectors !== "string" && jQuery(selectors);
  36748. // Positional selectors never match, since there's no _selection_ context
  36749. if (!rneedsContext.test(selectors)) {
  36750. for (; i < l; i++) {
  36751. for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
  36752. // Always skip document fragments
  36753. if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 :
  36754. // Don't pass non-elements to Sizzle
  36755. cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  36756. matched.push(cur);
  36757. break;
  36758. }
  36759. }
  36760. }
  36761. }
  36762. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  36763. },
  36764. // Determine the position of an element within the set
  36765. index: function index(elem) {
  36766. // No argument, return index in parent
  36767. if (!elem) {
  36768. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  36769. }
  36770. // Index in selector
  36771. if (typeof elem === "string") {
  36772. return indexOf.call(jQuery(elem), this[0]);
  36773. }
  36774. // Locate the position of the desired element
  36775. return indexOf.call(this,
  36776. // If it receives a jQuery object, the first element is used
  36777. elem.jquery ? elem[0] : elem);
  36778. },
  36779. add: function add(selector, context) {
  36780. return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
  36781. },
  36782. addBack: function addBack(selector) {
  36783. return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
  36784. }
  36785. });
  36786. function sibling(cur, dir) {
  36787. while ((cur = cur[dir]) && cur.nodeType !== 1) {}
  36788. return cur;
  36789. }
  36790. jQuery.each({
  36791. parent: function parent(elem) {
  36792. var parent = elem.parentNode;
  36793. return parent && parent.nodeType !== 11 ? parent : null;
  36794. },
  36795. parents: function parents(elem) {
  36796. return dir(elem, "parentNode");
  36797. },
  36798. parentsUntil: function parentsUntil(elem, i, until) {
  36799. return dir(elem, "parentNode", until);
  36800. },
  36801. next: function next(elem) {
  36802. return sibling(elem, "nextSibling");
  36803. },
  36804. prev: function prev(elem) {
  36805. return sibling(elem, "previousSibling");
  36806. },
  36807. nextAll: function nextAll(elem) {
  36808. return dir(elem, "nextSibling");
  36809. },
  36810. prevAll: function prevAll(elem) {
  36811. return dir(elem, "previousSibling");
  36812. },
  36813. nextUntil: function nextUntil(elem, i, until) {
  36814. return dir(elem, "nextSibling", until);
  36815. },
  36816. prevUntil: function prevUntil(elem, i, until) {
  36817. return dir(elem, "previousSibling", until);
  36818. },
  36819. siblings: function siblings(elem) {
  36820. return _siblings((elem.parentNode || {}).firstChild, elem);
  36821. },
  36822. children: function children(elem) {
  36823. return _siblings(elem.firstChild);
  36824. },
  36825. contents: function contents(elem) {
  36826. if (nodeName(elem, "iframe")) {
  36827. return elem.contentDocument;
  36828. }
  36829. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  36830. // Treat the template element as a regular one in browsers that
  36831. // don't support it.
  36832. if (nodeName(elem, "template")) {
  36833. elem = elem.content || elem;
  36834. }
  36835. return jQuery.merge([], elem.childNodes);
  36836. }
  36837. }, function (name, fn) {
  36838. jQuery.fn[name] = function (until, selector) {
  36839. var matched = jQuery.map(this, fn, until);
  36840. if (name.slice(-5) !== "Until") {
  36841. selector = until;
  36842. }
  36843. if (selector && typeof selector === "string") {
  36844. matched = jQuery.filter(selector, matched);
  36845. }
  36846. if (this.length > 1) {
  36847. // Remove duplicates
  36848. if (!guaranteedUnique[name]) {
  36849. jQuery.uniqueSort(matched);
  36850. }
  36851. // Reverse order for parents* and prev-derivatives
  36852. if (rparentsprev.test(name)) {
  36853. matched.reverse();
  36854. }
  36855. }
  36856. return this.pushStack(matched);
  36857. };
  36858. });
  36859. var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
  36860. // Convert String-formatted options into Object-formatted ones
  36861. function createOptions(options) {
  36862. var object = {};
  36863. jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
  36864. object[flag] = true;
  36865. });
  36866. return object;
  36867. }
  36868. /*
  36869. * Create a callback list using the following parameters:
  36870. *
  36871. * options: an optional list of space-separated options that will change how
  36872. * the callback list behaves or a more traditional option object
  36873. *
  36874. * By default a callback list will act like an event callback list and can be
  36875. * "fired" multiple times.
  36876. *
  36877. * Possible options:
  36878. *
  36879. * once: will ensure the callback list can only be fired once (like a Deferred)
  36880. *
  36881. * memory: will keep track of previous values and will call any callback added
  36882. * after the list has been fired right away with the latest "memorized"
  36883. * values (like a Deferred)
  36884. *
  36885. * unique: will ensure a callback can only be added once (no duplicate in the list)
  36886. *
  36887. * stopOnFalse: interrupt callings when a callback returns false
  36888. *
  36889. */
  36890. jQuery.Callbacks = function (options) {
  36891. // Convert options from String-formatted to Object-formatted if needed
  36892. // (we check in cache first)
  36893. options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options);
  36894. var // Flag to know if list is currently firing
  36895. firing,
  36896. // Last fire value for non-forgettable lists
  36897. memory,
  36898. // Flag to know if list was already fired
  36899. _fired,
  36900. // Flag to prevent firing
  36901. _locked,
  36902. // Actual callback list
  36903. list = [],
  36904. // Queue of execution data for repeatable lists
  36905. queue = [],
  36906. // Index of currently firing callback (modified by add/remove as needed)
  36907. firingIndex = -1,
  36908. // Fire callbacks
  36909. fire = function fire() {
  36910. // Enforce single-firing
  36911. _locked = _locked || options.once;
  36912. // Execute callbacks for all pending executions,
  36913. // respecting firingIndex overrides and runtime changes
  36914. _fired = firing = true;
  36915. for (; queue.length; firingIndex = -1) {
  36916. memory = queue.shift();
  36917. while (++firingIndex < list.length) {
  36918. // Run callback and check for early termination
  36919. if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {
  36920. // Jump to end and forget the data so .add doesn't re-fire
  36921. firingIndex = list.length;
  36922. memory = false;
  36923. }
  36924. }
  36925. }
  36926. // Forget the data if we're done with it
  36927. if (!options.memory) {
  36928. memory = false;
  36929. }
  36930. firing = false;
  36931. // Clean up if we're done firing for good
  36932. if (_locked) {
  36933. // Keep an empty list if we have data for future add calls
  36934. if (memory) {
  36935. list = [];
  36936. // Otherwise, this object is spent
  36937. } else {
  36938. list = "";
  36939. }
  36940. }
  36941. },
  36942. // Actual Callbacks object
  36943. self = {
  36944. // Add a callback or a collection of callbacks to the list
  36945. add: function add() {
  36946. if (list) {
  36947. // If we have memory from a past run, we should fire after adding
  36948. if (memory && !firing) {
  36949. firingIndex = list.length - 1;
  36950. queue.push(memory);
  36951. }
  36952. (function add(args) {
  36953. jQuery.each(args, function (_, arg) {
  36954. if (isFunction(arg)) {
  36955. if (!options.unique || !self.has(arg)) {
  36956. list.push(arg);
  36957. }
  36958. } else if (arg && arg.length && toType(arg) !== "string") {
  36959. // Inspect recursively
  36960. add(arg);
  36961. }
  36962. });
  36963. })(arguments);
  36964. if (memory && !firing) {
  36965. fire();
  36966. }
  36967. }
  36968. return this;
  36969. },
  36970. // Remove a callback from the list
  36971. remove: function remove() {
  36972. jQuery.each(arguments, function (_, arg) {
  36973. var index;
  36974. while ((index = jQuery.inArray(arg, list, index)) > -1) {
  36975. list.splice(index, 1);
  36976. // Handle firing indexes
  36977. if (index <= firingIndex) {
  36978. firingIndex--;
  36979. }
  36980. }
  36981. });
  36982. return this;
  36983. },
  36984. // Check if a given callback is in the list.
  36985. // If no argument is given, return whether or not list has callbacks attached.
  36986. has: function has(fn) {
  36987. return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
  36988. },
  36989. // Remove all callbacks from the list
  36990. empty: function empty() {
  36991. if (list) {
  36992. list = [];
  36993. }
  36994. return this;
  36995. },
  36996. // Disable .fire and .add
  36997. // Abort any current/pending executions
  36998. // Clear all callbacks and values
  36999. disable: function disable() {
  37000. _locked = queue = [];
  37001. list = memory = "";
  37002. return this;
  37003. },
  37004. disabled: function disabled() {
  37005. return !list;
  37006. },
  37007. // Disable .fire
  37008. // Also disable .add unless we have memory (since it would have no effect)
  37009. // Abort any pending executions
  37010. lock: function lock() {
  37011. _locked = queue = [];
  37012. if (!memory && !firing) {
  37013. list = memory = "";
  37014. }
  37015. return this;
  37016. },
  37017. locked: function locked() {
  37018. return !!_locked;
  37019. },
  37020. // Call all callbacks with the given context and arguments
  37021. fireWith: function fireWith(context, args) {
  37022. if (!_locked) {
  37023. args = args || [];
  37024. args = [context, args.slice ? args.slice() : args];
  37025. queue.push(args);
  37026. if (!firing) {
  37027. fire();
  37028. }
  37029. }
  37030. return this;
  37031. },
  37032. // Call all the callbacks with the given arguments
  37033. fire: function fire() {
  37034. self.fireWith(this, arguments);
  37035. return this;
  37036. },
  37037. // To know if the callbacks have already been called at least once
  37038. fired: function fired() {
  37039. return !!_fired;
  37040. }
  37041. };
  37042. return self;
  37043. };
  37044. function Identity(v) {
  37045. return v;
  37046. }
  37047. function Thrower(ex) {
  37048. throw ex;
  37049. }
  37050. function adoptValue(value, resolve, reject, noValue) {
  37051. var method;
  37052. try {
  37053. // Check for promise aspect first to privilege synchronous behavior
  37054. if (value && isFunction(method = value.promise)) {
  37055. method.call(value).done(resolve).fail(reject);
  37056. // Other thenables
  37057. } else if (value && isFunction(method = value.then)) {
  37058. method.call(value, resolve, reject);
  37059. // Other non-thenables
  37060. } else {
  37061. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  37062. // * false: [ value ].slice( 0 ) => resolve( value )
  37063. // * true: [ value ].slice( 1 ) => resolve()
  37064. resolve.apply(undefined, [value].slice(noValue));
  37065. }
  37066. // For Promises/A+, convert exceptions into rejections
  37067. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  37068. // Deferred#then to conditionally suppress rejection.
  37069. } catch (value) {
  37070. // Support: Android 4.0 only
  37071. // Strict mode functions invoked without .call/.apply get global-object context
  37072. reject.apply(undefined, [value]);
  37073. }
  37074. }
  37075. jQuery.extend({
  37076. Deferred: function Deferred(func) {
  37077. var tuples = [
  37078. // action, add listener, callbacks,
  37079. // ... .then handlers, argument index, [final state]
  37080. ["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"]],
  37081. _state = "pending",
  37082. _promise = {
  37083. state: function state() {
  37084. return _state;
  37085. },
  37086. always: function always() {
  37087. deferred.done(arguments).fail(arguments);
  37088. return this;
  37089. },
  37090. "catch": function _catch(fn) {
  37091. return _promise.then(null, fn);
  37092. },
  37093. // Keep pipe for back-compat
  37094. pipe: function pipe() /* fnDone, fnFail, fnProgress */{
  37095. var fns = arguments;
  37096. return jQuery.Deferred(function (newDefer) {
  37097. jQuery.each(tuples, function (i, tuple) {
  37098. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  37099. var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
  37100. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  37101. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  37102. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  37103. deferred[tuple[1]](function () {
  37104. var returned = fn && fn.apply(this, arguments);
  37105. if (returned && isFunction(returned.promise)) {
  37106. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  37107. } else {
  37108. newDefer[tuple[0] + "With"](this, fn ? [returned] : arguments);
  37109. }
  37110. });
  37111. });
  37112. fns = null;
  37113. }).promise();
  37114. },
  37115. then: function then(onFulfilled, onRejected, onProgress) {
  37116. var maxDepth = 0;
  37117. function resolve(depth, deferred, handler, special) {
  37118. return function () {
  37119. var that = this,
  37120. args = arguments,
  37121. mightThrow = function mightThrow() {
  37122. var returned, then;
  37123. // Support: Promises/A+ section 2.3.3.3.3
  37124. // https://promisesaplus.com/#point-59
  37125. // Ignore double-resolution attempts
  37126. if (depth < maxDepth) {
  37127. return;
  37128. }
  37129. returned = handler.apply(that, args);
  37130. // Support: Promises/A+ section 2.3.1
  37131. // https://promisesaplus.com/#point-48
  37132. if (returned === deferred.promise()) {
  37133. throw new TypeError("Thenable self-resolution");
  37134. }
  37135. // Support: Promises/A+ sections 2.3.3.1, 3.5
  37136. // https://promisesaplus.com/#point-54
  37137. // https://promisesaplus.com/#point-75
  37138. // Retrieve `then` only once
  37139. then = returned && (
  37140. // Support: Promises/A+ section 2.3.4
  37141. // https://promisesaplus.com/#point-64
  37142. // Only check objects and functions for thenability
  37143. (typeof returned === "undefined" ? "undefined" : _typeof(returned)) === "object" || typeof returned === "function") && returned.then;
  37144. // Handle a returned thenable
  37145. if (isFunction(then)) {
  37146. // Special processors (notify) just wait for resolution
  37147. if (special) {
  37148. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));
  37149. // Normal processors (resolve) also hook into progress
  37150. } else {
  37151. // ...and disregard older resolution values
  37152. maxDepth++;
  37153. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));
  37154. }
  37155. // Handle all other returned values
  37156. } else {
  37157. // Only substitute handlers pass on context
  37158. // and multiple values (non-spec behavior)
  37159. if (handler !== Identity) {
  37160. that = undefined;
  37161. args = [returned];
  37162. }
  37163. // Process the value(s)
  37164. // Default process is resolve
  37165. (special || deferred.resolveWith)(that, args);
  37166. }
  37167. },
  37168. // Only normal processors (resolve) catch and reject exceptions
  37169. process = special ? mightThrow : function () {
  37170. try {
  37171. mightThrow();
  37172. } catch (e) {
  37173. if (jQuery.Deferred.exceptionHook) {
  37174. jQuery.Deferred.exceptionHook(e, process.stackTrace);
  37175. }
  37176. // Support: Promises/A+ section 2.3.3.3.4.1
  37177. // https://promisesaplus.com/#point-61
  37178. // Ignore post-resolution exceptions
  37179. if (depth + 1 >= maxDepth) {
  37180. // Only substitute handlers pass on context
  37181. // and multiple values (non-spec behavior)
  37182. if (handler !== Thrower) {
  37183. that = undefined;
  37184. args = [e];
  37185. }
  37186. deferred.rejectWith(that, args);
  37187. }
  37188. }
  37189. };
  37190. // Support: Promises/A+ section 2.3.3.3.1
  37191. // https://promisesaplus.com/#point-57
  37192. // Re-resolve promises immediately to dodge false rejection from
  37193. // subsequent errors
  37194. if (depth) {
  37195. process();
  37196. } else {
  37197. // Call an optional hook to record the stack, in case of exception
  37198. // since it's otherwise lost when execution goes async
  37199. if (jQuery.Deferred.getStackHook) {
  37200. process.stackTrace = jQuery.Deferred.getStackHook();
  37201. }
  37202. window.setTimeout(process);
  37203. }
  37204. };
  37205. }
  37206. return jQuery.Deferred(function (newDefer) {
  37207. // progress_handlers.add( ... )
  37208. tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith));
  37209. // fulfilled_handlers.add( ... )
  37210. tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity));
  37211. // rejected_handlers.add( ... )
  37212. tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));
  37213. }).promise();
  37214. },
  37215. // Get a promise for this deferred
  37216. // If obj is provided, the promise aspect is added to the object
  37217. promise: function promise(obj) {
  37218. return obj != null ? jQuery.extend(obj, _promise) : _promise;
  37219. }
  37220. },
  37221. deferred = {};
  37222. // Add list-specific methods
  37223. jQuery.each(tuples, function (i, tuple) {
  37224. var list = tuple[2],
  37225. stateString = tuple[5];
  37226. // promise.progress = list.add
  37227. // promise.done = list.add
  37228. // promise.fail = list.add
  37229. _promise[tuple[1]] = list.add;
  37230. // Handle state
  37231. if (stateString) {
  37232. list.add(function () {
  37233. // state = "resolved" (i.e., fulfilled)
  37234. // state = "rejected"
  37235. _state = stateString;
  37236. },
  37237. // rejected_callbacks.disable
  37238. // fulfilled_callbacks.disable
  37239. tuples[3 - i][2].disable,
  37240. // rejected_handlers.disable
  37241. // fulfilled_handlers.disable
  37242. tuples[3 - i][3].disable,
  37243. // progress_callbacks.lock
  37244. tuples[0][2].lock,
  37245. // progress_handlers.lock
  37246. tuples[0][3].lock);
  37247. }
  37248. // progress_handlers.fire
  37249. // fulfilled_handlers.fire
  37250. // rejected_handlers.fire
  37251. list.add(tuple[3].fire);
  37252. // deferred.notify = function() { deferred.notifyWith(...) }
  37253. // deferred.resolve = function() { deferred.resolveWith(...) }
  37254. // deferred.reject = function() { deferred.rejectWith(...) }
  37255. deferred[tuple[0]] = function () {
  37256. deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
  37257. return this;
  37258. };
  37259. // deferred.notifyWith = list.fireWith
  37260. // deferred.resolveWith = list.fireWith
  37261. // deferred.rejectWith = list.fireWith
  37262. deferred[tuple[0] + "With"] = list.fireWith;
  37263. });
  37264. // Make the deferred a promise
  37265. _promise.promise(deferred);
  37266. // Call given func if any
  37267. if (func) {
  37268. func.call(deferred, deferred);
  37269. }
  37270. // All done!
  37271. return deferred;
  37272. },
  37273. // Deferred helper
  37274. when: function when(singleValue) {
  37275. var
  37276. // count of uncompleted subordinates
  37277. remaining = arguments.length,
  37278. // count of unprocessed arguments
  37279. i = remaining,
  37280. // subordinate fulfillment data
  37281. resolveContexts = Array(i),
  37282. resolveValues = _slice.call(arguments),
  37283. // the master Deferred
  37284. master = jQuery.Deferred(),
  37285. // subordinate callback factory
  37286. updateFunc = function updateFunc(i) {
  37287. return function (value) {
  37288. resolveContexts[i] = this;
  37289. resolveValues[i] = arguments.length > 1 ? _slice.call(arguments) : value;
  37290. if (! --remaining) {
  37291. master.resolveWith(resolveContexts, resolveValues);
  37292. }
  37293. };
  37294. };
  37295. // Single- and empty arguments are adopted like Promise.resolve
  37296. if (remaining <= 1) {
  37297. adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining);
  37298. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  37299. if (master.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) {
  37300. return master.then();
  37301. }
  37302. }
  37303. // Multiple arguments are aggregated like Promise.all array elements
  37304. while (i--) {
  37305. adoptValue(resolveValues[i], updateFunc(i), master.reject);
  37306. }
  37307. return master.promise();
  37308. }
  37309. });
  37310. // These usually indicate a programmer mistake during development,
  37311. // warn about them ASAP rather than swallowing them by default.
  37312. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  37313. jQuery.Deferred.exceptionHook = function (error, stack) {
  37314. // Support: IE 8 - 9 only
  37315. // Console exists when dev tools are open, which can happen at any time
  37316. if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
  37317. window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
  37318. }
  37319. };
  37320. jQuery.readyException = function (error) {
  37321. window.setTimeout(function () {
  37322. throw error;
  37323. });
  37324. };
  37325. // The deferred used on DOM ready
  37326. var readyList = jQuery.Deferred();
  37327. jQuery.fn.ready = function (fn) {
  37328. readyList.then(fn)
  37329. // Wrap jQuery.readyException in a function so that the lookup
  37330. // happens at the time of error handling instead of callback
  37331. // registration.
  37332. .catch(function (error) {
  37333. jQuery.readyException(error);
  37334. });
  37335. return this;
  37336. };
  37337. jQuery.extend({
  37338. // Is the DOM ready to be used? Set to true once it occurs.
  37339. isReady: false,
  37340. // A counter to track how many items to wait for before
  37341. // the ready event fires. See #6781
  37342. readyWait: 1,
  37343. // Handle when the DOM is ready
  37344. ready: function ready(wait) {
  37345. // Abort if there are pending holds or we're already ready
  37346. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  37347. return;
  37348. }
  37349. // Remember that the DOM is ready
  37350. jQuery.isReady = true;
  37351. // If a normal DOM Ready event fired, decrement, and wait if need be
  37352. if (wait !== true && --jQuery.readyWait > 0) {
  37353. return;
  37354. }
  37355. // If there are functions bound, to execute
  37356. readyList.resolveWith(document, [jQuery]);
  37357. }
  37358. });
  37359. jQuery.ready.then = readyList.then;
  37360. // The ready event handler and self cleanup method
  37361. function completed() {
  37362. document.removeEventListener("DOMContentLoaded", completed);
  37363. window.removeEventListener("load", completed);
  37364. jQuery.ready();
  37365. }
  37366. // Catch cases where $(document).ready() is called
  37367. // after the browser event has already occurred.
  37368. // Support: IE <=9 - 10 only
  37369. // Older IE sometimes signals "interactive" too soon
  37370. if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) {
  37371. // Handle it asynchronously to allow scripts the opportunity to delay ready
  37372. window.setTimeout(jQuery.ready);
  37373. } else {
  37374. // Use the handy event callback
  37375. document.addEventListener("DOMContentLoaded", completed);
  37376. // A fallback to window.onload, that will always work
  37377. window.addEventListener("load", completed);
  37378. }
  37379. // Multifunctional method to get and set values of a collection
  37380. // The value/s can optionally be executed if it's a function
  37381. var access = function access(elems, fn, key, value, chainable, emptyGet, raw) {
  37382. var i = 0,
  37383. len = elems.length,
  37384. bulk = key == null;
  37385. // Sets many values
  37386. if (toType(key) === "object") {
  37387. chainable = true;
  37388. for (i in key) {
  37389. access(elems, fn, i, key[i], true, emptyGet, raw);
  37390. }
  37391. // Sets one value
  37392. } else if (value !== undefined) {
  37393. chainable = true;
  37394. if (!isFunction(value)) {
  37395. raw = true;
  37396. }
  37397. if (bulk) {
  37398. // Bulk operations run against the entire set
  37399. if (raw) {
  37400. fn.call(elems, value);
  37401. fn = null;
  37402. // ...except when executing function values
  37403. } else {
  37404. bulk = fn;
  37405. fn = function fn(elem, key, value) {
  37406. return bulk.call(jQuery(elem), value);
  37407. };
  37408. }
  37409. }
  37410. if (fn) {
  37411. for (; i < len; i++) {
  37412. fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
  37413. }
  37414. }
  37415. }
  37416. if (chainable) {
  37417. return elems;
  37418. }
  37419. // Gets
  37420. if (bulk) {
  37421. return fn.call(elems);
  37422. }
  37423. return len ? fn(elems[0], key) : emptyGet;
  37424. };
  37425. // Matches dashed string for camelizing
  37426. var rmsPrefix = /^-ms-/,
  37427. rdashAlpha = /-([a-z])/g;
  37428. // Used by camelCase as callback to replace()
  37429. function fcamelCase(all, letter) {
  37430. return letter.toUpperCase();
  37431. }
  37432. // Convert dashed to camelCase; used by the css and data modules
  37433. // Support: IE <=9 - 11, Edge 12 - 15
  37434. // Microsoft forgot to hump their vendor prefix (#9572)
  37435. function camelCase(string) {
  37436. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  37437. }
  37438. var acceptData = function acceptData(owner) {
  37439. // Accepts only:
  37440. // - Node
  37441. // - Node.ELEMENT_NODE
  37442. // - Node.DOCUMENT_NODE
  37443. // - Object
  37444. // - Any
  37445. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  37446. };
  37447. function Data() {
  37448. this.expando = jQuery.expando + Data.uid++;
  37449. }
  37450. Data.uid = 1;
  37451. Data.prototype = {
  37452. cache: function cache(owner) {
  37453. // Check if the owner object already has a cache
  37454. var value = owner[this.expando];
  37455. // If not, create one
  37456. if (!value) {
  37457. value = {};
  37458. // We can accept data for non-element nodes in modern browsers,
  37459. // but we should not, see #8335.
  37460. // Always return an empty object.
  37461. if (acceptData(owner)) {
  37462. // If it is a node unlikely to be stringify-ed or looped over
  37463. // use plain assignment
  37464. if (owner.nodeType) {
  37465. owner[this.expando] = value;
  37466. // Otherwise secure it in a non-enumerable property
  37467. // configurable must be true to allow the property to be
  37468. // deleted when data is removed
  37469. } else {
  37470. Object.defineProperty(owner, this.expando, {
  37471. value: value,
  37472. configurable: true
  37473. });
  37474. }
  37475. }
  37476. }
  37477. return value;
  37478. },
  37479. set: function set(owner, data, value) {
  37480. var prop,
  37481. cache = this.cache(owner);
  37482. // Handle: [ owner, key, value ] args
  37483. // Always use camelCase key (gh-2257)
  37484. if (typeof data === "string") {
  37485. cache[camelCase(data)] = value;
  37486. // Handle: [ owner, { properties } ] args
  37487. } else {
  37488. // Copy the properties one-by-one to the cache object
  37489. for (prop in data) {
  37490. cache[camelCase(prop)] = data[prop];
  37491. }
  37492. }
  37493. return cache;
  37494. },
  37495. get: function get(owner, key) {
  37496. return key === undefined ? this.cache(owner) :
  37497. // Always use camelCase key (gh-2257)
  37498. owner[this.expando] && owner[this.expando][camelCase(key)];
  37499. },
  37500. access: function access(owner, key, value) {
  37501. // In cases where either:
  37502. //
  37503. // 1. No key was specified
  37504. // 2. A string key was specified, but no value provided
  37505. //
  37506. // Take the "read" path and allow the get method to determine
  37507. // which value to return, respectively either:
  37508. //
  37509. // 1. The entire cache object
  37510. // 2. The data stored at the key
  37511. //
  37512. if (key === undefined || key && typeof key === "string" && value === undefined) {
  37513. return this.get(owner, key);
  37514. }
  37515. // When the key is not a string, or both a key and value
  37516. // are specified, set or extend (existing objects) with either:
  37517. //
  37518. // 1. An object of properties
  37519. // 2. A key and value
  37520. //
  37521. this.set(owner, key, value);
  37522. // Since the "set" path can have two possible entry points
  37523. // return the expected data based on which path was taken[*]
  37524. return value !== undefined ? value : key;
  37525. },
  37526. remove: function remove(owner, key) {
  37527. var i,
  37528. cache = owner[this.expando];
  37529. if (cache === undefined) {
  37530. return;
  37531. }
  37532. if (key !== undefined) {
  37533. // Support array or space separated string of keys
  37534. if (Array.isArray(key)) {
  37535. // If key is an array of keys...
  37536. // We always set camelCase keys, so remove that.
  37537. key = key.map(camelCase);
  37538. } else {
  37539. key = camelCase(key);
  37540. // If a key with the spaces exists, use it.
  37541. // Otherwise, create an array by matching non-whitespace
  37542. key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
  37543. }
  37544. i = key.length;
  37545. while (i--) {
  37546. delete cache[key[i]];
  37547. }
  37548. }
  37549. // Remove the expando if there's no more data
  37550. if (key === undefined || jQuery.isEmptyObject(cache)) {
  37551. // Support: Chrome <=35 - 45
  37552. // Webkit & Blink performance suffers when deleting properties
  37553. // from DOM nodes, so set to undefined instead
  37554. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  37555. if (owner.nodeType) {
  37556. owner[this.expando] = undefined;
  37557. } else {
  37558. delete owner[this.expando];
  37559. }
  37560. }
  37561. },
  37562. hasData: function hasData(owner) {
  37563. var cache = owner[this.expando];
  37564. return cache !== undefined && !jQuery.isEmptyObject(cache);
  37565. }
  37566. };
  37567. var dataPriv = new Data();
  37568. var dataUser = new Data();
  37569. // Implementation Summary
  37570. //
  37571. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  37572. // 2. Improve the module's maintainability by reducing the storage
  37573. // paths to a single mechanism.
  37574. // 3. Use the same single mechanism to support "private" and "user" data.
  37575. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  37576. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  37577. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  37578. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  37579. rmultiDash = /[A-Z]/g;
  37580. function getData(data) {
  37581. if (data === "true") {
  37582. return true;
  37583. }
  37584. if (data === "false") {
  37585. return false;
  37586. }
  37587. if (data === "null") {
  37588. return null;
  37589. }
  37590. // Only convert to a number if it doesn't change the string
  37591. if (data === +data + "") {
  37592. return +data;
  37593. }
  37594. if (rbrace.test(data)) {
  37595. return JSON.parse(data);
  37596. }
  37597. return data;
  37598. }
  37599. function dataAttr(elem, key, data) {
  37600. var name;
  37601. // If nothing was found internally, try to fetch any
  37602. // data from the HTML5 data-* attribute
  37603. if (data === undefined && elem.nodeType === 1) {
  37604. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  37605. data = elem.getAttribute(name);
  37606. if (typeof data === "string") {
  37607. try {
  37608. data = getData(data);
  37609. } catch (e) {}
  37610. // Make sure we set the data so it isn't changed later
  37611. dataUser.set(elem, key, data);
  37612. } else {
  37613. data = undefined;
  37614. }
  37615. }
  37616. return data;
  37617. }
  37618. jQuery.extend({
  37619. hasData: function hasData(elem) {
  37620. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  37621. },
  37622. data: function data(elem, name, _data) {
  37623. return dataUser.access(elem, name, _data);
  37624. },
  37625. removeData: function removeData(elem, name) {
  37626. dataUser.remove(elem, name);
  37627. },
  37628. // TODO: Now that all calls to _data and _removeData have been replaced
  37629. // with direct calls to dataPriv methods, these can be deprecated.
  37630. _data: function _data(elem, name, data) {
  37631. return dataPriv.access(elem, name, data);
  37632. },
  37633. _removeData: function _removeData(elem, name) {
  37634. dataPriv.remove(elem, name);
  37635. }
  37636. });
  37637. jQuery.fn.extend({
  37638. data: function data(key, value) {
  37639. var i,
  37640. name,
  37641. data,
  37642. elem = this[0],
  37643. attrs = elem && elem.attributes;
  37644. // Gets all values
  37645. if (key === undefined) {
  37646. if (this.length) {
  37647. data = dataUser.get(elem);
  37648. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  37649. i = attrs.length;
  37650. while (i--) {
  37651. // Support: IE 11 only
  37652. // The attrs elements can be null (#14894)
  37653. if (attrs[i]) {
  37654. name = attrs[i].name;
  37655. if (name.indexOf("data-") === 0) {
  37656. name = camelCase(name.slice(5));
  37657. dataAttr(elem, name, data[name]);
  37658. }
  37659. }
  37660. }
  37661. dataPriv.set(elem, "hasDataAttrs", true);
  37662. }
  37663. }
  37664. return data;
  37665. }
  37666. // Sets multiple values
  37667. if ((typeof key === "undefined" ? "undefined" : _typeof(key)) === "object") {
  37668. return this.each(function () {
  37669. dataUser.set(this, key);
  37670. });
  37671. }
  37672. return access(this, function (value) {
  37673. var data;
  37674. // The calling jQuery object (element matches) is not empty
  37675. // (and therefore has an element appears at this[ 0 ]) and the
  37676. // `value` parameter was not undefined. An empty jQuery object
  37677. // will result in `undefined` for elem = this[ 0 ] which will
  37678. // throw an exception if an attempt to read a data cache is made.
  37679. if (elem && value === undefined) {
  37680. // Attempt to get data from the cache
  37681. // The key will always be camelCased in Data
  37682. data = dataUser.get(elem, key);
  37683. if (data !== undefined) {
  37684. return data;
  37685. }
  37686. // Attempt to "discover" the data in
  37687. // HTML5 custom data-* attrs
  37688. data = dataAttr(elem, key);
  37689. if (data !== undefined) {
  37690. return data;
  37691. }
  37692. // We tried really hard, but the data doesn't exist.
  37693. return;
  37694. }
  37695. // Set the data...
  37696. this.each(function () {
  37697. // We always store the camelCased key
  37698. dataUser.set(this, key, value);
  37699. });
  37700. }, null, value, arguments.length > 1, null, true);
  37701. },
  37702. removeData: function removeData(key) {
  37703. return this.each(function () {
  37704. dataUser.remove(this, key);
  37705. });
  37706. }
  37707. });
  37708. jQuery.extend({
  37709. queue: function queue(elem, type, data) {
  37710. var queue;
  37711. if (elem) {
  37712. type = (type || "fx") + "queue";
  37713. queue = dataPriv.get(elem, type);
  37714. // Speed up dequeue by getting out quickly if this is just a lookup
  37715. if (data) {
  37716. if (!queue || Array.isArray(data)) {
  37717. queue = dataPriv.access(elem, type, jQuery.makeArray(data));
  37718. } else {
  37719. queue.push(data);
  37720. }
  37721. }
  37722. return queue || [];
  37723. }
  37724. },
  37725. dequeue: function dequeue(elem, type) {
  37726. type = type || "fx";
  37727. var queue = jQuery.queue(elem, type),
  37728. startLength = queue.length,
  37729. fn = queue.shift(),
  37730. hooks = jQuery._queueHooks(elem, type),
  37731. next = function next() {
  37732. jQuery.dequeue(elem, type);
  37733. };
  37734. // If the fx queue is dequeued, always remove the progress sentinel
  37735. if (fn === "inprogress") {
  37736. fn = queue.shift();
  37737. startLength--;
  37738. }
  37739. if (fn) {
  37740. // Add a progress sentinel to prevent the fx queue from being
  37741. // automatically dequeued
  37742. if (type === "fx") {
  37743. queue.unshift("inprogress");
  37744. }
  37745. // Clear up the last queue stop function
  37746. delete hooks.stop;
  37747. fn.call(elem, next, hooks);
  37748. }
  37749. if (!startLength && hooks) {
  37750. hooks.empty.fire();
  37751. }
  37752. },
  37753. // Not public - generate a queueHooks object, or return the current one
  37754. _queueHooks: function _queueHooks(elem, type) {
  37755. var key = type + "queueHooks";
  37756. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  37757. empty: jQuery.Callbacks("once memory").add(function () {
  37758. dataPriv.remove(elem, [type + "queue", key]);
  37759. })
  37760. });
  37761. }
  37762. });
  37763. jQuery.fn.extend({
  37764. queue: function queue(type, data) {
  37765. var setter = 2;
  37766. if (typeof type !== "string") {
  37767. data = type;
  37768. type = "fx";
  37769. setter--;
  37770. }
  37771. if (arguments.length < setter) {
  37772. return jQuery.queue(this[0], type);
  37773. }
  37774. return data === undefined ? this : this.each(function () {
  37775. var queue = jQuery.queue(this, type, data);
  37776. // Ensure a hooks for this queue
  37777. jQuery._queueHooks(this, type);
  37778. if (type === "fx" && queue[0] !== "inprogress") {
  37779. jQuery.dequeue(this, type);
  37780. }
  37781. });
  37782. },
  37783. dequeue: function dequeue(type) {
  37784. return this.each(function () {
  37785. jQuery.dequeue(this, type);
  37786. });
  37787. },
  37788. clearQueue: function clearQueue(type) {
  37789. return this.queue(type || "fx", []);
  37790. },
  37791. // Get a promise resolved when queues of a certain type
  37792. // are emptied (fx is the type by default)
  37793. promise: function promise(type, obj) {
  37794. var tmp,
  37795. count = 1,
  37796. defer = jQuery.Deferred(),
  37797. elements = this,
  37798. i = this.length,
  37799. resolve = function resolve() {
  37800. if (! --count) {
  37801. defer.resolveWith(elements, [elements]);
  37802. }
  37803. };
  37804. if (typeof type !== "string") {
  37805. obj = type;
  37806. type = undefined;
  37807. }
  37808. type = type || "fx";
  37809. while (i--) {
  37810. tmp = dataPriv.get(elements[i], type + "queueHooks");
  37811. if (tmp && tmp.empty) {
  37812. count++;
  37813. tmp.empty.add(resolve);
  37814. }
  37815. }
  37816. resolve();
  37817. return defer.promise(obj);
  37818. }
  37819. });
  37820. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  37821. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  37822. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  37823. var isHiddenWithinTree = function isHiddenWithinTree(elem, el) {
  37824. // isHiddenWithinTree might be called from jQuery#filter function;
  37825. // in that case, element will be second argument
  37826. elem = el || elem;
  37827. // Inline style trumps all
  37828. return elem.style.display === "none" || elem.style.display === "" &&
  37829. // Otherwise, check computed style
  37830. // Support: Firefox <=43 - 45
  37831. // Disconnected elements can have computed display: none, so first confirm that elem is
  37832. // in the document.
  37833. jQuery.contains(elem.ownerDocument, elem) && jQuery.css(elem, "display") === "none";
  37834. };
  37835. var swap = function swap(elem, options, callback, args) {
  37836. var ret,
  37837. name,
  37838. old = {};
  37839. // Remember the old values, and insert the new ones
  37840. for (name in options) {
  37841. old[name] = elem.style[name];
  37842. elem.style[name] = options[name];
  37843. }
  37844. ret = callback.apply(elem, args || []);
  37845. // Revert the old values
  37846. for (name in options) {
  37847. elem.style[name] = old[name];
  37848. }
  37849. return ret;
  37850. };
  37851. function adjustCSS(elem, prop, valueParts, tween) {
  37852. var adjusted,
  37853. scale,
  37854. maxIterations = 20,
  37855. currentValue = tween ? function () {
  37856. return tween.cur();
  37857. } : function () {
  37858. return jQuery.css(elem, prop, "");
  37859. },
  37860. initial = currentValue(),
  37861. unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
  37862. // Starting value computation is required for potential unit mismatches
  37863. initialInUnit = (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
  37864. if (initialInUnit && initialInUnit[3] !== unit) {
  37865. // Support: Firefox <=54
  37866. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  37867. initial = initial / 2;
  37868. // Trust units reported by jQuery.css
  37869. unit = unit || initialInUnit[3];
  37870. // Iteratively approximate from a nonzero starting point
  37871. initialInUnit = +initial || 1;
  37872. while (maxIterations--) {
  37873. // Evaluate and update our best guess (doubling guesses that zero out).
  37874. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  37875. jQuery.style(elem, prop, initialInUnit + unit);
  37876. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  37877. maxIterations = 0;
  37878. }
  37879. initialInUnit = initialInUnit / scale;
  37880. }
  37881. initialInUnit = initialInUnit * 2;
  37882. jQuery.style(elem, prop, initialInUnit + unit);
  37883. // Make sure we update the tween properties later on
  37884. valueParts = valueParts || [];
  37885. }
  37886. if (valueParts) {
  37887. initialInUnit = +initialInUnit || +initial || 0;
  37888. // Apply relative offset (+=/-=) if specified
  37889. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  37890. if (tween) {
  37891. tween.unit = unit;
  37892. tween.start = initialInUnit;
  37893. tween.end = adjusted;
  37894. }
  37895. }
  37896. return adjusted;
  37897. }
  37898. var defaultDisplayMap = {};
  37899. function getDefaultDisplay(elem) {
  37900. var temp,
  37901. doc = elem.ownerDocument,
  37902. nodeName = elem.nodeName,
  37903. display = defaultDisplayMap[nodeName];
  37904. if (display) {
  37905. return display;
  37906. }
  37907. temp = doc.body.appendChild(doc.createElement(nodeName));
  37908. display = jQuery.css(temp, "display");
  37909. temp.parentNode.removeChild(temp);
  37910. if (display === "none") {
  37911. display = "block";
  37912. }
  37913. defaultDisplayMap[nodeName] = display;
  37914. return display;
  37915. }
  37916. function showHide(elements, show) {
  37917. var display,
  37918. elem,
  37919. values = [],
  37920. index = 0,
  37921. length = elements.length;
  37922. // Determine new display value for elements that need to change
  37923. for (; index < length; index++) {
  37924. elem = elements[index];
  37925. if (!elem.style) {
  37926. continue;
  37927. }
  37928. display = elem.style.display;
  37929. if (show) {
  37930. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  37931. // check is required in this first loop unless we have a nonempty display value (either
  37932. // inline or about-to-be-restored)
  37933. if (display === "none") {
  37934. values[index] = dataPriv.get(elem, "display") || null;
  37935. if (!values[index]) {
  37936. elem.style.display = "";
  37937. }
  37938. }
  37939. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  37940. values[index] = getDefaultDisplay(elem);
  37941. }
  37942. } else {
  37943. if (display !== "none") {
  37944. values[index] = "none";
  37945. // Remember what we're overwriting
  37946. dataPriv.set(elem, "display", display);
  37947. }
  37948. }
  37949. }
  37950. // Set the display of the elements in a second loop to avoid constant reflow
  37951. for (index = 0; index < length; index++) {
  37952. if (values[index] != null) {
  37953. elements[index].style.display = values[index];
  37954. }
  37955. }
  37956. return elements;
  37957. }
  37958. jQuery.fn.extend({
  37959. show: function show() {
  37960. return showHide(this, true);
  37961. },
  37962. hide: function hide() {
  37963. return showHide(this);
  37964. },
  37965. toggle: function toggle(state) {
  37966. if (typeof state === "boolean") {
  37967. return state ? this.show() : this.hide();
  37968. }
  37969. return this.each(function () {
  37970. if (isHiddenWithinTree(this)) {
  37971. jQuery(this).show();
  37972. } else {
  37973. jQuery(this).hide();
  37974. }
  37975. });
  37976. }
  37977. });
  37978. var rcheckableType = /^(?:checkbox|radio)$/i;
  37979. var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i;
  37980. var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  37981. // We have to close these tags to support XHTML (#13200)
  37982. var wrapMap = {
  37983. // Support: IE <=9 only
  37984. option: [1, "<select multiple='multiple'>", "</select>"],
  37985. // XHTML parsers do not magically insert elements in the
  37986. // same way that tag soup parsers do. So we cannot shorten
  37987. // this by omitting <tbody> or other required elements.
  37988. thead: [1, "<table>", "</table>"],
  37989. col: [2, "<table><colgroup>", "</colgroup></table>"],
  37990. tr: [2, "<table><tbody>", "</tbody></table>"],
  37991. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  37992. _default: [0, "", ""]
  37993. };
  37994. // Support: IE <=9 only
  37995. wrapMap.optgroup = wrapMap.option;
  37996. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  37997. wrapMap.th = wrapMap.td;
  37998. function getAll(context, tag) {
  37999. // Support: IE <=9 - 11 only
  38000. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  38001. var ret;
  38002. if (typeof context.getElementsByTagName !== "undefined") {
  38003. ret = context.getElementsByTagName(tag || "*");
  38004. } else if (typeof context.querySelectorAll !== "undefined") {
  38005. ret = context.querySelectorAll(tag || "*");
  38006. } else {
  38007. ret = [];
  38008. }
  38009. if (tag === undefined || tag && nodeName(context, tag)) {
  38010. return jQuery.merge([context], ret);
  38011. }
  38012. return ret;
  38013. }
  38014. // Mark scripts as having already been evaluated
  38015. function setGlobalEval(elems, refElements) {
  38016. var i = 0,
  38017. l = elems.length;
  38018. for (; i < l; i++) {
  38019. dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval"));
  38020. }
  38021. }
  38022. var rhtml = /<|&#?\w+;/;
  38023. function buildFragment(elems, context, scripts, selection, ignored) {
  38024. var elem,
  38025. tmp,
  38026. tag,
  38027. wrap,
  38028. contains,
  38029. j,
  38030. fragment = context.createDocumentFragment(),
  38031. nodes = [],
  38032. i = 0,
  38033. l = elems.length;
  38034. for (; i < l; i++) {
  38035. elem = elems[i];
  38036. if (elem || elem === 0) {
  38037. // Add nodes directly
  38038. if (toType(elem) === "object") {
  38039. // Support: Android <=4.0 only, PhantomJS 1 only
  38040. // push.apply(_, arraylike) throws on ancient WebKit
  38041. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  38042. // Convert non-html into a text node
  38043. } else if (!rhtml.test(elem)) {
  38044. nodes.push(context.createTextNode(elem));
  38045. // Convert html into DOM nodes
  38046. } else {
  38047. tmp = tmp || fragment.appendChild(context.createElement("div"));
  38048. // Deserialize a standard representation
  38049. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  38050. wrap = wrapMap[tag] || wrapMap._default;
  38051. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  38052. // Descend through wrappers to the right content
  38053. j = wrap[0];
  38054. while (j--) {
  38055. tmp = tmp.lastChild;
  38056. }
  38057. // Support: Android <=4.0 only, PhantomJS 1 only
  38058. // push.apply(_, arraylike) throws on ancient WebKit
  38059. jQuery.merge(nodes, tmp.childNodes);
  38060. // Remember the top-level container
  38061. tmp = fragment.firstChild;
  38062. // Ensure the created nodes are orphaned (#12392)
  38063. tmp.textContent = "";
  38064. }
  38065. }
  38066. }
  38067. // Remove wrapper from fragment
  38068. fragment.textContent = "";
  38069. i = 0;
  38070. while (elem = nodes[i++]) {
  38071. // Skip elements already in the context collection (trac-4087)
  38072. if (selection && jQuery.inArray(elem, selection) > -1) {
  38073. if (ignored) {
  38074. ignored.push(elem);
  38075. }
  38076. continue;
  38077. }
  38078. contains = jQuery.contains(elem.ownerDocument, elem);
  38079. // Append to fragment
  38080. tmp = getAll(fragment.appendChild(elem), "script");
  38081. // Preserve script evaluation history
  38082. if (contains) {
  38083. setGlobalEval(tmp);
  38084. }
  38085. // Capture executables
  38086. if (scripts) {
  38087. j = 0;
  38088. while (elem = tmp[j++]) {
  38089. if (rscriptType.test(elem.type || "")) {
  38090. scripts.push(elem);
  38091. }
  38092. }
  38093. }
  38094. }
  38095. return fragment;
  38096. }
  38097. (function () {
  38098. var fragment = document.createDocumentFragment(),
  38099. div = fragment.appendChild(document.createElement("div")),
  38100. input = document.createElement("input");
  38101. // Support: Android 4.0 - 4.3 only
  38102. // Check state lost if the name is set (#11217)
  38103. // Support: Windows Web Apps (WWA)
  38104. // `name` and `type` must use .setAttribute for WWA (#14901)
  38105. input.setAttribute("type", "radio");
  38106. input.setAttribute("checked", "checked");
  38107. input.setAttribute("name", "t");
  38108. div.appendChild(input);
  38109. // Support: Android <=4.1 only
  38110. // Older WebKit doesn't clone checked state correctly in fragments
  38111. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  38112. // Support: IE <=11 only
  38113. // Make sure textarea (and checkbox) defaultValue is properly cloned
  38114. div.innerHTML = "<textarea>x</textarea>";
  38115. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  38116. })();
  38117. var documentElement = document.documentElement;
  38118. var rkeyEvent = /^key/,
  38119. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  38120. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  38121. function returnTrue() {
  38122. return true;
  38123. }
  38124. function returnFalse() {
  38125. return false;
  38126. }
  38127. // Support: IE <=9 only
  38128. // See #13393 for more info
  38129. function safeActiveElement() {
  38130. try {
  38131. return document.activeElement;
  38132. } catch (err) {}
  38133. }
  38134. function _on(elem, types, selector, data, fn, one) {
  38135. var origFn, type;
  38136. // Types can be a map of types/handlers
  38137. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  38138. // ( types-Object, selector, data )
  38139. if (typeof selector !== "string") {
  38140. // ( types-Object, data )
  38141. data = data || selector;
  38142. selector = undefined;
  38143. }
  38144. for (type in types) {
  38145. _on(elem, type, selector, data, types[type], one);
  38146. }
  38147. return elem;
  38148. }
  38149. if (data == null && fn == null) {
  38150. // ( types, fn )
  38151. fn = selector;
  38152. data = selector = undefined;
  38153. } else if (fn == null) {
  38154. if (typeof selector === "string") {
  38155. // ( types, selector, fn )
  38156. fn = data;
  38157. data = undefined;
  38158. } else {
  38159. // ( types, data, fn )
  38160. fn = data;
  38161. data = selector;
  38162. selector = undefined;
  38163. }
  38164. }
  38165. if (fn === false) {
  38166. fn = returnFalse;
  38167. } else if (!fn) {
  38168. return elem;
  38169. }
  38170. if (one === 1) {
  38171. origFn = fn;
  38172. fn = function fn(event) {
  38173. // Can use an empty set, since event contains the info
  38174. jQuery().off(event);
  38175. return origFn.apply(this, arguments);
  38176. };
  38177. // Use same guid so caller can remove using origFn
  38178. fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  38179. }
  38180. return elem.each(function () {
  38181. jQuery.event.add(this, types, fn, data, selector);
  38182. });
  38183. }
  38184. /*
  38185. * Helper functions for managing events -- not part of the public interface.
  38186. * Props to Dean Edwards' addEvent library for many of the ideas.
  38187. */
  38188. jQuery.event = {
  38189. global: {},
  38190. add: function add(elem, types, handler, data, selector) {
  38191. var handleObjIn,
  38192. eventHandle,
  38193. tmp,
  38194. events,
  38195. t,
  38196. handleObj,
  38197. special,
  38198. handlers,
  38199. type,
  38200. namespaces,
  38201. origType,
  38202. elemData = dataPriv.get(elem);
  38203. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  38204. if (!elemData) {
  38205. return;
  38206. }
  38207. // Caller can pass in an object of custom data in lieu of the handler
  38208. if (handler.handler) {
  38209. handleObjIn = handler;
  38210. handler = handleObjIn.handler;
  38211. selector = handleObjIn.selector;
  38212. }
  38213. // Ensure that invalid selectors throw exceptions at attach time
  38214. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  38215. if (selector) {
  38216. jQuery.find.matchesSelector(documentElement, selector);
  38217. }
  38218. // Make sure that the handler has a unique ID, used to find/remove it later
  38219. if (!handler.guid) {
  38220. handler.guid = jQuery.guid++;
  38221. }
  38222. // Init the element's event structure and main handler, if this is the first
  38223. if (!(events = elemData.events)) {
  38224. events = elemData.events = {};
  38225. }
  38226. if (!(eventHandle = elemData.handle)) {
  38227. eventHandle = elemData.handle = function (e) {
  38228. // Discard the second event of a jQuery.event.trigger() and
  38229. // when an event is called after a page has unloaded
  38230. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;
  38231. };
  38232. }
  38233. // Handle multiple events separated by a space
  38234. types = (types || "").match(rnothtmlwhite) || [""];
  38235. t = types.length;
  38236. while (t--) {
  38237. tmp = rtypenamespace.exec(types[t]) || [];
  38238. type = origType = tmp[1];
  38239. namespaces = (tmp[2] || "").split(".").sort();
  38240. // There *must* be a type, no attaching namespace-only handlers
  38241. if (!type) {
  38242. continue;
  38243. }
  38244. // If event changes its type, use the special event handlers for the changed type
  38245. special = jQuery.event.special[type] || {};
  38246. // If selector defined, determine special event api type, otherwise given type
  38247. type = (selector ? special.delegateType : special.bindType) || type;
  38248. // Update special based on newly reset type
  38249. special = jQuery.event.special[type] || {};
  38250. // handleObj is passed to all event handlers
  38251. handleObj = jQuery.extend({
  38252. type: type,
  38253. origType: origType,
  38254. data: data,
  38255. handler: handler,
  38256. guid: handler.guid,
  38257. selector: selector,
  38258. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  38259. namespace: namespaces.join(".")
  38260. }, handleObjIn);
  38261. // Init the event handler queue if we're the first
  38262. if (!(handlers = events[type])) {
  38263. handlers = events[type] = [];
  38264. handlers.delegateCount = 0;
  38265. // Only use addEventListener if the special events handler returns false
  38266. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  38267. if (elem.addEventListener) {
  38268. elem.addEventListener(type, eventHandle);
  38269. }
  38270. }
  38271. }
  38272. if (special.add) {
  38273. special.add.call(elem, handleObj);
  38274. if (!handleObj.handler.guid) {
  38275. handleObj.handler.guid = handler.guid;
  38276. }
  38277. }
  38278. // Add to the element's handler list, delegates in front
  38279. if (selector) {
  38280. handlers.splice(handlers.delegateCount++, 0, handleObj);
  38281. } else {
  38282. handlers.push(handleObj);
  38283. }
  38284. // Keep track of which events have ever been used, for event optimization
  38285. jQuery.event.global[type] = true;
  38286. }
  38287. },
  38288. // Detach an event or set of events from an element
  38289. remove: function remove(elem, types, handler, selector, mappedTypes) {
  38290. var j,
  38291. origCount,
  38292. tmp,
  38293. events,
  38294. t,
  38295. handleObj,
  38296. special,
  38297. handlers,
  38298. type,
  38299. namespaces,
  38300. origType,
  38301. elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  38302. if (!elemData || !(events = elemData.events)) {
  38303. return;
  38304. }
  38305. // Once for each type.namespace in types; type may be omitted
  38306. types = (types || "").match(rnothtmlwhite) || [""];
  38307. t = types.length;
  38308. while (t--) {
  38309. tmp = rtypenamespace.exec(types[t]) || [];
  38310. type = origType = tmp[1];
  38311. namespaces = (tmp[2] || "").split(".").sort();
  38312. // Unbind all events (on this namespace, if provided) for the element
  38313. if (!type) {
  38314. for (type in events) {
  38315. jQuery.event.remove(elem, type + types[t], handler, selector, true);
  38316. }
  38317. continue;
  38318. }
  38319. special = jQuery.event.special[type] || {};
  38320. type = (selector ? special.delegateType : special.bindType) || type;
  38321. handlers = events[type] || [];
  38322. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  38323. // Remove matching events
  38324. origCount = j = handlers.length;
  38325. while (j--) {
  38326. handleObj = handlers[j];
  38327. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  38328. handlers.splice(j, 1);
  38329. if (handleObj.selector) {
  38330. handlers.delegateCount--;
  38331. }
  38332. if (special.remove) {
  38333. special.remove.call(elem, handleObj);
  38334. }
  38335. }
  38336. }
  38337. // Remove generic event handler if we removed something and no more handlers exist
  38338. // (avoids potential for endless recursion during removal of special event handlers)
  38339. if (origCount && !handlers.length) {
  38340. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  38341. jQuery.removeEvent(elem, type, elemData.handle);
  38342. }
  38343. delete events[type];
  38344. }
  38345. }
  38346. // Remove data and the expando if it's no longer used
  38347. if (jQuery.isEmptyObject(events)) {
  38348. dataPriv.remove(elem, "handle events");
  38349. }
  38350. },
  38351. dispatch: function dispatch(nativeEvent) {
  38352. // Make a writable jQuery.Event from the native event object
  38353. var event = jQuery.event.fix(nativeEvent);
  38354. var i,
  38355. j,
  38356. ret,
  38357. matched,
  38358. handleObj,
  38359. handlerQueue,
  38360. args = new Array(arguments.length),
  38361. handlers = (dataPriv.get(this, "events") || {})[event.type] || [],
  38362. special = jQuery.event.special[event.type] || {};
  38363. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  38364. args[0] = event;
  38365. for (i = 1; i < arguments.length; i++) {
  38366. args[i] = arguments[i];
  38367. }
  38368. event.delegateTarget = this;
  38369. // Call the preDispatch hook for the mapped type, and let it bail if desired
  38370. if (special.preDispatch && special.preDispatch.call(this, event) === false) {
  38371. return;
  38372. }
  38373. // Determine handlers
  38374. handlerQueue = jQuery.event.handlers.call(this, event, handlers);
  38375. // Run delegates first; they may want to stop propagation beneath us
  38376. i = 0;
  38377. while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
  38378. event.currentTarget = matched.elem;
  38379. j = 0;
  38380. while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
  38381. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  38382. // a subset or equal to those in the bound event (both can have no namespace).
  38383. if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {
  38384. event.handleObj = handleObj;
  38385. event.data = handleObj.data;
  38386. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  38387. if (ret !== undefined) {
  38388. if ((event.result = ret) === false) {
  38389. event.preventDefault();
  38390. event.stopPropagation();
  38391. }
  38392. }
  38393. }
  38394. }
  38395. }
  38396. // Call the postDispatch hook for the mapped type
  38397. if (special.postDispatch) {
  38398. special.postDispatch.call(this, event);
  38399. }
  38400. return event.result;
  38401. },
  38402. handlers: function handlers(event, _handlers) {
  38403. var i,
  38404. handleObj,
  38405. sel,
  38406. matchedHandlers,
  38407. matchedSelectors,
  38408. handlerQueue = [],
  38409. delegateCount = _handlers.delegateCount,
  38410. cur = event.target;
  38411. // Find delegate handlers
  38412. if (delegateCount &&
  38413. // Support: IE <=9
  38414. // Black-hole SVG <use> instance trees (trac-13180)
  38415. cur.nodeType &&
  38416. // Support: Firefox <=42
  38417. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  38418. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  38419. // Support: IE 11 only
  38420. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  38421. !(event.type === "click" && event.button >= 1)) {
  38422. for (; cur !== this; cur = cur.parentNode || this) {
  38423. // Don't check non-elements (#13208)
  38424. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  38425. if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
  38426. matchedHandlers = [];
  38427. matchedSelectors = {};
  38428. for (i = 0; i < delegateCount; i++) {
  38429. handleObj = _handlers[i];
  38430. // Don't conflict with Object.prototype properties (#13203)
  38431. sel = handleObj.selector + " ";
  38432. if (matchedSelectors[sel] === undefined) {
  38433. matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  38434. }
  38435. if (matchedSelectors[sel]) {
  38436. matchedHandlers.push(handleObj);
  38437. }
  38438. }
  38439. if (matchedHandlers.length) {
  38440. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  38441. }
  38442. }
  38443. }
  38444. }
  38445. // Add the remaining (directly-bound) handlers
  38446. cur = this;
  38447. if (delegateCount < _handlers.length) {
  38448. handlerQueue.push({ elem: cur, handlers: _handlers.slice(delegateCount) });
  38449. }
  38450. return handlerQueue;
  38451. },
  38452. addProp: function addProp(name, hook) {
  38453. Object.defineProperty(jQuery.Event.prototype, name, {
  38454. enumerable: true,
  38455. configurable: true,
  38456. get: isFunction(hook) ? function () {
  38457. if (this.originalEvent) {
  38458. return hook(this.originalEvent);
  38459. }
  38460. } : function () {
  38461. if (this.originalEvent) {
  38462. return this.originalEvent[name];
  38463. }
  38464. },
  38465. set: function set(value) {
  38466. Object.defineProperty(this, name, {
  38467. enumerable: true,
  38468. configurable: true,
  38469. writable: true,
  38470. value: value
  38471. });
  38472. }
  38473. });
  38474. },
  38475. fix: function fix(originalEvent) {
  38476. return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
  38477. },
  38478. special: {
  38479. load: {
  38480. // Prevent triggered image.load events from bubbling to window.load
  38481. noBubble: true
  38482. },
  38483. focus: {
  38484. // Fire native event if possible so blur/focus sequence is correct
  38485. trigger: function trigger() {
  38486. if (this !== safeActiveElement() && this.focus) {
  38487. this.focus();
  38488. return false;
  38489. }
  38490. },
  38491. delegateType: "focusin"
  38492. },
  38493. blur: {
  38494. trigger: function trigger() {
  38495. if (this === safeActiveElement() && this.blur) {
  38496. this.blur();
  38497. return false;
  38498. }
  38499. },
  38500. delegateType: "focusout"
  38501. },
  38502. click: {
  38503. // For checkbox, fire native event so checked state will be right
  38504. trigger: function trigger() {
  38505. if (this.type === "checkbox" && this.click && nodeName(this, "input")) {
  38506. this.click();
  38507. return false;
  38508. }
  38509. },
  38510. // For cross-browser consistency, don't fire native .click() on links
  38511. _default: function _default(event) {
  38512. return nodeName(event.target, "a");
  38513. }
  38514. },
  38515. beforeunload: {
  38516. postDispatch: function postDispatch(event) {
  38517. // Support: Firefox 20+
  38518. // Firefox doesn't alert if the returnValue field is not set.
  38519. if (event.result !== undefined && event.originalEvent) {
  38520. event.originalEvent.returnValue = event.result;
  38521. }
  38522. }
  38523. }
  38524. }
  38525. };
  38526. jQuery.removeEvent = function (elem, type, handle) {
  38527. // This "if" is needed for plain objects
  38528. if (elem.removeEventListener) {
  38529. elem.removeEventListener(type, handle);
  38530. }
  38531. };
  38532. jQuery.Event = function (src, props) {
  38533. // Allow instantiation without the 'new' keyword
  38534. if (!(this instanceof jQuery.Event)) {
  38535. return new jQuery.Event(src, props);
  38536. }
  38537. // Event object
  38538. if (src && src.type) {
  38539. this.originalEvent = src;
  38540. this.type = src.type;
  38541. // Events bubbling up the document may have been marked as prevented
  38542. // by a handler lower down the tree; reflect the correct value.
  38543. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&
  38544. // Support: Android <=2.3 only
  38545. src.returnValue === false ? returnTrue : returnFalse;
  38546. // Create target properties
  38547. // Support: Safari <=6 - 7 only
  38548. // Target should not be a text node (#504, #13143)
  38549. this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
  38550. this.currentTarget = src.currentTarget;
  38551. this.relatedTarget = src.relatedTarget;
  38552. // Event type
  38553. } else {
  38554. this.type = src;
  38555. }
  38556. // Put explicitly provided properties onto the event object
  38557. if (props) {
  38558. jQuery.extend(this, props);
  38559. }
  38560. // Create a timestamp if incoming event doesn't have one
  38561. this.timeStamp = src && src.timeStamp || Date.now();
  38562. // Mark it as fixed
  38563. this[jQuery.expando] = true;
  38564. };
  38565. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  38566. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  38567. jQuery.Event.prototype = {
  38568. constructor: jQuery.Event,
  38569. isDefaultPrevented: returnFalse,
  38570. isPropagationStopped: returnFalse,
  38571. isImmediatePropagationStopped: returnFalse,
  38572. isSimulated: false,
  38573. preventDefault: function preventDefault() {
  38574. var e = this.originalEvent;
  38575. this.isDefaultPrevented = returnTrue;
  38576. if (e && !this.isSimulated) {
  38577. e.preventDefault();
  38578. }
  38579. },
  38580. stopPropagation: function stopPropagation() {
  38581. var e = this.originalEvent;
  38582. this.isPropagationStopped = returnTrue;
  38583. if (e && !this.isSimulated) {
  38584. e.stopPropagation();
  38585. }
  38586. },
  38587. stopImmediatePropagation: function stopImmediatePropagation() {
  38588. var e = this.originalEvent;
  38589. this.isImmediatePropagationStopped = returnTrue;
  38590. if (e && !this.isSimulated) {
  38591. e.stopImmediatePropagation();
  38592. }
  38593. this.stopPropagation();
  38594. }
  38595. };
  38596. // Includes all common event props including KeyEvent and MouseEvent specific props
  38597. jQuery.each({
  38598. altKey: true,
  38599. bubbles: true,
  38600. cancelable: true,
  38601. changedTouches: true,
  38602. ctrlKey: true,
  38603. detail: true,
  38604. eventPhase: true,
  38605. metaKey: true,
  38606. pageX: true,
  38607. pageY: true,
  38608. shiftKey: true,
  38609. view: true,
  38610. "char": true,
  38611. charCode: true,
  38612. key: true,
  38613. keyCode: true,
  38614. button: true,
  38615. buttons: true,
  38616. clientX: true,
  38617. clientY: true,
  38618. offsetX: true,
  38619. offsetY: true,
  38620. pointerId: true,
  38621. pointerType: true,
  38622. screenX: true,
  38623. screenY: true,
  38624. targetTouches: true,
  38625. toElement: true,
  38626. touches: true,
  38627. which: function which(event) {
  38628. var button = event.button;
  38629. // Add which for key events
  38630. if (event.which == null && rkeyEvent.test(event.type)) {
  38631. return event.charCode != null ? event.charCode : event.keyCode;
  38632. }
  38633. // Add which for click: 1 === left; 2 === middle; 3 === right
  38634. if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {
  38635. if (button & 1) {
  38636. return 1;
  38637. }
  38638. if (button & 2) {
  38639. return 3;
  38640. }
  38641. if (button & 4) {
  38642. return 2;
  38643. }
  38644. return 0;
  38645. }
  38646. return event.which;
  38647. }
  38648. }, jQuery.event.addProp);
  38649. // Create mouseenter/leave events using mouseover/out and event-time checks
  38650. // so that event delegation works in jQuery.
  38651. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  38652. //
  38653. // Support: Safari 7 only
  38654. // Safari sends mouseenter too often; see:
  38655. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  38656. // for the description of the bug (it existed in older Chrome versions as well).
  38657. jQuery.each({
  38658. mouseenter: "mouseover",
  38659. mouseleave: "mouseout",
  38660. pointerenter: "pointerover",
  38661. pointerleave: "pointerout"
  38662. }, function (orig, fix) {
  38663. jQuery.event.special[orig] = {
  38664. delegateType: fix,
  38665. bindType: fix,
  38666. handle: function handle(event) {
  38667. var ret,
  38668. target = this,
  38669. related = event.relatedTarget,
  38670. handleObj = event.handleObj;
  38671. // For mouseenter/leave call the handler if related is outside the target.
  38672. // NB: No relatedTarget if the mouse left/entered the browser window
  38673. if (!related || related !== target && !jQuery.contains(target, related)) {
  38674. event.type = handleObj.origType;
  38675. ret = handleObj.handler.apply(this, arguments);
  38676. event.type = fix;
  38677. }
  38678. return ret;
  38679. }
  38680. };
  38681. });
  38682. jQuery.fn.extend({
  38683. on: function on(types, selector, data, fn) {
  38684. return _on(this, types, selector, data, fn);
  38685. },
  38686. one: function one(types, selector, data, fn) {
  38687. return _on(this, types, selector, data, fn, 1);
  38688. },
  38689. off: function off(types, selector, fn) {
  38690. var handleObj, type;
  38691. if (types && types.preventDefault && types.handleObj) {
  38692. // ( event ) dispatched jQuery.Event
  38693. handleObj = types.handleObj;
  38694. jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
  38695. return this;
  38696. }
  38697. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  38698. // ( types-object [, selector] )
  38699. for (type in types) {
  38700. this.off(type, selector, types[type]);
  38701. }
  38702. return this;
  38703. }
  38704. if (selector === false || typeof selector === "function") {
  38705. // ( types [, fn] )
  38706. fn = selector;
  38707. selector = undefined;
  38708. }
  38709. if (fn === false) {
  38710. fn = returnFalse;
  38711. }
  38712. return this.each(function () {
  38713. jQuery.event.remove(this, types, fn, selector);
  38714. });
  38715. }
  38716. });
  38717. var
  38718. /* eslint-disable max-len */
  38719. // See https://github.com/eslint/eslint/issues/3229
  38720. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  38721. /* eslint-enable */
  38722. // Support: IE <=10 - 11, Edge 12 - 13 only
  38723. // In IE/Edge using regex groups here causes severe slowdowns.
  38724. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  38725. rnoInnerhtml = /<script|<style|<link/i,
  38726. // checked="checked" or checked
  38727. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  38728. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  38729. // Prefer a tbody over its parent table for containing new rows
  38730. function manipulationTarget(elem, content) {
  38731. if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  38732. return jQuery(elem).children("tbody")[0] || elem;
  38733. }
  38734. return elem;
  38735. }
  38736. // Replace/restore the type attribute of script elements for safe DOM manipulation
  38737. function disableScript(elem) {
  38738. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  38739. return elem;
  38740. }
  38741. function restoreScript(elem) {
  38742. if ((elem.type || "").slice(0, 5) === "true/") {
  38743. elem.type = elem.type.slice(5);
  38744. } else {
  38745. elem.removeAttribute("type");
  38746. }
  38747. return elem;
  38748. }
  38749. function cloneCopyEvent(src, dest) {
  38750. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  38751. if (dest.nodeType !== 1) {
  38752. return;
  38753. }
  38754. // 1. Copy private data: events, handlers, etc.
  38755. if (dataPriv.hasData(src)) {
  38756. pdataOld = dataPriv.access(src);
  38757. pdataCur = dataPriv.set(dest, pdataOld);
  38758. events = pdataOld.events;
  38759. if (events) {
  38760. delete pdataCur.handle;
  38761. pdataCur.events = {};
  38762. for (type in events) {
  38763. for (i = 0, l = events[type].length; i < l; i++) {
  38764. jQuery.event.add(dest, type, events[type][i]);
  38765. }
  38766. }
  38767. }
  38768. }
  38769. // 2. Copy user data
  38770. if (dataUser.hasData(src)) {
  38771. udataOld = dataUser.access(src);
  38772. udataCur = jQuery.extend({}, udataOld);
  38773. dataUser.set(dest, udataCur);
  38774. }
  38775. }
  38776. // Fix IE bugs, see support tests
  38777. function fixInput(src, dest) {
  38778. var nodeName = dest.nodeName.toLowerCase();
  38779. // Fails to persist the checked state of a cloned checkbox or radio button.
  38780. if (nodeName === "input" && rcheckableType.test(src.type)) {
  38781. dest.checked = src.checked;
  38782. // Fails to return the selected option to the default selected state when cloning options
  38783. } else if (nodeName === "input" || nodeName === "textarea") {
  38784. dest.defaultValue = src.defaultValue;
  38785. }
  38786. }
  38787. function domManip(collection, args, callback, ignored) {
  38788. // Flatten any nested arrays
  38789. args = concat.apply([], args);
  38790. var fragment,
  38791. first,
  38792. scripts,
  38793. hasScripts,
  38794. node,
  38795. doc,
  38796. i = 0,
  38797. l = collection.length,
  38798. iNoClone = l - 1,
  38799. value = args[0],
  38800. valueIsFunction = isFunction(value);
  38801. // We can't cloneNode fragments that contain checked, in WebKit
  38802. if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
  38803. return collection.each(function (index) {
  38804. var self = collection.eq(index);
  38805. if (valueIsFunction) {
  38806. args[0] = value.call(this, index, self.html());
  38807. }
  38808. domManip(self, args, callback, ignored);
  38809. });
  38810. }
  38811. if (l) {
  38812. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  38813. first = fragment.firstChild;
  38814. if (fragment.childNodes.length === 1) {
  38815. fragment = first;
  38816. }
  38817. // Require either new content or an interest in ignored elements to invoke the callback
  38818. if (first || ignored) {
  38819. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  38820. hasScripts = scripts.length;
  38821. // Use the original fragment for the last item
  38822. // instead of the first because it can end up
  38823. // being emptied incorrectly in certain situations (#8070).
  38824. for (; i < l; i++) {
  38825. node = fragment;
  38826. if (i !== iNoClone) {
  38827. node = jQuery.clone(node, true, true);
  38828. // Keep references to cloned scripts for later restoration
  38829. if (hasScripts) {
  38830. // Support: Android <=4.0 only, PhantomJS 1 only
  38831. // push.apply(_, arraylike) throws on ancient WebKit
  38832. jQuery.merge(scripts, getAll(node, "script"));
  38833. }
  38834. }
  38835. callback.call(collection[i], node, i);
  38836. }
  38837. if (hasScripts) {
  38838. doc = scripts[scripts.length - 1].ownerDocument;
  38839. // Reenable scripts
  38840. jQuery.map(scripts, restoreScript);
  38841. // Evaluate executable scripts on first document insertion
  38842. for (i = 0; i < hasScripts; i++) {
  38843. node = scripts[i];
  38844. if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
  38845. if (node.src && (node.type || "").toLowerCase() !== "module") {
  38846. // Optional AJAX dependency, but won't run scripts if not present
  38847. if (jQuery._evalUrl) {
  38848. jQuery._evalUrl(node.src);
  38849. }
  38850. } else {
  38851. DOMEval(node.textContent.replace(rcleanScript, ""), doc, node);
  38852. }
  38853. }
  38854. }
  38855. }
  38856. }
  38857. }
  38858. return collection;
  38859. }
  38860. function _remove(elem, selector, keepData) {
  38861. var node,
  38862. nodes = selector ? jQuery.filter(selector, elem) : elem,
  38863. i = 0;
  38864. for (; (node = nodes[i]) != null; i++) {
  38865. if (!keepData && node.nodeType === 1) {
  38866. jQuery.cleanData(getAll(node));
  38867. }
  38868. if (node.parentNode) {
  38869. if (keepData && jQuery.contains(node.ownerDocument, node)) {
  38870. setGlobalEval(getAll(node, "script"));
  38871. }
  38872. node.parentNode.removeChild(node);
  38873. }
  38874. }
  38875. return elem;
  38876. }
  38877. jQuery.extend({
  38878. htmlPrefilter: function htmlPrefilter(html) {
  38879. return html.replace(rxhtmlTag, "<$1></$2>");
  38880. },
  38881. clone: function clone(elem, dataAndEvents, deepDataAndEvents) {
  38882. var i,
  38883. l,
  38884. srcElements,
  38885. destElements,
  38886. clone = elem.cloneNode(true),
  38887. inPage = jQuery.contains(elem.ownerDocument, elem);
  38888. // Fix IE cloning issues
  38889. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  38890. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  38891. destElements = getAll(clone);
  38892. srcElements = getAll(elem);
  38893. for (i = 0, l = srcElements.length; i < l; i++) {
  38894. fixInput(srcElements[i], destElements[i]);
  38895. }
  38896. }
  38897. // Copy the events from the original to the clone
  38898. if (dataAndEvents) {
  38899. if (deepDataAndEvents) {
  38900. srcElements = srcElements || getAll(elem);
  38901. destElements = destElements || getAll(clone);
  38902. for (i = 0, l = srcElements.length; i < l; i++) {
  38903. cloneCopyEvent(srcElements[i], destElements[i]);
  38904. }
  38905. } else {
  38906. cloneCopyEvent(elem, clone);
  38907. }
  38908. }
  38909. // Preserve script evaluation history
  38910. destElements = getAll(clone, "script");
  38911. if (destElements.length > 0) {
  38912. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  38913. }
  38914. // Return the cloned set
  38915. return clone;
  38916. },
  38917. cleanData: function cleanData(elems) {
  38918. var data,
  38919. elem,
  38920. type,
  38921. special = jQuery.event.special,
  38922. i = 0;
  38923. for (; (elem = elems[i]) !== undefined; i++) {
  38924. if (acceptData(elem)) {
  38925. if (data = elem[dataPriv.expando]) {
  38926. if (data.events) {
  38927. for (type in data.events) {
  38928. if (special[type]) {
  38929. jQuery.event.remove(elem, type);
  38930. // This is a shortcut to avoid jQuery.event.remove's overhead
  38931. } else {
  38932. jQuery.removeEvent(elem, type, data.handle);
  38933. }
  38934. }
  38935. }
  38936. // Support: Chrome <=35 - 45+
  38937. // Assign undefined instead of using delete, see Data#remove
  38938. elem[dataPriv.expando] = undefined;
  38939. }
  38940. if (elem[dataUser.expando]) {
  38941. // Support: Chrome <=35 - 45+
  38942. // Assign undefined instead of using delete, see Data#remove
  38943. elem[dataUser.expando] = undefined;
  38944. }
  38945. }
  38946. }
  38947. }
  38948. });
  38949. jQuery.fn.extend({
  38950. detach: function detach(selector) {
  38951. return _remove(this, selector, true);
  38952. },
  38953. remove: function remove(selector) {
  38954. return _remove(this, selector);
  38955. },
  38956. text: function text(value) {
  38957. return access(this, function (value) {
  38958. return value === undefined ? jQuery.text(this) : this.empty().each(function () {
  38959. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  38960. this.textContent = value;
  38961. }
  38962. });
  38963. }, null, value, arguments.length);
  38964. },
  38965. append: function append() {
  38966. return domManip(this, arguments, function (elem) {
  38967. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  38968. var target = manipulationTarget(this, elem);
  38969. target.appendChild(elem);
  38970. }
  38971. });
  38972. },
  38973. prepend: function prepend() {
  38974. return domManip(this, arguments, function (elem) {
  38975. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  38976. var target = manipulationTarget(this, elem);
  38977. target.insertBefore(elem, target.firstChild);
  38978. }
  38979. });
  38980. },
  38981. before: function before() {
  38982. return domManip(this, arguments, function (elem) {
  38983. if (this.parentNode) {
  38984. this.parentNode.insertBefore(elem, this);
  38985. }
  38986. });
  38987. },
  38988. after: function after() {
  38989. return domManip(this, arguments, function (elem) {
  38990. if (this.parentNode) {
  38991. this.parentNode.insertBefore(elem, this.nextSibling);
  38992. }
  38993. });
  38994. },
  38995. empty: function empty() {
  38996. var elem,
  38997. i = 0;
  38998. for (; (elem = this[i]) != null; i++) {
  38999. if (elem.nodeType === 1) {
  39000. // Prevent memory leaks
  39001. jQuery.cleanData(getAll(elem, false));
  39002. // Remove any remaining nodes
  39003. elem.textContent = "";
  39004. }
  39005. }
  39006. return this;
  39007. },
  39008. clone: function clone(dataAndEvents, deepDataAndEvents) {
  39009. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  39010. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  39011. return this.map(function () {
  39012. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  39013. });
  39014. },
  39015. html: function html(value) {
  39016. return access(this, function (value) {
  39017. var elem = this[0] || {},
  39018. i = 0,
  39019. l = this.length;
  39020. if (value === undefined && elem.nodeType === 1) {
  39021. return elem.innerHTML;
  39022. }
  39023. // See if we can take a shortcut and just use innerHTML
  39024. if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
  39025. value = jQuery.htmlPrefilter(value);
  39026. try {
  39027. for (; i < l; i++) {
  39028. elem = this[i] || {};
  39029. // Remove element nodes and prevent memory leaks
  39030. if (elem.nodeType === 1) {
  39031. jQuery.cleanData(getAll(elem, false));
  39032. elem.innerHTML = value;
  39033. }
  39034. }
  39035. elem = 0;
  39036. // If using innerHTML throws an exception, use the fallback method
  39037. } catch (e) {}
  39038. }
  39039. if (elem) {
  39040. this.empty().append(value);
  39041. }
  39042. }, null, value, arguments.length);
  39043. },
  39044. replaceWith: function replaceWith() {
  39045. var ignored = [];
  39046. // Make the changes, replacing each non-ignored context element with the new content
  39047. return domManip(this, arguments, function (elem) {
  39048. var parent = this.parentNode;
  39049. if (jQuery.inArray(this, ignored) < 0) {
  39050. jQuery.cleanData(getAll(this));
  39051. if (parent) {
  39052. parent.replaceChild(elem, this);
  39053. }
  39054. }
  39055. // Force callback invocation
  39056. }, ignored);
  39057. }
  39058. });
  39059. jQuery.each({
  39060. appendTo: "append",
  39061. prependTo: "prepend",
  39062. insertBefore: "before",
  39063. insertAfter: "after",
  39064. replaceAll: "replaceWith"
  39065. }, function (name, original) {
  39066. jQuery.fn[name] = function (selector) {
  39067. var elems,
  39068. ret = [],
  39069. insert = jQuery(selector),
  39070. last = insert.length - 1,
  39071. i = 0;
  39072. for (; i <= last; i++) {
  39073. elems = i === last ? this : this.clone(true);
  39074. jQuery(insert[i])[original](elems);
  39075. // Support: Android <=4.0 only, PhantomJS 1 only
  39076. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  39077. push.apply(ret, elems.get());
  39078. }
  39079. return this.pushStack(ret);
  39080. };
  39081. });
  39082. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  39083. var getStyles = function getStyles(elem) {
  39084. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  39085. // IE throws on elements created in popups
  39086. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  39087. var view = elem.ownerDocument.defaultView;
  39088. if (!view || !view.opener) {
  39089. view = window;
  39090. }
  39091. return view.getComputedStyle(elem);
  39092. };
  39093. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  39094. (function () {
  39095. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  39096. // so they're executed at the same time to save the second computation.
  39097. function computeStyleTests() {
  39098. // This is a singleton, we need to execute it only once
  39099. if (!div) {
  39100. return;
  39101. }
  39102. container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0";
  39103. div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%";
  39104. documentElement.appendChild(container).appendChild(div);
  39105. var divStyle = window.getComputedStyle(div);
  39106. pixelPositionVal = divStyle.top !== "1%";
  39107. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  39108. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  39109. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  39110. // Some styles come back with percentage values, even though they shouldn't
  39111. div.style.right = "60%";
  39112. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  39113. // Support: IE 9 - 11 only
  39114. // Detect misreporting of content dimensions for box-sizing:border-box elements
  39115. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  39116. // Support: IE 9 only
  39117. // Detect overflow:scroll screwiness (gh-3699)
  39118. div.style.position = "absolute";
  39119. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  39120. documentElement.removeChild(container);
  39121. // Nullify the div so it wouldn't be stored in the memory and
  39122. // it will also be a sign that checks already performed
  39123. div = null;
  39124. }
  39125. function roundPixelMeasures(measure) {
  39126. return Math.round(parseFloat(measure));
  39127. }
  39128. var pixelPositionVal,
  39129. boxSizingReliableVal,
  39130. scrollboxSizeVal,
  39131. pixelBoxStylesVal,
  39132. reliableMarginLeftVal,
  39133. container = document.createElement("div"),
  39134. div = document.createElement("div");
  39135. // Finish early in limited (non-browser) environments
  39136. if (!div.style) {
  39137. return;
  39138. }
  39139. // Support: IE <=9 - 11 only
  39140. // Style of cloned element affects source element cloned (#8908)
  39141. div.style.backgroundClip = "content-box";
  39142. div.cloneNode(true).style.backgroundClip = "";
  39143. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  39144. jQuery.extend(support, {
  39145. boxSizingReliable: function boxSizingReliable() {
  39146. computeStyleTests();
  39147. return boxSizingReliableVal;
  39148. },
  39149. pixelBoxStyles: function pixelBoxStyles() {
  39150. computeStyleTests();
  39151. return pixelBoxStylesVal;
  39152. },
  39153. pixelPosition: function pixelPosition() {
  39154. computeStyleTests();
  39155. return pixelPositionVal;
  39156. },
  39157. reliableMarginLeft: function reliableMarginLeft() {
  39158. computeStyleTests();
  39159. return reliableMarginLeftVal;
  39160. },
  39161. scrollboxSize: function scrollboxSize() {
  39162. computeStyleTests();
  39163. return scrollboxSizeVal;
  39164. }
  39165. });
  39166. })();
  39167. function curCSS(elem, name, computed) {
  39168. var width,
  39169. minWidth,
  39170. maxWidth,
  39171. ret,
  39172. // Support: Firefox 51+
  39173. // Retrieving style before computed somehow
  39174. // fixes an issue with getting wrong values
  39175. // on detached elements
  39176. style = elem.style;
  39177. computed = computed || getStyles(elem);
  39178. // getPropertyValue is needed for:
  39179. // .css('filter') (IE 9 only, #12537)
  39180. // .css('--customProperty) (#3144)
  39181. if (computed) {
  39182. ret = computed.getPropertyValue(name) || computed[name];
  39183. if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
  39184. ret = jQuery.style(elem, name);
  39185. }
  39186. // A tribute to the "awesome hack by Dean Edwards"
  39187. // Android Browser returns percentage for some values,
  39188. // but width seems to be reliably pixels.
  39189. // This is against the CSSOM draft spec:
  39190. // https://drafts.csswg.org/cssom/#resolved-values
  39191. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  39192. // Remember the original values
  39193. width = style.width;
  39194. minWidth = style.minWidth;
  39195. maxWidth = style.maxWidth;
  39196. // Put in the new values to get a computed value out
  39197. style.minWidth = style.maxWidth = style.width = ret;
  39198. ret = computed.width;
  39199. // Revert the changed values
  39200. style.width = width;
  39201. style.minWidth = minWidth;
  39202. style.maxWidth = maxWidth;
  39203. }
  39204. }
  39205. return ret !== undefined ?
  39206. // Support: IE <=9 - 11 only
  39207. // IE returns zIndex value as an integer.
  39208. ret + "" : ret;
  39209. }
  39210. function addGetHookIf(conditionFn, hookFn) {
  39211. // Define the hook, we'll check on the first run if it's really needed.
  39212. return {
  39213. get: function get() {
  39214. if (conditionFn()) {
  39215. // Hook not needed (or it's not possible to use it due
  39216. // to missing dependency), remove it.
  39217. delete this.get;
  39218. return;
  39219. }
  39220. // Hook needed; redefine it so that the support test is not executed again.
  39221. return (this.get = hookFn).apply(this, arguments);
  39222. }
  39223. };
  39224. }
  39225. var
  39226. // Swappable if display is none or starts with table
  39227. // except "table", "table-cell", or "table-caption"
  39228. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  39229. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  39230. rcustomProp = /^--/,
  39231. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  39232. cssNormalTransform = {
  39233. letterSpacing: "0",
  39234. fontWeight: "400"
  39235. },
  39236. cssPrefixes = ["Webkit", "Moz", "ms"],
  39237. emptyStyle = document.createElement("div").style;
  39238. // Return a css property mapped to a potentially vendor prefixed property
  39239. function vendorPropName(name) {
  39240. // Shortcut for names that are not vendor prefixed
  39241. if (name in emptyStyle) {
  39242. return name;
  39243. }
  39244. // Check for vendor prefixed names
  39245. var capName = name[0].toUpperCase() + name.slice(1),
  39246. i = cssPrefixes.length;
  39247. while (i--) {
  39248. name = cssPrefixes[i] + capName;
  39249. if (name in emptyStyle) {
  39250. return name;
  39251. }
  39252. }
  39253. }
  39254. // Return a property mapped along what jQuery.cssProps suggests or to
  39255. // a vendor prefixed property.
  39256. function finalPropName(name) {
  39257. var ret = jQuery.cssProps[name];
  39258. if (!ret) {
  39259. ret = jQuery.cssProps[name] = vendorPropName(name) || name;
  39260. }
  39261. return ret;
  39262. }
  39263. function setPositiveNumber(elem, value, subtract) {
  39264. // Any relative (+/-) values have already been
  39265. // normalized at this point
  39266. var matches = rcssNum.exec(value);
  39267. return matches ?
  39268. // Guard against undefined "subtract", e.g., when used as in cssHooks
  39269. Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  39270. }
  39271. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  39272. var i = dimension === "width" ? 1 : 0,
  39273. extra = 0,
  39274. delta = 0;
  39275. // Adjustment may not be necessary
  39276. if (box === (isBorderBox ? "border" : "content")) {
  39277. return 0;
  39278. }
  39279. for (; i < 4; i += 2) {
  39280. // Both box models exclude margin
  39281. if (box === "margin") {
  39282. delta += jQuery.css(elem, box + cssExpand[i], true, styles);
  39283. }
  39284. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  39285. if (!isBorderBox) {
  39286. // Add padding
  39287. delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  39288. // For "border" or "margin", add border
  39289. if (box !== "padding") {
  39290. delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  39291. // But still keep track of it otherwise
  39292. } else {
  39293. extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  39294. }
  39295. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  39296. // "padding" or "margin"
  39297. } else {
  39298. // For "content", subtract padding
  39299. if (box === "content") {
  39300. delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  39301. }
  39302. // For "content" or "padding", subtract border
  39303. if (box !== "margin") {
  39304. delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  39305. }
  39306. }
  39307. }
  39308. // Account for positive content-box scroll gutter when requested by providing computedVal
  39309. if (!isBorderBox && computedVal >= 0) {
  39310. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  39311. // Assuming integer scroll gutter, subtract the rest and round down
  39312. delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5));
  39313. }
  39314. return delta;
  39315. }
  39316. function getWidthOrHeight(elem, dimension, extra) {
  39317. // Start with computed style
  39318. var styles = getStyles(elem),
  39319. val = curCSS(elem, dimension, styles),
  39320. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  39321. valueIsBorderBox = isBorderBox;
  39322. // Support: Firefox <=54
  39323. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  39324. if (rnumnonpx.test(val)) {
  39325. if (!extra) {
  39326. return val;
  39327. }
  39328. val = "auto";
  39329. }
  39330. // Check for style in case a browser which returns unreliable values
  39331. // for getComputedStyle silently falls back to the reliable elem.style
  39332. valueIsBorderBox = valueIsBorderBox && (support.boxSizingReliable() || val === elem.style[dimension]);
  39333. // Fall back to offsetWidth/offsetHeight when value is "auto"
  39334. // This happens for inline elements with no explicit setting (gh-3571)
  39335. // Support: Android <=4.1 - 4.3 only
  39336. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  39337. if (val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") {
  39338. val = elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)];
  39339. // offsetWidth/offsetHeight provide border-box values
  39340. valueIsBorderBox = true;
  39341. }
  39342. // Normalize "" and auto
  39343. val = parseFloat(val) || 0;
  39344. // Adjust for the element's box model
  39345. return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles,
  39346. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  39347. val) + "px";
  39348. }
  39349. jQuery.extend({
  39350. // Add in style property hooks for overriding the default
  39351. // behavior of getting and setting a style property
  39352. cssHooks: {
  39353. opacity: {
  39354. get: function get(elem, computed) {
  39355. if (computed) {
  39356. // We should always get a number back from opacity
  39357. var ret = curCSS(elem, "opacity");
  39358. return ret === "" ? "1" : ret;
  39359. }
  39360. }
  39361. }
  39362. },
  39363. // Don't automatically add "px" to these possibly-unitless properties
  39364. cssNumber: {
  39365. "animationIterationCount": true,
  39366. "columnCount": true,
  39367. "fillOpacity": true,
  39368. "flexGrow": true,
  39369. "flexShrink": true,
  39370. "fontWeight": true,
  39371. "lineHeight": true,
  39372. "opacity": true,
  39373. "order": true,
  39374. "orphans": true,
  39375. "widows": true,
  39376. "zIndex": true,
  39377. "zoom": true
  39378. },
  39379. // Add in properties whose names you wish to fix before
  39380. // setting or getting the value
  39381. cssProps: {},
  39382. // Get and set the style property on a DOM Node
  39383. style: function style(elem, name, value, extra) {
  39384. // Don't set styles on text and comment nodes
  39385. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  39386. return;
  39387. }
  39388. // Make sure that we're working with the right name
  39389. var ret,
  39390. type,
  39391. hooks,
  39392. origName = camelCase(name),
  39393. isCustomProp = rcustomProp.test(name),
  39394. style = elem.style;
  39395. // Make sure that we're working with the right name. We don't
  39396. // want to query the value if it is a CSS custom property
  39397. // since they are user-defined.
  39398. if (!isCustomProp) {
  39399. name = finalPropName(origName);
  39400. }
  39401. // Gets hook for the prefixed version, then unprefixed version
  39402. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  39403. // Check if we're setting a value
  39404. if (value !== undefined) {
  39405. type = typeof value === "undefined" ? "undefined" : _typeof(value);
  39406. // Convert "+=" or "-=" to relative numbers (#7345)
  39407. if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  39408. value = adjustCSS(elem, name, ret);
  39409. // Fixes bug #9237
  39410. type = "number";
  39411. }
  39412. // Make sure that null and NaN values aren't set (#7116)
  39413. if (value == null || value !== value) {
  39414. return;
  39415. }
  39416. // If a number was passed in, add the unit (except for certain CSS properties)
  39417. if (type === "number") {
  39418. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  39419. }
  39420. // background-* props affect original clone's values
  39421. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  39422. style[name] = "inherit";
  39423. }
  39424. // If a hook was provided, use that value, otherwise just set the specified value
  39425. if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
  39426. if (isCustomProp) {
  39427. style.setProperty(name, value);
  39428. } else {
  39429. style[name] = value;
  39430. }
  39431. }
  39432. } else {
  39433. // If a hook was provided get the non-computed value from there
  39434. if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
  39435. return ret;
  39436. }
  39437. // Otherwise just get the value from the style object
  39438. return style[name];
  39439. }
  39440. },
  39441. css: function css(elem, name, extra, styles) {
  39442. var val,
  39443. num,
  39444. hooks,
  39445. origName = camelCase(name),
  39446. isCustomProp = rcustomProp.test(name);
  39447. // Make sure that we're working with the right name. We don't
  39448. // want to modify the value if it is a CSS custom property
  39449. // since they are user-defined.
  39450. if (!isCustomProp) {
  39451. name = finalPropName(origName);
  39452. }
  39453. // Try prefixed name followed by the unprefixed name
  39454. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  39455. // If a hook was provided get the computed value from there
  39456. if (hooks && "get" in hooks) {
  39457. val = hooks.get(elem, true, extra);
  39458. }
  39459. // Otherwise, if a way to get the computed value exists, use that
  39460. if (val === undefined) {
  39461. val = curCSS(elem, name, styles);
  39462. }
  39463. // Convert "normal" to computed value
  39464. if (val === "normal" && name in cssNormalTransform) {
  39465. val = cssNormalTransform[name];
  39466. }
  39467. // Make numeric if forced or a qualifier was provided and val looks numeric
  39468. if (extra === "" || extra) {
  39469. num = parseFloat(val);
  39470. return extra === true || isFinite(num) ? num || 0 : val;
  39471. }
  39472. return val;
  39473. }
  39474. });
  39475. jQuery.each(["height", "width"], function (i, dimension) {
  39476. jQuery.cssHooks[dimension] = {
  39477. get: function get(elem, computed, extra) {
  39478. if (computed) {
  39479. // Certain elements can have dimension info if we invisibly show them
  39480. // but it must have a current display style that would benefit
  39481. return rdisplayswap.test(jQuery.css(elem, "display")) && (
  39482. // Support: Safari 8+
  39483. // Table columns in Safari have non-zero offsetWidth & zero
  39484. // getBoundingClientRect().width unless display is changed.
  39485. // Support: IE <=11 only
  39486. // Running getBoundingClientRect on a disconnected node
  39487. // in IE throws an error.
  39488. !elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {
  39489. return getWidthOrHeight(elem, dimension, extra);
  39490. }) : getWidthOrHeight(elem, dimension, extra);
  39491. }
  39492. },
  39493. set: function set(elem, value, extra) {
  39494. var matches,
  39495. styles = getStyles(elem),
  39496. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  39497. subtract = extra && boxModelAdjustment(elem, dimension, extra, isBorderBox, styles);
  39498. // Account for unreliable border-box dimensions by comparing offset* to computed and
  39499. // faking a content-box to get border and padding (gh-3699)
  39500. if (isBorderBox && support.scrollboxSize() === styles.position) {
  39501. subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5);
  39502. }
  39503. // Convert to pixels if value adjustment is needed
  39504. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
  39505. elem.style[dimension] = value;
  39506. value = jQuery.css(elem, dimension);
  39507. }
  39508. return setPositiveNumber(elem, value, subtract);
  39509. }
  39510. };
  39511. });
  39512. jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {
  39513. if (computed) {
  39514. return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function () {
  39515. return elem.getBoundingClientRect().left;
  39516. })) + "px";
  39517. }
  39518. });
  39519. // These hooks are used by animate to expand properties
  39520. jQuery.each({
  39521. margin: "",
  39522. padding: "",
  39523. border: "Width"
  39524. }, function (prefix, suffix) {
  39525. jQuery.cssHooks[prefix + suffix] = {
  39526. expand: function expand(value) {
  39527. var i = 0,
  39528. expanded = {},
  39529. // Assumes a single number if not a string
  39530. parts = typeof value === "string" ? value.split(" ") : [value];
  39531. for (; i < 4; i++) {
  39532. expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
  39533. }
  39534. return expanded;
  39535. }
  39536. };
  39537. if (prefix !== "margin") {
  39538. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  39539. }
  39540. });
  39541. jQuery.fn.extend({
  39542. css: function css(name, value) {
  39543. return access(this, function (elem, name, value) {
  39544. var styles,
  39545. len,
  39546. map = {},
  39547. i = 0;
  39548. if (Array.isArray(name)) {
  39549. styles = getStyles(elem);
  39550. len = name.length;
  39551. for (; i < len; i++) {
  39552. map[name[i]] = jQuery.css(elem, name[i], false, styles);
  39553. }
  39554. return map;
  39555. }
  39556. return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
  39557. }, name, value, arguments.length > 1);
  39558. }
  39559. });
  39560. function Tween(elem, options, prop, end, easing) {
  39561. return new Tween.prototype.init(elem, options, prop, end, easing);
  39562. }
  39563. jQuery.Tween = Tween;
  39564. Tween.prototype = {
  39565. constructor: Tween,
  39566. init: function init(elem, options, prop, end, easing, unit) {
  39567. this.elem = elem;
  39568. this.prop = prop;
  39569. this.easing = easing || jQuery.easing._default;
  39570. this.options = options;
  39571. this.start = this.now = this.cur();
  39572. this.end = end;
  39573. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  39574. },
  39575. cur: function cur() {
  39576. var hooks = Tween.propHooks[this.prop];
  39577. return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
  39578. },
  39579. run: function run(percent) {
  39580. var eased,
  39581. hooks = Tween.propHooks[this.prop];
  39582. if (this.options.duration) {
  39583. this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);
  39584. } else {
  39585. this.pos = eased = percent;
  39586. }
  39587. this.now = (this.end - this.start) * eased + this.start;
  39588. if (this.options.step) {
  39589. this.options.step.call(this.elem, this.now, this);
  39590. }
  39591. if (hooks && hooks.set) {
  39592. hooks.set(this);
  39593. } else {
  39594. Tween.propHooks._default.set(this);
  39595. }
  39596. return this;
  39597. }
  39598. };
  39599. Tween.prototype.init.prototype = Tween.prototype;
  39600. Tween.propHooks = {
  39601. _default: {
  39602. get: function get(tween) {
  39603. var result;
  39604. // Use a property on the element directly when it is not a DOM element,
  39605. // or when there is no matching style property that exists.
  39606. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  39607. return tween.elem[tween.prop];
  39608. }
  39609. // Passing an empty string as a 3rd parameter to .css will automatically
  39610. // attempt a parseFloat and fallback to a string if the parse fails.
  39611. // Simple values such as "10px" are parsed to Float;
  39612. // complex values such as "rotate(1rad)" are returned as-is.
  39613. result = jQuery.css(tween.elem, tween.prop, "");
  39614. // Empty strings, null, undefined and "auto" are converted to 0.
  39615. return !result || result === "auto" ? 0 : result;
  39616. },
  39617. set: function set(tween) {
  39618. // Use step hook for back compat.
  39619. // Use cssHook if its there.
  39620. // Use .style if available and use plain properties where available.
  39621. if (jQuery.fx.step[tween.prop]) {
  39622. jQuery.fx.step[tween.prop](tween);
  39623. } else if (tween.elem.nodeType === 1 && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
  39624. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  39625. } else {
  39626. tween.elem[tween.prop] = tween.now;
  39627. }
  39628. }
  39629. }
  39630. };
  39631. // Support: IE <=9 only
  39632. // Panic based approach to setting things on disconnected nodes
  39633. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  39634. set: function set(tween) {
  39635. if (tween.elem.nodeType && tween.elem.parentNode) {
  39636. tween.elem[tween.prop] = tween.now;
  39637. }
  39638. }
  39639. };
  39640. jQuery.easing = {
  39641. linear: function linear(p) {
  39642. return p;
  39643. },
  39644. swing: function swing(p) {
  39645. return 0.5 - Math.cos(p * Math.PI) / 2;
  39646. },
  39647. _default: "swing"
  39648. };
  39649. jQuery.fx = Tween.prototype.init;
  39650. // Back compat <1.8 extension point
  39651. jQuery.fx.step = {};
  39652. var fxNow,
  39653. inProgress,
  39654. rfxtypes = /^(?:toggle|show|hide)$/,
  39655. rrun = /queueHooks$/;
  39656. function schedule() {
  39657. if (inProgress) {
  39658. if (document.hidden === false && window.requestAnimationFrame) {
  39659. window.requestAnimationFrame(schedule);
  39660. } else {
  39661. window.setTimeout(schedule, jQuery.fx.interval);
  39662. }
  39663. jQuery.fx.tick();
  39664. }
  39665. }
  39666. // Animations created synchronously will run synchronously
  39667. function createFxNow() {
  39668. window.setTimeout(function () {
  39669. fxNow = undefined;
  39670. });
  39671. return fxNow = Date.now();
  39672. }
  39673. // Generate parameters to create a standard animation
  39674. function genFx(type, includeWidth) {
  39675. var which,
  39676. i = 0,
  39677. attrs = { height: type };
  39678. // If we include width, step value is 1 to do all cssExpand values,
  39679. // otherwise step value is 2 to skip over Left and Right
  39680. includeWidth = includeWidth ? 1 : 0;
  39681. for (; i < 4; i += 2 - includeWidth) {
  39682. which = cssExpand[i];
  39683. attrs["margin" + which] = attrs["padding" + which] = type;
  39684. }
  39685. if (includeWidth) {
  39686. attrs.opacity = attrs.width = type;
  39687. }
  39688. return attrs;
  39689. }
  39690. function createTween(value, prop, animation) {
  39691. var tween,
  39692. collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
  39693. index = 0,
  39694. length = collection.length;
  39695. for (; index < length; index++) {
  39696. if (tween = collection[index].call(animation, prop, value)) {
  39697. // We're done with this property
  39698. return tween;
  39699. }
  39700. }
  39701. }
  39702. function defaultPrefilter(elem, props, opts) {
  39703. var prop,
  39704. value,
  39705. toggle,
  39706. hooks,
  39707. oldfire,
  39708. propTween,
  39709. restoreDisplay,
  39710. display,
  39711. isBox = "width" in props || "height" in props,
  39712. anim = this,
  39713. orig = {},
  39714. style = elem.style,
  39715. hidden = elem.nodeType && isHiddenWithinTree(elem),
  39716. dataShow = dataPriv.get(elem, "fxshow");
  39717. // Queue-skipping animations hijack the fx hooks
  39718. if (!opts.queue) {
  39719. hooks = jQuery._queueHooks(elem, "fx");
  39720. if (hooks.unqueued == null) {
  39721. hooks.unqueued = 0;
  39722. oldfire = hooks.empty.fire;
  39723. hooks.empty.fire = function () {
  39724. if (!hooks.unqueued) {
  39725. oldfire();
  39726. }
  39727. };
  39728. }
  39729. hooks.unqueued++;
  39730. anim.always(function () {
  39731. // Ensure the complete handler is called before this completes
  39732. anim.always(function () {
  39733. hooks.unqueued--;
  39734. if (!jQuery.queue(elem, "fx").length) {
  39735. hooks.empty.fire();
  39736. }
  39737. });
  39738. });
  39739. }
  39740. // Detect show/hide animations
  39741. for (prop in props) {
  39742. value = props[prop];
  39743. if (rfxtypes.test(value)) {
  39744. delete props[prop];
  39745. toggle = toggle || value === "toggle";
  39746. if (value === (hidden ? "hide" : "show")) {
  39747. // Pretend to be hidden if this is a "show" and
  39748. // there is still data from a stopped show/hide
  39749. if (value === "show" && dataShow && dataShow[prop] !== undefined) {
  39750. hidden = true;
  39751. // Ignore all other no-op show/hide data
  39752. } else {
  39753. continue;
  39754. }
  39755. }
  39756. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  39757. }
  39758. }
  39759. // Bail out if this is a no-op like .hide().hide()
  39760. propTween = !jQuery.isEmptyObject(props);
  39761. if (!propTween && jQuery.isEmptyObject(orig)) {
  39762. return;
  39763. }
  39764. // Restrict "overflow" and "display" styles during box animations
  39765. if (isBox && elem.nodeType === 1) {
  39766. // Support: IE <=9 - 11, Edge 12 - 15
  39767. // Record all 3 overflow attributes because IE does not infer the shorthand
  39768. // from identically-valued overflowX and overflowY and Edge just mirrors
  39769. // the overflowX value there.
  39770. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  39771. // Identify a display type, preferring old show/hide data over the CSS cascade
  39772. restoreDisplay = dataShow && dataShow.display;
  39773. if (restoreDisplay == null) {
  39774. restoreDisplay = dataPriv.get(elem, "display");
  39775. }
  39776. display = jQuery.css(elem, "display");
  39777. if (display === "none") {
  39778. if (restoreDisplay) {
  39779. display = restoreDisplay;
  39780. } else {
  39781. // Get nonempty value(s) by temporarily forcing visibility
  39782. showHide([elem], true);
  39783. restoreDisplay = elem.style.display || restoreDisplay;
  39784. display = jQuery.css(elem, "display");
  39785. showHide([elem]);
  39786. }
  39787. }
  39788. // Animate inline elements as inline-block
  39789. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  39790. if (jQuery.css(elem, "float") === "none") {
  39791. // Restore the original display value at the end of pure show/hide animations
  39792. if (!propTween) {
  39793. anim.done(function () {
  39794. style.display = restoreDisplay;
  39795. });
  39796. if (restoreDisplay == null) {
  39797. display = style.display;
  39798. restoreDisplay = display === "none" ? "" : display;
  39799. }
  39800. }
  39801. style.display = "inline-block";
  39802. }
  39803. }
  39804. }
  39805. if (opts.overflow) {
  39806. style.overflow = "hidden";
  39807. anim.always(function () {
  39808. style.overflow = opts.overflow[0];
  39809. style.overflowX = opts.overflow[1];
  39810. style.overflowY = opts.overflow[2];
  39811. });
  39812. }
  39813. // Implement show/hide animations
  39814. propTween = false;
  39815. for (prop in orig) {
  39816. // General show/hide setup for this element animation
  39817. if (!propTween) {
  39818. if (dataShow) {
  39819. if ("hidden" in dataShow) {
  39820. hidden = dataShow.hidden;
  39821. }
  39822. } else {
  39823. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  39824. }
  39825. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  39826. if (toggle) {
  39827. dataShow.hidden = !hidden;
  39828. }
  39829. // Show elements before animating them
  39830. if (hidden) {
  39831. showHide([elem], true);
  39832. }
  39833. /* eslint-disable no-loop-func */
  39834. anim.done(function () {
  39835. /* eslint-enable no-loop-func */
  39836. // The final step of a "hide" animation is actually hiding the element
  39837. if (!hidden) {
  39838. showHide([elem]);
  39839. }
  39840. dataPriv.remove(elem, "fxshow");
  39841. for (prop in orig) {
  39842. jQuery.style(elem, prop, orig[prop]);
  39843. }
  39844. });
  39845. }
  39846. // Per-property setup
  39847. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  39848. if (!(prop in dataShow)) {
  39849. dataShow[prop] = propTween.start;
  39850. if (hidden) {
  39851. propTween.end = propTween.start;
  39852. propTween.start = 0;
  39853. }
  39854. }
  39855. }
  39856. }
  39857. function propFilter(props, specialEasing) {
  39858. var index, name, easing, value, hooks;
  39859. // camelCase, specialEasing and expand cssHook pass
  39860. for (index in props) {
  39861. name = camelCase(index);
  39862. easing = specialEasing[name];
  39863. value = props[index];
  39864. if (Array.isArray(value)) {
  39865. easing = value[1];
  39866. value = props[index] = value[0];
  39867. }
  39868. if (index !== name) {
  39869. props[name] = value;
  39870. delete props[index];
  39871. }
  39872. hooks = jQuery.cssHooks[name];
  39873. if (hooks && "expand" in hooks) {
  39874. value = hooks.expand(value);
  39875. delete props[name];
  39876. // Not quite $.extend, this won't overwrite existing keys.
  39877. // Reusing 'index' because we have the correct "name"
  39878. for (index in value) {
  39879. if (!(index in props)) {
  39880. props[index] = value[index];
  39881. specialEasing[index] = easing;
  39882. }
  39883. }
  39884. } else {
  39885. specialEasing[name] = easing;
  39886. }
  39887. }
  39888. }
  39889. function Animation(elem, properties, options) {
  39890. var result,
  39891. stopped,
  39892. index = 0,
  39893. length = Animation.prefilters.length,
  39894. deferred = jQuery.Deferred().always(function () {
  39895. // Don't match elem in the :animated selector
  39896. delete tick.elem;
  39897. }),
  39898. tick = function tick() {
  39899. if (stopped) {
  39900. return false;
  39901. }
  39902. var currentTime = fxNow || createFxNow(),
  39903. remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
  39904. // Support: Android 2.3 only
  39905. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  39906. temp = remaining / animation.duration || 0,
  39907. percent = 1 - temp,
  39908. index = 0,
  39909. length = animation.tweens.length;
  39910. for (; index < length; index++) {
  39911. animation.tweens[index].run(percent);
  39912. }
  39913. deferred.notifyWith(elem, [animation, percent, remaining]);
  39914. // If there's more to do, yield
  39915. if (percent < 1 && length) {
  39916. return remaining;
  39917. }
  39918. // If this was an empty animation, synthesize a final progress notification
  39919. if (!length) {
  39920. deferred.notifyWith(elem, [animation, 1, 0]);
  39921. }
  39922. // Resolve the animation and report its conclusion
  39923. deferred.resolveWith(elem, [animation]);
  39924. return false;
  39925. },
  39926. animation = deferred.promise({
  39927. elem: elem,
  39928. props: jQuery.extend({}, properties),
  39929. opts: jQuery.extend(true, {
  39930. specialEasing: {},
  39931. easing: jQuery.easing._default
  39932. }, options),
  39933. originalProperties: properties,
  39934. originalOptions: options,
  39935. startTime: fxNow || createFxNow(),
  39936. duration: options.duration,
  39937. tweens: [],
  39938. createTween: function createTween(prop, end) {
  39939. var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
  39940. animation.tweens.push(tween);
  39941. return tween;
  39942. },
  39943. stop: function stop(gotoEnd) {
  39944. var index = 0,
  39945. // If we are going to the end, we want to run all the tweens
  39946. // otherwise we skip this part
  39947. length = gotoEnd ? animation.tweens.length : 0;
  39948. if (stopped) {
  39949. return this;
  39950. }
  39951. stopped = true;
  39952. for (; index < length; index++) {
  39953. animation.tweens[index].run(1);
  39954. }
  39955. // Resolve when we played the last frame; otherwise, reject
  39956. if (gotoEnd) {
  39957. deferred.notifyWith(elem, [animation, 1, 0]);
  39958. deferred.resolveWith(elem, [animation, gotoEnd]);
  39959. } else {
  39960. deferred.rejectWith(elem, [animation, gotoEnd]);
  39961. }
  39962. return this;
  39963. }
  39964. }),
  39965. props = animation.props;
  39966. propFilter(props, animation.opts.specialEasing);
  39967. for (; index < length; index++) {
  39968. result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
  39969. if (result) {
  39970. if (isFunction(result.stop)) {
  39971. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
  39972. }
  39973. return result;
  39974. }
  39975. }
  39976. jQuery.map(props, createTween, animation);
  39977. if (isFunction(animation.opts.start)) {
  39978. animation.opts.start.call(elem, animation);
  39979. }
  39980. // Attach callbacks from options
  39981. animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  39982. jQuery.fx.timer(jQuery.extend(tick, {
  39983. elem: elem,
  39984. anim: animation,
  39985. queue: animation.opts.queue
  39986. }));
  39987. return animation;
  39988. }
  39989. jQuery.Animation = jQuery.extend(Animation, {
  39990. tweeners: {
  39991. "*": [function (prop, value) {
  39992. var tween = this.createTween(prop, value);
  39993. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  39994. return tween;
  39995. }]
  39996. },
  39997. tweener: function tweener(props, callback) {
  39998. if (isFunction(props)) {
  39999. callback = props;
  40000. props = ["*"];
  40001. } else {
  40002. props = props.match(rnothtmlwhite);
  40003. }
  40004. var prop,
  40005. index = 0,
  40006. length = props.length;
  40007. for (; index < length; index++) {
  40008. prop = props[index];
  40009. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  40010. Animation.tweeners[prop].unshift(callback);
  40011. }
  40012. },
  40013. prefilters: [defaultPrefilter],
  40014. prefilter: function prefilter(callback, prepend) {
  40015. if (prepend) {
  40016. Animation.prefilters.unshift(callback);
  40017. } else {
  40018. Animation.prefilters.push(callback);
  40019. }
  40020. }
  40021. });
  40022. jQuery.speed = function (speed, easing, fn) {
  40023. var opt = speed && (typeof speed === "undefined" ? "undefined" : _typeof(speed)) === "object" ? jQuery.extend({}, speed) : {
  40024. complete: fn || !fn && easing || isFunction(speed) && speed,
  40025. duration: speed,
  40026. easing: fn && easing || easing && !isFunction(easing) && easing
  40027. };
  40028. // Go to the end state if fx are off
  40029. if (jQuery.fx.off) {
  40030. opt.duration = 0;
  40031. } else {
  40032. if (typeof opt.duration !== "number") {
  40033. if (opt.duration in jQuery.fx.speeds) {
  40034. opt.duration = jQuery.fx.speeds[opt.duration];
  40035. } else {
  40036. opt.duration = jQuery.fx.speeds._default;
  40037. }
  40038. }
  40039. }
  40040. // Normalize opt.queue - true/undefined/null -> "fx"
  40041. if (opt.queue == null || opt.queue === true) {
  40042. opt.queue = "fx";
  40043. }
  40044. // Queueing
  40045. opt.old = opt.complete;
  40046. opt.complete = function () {
  40047. if (isFunction(opt.old)) {
  40048. opt.old.call(this);
  40049. }
  40050. if (opt.queue) {
  40051. jQuery.dequeue(this, opt.queue);
  40052. }
  40053. };
  40054. return opt;
  40055. };
  40056. jQuery.fn.extend({
  40057. fadeTo: function fadeTo(speed, to, easing, callback) {
  40058. // Show any hidden elements after setting opacity to 0
  40059. return this.filter(isHiddenWithinTree).css("opacity", 0).show()
  40060. // Animate to the value specified
  40061. .end().animate({ opacity: to }, speed, easing, callback);
  40062. },
  40063. animate: function animate(prop, speed, easing, callback) {
  40064. var empty = jQuery.isEmptyObject(prop),
  40065. optall = jQuery.speed(speed, easing, callback),
  40066. doAnimation = function doAnimation() {
  40067. // Operate on a copy of prop so per-property easing won't be lost
  40068. var anim = Animation(this, jQuery.extend({}, prop), optall);
  40069. // Empty animations, or finishing resolves immediately
  40070. if (empty || dataPriv.get(this, "finish")) {
  40071. anim.stop(true);
  40072. }
  40073. };
  40074. doAnimation.finish = doAnimation;
  40075. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  40076. },
  40077. stop: function stop(type, clearQueue, gotoEnd) {
  40078. var stopQueue = function stopQueue(hooks) {
  40079. var stop = hooks.stop;
  40080. delete hooks.stop;
  40081. stop(gotoEnd);
  40082. };
  40083. if (typeof type !== "string") {
  40084. gotoEnd = clearQueue;
  40085. clearQueue = type;
  40086. type = undefined;
  40087. }
  40088. if (clearQueue && type !== false) {
  40089. this.queue(type || "fx", []);
  40090. }
  40091. return this.each(function () {
  40092. var dequeue = true,
  40093. index = type != null && type + "queueHooks",
  40094. timers = jQuery.timers,
  40095. data = dataPriv.get(this);
  40096. if (index) {
  40097. if (data[index] && data[index].stop) {
  40098. stopQueue(data[index]);
  40099. }
  40100. } else {
  40101. for (index in data) {
  40102. if (data[index] && data[index].stop && rrun.test(index)) {
  40103. stopQueue(data[index]);
  40104. }
  40105. }
  40106. }
  40107. for (index = timers.length; index--;) {
  40108. if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
  40109. timers[index].anim.stop(gotoEnd);
  40110. dequeue = false;
  40111. timers.splice(index, 1);
  40112. }
  40113. }
  40114. // Start the next in the queue if the last step wasn't forced.
  40115. // Timers currently will call their complete callbacks, which
  40116. // will dequeue but only if they were gotoEnd.
  40117. if (dequeue || !gotoEnd) {
  40118. jQuery.dequeue(this, type);
  40119. }
  40120. });
  40121. },
  40122. finish: function finish(type) {
  40123. if (type !== false) {
  40124. type = type || "fx";
  40125. }
  40126. return this.each(function () {
  40127. var index,
  40128. data = dataPriv.get(this),
  40129. queue = data[type + "queue"],
  40130. hooks = data[type + "queueHooks"],
  40131. timers = jQuery.timers,
  40132. length = queue ? queue.length : 0;
  40133. // Enable finishing flag on private data
  40134. data.finish = true;
  40135. // Empty the queue first
  40136. jQuery.queue(this, type, []);
  40137. if (hooks && hooks.stop) {
  40138. hooks.stop.call(this, true);
  40139. }
  40140. // Look for any active animations, and finish them
  40141. for (index = timers.length; index--;) {
  40142. if (timers[index].elem === this && timers[index].queue === type) {
  40143. timers[index].anim.stop(true);
  40144. timers.splice(index, 1);
  40145. }
  40146. }
  40147. // Look for any animations in the old queue and finish them
  40148. for (index = 0; index < length; index++) {
  40149. if (queue[index] && queue[index].finish) {
  40150. queue[index].finish.call(this);
  40151. }
  40152. }
  40153. // Turn off finishing flag
  40154. delete data.finish;
  40155. });
  40156. }
  40157. });
  40158. jQuery.each(["toggle", "show", "hide"], function (i, name) {
  40159. var cssFn = jQuery.fn[name];
  40160. jQuery.fn[name] = function (speed, easing, callback) {
  40161. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
  40162. };
  40163. });
  40164. // Generate shortcuts for custom animations
  40165. jQuery.each({
  40166. slideDown: genFx("show"),
  40167. slideUp: genFx("hide"),
  40168. slideToggle: genFx("toggle"),
  40169. fadeIn: { opacity: "show" },
  40170. fadeOut: { opacity: "hide" },
  40171. fadeToggle: { opacity: "toggle" }
  40172. }, function (name, props) {
  40173. jQuery.fn[name] = function (speed, easing, callback) {
  40174. return this.animate(props, speed, easing, callback);
  40175. };
  40176. });
  40177. jQuery.timers = [];
  40178. jQuery.fx.tick = function () {
  40179. var timer,
  40180. i = 0,
  40181. timers = jQuery.timers;
  40182. fxNow = Date.now();
  40183. for (; i < timers.length; i++) {
  40184. timer = timers[i];
  40185. // Run the timer and safely remove it when done (allowing for external removal)
  40186. if (!timer() && timers[i] === timer) {
  40187. timers.splice(i--, 1);
  40188. }
  40189. }
  40190. if (!timers.length) {
  40191. jQuery.fx.stop();
  40192. }
  40193. fxNow = undefined;
  40194. };
  40195. jQuery.fx.timer = function (timer) {
  40196. jQuery.timers.push(timer);
  40197. jQuery.fx.start();
  40198. };
  40199. jQuery.fx.interval = 13;
  40200. jQuery.fx.start = function () {
  40201. if (inProgress) {
  40202. return;
  40203. }
  40204. inProgress = true;
  40205. schedule();
  40206. };
  40207. jQuery.fx.stop = function () {
  40208. inProgress = null;
  40209. };
  40210. jQuery.fx.speeds = {
  40211. slow: 600,
  40212. fast: 200,
  40213. // Default speed
  40214. _default: 400
  40215. };
  40216. // Based off of the plugin by Clint Helfers, with permission.
  40217. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  40218. jQuery.fn.delay = function (time, type) {
  40219. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  40220. type = type || "fx";
  40221. return this.queue(type, function (next, hooks) {
  40222. var timeout = window.setTimeout(next, time);
  40223. hooks.stop = function () {
  40224. window.clearTimeout(timeout);
  40225. };
  40226. });
  40227. };
  40228. (function () {
  40229. var input = document.createElement("input"),
  40230. select = document.createElement("select"),
  40231. opt = select.appendChild(document.createElement("option"));
  40232. input.type = "checkbox";
  40233. // Support: Android <=4.3 only
  40234. // Default value for a checkbox should be "on"
  40235. support.checkOn = input.value !== "";
  40236. // Support: IE <=11 only
  40237. // Must access selectedIndex to make default options select
  40238. support.optSelected = opt.selected;
  40239. // Support: IE <=11 only
  40240. // An input loses its value after becoming a radio
  40241. input = document.createElement("input");
  40242. input.value = "t";
  40243. input.type = "radio";
  40244. support.radioValue = input.value === "t";
  40245. })();
  40246. var boolHook,
  40247. attrHandle = jQuery.expr.attrHandle;
  40248. jQuery.fn.extend({
  40249. attr: function attr(name, value) {
  40250. return access(this, jQuery.attr, name, value, arguments.length > 1);
  40251. },
  40252. removeAttr: function removeAttr(name) {
  40253. return this.each(function () {
  40254. jQuery.removeAttr(this, name);
  40255. });
  40256. }
  40257. });
  40258. jQuery.extend({
  40259. attr: function attr(elem, name, value) {
  40260. var ret,
  40261. hooks,
  40262. nType = elem.nodeType;
  40263. // Don't get/set attributes on text, comment and attribute nodes
  40264. if (nType === 3 || nType === 8 || nType === 2) {
  40265. return;
  40266. }
  40267. // Fallback to prop when attributes are not supported
  40268. if (typeof elem.getAttribute === "undefined") {
  40269. return jQuery.prop(elem, name, value);
  40270. }
  40271. // Attribute hooks are determined by the lowercase version
  40272. // Grab necessary hook if one is defined
  40273. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  40274. hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
  40275. }
  40276. if (value !== undefined) {
  40277. if (value === null) {
  40278. jQuery.removeAttr(elem, name);
  40279. return;
  40280. }
  40281. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  40282. return ret;
  40283. }
  40284. elem.setAttribute(name, value + "");
  40285. return value;
  40286. }
  40287. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  40288. return ret;
  40289. }
  40290. ret = jQuery.find.attr(elem, name);
  40291. // Non-existent attributes return null, we normalize to undefined
  40292. return ret == null ? undefined : ret;
  40293. },
  40294. attrHooks: {
  40295. type: {
  40296. set: function set(elem, value) {
  40297. if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
  40298. var val = elem.value;
  40299. elem.setAttribute("type", value);
  40300. if (val) {
  40301. elem.value = val;
  40302. }
  40303. return value;
  40304. }
  40305. }
  40306. }
  40307. },
  40308. removeAttr: function removeAttr(elem, value) {
  40309. var name,
  40310. i = 0,
  40311. // Attribute names can contain non-HTML whitespace characters
  40312. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  40313. attrNames = value && value.match(rnothtmlwhite);
  40314. if (attrNames && elem.nodeType === 1) {
  40315. while (name = attrNames[i++]) {
  40316. elem.removeAttribute(name);
  40317. }
  40318. }
  40319. }
  40320. });
  40321. // Hooks for boolean attributes
  40322. boolHook = {
  40323. set: function set(elem, value, name) {
  40324. if (value === false) {
  40325. // Remove boolean attributes when set to false
  40326. jQuery.removeAttr(elem, name);
  40327. } else {
  40328. elem.setAttribute(name, name);
  40329. }
  40330. return name;
  40331. }
  40332. };
  40333. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
  40334. var getter = attrHandle[name] || jQuery.find.attr;
  40335. attrHandle[name] = function (elem, name, isXML) {
  40336. var ret,
  40337. handle,
  40338. lowercaseName = name.toLowerCase();
  40339. if (!isXML) {
  40340. // Avoid an infinite loop by temporarily removing this function from the getter
  40341. handle = attrHandle[lowercaseName];
  40342. attrHandle[lowercaseName] = ret;
  40343. ret = getter(elem, name, isXML) != null ? lowercaseName : null;
  40344. attrHandle[lowercaseName] = handle;
  40345. }
  40346. return ret;
  40347. };
  40348. });
  40349. var rfocusable = /^(?:input|select|textarea|button)$/i,
  40350. rclickable = /^(?:a|area)$/i;
  40351. jQuery.fn.extend({
  40352. prop: function prop(name, value) {
  40353. return access(this, jQuery.prop, name, value, arguments.length > 1);
  40354. },
  40355. removeProp: function removeProp(name) {
  40356. return this.each(function () {
  40357. delete this[jQuery.propFix[name] || name];
  40358. });
  40359. }
  40360. });
  40361. jQuery.extend({
  40362. prop: function prop(elem, name, value) {
  40363. var ret,
  40364. hooks,
  40365. nType = elem.nodeType;
  40366. // Don't get/set properties on text, comment and attribute nodes
  40367. if (nType === 3 || nType === 8 || nType === 2) {
  40368. return;
  40369. }
  40370. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  40371. // Fix name and attach hooks
  40372. name = jQuery.propFix[name] || name;
  40373. hooks = jQuery.propHooks[name];
  40374. }
  40375. if (value !== undefined) {
  40376. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  40377. return ret;
  40378. }
  40379. return elem[name] = value;
  40380. }
  40381. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  40382. return ret;
  40383. }
  40384. return elem[name];
  40385. },
  40386. propHooks: {
  40387. tabIndex: {
  40388. get: function get(elem) {
  40389. // Support: IE <=9 - 11 only
  40390. // elem.tabIndex doesn't always return the
  40391. // correct value when it hasn't been explicitly set
  40392. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  40393. // Use proper attribute retrieval(#12072)
  40394. var tabindex = jQuery.find.attr(elem, "tabindex");
  40395. if (tabindex) {
  40396. return parseInt(tabindex, 10);
  40397. }
  40398. if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
  40399. return 0;
  40400. }
  40401. return -1;
  40402. }
  40403. }
  40404. },
  40405. propFix: {
  40406. "for": "htmlFor",
  40407. "class": "className"
  40408. }
  40409. });
  40410. // Support: IE <=11 only
  40411. // Accessing the selectedIndex property
  40412. // forces the browser to respect setting selected
  40413. // on the option
  40414. // The getter ensures a default option is selected
  40415. // when in an optgroup
  40416. // eslint rule "no-unused-expressions" is disabled for this code
  40417. // since it considers such accessions noop
  40418. if (!support.optSelected) {
  40419. jQuery.propHooks.selected = {
  40420. get: function get(elem) {
  40421. /* eslint no-unused-expressions: "off" */
  40422. var parent = elem.parentNode;
  40423. if (parent && parent.parentNode) {
  40424. parent.parentNode.selectedIndex;
  40425. }
  40426. return null;
  40427. },
  40428. set: function set(elem) {
  40429. /* eslint no-unused-expressions: "off" */
  40430. var parent = elem.parentNode;
  40431. if (parent) {
  40432. parent.selectedIndex;
  40433. if (parent.parentNode) {
  40434. parent.parentNode.selectedIndex;
  40435. }
  40436. }
  40437. }
  40438. };
  40439. }
  40440. jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
  40441. jQuery.propFix[this.toLowerCase()] = this;
  40442. });
  40443. // Strip and collapse whitespace according to HTML spec
  40444. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  40445. function stripAndCollapse(value) {
  40446. var tokens = value.match(rnothtmlwhite) || [];
  40447. return tokens.join(" ");
  40448. }
  40449. function getClass(elem) {
  40450. return elem.getAttribute && elem.getAttribute("class") || "";
  40451. }
  40452. function classesToArray(value) {
  40453. if (Array.isArray(value)) {
  40454. return value;
  40455. }
  40456. if (typeof value === "string") {
  40457. return value.match(rnothtmlwhite) || [];
  40458. }
  40459. return [];
  40460. }
  40461. jQuery.fn.extend({
  40462. addClass: function addClass(value) {
  40463. var classes,
  40464. elem,
  40465. cur,
  40466. curValue,
  40467. clazz,
  40468. j,
  40469. finalValue,
  40470. i = 0;
  40471. if (isFunction(value)) {
  40472. return this.each(function (j) {
  40473. jQuery(this).addClass(value.call(this, j, getClass(this)));
  40474. });
  40475. }
  40476. classes = classesToArray(value);
  40477. if (classes.length) {
  40478. while (elem = this[i++]) {
  40479. curValue = getClass(elem);
  40480. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  40481. if (cur) {
  40482. j = 0;
  40483. while (clazz = classes[j++]) {
  40484. if (cur.indexOf(" " + clazz + " ") < 0) {
  40485. cur += clazz + " ";
  40486. }
  40487. }
  40488. // Only assign if different to avoid unneeded rendering.
  40489. finalValue = stripAndCollapse(cur);
  40490. if (curValue !== finalValue) {
  40491. elem.setAttribute("class", finalValue);
  40492. }
  40493. }
  40494. }
  40495. }
  40496. return this;
  40497. },
  40498. removeClass: function removeClass(value) {
  40499. var classes,
  40500. elem,
  40501. cur,
  40502. curValue,
  40503. clazz,
  40504. j,
  40505. finalValue,
  40506. i = 0;
  40507. if (isFunction(value)) {
  40508. return this.each(function (j) {
  40509. jQuery(this).removeClass(value.call(this, j, getClass(this)));
  40510. });
  40511. }
  40512. if (!arguments.length) {
  40513. return this.attr("class", "");
  40514. }
  40515. classes = classesToArray(value);
  40516. if (classes.length) {
  40517. while (elem = this[i++]) {
  40518. curValue = getClass(elem);
  40519. // This expression is here for better compressibility (see addClass)
  40520. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  40521. if (cur) {
  40522. j = 0;
  40523. while (clazz = classes[j++]) {
  40524. // Remove *all* instances
  40525. while (cur.indexOf(" " + clazz + " ") > -1) {
  40526. cur = cur.replace(" " + clazz + " ", " ");
  40527. }
  40528. }
  40529. // Only assign if different to avoid unneeded rendering.
  40530. finalValue = stripAndCollapse(cur);
  40531. if (curValue !== finalValue) {
  40532. elem.setAttribute("class", finalValue);
  40533. }
  40534. }
  40535. }
  40536. }
  40537. return this;
  40538. },
  40539. toggleClass: function toggleClass(value, stateVal) {
  40540. var type = typeof value === "undefined" ? "undefined" : _typeof(value),
  40541. isValidValue = type === "string" || Array.isArray(value);
  40542. if (typeof stateVal === "boolean" && isValidValue) {
  40543. return stateVal ? this.addClass(value) : this.removeClass(value);
  40544. }
  40545. if (isFunction(value)) {
  40546. return this.each(function (i) {
  40547. jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
  40548. });
  40549. }
  40550. return this.each(function () {
  40551. var className, i, self, classNames;
  40552. if (isValidValue) {
  40553. // Toggle individual class names
  40554. i = 0;
  40555. self = jQuery(this);
  40556. classNames = classesToArray(value);
  40557. while (className = classNames[i++]) {
  40558. // Check each className given, space separated list
  40559. if (self.hasClass(className)) {
  40560. self.removeClass(className);
  40561. } else {
  40562. self.addClass(className);
  40563. }
  40564. }
  40565. // Toggle whole class name
  40566. } else if (value === undefined || type === "boolean") {
  40567. className = getClass(this);
  40568. if (className) {
  40569. // Store className if set
  40570. dataPriv.set(this, "__className__", className);
  40571. }
  40572. // If the element has a class name or if we're passed `false`,
  40573. // then remove the whole classname (if there was one, the above saved it).
  40574. // Otherwise bring back whatever was previously saved (if anything),
  40575. // falling back to the empty string if nothing was stored.
  40576. if (this.setAttribute) {
  40577. this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || "");
  40578. }
  40579. }
  40580. });
  40581. },
  40582. hasClass: function hasClass(selector) {
  40583. var className,
  40584. elem,
  40585. i = 0;
  40586. className = " " + selector + " ";
  40587. while (elem = this[i++]) {
  40588. if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
  40589. return true;
  40590. }
  40591. }
  40592. return false;
  40593. }
  40594. });
  40595. var rreturn = /\r/g;
  40596. jQuery.fn.extend({
  40597. val: function val(value) {
  40598. var hooks,
  40599. ret,
  40600. valueIsFunction,
  40601. elem = this[0];
  40602. if (!arguments.length) {
  40603. if (elem) {
  40604. hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  40605. if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
  40606. return ret;
  40607. }
  40608. ret = elem.value;
  40609. // Handle most common string cases
  40610. if (typeof ret === "string") {
  40611. return ret.replace(rreturn, "");
  40612. }
  40613. // Handle cases where value is null/undef or number
  40614. return ret == null ? "" : ret;
  40615. }
  40616. return;
  40617. }
  40618. valueIsFunction = isFunction(value);
  40619. return this.each(function (i) {
  40620. var val;
  40621. if (this.nodeType !== 1) {
  40622. return;
  40623. }
  40624. if (valueIsFunction) {
  40625. val = value.call(this, i, jQuery(this).val());
  40626. } else {
  40627. val = value;
  40628. }
  40629. // Treat null/undefined as ""; convert numbers to string
  40630. if (val == null) {
  40631. val = "";
  40632. } else if (typeof val === "number") {
  40633. val += "";
  40634. } else if (Array.isArray(val)) {
  40635. val = jQuery.map(val, function (value) {
  40636. return value == null ? "" : value + "";
  40637. });
  40638. }
  40639. hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  40640. // If set returns undefined, fall back to normal setting
  40641. if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
  40642. this.value = val;
  40643. }
  40644. });
  40645. }
  40646. });
  40647. jQuery.extend({
  40648. valHooks: {
  40649. option: {
  40650. get: function get(elem) {
  40651. var val = jQuery.find.attr(elem, "value");
  40652. return val != null ? val :
  40653. // Support: IE <=10 - 11 only
  40654. // option.text throws exceptions (#14686, #14858)
  40655. // Strip and collapse whitespace
  40656. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  40657. stripAndCollapse(jQuery.text(elem));
  40658. }
  40659. },
  40660. select: {
  40661. get: function get(elem) {
  40662. var value,
  40663. option,
  40664. i,
  40665. options = elem.options,
  40666. index = elem.selectedIndex,
  40667. one = elem.type === "select-one",
  40668. values = one ? null : [],
  40669. max = one ? index + 1 : options.length;
  40670. if (index < 0) {
  40671. i = max;
  40672. } else {
  40673. i = one ? index : 0;
  40674. }
  40675. // Loop through all the selected options
  40676. for (; i < max; i++) {
  40677. option = options[i];
  40678. // Support: IE <=9 only
  40679. // IE8-9 doesn't update selected after form reset (#2551)
  40680. if ((option.selected || i === index) &&
  40681. // Don't return options that are disabled or in a disabled optgroup
  40682. !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
  40683. // Get the specific value for the option
  40684. value = jQuery(option).val();
  40685. // We don't need an array for one selects
  40686. if (one) {
  40687. return value;
  40688. }
  40689. // Multi-Selects return an array
  40690. values.push(value);
  40691. }
  40692. }
  40693. return values;
  40694. },
  40695. set: function set(elem, value) {
  40696. var optionSet,
  40697. option,
  40698. options = elem.options,
  40699. values = jQuery.makeArray(value),
  40700. i = options.length;
  40701. while (i--) {
  40702. option = options[i];
  40703. /* eslint-disable no-cond-assign */
  40704. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
  40705. optionSet = true;
  40706. }
  40707. /* eslint-enable no-cond-assign */
  40708. }
  40709. // Force browsers to behave consistently when non-matching value is set
  40710. if (!optionSet) {
  40711. elem.selectedIndex = -1;
  40712. }
  40713. return values;
  40714. }
  40715. }
  40716. }
  40717. });
  40718. // Radios and checkboxes getter/setter
  40719. jQuery.each(["radio", "checkbox"], function () {
  40720. jQuery.valHooks[this] = {
  40721. set: function set(elem, value) {
  40722. if (Array.isArray(value)) {
  40723. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  40724. }
  40725. }
  40726. };
  40727. if (!support.checkOn) {
  40728. jQuery.valHooks[this].get = function (elem) {
  40729. return elem.getAttribute("value") === null ? "on" : elem.value;
  40730. };
  40731. }
  40732. });
  40733. // Return jQuery for attributes-only inclusion
  40734. support.focusin = "onfocusin" in window;
  40735. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  40736. stopPropagationCallback = function stopPropagationCallback(e) {
  40737. e.stopPropagation();
  40738. };
  40739. jQuery.extend(jQuery.event, {
  40740. trigger: function trigger(event, data, elem, onlyHandlers) {
  40741. var i,
  40742. cur,
  40743. tmp,
  40744. bubbleType,
  40745. ontype,
  40746. handle,
  40747. special,
  40748. lastElement,
  40749. eventPath = [elem || document],
  40750. type = hasOwn.call(event, "type") ? event.type : event,
  40751. namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
  40752. cur = lastElement = tmp = elem = elem || document;
  40753. // Don't do events on text and comment nodes
  40754. if (elem.nodeType === 3 || elem.nodeType === 8) {
  40755. return;
  40756. }
  40757. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  40758. if (rfocusMorph.test(type + jQuery.event.triggered)) {
  40759. return;
  40760. }
  40761. if (type.indexOf(".") > -1) {
  40762. // Namespaced trigger; create a regexp to match event type in handle()
  40763. namespaces = type.split(".");
  40764. type = namespaces.shift();
  40765. namespaces.sort();
  40766. }
  40767. ontype = type.indexOf(":") < 0 && "on" + type;
  40768. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  40769. event = event[jQuery.expando] ? event : new jQuery.Event(type, (typeof event === "undefined" ? "undefined" : _typeof(event)) === "object" && event);
  40770. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  40771. event.isTrigger = onlyHandlers ? 2 : 3;
  40772. event.namespace = namespaces.join(".");
  40773. event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  40774. // Clean up the event in case it is being reused
  40775. event.result = undefined;
  40776. if (!event.target) {
  40777. event.target = elem;
  40778. }
  40779. // Clone any incoming data and prepend the event, creating the handler arg list
  40780. data = data == null ? [event] : jQuery.makeArray(data, [event]);
  40781. // Allow special events to draw outside the lines
  40782. special = jQuery.event.special[type] || {};
  40783. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  40784. return;
  40785. }
  40786. // Determine event propagation path in advance, per W3C events spec (#9951)
  40787. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  40788. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  40789. bubbleType = special.delegateType || type;
  40790. if (!rfocusMorph.test(bubbleType + type)) {
  40791. cur = cur.parentNode;
  40792. }
  40793. for (; cur; cur = cur.parentNode) {
  40794. eventPath.push(cur);
  40795. tmp = cur;
  40796. }
  40797. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  40798. if (tmp === (elem.ownerDocument || document)) {
  40799. eventPath.push(tmp.defaultView || tmp.parentWindow || window);
  40800. }
  40801. }
  40802. // Fire handlers on the event path
  40803. i = 0;
  40804. while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
  40805. lastElement = cur;
  40806. event.type = i > 1 ? bubbleType : special.bindType || type;
  40807. // jQuery handler
  40808. handle = (dataPriv.get(cur, "events") || {})[event.type] && dataPriv.get(cur, "handle");
  40809. if (handle) {
  40810. handle.apply(cur, data);
  40811. }
  40812. // Native handler
  40813. handle = ontype && cur[ontype];
  40814. if (handle && handle.apply && acceptData(cur)) {
  40815. event.result = handle.apply(cur, data);
  40816. if (event.result === false) {
  40817. event.preventDefault();
  40818. }
  40819. }
  40820. }
  40821. event.type = type;
  40822. // If nobody prevented the default action, do it now
  40823. if (!onlyHandlers && !event.isDefaultPrevented()) {
  40824. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  40825. // Call a native DOM method on the target with the same name as the event.
  40826. // Don't do default actions on window, that's where global variables be (#6170)
  40827. if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
  40828. // Don't re-trigger an onFOO event when we call its FOO() method
  40829. tmp = elem[ontype];
  40830. if (tmp) {
  40831. elem[ontype] = null;
  40832. }
  40833. // Prevent re-triggering of the same event, since we already bubbled it above
  40834. jQuery.event.triggered = type;
  40835. if (event.isPropagationStopped()) {
  40836. lastElement.addEventListener(type, stopPropagationCallback);
  40837. }
  40838. elem[type]();
  40839. if (event.isPropagationStopped()) {
  40840. lastElement.removeEventListener(type, stopPropagationCallback);
  40841. }
  40842. jQuery.event.triggered = undefined;
  40843. if (tmp) {
  40844. elem[ontype] = tmp;
  40845. }
  40846. }
  40847. }
  40848. }
  40849. return event.result;
  40850. },
  40851. // Piggyback on a donor event to simulate a different one
  40852. // Used only for `focus(in | out)` events
  40853. simulate: function simulate(type, elem, event) {
  40854. var e = jQuery.extend(new jQuery.Event(), event, {
  40855. type: type,
  40856. isSimulated: true
  40857. });
  40858. jQuery.event.trigger(e, null, elem);
  40859. }
  40860. });
  40861. jQuery.fn.extend({
  40862. trigger: function trigger(type, data) {
  40863. return this.each(function () {
  40864. jQuery.event.trigger(type, data, this);
  40865. });
  40866. },
  40867. triggerHandler: function triggerHandler(type, data) {
  40868. var elem = this[0];
  40869. if (elem) {
  40870. return jQuery.event.trigger(type, data, elem, true);
  40871. }
  40872. }
  40873. });
  40874. // Support: Firefox <=44
  40875. // Firefox doesn't have focus(in | out) events
  40876. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  40877. //
  40878. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  40879. // focus(in | out) events fire after focus & blur events,
  40880. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  40881. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  40882. if (!support.focusin) {
  40883. jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) {
  40884. // Attach a single capturing handler on the document while someone wants focusin/focusout
  40885. var handler = function handler(event) {
  40886. jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
  40887. };
  40888. jQuery.event.special[fix] = {
  40889. setup: function setup() {
  40890. var doc = this.ownerDocument || this,
  40891. attaches = dataPriv.access(doc, fix);
  40892. if (!attaches) {
  40893. doc.addEventListener(orig, handler, true);
  40894. }
  40895. dataPriv.access(doc, fix, (attaches || 0) + 1);
  40896. },
  40897. teardown: function teardown() {
  40898. var doc = this.ownerDocument || this,
  40899. attaches = dataPriv.access(doc, fix) - 1;
  40900. if (!attaches) {
  40901. doc.removeEventListener(orig, handler, true);
  40902. dataPriv.remove(doc, fix);
  40903. } else {
  40904. dataPriv.access(doc, fix, attaches);
  40905. }
  40906. }
  40907. };
  40908. });
  40909. }
  40910. var location = window.location;
  40911. var nonce = Date.now();
  40912. var rquery = /\?/;
  40913. // Cross-browser xml parsing
  40914. jQuery.parseXML = function (data) {
  40915. var xml;
  40916. if (!data || typeof data !== "string") {
  40917. return null;
  40918. }
  40919. // Support: IE 9 - 11 only
  40920. // IE throws on parseFromString with invalid input.
  40921. try {
  40922. xml = new window.DOMParser().parseFromString(data, "text/xml");
  40923. } catch (e) {
  40924. xml = undefined;
  40925. }
  40926. if (!xml || xml.getElementsByTagName("parsererror").length) {
  40927. jQuery.error("Invalid XML: " + data);
  40928. }
  40929. return xml;
  40930. };
  40931. var rbracket = /\[\]$/,
  40932. rCRLF = /\r?\n/g,
  40933. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  40934. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  40935. function buildParams(prefix, obj, traditional, add) {
  40936. var name;
  40937. if (Array.isArray(obj)) {
  40938. // Serialize array item.
  40939. jQuery.each(obj, function (i, v) {
  40940. if (traditional || rbracket.test(prefix)) {
  40941. // Treat each array item as a scalar.
  40942. add(prefix, v);
  40943. } else {
  40944. // Item is non-scalar (array or object), encode its numeric index.
  40945. buildParams(prefix + "[" + ((typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && v != null ? i : "") + "]", v, traditional, add);
  40946. }
  40947. });
  40948. } else if (!traditional && toType(obj) === "object") {
  40949. // Serialize object item.
  40950. for (name in obj) {
  40951. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  40952. }
  40953. } else {
  40954. // Serialize scalar item.
  40955. add(prefix, obj);
  40956. }
  40957. }
  40958. // Serialize an array of form elements or a set of
  40959. // key/values into a query string
  40960. jQuery.param = function (a, traditional) {
  40961. var prefix,
  40962. s = [],
  40963. add = function add(key, valueOrFunction) {
  40964. // If value is a function, invoke it and use its return value
  40965. var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;
  40966. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
  40967. };
  40968. // If an array was passed in, assume that it is an array of form elements.
  40969. if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  40970. // Serialize the form elements
  40971. jQuery.each(a, function () {
  40972. add(this.name, this.value);
  40973. });
  40974. } else {
  40975. // If traditional, encode the "old" way (the way 1.3.2 or older
  40976. // did it), otherwise encode params recursively.
  40977. for (prefix in a) {
  40978. buildParams(prefix, a[prefix], traditional, add);
  40979. }
  40980. }
  40981. // Return the resulting serialization
  40982. return s.join("&");
  40983. };
  40984. jQuery.fn.extend({
  40985. serialize: function serialize() {
  40986. return jQuery.param(this.serializeArray());
  40987. },
  40988. serializeArray: function serializeArray() {
  40989. return this.map(function () {
  40990. // Can add propHook for "elements" to filter or add form elements
  40991. var elements = jQuery.prop(this, "elements");
  40992. return elements ? jQuery.makeArray(elements) : this;
  40993. }).filter(function () {
  40994. var type = this.type;
  40995. // Use .is( ":disabled" ) so that fieldset[disabled] works
  40996. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
  40997. }).map(function (i, elem) {
  40998. var val = jQuery(this).val();
  40999. if (val == null) {
  41000. return null;
  41001. }
  41002. if (Array.isArray(val)) {
  41003. return jQuery.map(val, function (val) {
  41004. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  41005. });
  41006. }
  41007. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  41008. }).get();
  41009. }
  41010. });
  41011. var r20 = /%20/g,
  41012. rhash = /#.*$/,
  41013. rantiCache = /([?&])_=[^&]*/,
  41014. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  41015. // #7653, #8125, #8152: local protocol detection
  41016. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  41017. rnoContent = /^(?:GET|HEAD)$/,
  41018. rprotocol = /^\/\//,
  41019. /* Prefilters
  41020. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  41021. * 2) These are called:
  41022. * - BEFORE asking for a transport
  41023. * - AFTER param serialization (s.data is a string if s.processData is true)
  41024. * 3) key is the dataType
  41025. * 4) the catchall symbol "*" can be used
  41026. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  41027. */
  41028. prefilters = {},
  41029. /* Transports bindings
  41030. * 1) key is the dataType
  41031. * 2) the catchall symbol "*" can be used
  41032. * 3) selection will start with transport dataType and THEN go to "*" if needed
  41033. */
  41034. transports = {},
  41035. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  41036. allTypes = "*/".concat("*"),
  41037. // Anchor tag for parsing the document origin
  41038. originAnchor = document.createElement("a");
  41039. originAnchor.href = location.href;
  41040. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  41041. function addToPrefiltersOrTransports(structure) {
  41042. // dataTypeExpression is optional and defaults to "*"
  41043. return function (dataTypeExpression, func) {
  41044. if (typeof dataTypeExpression !== "string") {
  41045. func = dataTypeExpression;
  41046. dataTypeExpression = "*";
  41047. }
  41048. var dataType,
  41049. i = 0,
  41050. dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  41051. if (isFunction(func)) {
  41052. // For each dataType in the dataTypeExpression
  41053. while (dataType = dataTypes[i++]) {
  41054. // Prepend if requested
  41055. if (dataType[0] === "+") {
  41056. dataType = dataType.slice(1) || "*";
  41057. (structure[dataType] = structure[dataType] || []).unshift(func);
  41058. // Otherwise append
  41059. } else {
  41060. (structure[dataType] = structure[dataType] || []).push(func);
  41061. }
  41062. }
  41063. }
  41064. };
  41065. }
  41066. // Base inspection function for prefilters and transports
  41067. function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
  41068. var inspected = {},
  41069. seekingTransport = structure === transports;
  41070. function inspect(dataType) {
  41071. var selected;
  41072. inspected[dataType] = true;
  41073. jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
  41074. var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
  41075. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  41076. options.dataTypes.unshift(dataTypeOrTransport);
  41077. inspect(dataTypeOrTransport);
  41078. return false;
  41079. } else if (seekingTransport) {
  41080. return !(selected = dataTypeOrTransport);
  41081. }
  41082. });
  41083. return selected;
  41084. }
  41085. return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
  41086. }
  41087. // A special extend for ajax options
  41088. // that takes "flat" options (not to be deep extended)
  41089. // Fixes #9887
  41090. function ajaxExtend(target, src) {
  41091. var key,
  41092. deep,
  41093. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  41094. for (key in src) {
  41095. if (src[key] !== undefined) {
  41096. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  41097. }
  41098. }
  41099. if (deep) {
  41100. jQuery.extend(true, target, deep);
  41101. }
  41102. return target;
  41103. }
  41104. /* Handles responses to an ajax request:
  41105. * - finds the right dataType (mediates between content-type and expected dataType)
  41106. * - returns the corresponding response
  41107. */
  41108. function ajaxHandleResponses(s, jqXHR, responses) {
  41109. var ct,
  41110. type,
  41111. finalDataType,
  41112. firstDataType,
  41113. contents = s.contents,
  41114. dataTypes = s.dataTypes;
  41115. // Remove auto dataType and get content-type in the process
  41116. while (dataTypes[0] === "*") {
  41117. dataTypes.shift();
  41118. if (ct === undefined) {
  41119. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  41120. }
  41121. }
  41122. // Check if we're dealing with a known content-type
  41123. if (ct) {
  41124. for (type in contents) {
  41125. if (contents[type] && contents[type].test(ct)) {
  41126. dataTypes.unshift(type);
  41127. break;
  41128. }
  41129. }
  41130. }
  41131. // Check to see if we have a response for the expected dataType
  41132. if (dataTypes[0] in responses) {
  41133. finalDataType = dataTypes[0];
  41134. } else {
  41135. // Try convertible dataTypes
  41136. for (type in responses) {
  41137. if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
  41138. finalDataType = type;
  41139. break;
  41140. }
  41141. if (!firstDataType) {
  41142. firstDataType = type;
  41143. }
  41144. }
  41145. // Or just use first one
  41146. finalDataType = finalDataType || firstDataType;
  41147. }
  41148. // If we found a dataType
  41149. // We add the dataType to the list if needed
  41150. // and return the corresponding response
  41151. if (finalDataType) {
  41152. if (finalDataType !== dataTypes[0]) {
  41153. dataTypes.unshift(finalDataType);
  41154. }
  41155. return responses[finalDataType];
  41156. }
  41157. }
  41158. /* Chain conversions given the request and the original response
  41159. * Also sets the responseXXX fields on the jqXHR instance
  41160. */
  41161. function ajaxConvert(s, response, jqXHR, isSuccess) {
  41162. var conv2,
  41163. current,
  41164. conv,
  41165. tmp,
  41166. prev,
  41167. converters = {},
  41168. // Work with a copy of dataTypes in case we need to modify it for conversion
  41169. dataTypes = s.dataTypes.slice();
  41170. // Create converters map with lowercased keys
  41171. if (dataTypes[1]) {
  41172. for (conv in s.converters) {
  41173. converters[conv.toLowerCase()] = s.converters[conv];
  41174. }
  41175. }
  41176. current = dataTypes.shift();
  41177. // Convert to each sequential dataType
  41178. while (current) {
  41179. if (s.responseFields[current]) {
  41180. jqXHR[s.responseFields[current]] = response;
  41181. }
  41182. // Apply the dataFilter if provided
  41183. if (!prev && isSuccess && s.dataFilter) {
  41184. response = s.dataFilter(response, s.dataType);
  41185. }
  41186. prev = current;
  41187. current = dataTypes.shift();
  41188. if (current) {
  41189. // There's only work to do if current dataType is non-auto
  41190. if (current === "*") {
  41191. current = prev;
  41192. // Convert response if prev dataType is non-auto and differs from current
  41193. } else if (prev !== "*" && prev !== current) {
  41194. // Seek a direct converter
  41195. conv = converters[prev + " " + current] || converters["* " + current];
  41196. // If none found, seek a pair
  41197. if (!conv) {
  41198. for (conv2 in converters) {
  41199. // If conv2 outputs current
  41200. tmp = conv2.split(" ");
  41201. if (tmp[1] === current) {
  41202. // If prev can be converted to accepted input
  41203. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  41204. if (conv) {
  41205. // Condense equivalence converters
  41206. if (conv === true) {
  41207. conv = converters[conv2];
  41208. // Otherwise, insert the intermediate dataType
  41209. } else if (converters[conv2] !== true) {
  41210. current = tmp[0];
  41211. dataTypes.unshift(tmp[1]);
  41212. }
  41213. break;
  41214. }
  41215. }
  41216. }
  41217. }
  41218. // Apply converter (if not an equivalence)
  41219. if (conv !== true) {
  41220. // Unless errors are allowed to bubble, catch and return them
  41221. if (conv && s.throws) {
  41222. response = conv(response);
  41223. } else {
  41224. try {
  41225. response = conv(response);
  41226. } catch (e) {
  41227. return {
  41228. state: "parsererror",
  41229. error: conv ? e : "No conversion from " + prev + " to " + current
  41230. };
  41231. }
  41232. }
  41233. }
  41234. }
  41235. }
  41236. }
  41237. return { state: "success", data: response };
  41238. }
  41239. jQuery.extend({
  41240. // Counter for holding the number of active queries
  41241. active: 0,
  41242. // Last-Modified header cache for next request
  41243. lastModified: {},
  41244. etag: {},
  41245. ajaxSettings: {
  41246. url: location.href,
  41247. type: "GET",
  41248. isLocal: rlocalProtocol.test(location.protocol),
  41249. global: true,
  41250. processData: true,
  41251. async: true,
  41252. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  41253. /*
  41254. timeout: 0,
  41255. data: null,
  41256. dataType: null,
  41257. username: null,
  41258. password: null,
  41259. cache: null,
  41260. throws: false,
  41261. traditional: false,
  41262. headers: {},
  41263. */
  41264. accepts: {
  41265. "*": allTypes,
  41266. text: "text/plain",
  41267. html: "text/html",
  41268. xml: "application/xml, text/xml",
  41269. json: "application/json, text/javascript"
  41270. },
  41271. contents: {
  41272. xml: /\bxml\b/,
  41273. html: /\bhtml/,
  41274. json: /\bjson\b/
  41275. },
  41276. responseFields: {
  41277. xml: "responseXML",
  41278. text: "responseText",
  41279. json: "responseJSON"
  41280. },
  41281. // Data converters
  41282. // Keys separate source (or catchall "*") and destination types with a single space
  41283. converters: {
  41284. // Convert anything to text
  41285. "* text": String,
  41286. // Text to html (true = no transformation)
  41287. "text html": true,
  41288. // Evaluate text as a json expression
  41289. "text json": JSON.parse,
  41290. // Parse text as xml
  41291. "text xml": jQuery.parseXML
  41292. },
  41293. // For options that shouldn't be deep extended:
  41294. // you can add your own custom options here if
  41295. // and when you create one that shouldn't be
  41296. // deep extended (see ajaxExtend)
  41297. flatOptions: {
  41298. url: true,
  41299. context: true
  41300. }
  41301. },
  41302. // Creates a full fledged settings object into target
  41303. // with both ajaxSettings and settings fields.
  41304. // If target is omitted, writes into ajaxSettings.
  41305. ajaxSetup: function ajaxSetup(target, settings) {
  41306. return settings ?
  41307. // Building a settings object
  41308. ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
  41309. // Extending ajaxSettings
  41310. ajaxExtend(jQuery.ajaxSettings, target);
  41311. },
  41312. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  41313. ajaxTransport: addToPrefiltersOrTransports(transports),
  41314. // Main method
  41315. ajax: function ajax(url, options) {
  41316. // If url is an object, simulate pre-1.5 signature
  41317. if ((typeof url === "undefined" ? "undefined" : _typeof(url)) === "object") {
  41318. options = url;
  41319. url = undefined;
  41320. }
  41321. // Force options to be an object
  41322. options = options || {};
  41323. var transport,
  41324. // URL without anti-cache param
  41325. cacheURL,
  41326. // Response headers
  41327. responseHeadersString,
  41328. responseHeaders,
  41329. // timeout handle
  41330. timeoutTimer,
  41331. // Url cleanup var
  41332. urlAnchor,
  41333. // Request state (becomes false upon send and true upon completion)
  41334. completed,
  41335. // To know if global events are to be dispatched
  41336. fireGlobals,
  41337. // Loop variable
  41338. i,
  41339. // uncached part of the url
  41340. uncached,
  41341. // Create the final options object
  41342. s = jQuery.ajaxSetup({}, options),
  41343. // Callbacks context
  41344. callbackContext = s.context || s,
  41345. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  41346. globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
  41347. // Deferreds
  41348. deferred = jQuery.Deferred(),
  41349. completeDeferred = jQuery.Callbacks("once memory"),
  41350. // Status-dependent callbacks
  41351. _statusCode = s.statusCode || {},
  41352. // Headers (they are sent all at once)
  41353. requestHeaders = {},
  41354. requestHeadersNames = {},
  41355. // Default abort message
  41356. strAbort = "canceled",
  41357. // Fake xhr
  41358. jqXHR = {
  41359. readyState: 0,
  41360. // Builds headers hashtable if needed
  41361. getResponseHeader: function getResponseHeader(key) {
  41362. var match;
  41363. if (completed) {
  41364. if (!responseHeaders) {
  41365. responseHeaders = {};
  41366. while (match = rheaders.exec(responseHeadersString)) {
  41367. responseHeaders[match[1].toLowerCase()] = match[2];
  41368. }
  41369. }
  41370. match = responseHeaders[key.toLowerCase()];
  41371. }
  41372. return match == null ? null : match;
  41373. },
  41374. // Raw string
  41375. getAllResponseHeaders: function getAllResponseHeaders() {
  41376. return completed ? responseHeadersString : null;
  41377. },
  41378. // Caches the header
  41379. setRequestHeader: function setRequestHeader(name, value) {
  41380. if (completed == null) {
  41381. name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
  41382. requestHeaders[name] = value;
  41383. }
  41384. return this;
  41385. },
  41386. // Overrides response content-type header
  41387. overrideMimeType: function overrideMimeType(type) {
  41388. if (completed == null) {
  41389. s.mimeType = type;
  41390. }
  41391. return this;
  41392. },
  41393. // Status-dependent callbacks
  41394. statusCode: function statusCode(map) {
  41395. var code;
  41396. if (map) {
  41397. if (completed) {
  41398. // Execute the appropriate callbacks
  41399. jqXHR.always(map[jqXHR.status]);
  41400. } else {
  41401. // Lazy-add the new callbacks in a way that preserves old ones
  41402. for (code in map) {
  41403. _statusCode[code] = [_statusCode[code], map[code]];
  41404. }
  41405. }
  41406. }
  41407. return this;
  41408. },
  41409. // Cancel the request
  41410. abort: function abort(statusText) {
  41411. var finalText = statusText || strAbort;
  41412. if (transport) {
  41413. transport.abort(finalText);
  41414. }
  41415. done(0, finalText);
  41416. return this;
  41417. }
  41418. };
  41419. // Attach deferreds
  41420. deferred.promise(jqXHR);
  41421. // Add protocol if not provided (prefilters might expect it)
  41422. // Handle falsy url in the settings object (#10093: consistency with old signature)
  41423. // We also use the url parameter if available
  41424. s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");
  41425. // Alias method option to type as per ticket #12004
  41426. s.type = options.method || options.type || s.method || s.type;
  41427. // Extract dataTypes list
  41428. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  41429. // A cross-domain request is in order when the origin doesn't match the current origin.
  41430. if (s.crossDomain == null) {
  41431. urlAnchor = document.createElement("a");
  41432. // Support: IE <=8 - 11, Edge 12 - 15
  41433. // IE throws exception on accessing the href property if url is malformed,
  41434. // e.g. http://example.com:80x/
  41435. try {
  41436. urlAnchor.href = s.url;
  41437. // Support: IE <=8 - 11 only
  41438. // Anchor's host property isn't correctly set when s.url is relative
  41439. urlAnchor.href = urlAnchor.href;
  41440. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
  41441. } catch (e) {
  41442. // If there is an error parsing the URL, assume it is crossDomain,
  41443. // it can be rejected by the transport if it is invalid
  41444. s.crossDomain = true;
  41445. }
  41446. }
  41447. // Convert data if not already a string
  41448. if (s.data && s.processData && typeof s.data !== "string") {
  41449. s.data = jQuery.param(s.data, s.traditional);
  41450. }
  41451. // Apply prefilters
  41452. inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
  41453. // If request was aborted inside a prefilter, stop there
  41454. if (completed) {
  41455. return jqXHR;
  41456. }
  41457. // We can fire global events as of now if asked to
  41458. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  41459. fireGlobals = jQuery.event && s.global;
  41460. // Watch for a new set of requests
  41461. if (fireGlobals && jQuery.active++ === 0) {
  41462. jQuery.event.trigger("ajaxStart");
  41463. }
  41464. // Uppercase the type
  41465. s.type = s.type.toUpperCase();
  41466. // Determine if request has content
  41467. s.hasContent = !rnoContent.test(s.type);
  41468. // Save the URL in case we're toying with the If-Modified-Since
  41469. // and/or If-None-Match header later on
  41470. // Remove hash to simplify url manipulation
  41471. cacheURL = s.url.replace(rhash, "");
  41472. // More options handling for requests with no content
  41473. if (!s.hasContent) {
  41474. // Remember the hash so we can put it back
  41475. uncached = s.url.slice(cacheURL.length);
  41476. // If data is available and should be processed, append data to url
  41477. if (s.data && (s.processData || typeof s.data === "string")) {
  41478. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  41479. // #9682: remove data so that it's not used in an eventual retry
  41480. delete s.data;
  41481. }
  41482. // Add or update anti-cache param if needed
  41483. if (s.cache === false) {
  41484. cacheURL = cacheURL.replace(rantiCache, "$1");
  41485. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++ + uncached;
  41486. }
  41487. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  41488. s.url = cacheURL + uncached;
  41489. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  41490. } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  41491. s.data = s.data.replace(r20, "+");
  41492. }
  41493. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  41494. if (s.ifModified) {
  41495. if (jQuery.lastModified[cacheURL]) {
  41496. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  41497. }
  41498. if (jQuery.etag[cacheURL]) {
  41499. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  41500. }
  41501. }
  41502. // Set the correct header, if data is being sent
  41503. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  41504. jqXHR.setRequestHeader("Content-Type", s.contentType);
  41505. }
  41506. // Set the Accepts header for the server, depending on the dataType
  41507. 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["*"]);
  41508. // Check for headers option
  41509. for (i in s.headers) {
  41510. jqXHR.setRequestHeader(i, s.headers[i]);
  41511. }
  41512. // Allow custom headers/mimetypes and early abort
  41513. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {
  41514. // Abort if not done already and return
  41515. return jqXHR.abort();
  41516. }
  41517. // Aborting is no longer a cancellation
  41518. strAbort = "abort";
  41519. // Install callbacks on deferreds
  41520. completeDeferred.add(s.complete);
  41521. jqXHR.done(s.success);
  41522. jqXHR.fail(s.error);
  41523. // Get transport
  41524. transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
  41525. // If no transport, we auto-abort
  41526. if (!transport) {
  41527. done(-1, "No Transport");
  41528. } else {
  41529. jqXHR.readyState = 1;
  41530. // Send global event
  41531. if (fireGlobals) {
  41532. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  41533. }
  41534. // If request was aborted inside ajaxSend, stop there
  41535. if (completed) {
  41536. return jqXHR;
  41537. }
  41538. // Timeout
  41539. if (s.async && s.timeout > 0) {
  41540. timeoutTimer = window.setTimeout(function () {
  41541. jqXHR.abort("timeout");
  41542. }, s.timeout);
  41543. }
  41544. try {
  41545. completed = false;
  41546. transport.send(requestHeaders, done);
  41547. } catch (e) {
  41548. // Rethrow post-completion exceptions
  41549. if (completed) {
  41550. throw e;
  41551. }
  41552. // Propagate others as results
  41553. done(-1, e);
  41554. }
  41555. }
  41556. // Callback for when everything is done
  41557. function done(status, nativeStatusText, responses, headers) {
  41558. var isSuccess,
  41559. success,
  41560. error,
  41561. response,
  41562. modified,
  41563. statusText = nativeStatusText;
  41564. // Ignore repeat invocations
  41565. if (completed) {
  41566. return;
  41567. }
  41568. completed = true;
  41569. // Clear timeout if it exists
  41570. if (timeoutTimer) {
  41571. window.clearTimeout(timeoutTimer);
  41572. }
  41573. // Dereference transport for early garbage collection
  41574. // (no matter how long the jqXHR object will be used)
  41575. transport = undefined;
  41576. // Cache response headers
  41577. responseHeadersString = headers || "";
  41578. // Set readyState
  41579. jqXHR.readyState = status > 0 ? 4 : 0;
  41580. // Determine if successful
  41581. isSuccess = status >= 200 && status < 300 || status === 304;
  41582. // Get response data
  41583. if (responses) {
  41584. response = ajaxHandleResponses(s, jqXHR, responses);
  41585. }
  41586. // Convert no matter what (that way responseXXX fields are always set)
  41587. response = ajaxConvert(s, response, jqXHR, isSuccess);
  41588. // If successful, handle type chaining
  41589. if (isSuccess) {
  41590. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  41591. if (s.ifModified) {
  41592. modified = jqXHR.getResponseHeader("Last-Modified");
  41593. if (modified) {
  41594. jQuery.lastModified[cacheURL] = modified;
  41595. }
  41596. modified = jqXHR.getResponseHeader("etag");
  41597. if (modified) {
  41598. jQuery.etag[cacheURL] = modified;
  41599. }
  41600. }
  41601. // if no content
  41602. if (status === 204 || s.type === "HEAD") {
  41603. statusText = "nocontent";
  41604. // if not modified
  41605. } else if (status === 304) {
  41606. statusText = "notmodified";
  41607. // If we have data, let's convert it
  41608. } else {
  41609. statusText = response.state;
  41610. success = response.data;
  41611. error = response.error;
  41612. isSuccess = !error;
  41613. }
  41614. } else {
  41615. // Extract error from statusText and normalize for non-aborts
  41616. error = statusText;
  41617. if (status || !statusText) {
  41618. statusText = "error";
  41619. if (status < 0) {
  41620. status = 0;
  41621. }
  41622. }
  41623. }
  41624. // Set data for the fake xhr object
  41625. jqXHR.status = status;
  41626. jqXHR.statusText = (nativeStatusText || statusText) + "";
  41627. // Success/Error
  41628. if (isSuccess) {
  41629. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  41630. } else {
  41631. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  41632. }
  41633. // Status-dependent callbacks
  41634. jqXHR.statusCode(_statusCode);
  41635. _statusCode = undefined;
  41636. if (fireGlobals) {
  41637. globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
  41638. }
  41639. // Complete
  41640. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  41641. if (fireGlobals) {
  41642. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  41643. // Handle the global AJAX counter
  41644. if (! --jQuery.active) {
  41645. jQuery.event.trigger("ajaxStop");
  41646. }
  41647. }
  41648. }
  41649. return jqXHR;
  41650. },
  41651. getJSON: function getJSON(url, data, callback) {
  41652. return jQuery.get(url, data, callback, "json");
  41653. },
  41654. getScript: function getScript(url, callback) {
  41655. return jQuery.get(url, undefined, callback, "script");
  41656. }
  41657. });
  41658. jQuery.each(["get", "post"], function (i, method) {
  41659. jQuery[method] = function (url, data, callback, type) {
  41660. // Shift arguments if data argument was omitted
  41661. if (isFunction(data)) {
  41662. type = type || callback;
  41663. callback = data;
  41664. data = undefined;
  41665. }
  41666. // The url can be an options object (which then must have .url)
  41667. return jQuery.ajax(jQuery.extend({
  41668. url: url,
  41669. type: method,
  41670. dataType: type,
  41671. data: data,
  41672. success: callback
  41673. }, jQuery.isPlainObject(url) && url));
  41674. };
  41675. });
  41676. jQuery._evalUrl = function (url) {
  41677. return jQuery.ajax({
  41678. url: url,
  41679. // Make this explicit, since user can override this through ajaxSetup (#11264)
  41680. type: "GET",
  41681. dataType: "script",
  41682. cache: true,
  41683. async: false,
  41684. global: false,
  41685. "throws": true
  41686. });
  41687. };
  41688. jQuery.fn.extend({
  41689. wrapAll: function wrapAll(html) {
  41690. var wrap;
  41691. if (this[0]) {
  41692. if (isFunction(html)) {
  41693. html = html.call(this[0]);
  41694. }
  41695. // The elements to wrap the target around
  41696. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  41697. if (this[0].parentNode) {
  41698. wrap.insertBefore(this[0]);
  41699. }
  41700. wrap.map(function () {
  41701. var elem = this;
  41702. while (elem.firstElementChild) {
  41703. elem = elem.firstElementChild;
  41704. }
  41705. return elem;
  41706. }).append(this);
  41707. }
  41708. return this;
  41709. },
  41710. wrapInner: function wrapInner(html) {
  41711. if (isFunction(html)) {
  41712. return this.each(function (i) {
  41713. jQuery(this).wrapInner(html.call(this, i));
  41714. });
  41715. }
  41716. return this.each(function () {
  41717. var self = jQuery(this),
  41718. contents = self.contents();
  41719. if (contents.length) {
  41720. contents.wrapAll(html);
  41721. } else {
  41722. self.append(html);
  41723. }
  41724. });
  41725. },
  41726. wrap: function wrap(html) {
  41727. var htmlIsFunction = isFunction(html);
  41728. return this.each(function (i) {
  41729. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
  41730. });
  41731. },
  41732. unwrap: function unwrap(selector) {
  41733. this.parent(selector).not("body").each(function () {
  41734. jQuery(this).replaceWith(this.childNodes);
  41735. });
  41736. return this;
  41737. }
  41738. });
  41739. jQuery.expr.pseudos.hidden = function (elem) {
  41740. return !jQuery.expr.pseudos.visible(elem);
  41741. };
  41742. jQuery.expr.pseudos.visible = function (elem) {
  41743. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  41744. };
  41745. jQuery.ajaxSettings.xhr = function () {
  41746. try {
  41747. return new window.XMLHttpRequest();
  41748. } catch (e) {}
  41749. };
  41750. var xhrSuccessStatus = {
  41751. // File protocol always yields status code 0, assume 200
  41752. 0: 200,
  41753. // Support: IE <=9 only
  41754. // #1450: sometimes IE returns 1223 when it should be 204
  41755. 1223: 204
  41756. },
  41757. xhrSupported = jQuery.ajaxSettings.xhr();
  41758. support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  41759. support.ajax = xhrSupported = !!xhrSupported;
  41760. jQuery.ajaxTransport(function (options) {
  41761. var _callback, errorCallback;
  41762. // Cross domain only allowed if supported through XMLHttpRequest
  41763. if (support.cors || xhrSupported && !options.crossDomain) {
  41764. return {
  41765. send: function send(headers, complete) {
  41766. var i,
  41767. xhr = options.xhr();
  41768. xhr.open(options.type, options.url, options.async, options.username, options.password);
  41769. // Apply custom fields if provided
  41770. if (options.xhrFields) {
  41771. for (i in options.xhrFields) {
  41772. xhr[i] = options.xhrFields[i];
  41773. }
  41774. }
  41775. // Override mime type if needed
  41776. if (options.mimeType && xhr.overrideMimeType) {
  41777. xhr.overrideMimeType(options.mimeType);
  41778. }
  41779. // X-Requested-With header
  41780. // For cross-domain requests, seeing as conditions for a preflight are
  41781. // akin to a jigsaw puzzle, we simply never set it to be sure.
  41782. // (it can always be set on a per-request basis or even using ajaxSetup)
  41783. // For same-domain requests, won't change header if already provided.
  41784. if (!options.crossDomain && !headers["X-Requested-With"]) {
  41785. headers["X-Requested-With"] = "XMLHttpRequest";
  41786. }
  41787. // Set headers
  41788. for (i in headers) {
  41789. xhr.setRequestHeader(i, headers[i]);
  41790. }
  41791. // Callback
  41792. _callback = function callback(type) {
  41793. return function () {
  41794. if (_callback) {
  41795. _callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
  41796. if (type === "abort") {
  41797. xhr.abort();
  41798. } else if (type === "error") {
  41799. // Support: IE <=9 only
  41800. // On a manual native abort, IE9 throws
  41801. // errors on any property access that is not readyState
  41802. if (typeof xhr.status !== "number") {
  41803. complete(0, "error");
  41804. } else {
  41805. complete(
  41806. // File: protocol always yields status 0; see #8605, #14207
  41807. xhr.status, xhr.statusText);
  41808. }
  41809. } else {
  41810. complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText,
  41811. // Support: IE <=9 only
  41812. // IE9 has no XHR2 but throws on binary (trac-11426)
  41813. // For XHR2 non-text, let the caller handle it (gh-2498)
  41814. (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders());
  41815. }
  41816. }
  41817. };
  41818. };
  41819. // Listen to events
  41820. xhr.onload = _callback();
  41821. errorCallback = xhr.onerror = xhr.ontimeout = _callback("error");
  41822. // Support: IE 9 only
  41823. // Use onreadystatechange to replace onabort
  41824. // to handle uncaught aborts
  41825. if (xhr.onabort !== undefined) {
  41826. xhr.onabort = errorCallback;
  41827. } else {
  41828. xhr.onreadystatechange = function () {
  41829. // Check readyState before timeout as it changes
  41830. if (xhr.readyState === 4) {
  41831. // Allow onerror to be called first,
  41832. // but that will not handle a native abort
  41833. // Also, save errorCallback to a variable
  41834. // as xhr.onerror cannot be accessed
  41835. window.setTimeout(function () {
  41836. if (_callback) {
  41837. errorCallback();
  41838. }
  41839. });
  41840. }
  41841. };
  41842. }
  41843. // Create the abort callback
  41844. _callback = _callback("abort");
  41845. try {
  41846. // Do send the request (this may raise an exception)
  41847. xhr.send(options.hasContent && options.data || null);
  41848. } catch (e) {
  41849. // #14683: Only rethrow if this hasn't been notified as an error yet
  41850. if (_callback) {
  41851. throw e;
  41852. }
  41853. }
  41854. },
  41855. abort: function abort() {
  41856. if (_callback) {
  41857. _callback();
  41858. }
  41859. }
  41860. };
  41861. }
  41862. });
  41863. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  41864. jQuery.ajaxPrefilter(function (s) {
  41865. if (s.crossDomain) {
  41866. s.contents.script = false;
  41867. }
  41868. });
  41869. // Install script dataType
  41870. jQuery.ajaxSetup({
  41871. accepts: {
  41872. script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript"
  41873. },
  41874. contents: {
  41875. script: /\b(?:java|ecma)script\b/
  41876. },
  41877. converters: {
  41878. "text script": function textScript(text) {
  41879. jQuery.globalEval(text);
  41880. return text;
  41881. }
  41882. }
  41883. });
  41884. // Handle cache's special case and crossDomain
  41885. jQuery.ajaxPrefilter("script", function (s) {
  41886. if (s.cache === undefined) {
  41887. s.cache = false;
  41888. }
  41889. if (s.crossDomain) {
  41890. s.type = "GET";
  41891. }
  41892. });
  41893. // Bind script tag hack transport
  41894. jQuery.ajaxTransport("script", function (s) {
  41895. // This transport only deals with cross domain requests
  41896. if (s.crossDomain) {
  41897. var script, _callback2;
  41898. return {
  41899. send: function send(_, complete) {
  41900. script = jQuery("<script>").prop({
  41901. charset: s.scriptCharset,
  41902. src: s.url
  41903. }).on("load error", _callback2 = function callback(evt) {
  41904. script.remove();
  41905. _callback2 = null;
  41906. if (evt) {
  41907. complete(evt.type === "error" ? 404 : 200, evt.type);
  41908. }
  41909. });
  41910. // Use native DOM manipulation to avoid our domManip AJAX trickery
  41911. document.head.appendChild(script[0]);
  41912. },
  41913. abort: function abort() {
  41914. if (_callback2) {
  41915. _callback2();
  41916. }
  41917. }
  41918. };
  41919. }
  41920. });
  41921. var oldCallbacks = [],
  41922. rjsonp = /(=)\?(?=&|$)|\?\?/;
  41923. // Default jsonp settings
  41924. jQuery.ajaxSetup({
  41925. jsonp: "callback",
  41926. jsonpCallback: function jsonpCallback() {
  41927. var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce++;
  41928. this[callback] = true;
  41929. return callback;
  41930. }
  41931. });
  41932. // Detect, normalize options and install callbacks for jsonp requests
  41933. jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
  41934. var callbackName,
  41935. overwritten,
  41936. responseContainer,
  41937. 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");
  41938. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  41939. if (jsonProp || s.dataTypes[0] === "jsonp") {
  41940. // Get callback name, remembering preexisting value associated with it
  41941. callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  41942. // Insert callback into url or form data
  41943. if (jsonProp) {
  41944. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  41945. } else if (s.jsonp !== false) {
  41946. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  41947. }
  41948. // Use data converter to retrieve json after script execution
  41949. s.converters["script json"] = function () {
  41950. if (!responseContainer) {
  41951. jQuery.error(callbackName + " was not called");
  41952. }
  41953. return responseContainer[0];
  41954. };
  41955. // Force json dataType
  41956. s.dataTypes[0] = "json";
  41957. // Install callback
  41958. overwritten = window[callbackName];
  41959. window[callbackName] = function () {
  41960. responseContainer = arguments;
  41961. };
  41962. // Clean-up function (fires after converters)
  41963. jqXHR.always(function () {
  41964. // If previous value didn't exist - remove it
  41965. if (overwritten === undefined) {
  41966. jQuery(window).removeProp(callbackName);
  41967. // Otherwise restore preexisting value
  41968. } else {
  41969. window[callbackName] = overwritten;
  41970. }
  41971. // Save back as free
  41972. if (s[callbackName]) {
  41973. // Make sure that re-using the options doesn't screw things around
  41974. s.jsonpCallback = originalSettings.jsonpCallback;
  41975. // Save the callback name for future use
  41976. oldCallbacks.push(callbackName);
  41977. }
  41978. // Call if it was a function and we have a response
  41979. if (responseContainer && isFunction(overwritten)) {
  41980. overwritten(responseContainer[0]);
  41981. }
  41982. responseContainer = overwritten = undefined;
  41983. });
  41984. // Delegate to script
  41985. return "script";
  41986. }
  41987. });
  41988. // Support: Safari 8 only
  41989. // In Safari 8 documents created via document.implementation.createHTMLDocument
  41990. // collapse sibling forms: the second one becomes a child of the first one.
  41991. // Because of that, this security measure has to be disabled in Safari 8.
  41992. // https://bugs.webkit.org/show_bug.cgi?id=137337
  41993. support.createHTMLDocument = function () {
  41994. var body = document.implementation.createHTMLDocument("").body;
  41995. body.innerHTML = "<form></form><form></form>";
  41996. return body.childNodes.length === 2;
  41997. }();
  41998. // Argument "data" should be string of html
  41999. // context (optional): If specified, the fragment will be created in this context,
  42000. // defaults to document
  42001. // keepScripts (optional): If true, will include scripts passed in the html string
  42002. jQuery.parseHTML = function (data, context, keepScripts) {
  42003. if (typeof data !== "string") {
  42004. return [];
  42005. }
  42006. if (typeof context === "boolean") {
  42007. keepScripts = context;
  42008. context = false;
  42009. }
  42010. var base, parsed, scripts;
  42011. if (!context) {
  42012. // Stop scripts or inline event handlers from being executed immediately
  42013. // by using document.implementation
  42014. if (support.createHTMLDocument) {
  42015. context = document.implementation.createHTMLDocument("");
  42016. // Set the base href for the created document
  42017. // so any parsed elements with URLs
  42018. // are based on the document's URL (gh-2965)
  42019. base = context.createElement("base");
  42020. base.href = document.location.href;
  42021. context.head.appendChild(base);
  42022. } else {
  42023. context = document;
  42024. }
  42025. }
  42026. parsed = rsingleTag.exec(data);
  42027. scripts = !keepScripts && [];
  42028. // Single tag
  42029. if (parsed) {
  42030. return [context.createElement(parsed[1])];
  42031. }
  42032. parsed = buildFragment([data], context, scripts);
  42033. if (scripts && scripts.length) {
  42034. jQuery(scripts).remove();
  42035. }
  42036. return jQuery.merge([], parsed.childNodes);
  42037. };
  42038. /**
  42039. * Load a url into a page
  42040. */
  42041. jQuery.fn.load = function (url, params, callback) {
  42042. var selector,
  42043. type,
  42044. response,
  42045. self = this,
  42046. off = url.indexOf(" ");
  42047. if (off > -1) {
  42048. selector = stripAndCollapse(url.slice(off));
  42049. url = url.slice(0, off);
  42050. }
  42051. // If it's a function
  42052. if (isFunction(params)) {
  42053. // We assume that it's the callback
  42054. callback = params;
  42055. params = undefined;
  42056. // Otherwise, build a param string
  42057. } else if (params && (typeof params === "undefined" ? "undefined" : _typeof(params)) === "object") {
  42058. type = "POST";
  42059. }
  42060. // If we have elements to modify, make the request
  42061. if (self.length > 0) {
  42062. jQuery.ajax({
  42063. url: url,
  42064. // If "type" variable is undefined, then "GET" method will be used.
  42065. // Make value of this field explicit since
  42066. // user can override it through ajaxSetup method
  42067. type: type || "GET",
  42068. dataType: "html",
  42069. data: params
  42070. }).done(function (responseText) {
  42071. // Save response for use in complete callback
  42072. response = arguments;
  42073. self.html(selector ?
  42074. // If a selector was specified, locate the right elements in a dummy div
  42075. // Exclude scripts to avoid IE 'Permission Denied' errors
  42076. jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
  42077. // Otherwise use the full result
  42078. responseText);
  42079. // If the request succeeds, this function gets "data", "status", "jqXHR"
  42080. // but they are ignored because response was set above.
  42081. // If it fails, this function gets "jqXHR", "status", "error"
  42082. }).always(callback && function (jqXHR, status) {
  42083. self.each(function () {
  42084. callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  42085. });
  42086. });
  42087. }
  42088. return this;
  42089. };
  42090. // Attach a bunch of functions for handling common AJAX events
  42091. jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) {
  42092. jQuery.fn[type] = function (fn) {
  42093. return this.on(type, fn);
  42094. };
  42095. });
  42096. jQuery.expr.pseudos.animated = function (elem) {
  42097. return jQuery.grep(jQuery.timers, function (fn) {
  42098. return elem === fn.elem;
  42099. }).length;
  42100. };
  42101. jQuery.offset = {
  42102. setOffset: function setOffset(elem, options, i) {
  42103. var curPosition,
  42104. curLeft,
  42105. curCSSTop,
  42106. curTop,
  42107. curOffset,
  42108. curCSSLeft,
  42109. calculatePosition,
  42110. position = jQuery.css(elem, "position"),
  42111. curElem = jQuery(elem),
  42112. props = {};
  42113. // Set position first, in-case top/left are set even on static elem
  42114. if (position === "static") {
  42115. elem.style.position = "relative";
  42116. }
  42117. curOffset = curElem.offset();
  42118. curCSSTop = jQuery.css(elem, "top");
  42119. curCSSLeft = jQuery.css(elem, "left");
  42120. calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  42121. // Need to be able to calculate position if either
  42122. // top or left is auto and position is either absolute or fixed
  42123. if (calculatePosition) {
  42124. curPosition = curElem.position();
  42125. curTop = curPosition.top;
  42126. curLeft = curPosition.left;
  42127. } else {
  42128. curTop = parseFloat(curCSSTop) || 0;
  42129. curLeft = parseFloat(curCSSLeft) || 0;
  42130. }
  42131. if (isFunction(options)) {
  42132. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  42133. options = options.call(elem, i, jQuery.extend({}, curOffset));
  42134. }
  42135. if (options.top != null) {
  42136. props.top = options.top - curOffset.top + curTop;
  42137. }
  42138. if (options.left != null) {
  42139. props.left = options.left - curOffset.left + curLeft;
  42140. }
  42141. if ("using" in options) {
  42142. options.using.call(elem, props);
  42143. } else {
  42144. curElem.css(props);
  42145. }
  42146. }
  42147. };
  42148. jQuery.fn.extend({
  42149. // offset() relates an element's border box to the document origin
  42150. offset: function offset(options) {
  42151. // Preserve chaining for setter
  42152. if (arguments.length) {
  42153. return options === undefined ? this : this.each(function (i) {
  42154. jQuery.offset.setOffset(this, options, i);
  42155. });
  42156. }
  42157. var rect,
  42158. win,
  42159. elem = this[0];
  42160. if (!elem) {
  42161. return;
  42162. }
  42163. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  42164. // Support: IE <=11 only
  42165. // Running getBoundingClientRect on a
  42166. // disconnected node in IE throws an error
  42167. if (!elem.getClientRects().length) {
  42168. return { top: 0, left: 0 };
  42169. }
  42170. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  42171. rect = elem.getBoundingClientRect();
  42172. win = elem.ownerDocument.defaultView;
  42173. return {
  42174. top: rect.top + win.pageYOffset,
  42175. left: rect.left + win.pageXOffset
  42176. };
  42177. },
  42178. // position() relates an element's margin box to its offset parent's padding box
  42179. // This corresponds to the behavior of CSS absolute positioning
  42180. position: function position() {
  42181. if (!this[0]) {
  42182. return;
  42183. }
  42184. var offsetParent,
  42185. offset,
  42186. doc,
  42187. elem = this[0],
  42188. parentOffset = { top: 0, left: 0 };
  42189. // position:fixed elements are offset from the viewport, which itself always has zero offset
  42190. if (jQuery.css(elem, "position") === "fixed") {
  42191. // Assume position:fixed implies availability of getBoundingClientRect
  42192. offset = elem.getBoundingClientRect();
  42193. } else {
  42194. offset = this.offset();
  42195. // Account for the *real* offset parent, which can be the document or its root element
  42196. // when a statically positioned element is identified
  42197. doc = elem.ownerDocument;
  42198. offsetParent = elem.offsetParent || doc.documentElement;
  42199. while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
  42200. offsetParent = offsetParent.parentNode;
  42201. }
  42202. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  42203. // Incorporate borders into its offset, since they are outside its content origin
  42204. parentOffset = jQuery(offsetParent).offset();
  42205. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  42206. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  42207. }
  42208. }
  42209. // Subtract parent offsets and element margins
  42210. return {
  42211. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  42212. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  42213. };
  42214. },
  42215. // This method will return documentElement in the following cases:
  42216. // 1) For the element inside the iframe without offsetParent, this method will return
  42217. // documentElement of the parent window
  42218. // 2) For the hidden or detached element
  42219. // 3) For body or html element, i.e. in case of the html node - it will return itself
  42220. //
  42221. // but those exceptions were never presented as a real life use-cases
  42222. // and might be considered as more preferable results.
  42223. //
  42224. // This logic, however, is not guaranteed and can change at any point in the future
  42225. offsetParent: function offsetParent() {
  42226. return this.map(function () {
  42227. var offsetParent = this.offsetParent;
  42228. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  42229. offsetParent = offsetParent.offsetParent;
  42230. }
  42231. return offsetParent || documentElement;
  42232. });
  42233. }
  42234. });
  42235. // Create scrollLeft and scrollTop methods
  42236. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) {
  42237. var top = "pageYOffset" === prop;
  42238. jQuery.fn[method] = function (val) {
  42239. return access(this, function (elem, method, val) {
  42240. // Coalesce documents and windows
  42241. var win;
  42242. if (isWindow(elem)) {
  42243. win = elem;
  42244. } else if (elem.nodeType === 9) {
  42245. win = elem.defaultView;
  42246. }
  42247. if (val === undefined) {
  42248. return win ? win[prop] : elem[method];
  42249. }
  42250. if (win) {
  42251. win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset);
  42252. } else {
  42253. elem[method] = val;
  42254. }
  42255. }, method, val, arguments.length);
  42256. };
  42257. });
  42258. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  42259. // Add the top/left cssHooks using jQuery.fn.position
  42260. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  42261. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  42262. // getComputedStyle returns percent when specified for top/left/bottom/right;
  42263. // rather than make the css module depend on the offset module, just check for it here
  42264. jQuery.each(["top", "left"], function (i, prop) {
  42265. jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) {
  42266. if (computed) {
  42267. computed = curCSS(elem, prop);
  42268. // If curCSS returns percentage, fallback to offset
  42269. return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
  42270. }
  42271. });
  42272. });
  42273. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  42274. jQuery.each({ Height: "height", Width: "width" }, function (name, type) {
  42275. jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) {
  42276. // Margin is only for outerHeight, outerWidth
  42277. jQuery.fn[funcName] = function (margin, value) {
  42278. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
  42279. extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  42280. return access(this, function (elem, type, value) {
  42281. var doc;
  42282. if (isWindow(elem)) {
  42283. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  42284. return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
  42285. }
  42286. // Get document width or height
  42287. if (elem.nodeType === 9) {
  42288. doc = elem.documentElement;
  42289. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  42290. // whichever is greatest
  42291. return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);
  42292. }
  42293. return value === undefined ?
  42294. // Get width or height on the element, requesting but not forcing parseFloat
  42295. jQuery.css(elem, type, extra) :
  42296. // Set width or height on the element
  42297. jQuery.style(elem, type, value, extra);
  42298. }, type, chainable ? margin : undefined, chainable);
  42299. };
  42300. });
  42301. });
  42302. 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) {
  42303. // Handle event binding
  42304. jQuery.fn[name] = function (data, fn) {
  42305. return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
  42306. };
  42307. });
  42308. jQuery.fn.extend({
  42309. hover: function hover(fnOver, fnOut) {
  42310. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  42311. }
  42312. });
  42313. jQuery.fn.extend({
  42314. bind: function bind(types, data, fn) {
  42315. return this.on(types, null, data, fn);
  42316. },
  42317. unbind: function unbind(types, fn) {
  42318. return this.off(types, null, fn);
  42319. },
  42320. delegate: function delegate(selector, types, data, fn) {
  42321. return this.on(types, selector, data, fn);
  42322. },
  42323. undelegate: function undelegate(selector, types, fn) {
  42324. // ( namespace ) or ( selector, types [, fn] )
  42325. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
  42326. }
  42327. });
  42328. // Bind a function to a context, optionally partially applying any
  42329. // arguments.
  42330. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  42331. // However, it is not slated for removal any time soon
  42332. jQuery.proxy = function (fn, context) {
  42333. var tmp, args, proxy;
  42334. if (typeof context === "string") {
  42335. tmp = fn[context];
  42336. context = fn;
  42337. fn = tmp;
  42338. }
  42339. // Quick check to determine if target is callable, in the spec
  42340. // this throws a TypeError, but we will just return undefined.
  42341. if (!isFunction(fn)) {
  42342. return undefined;
  42343. }
  42344. // Simulated bind
  42345. args = _slice.call(arguments, 2);
  42346. proxy = function proxy() {
  42347. return fn.apply(context || this, args.concat(_slice.call(arguments)));
  42348. };
  42349. // Set the guid of unique handler to the same of original handler, so it can be removed
  42350. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  42351. return proxy;
  42352. };
  42353. jQuery.holdReady = function (hold) {
  42354. if (hold) {
  42355. jQuery.readyWait++;
  42356. } else {
  42357. jQuery.ready(true);
  42358. }
  42359. };
  42360. jQuery.isArray = Array.isArray;
  42361. jQuery.parseJSON = JSON.parse;
  42362. jQuery.nodeName = nodeName;
  42363. jQuery.isFunction = isFunction;
  42364. jQuery.isWindow = isWindow;
  42365. jQuery.camelCase = camelCase;
  42366. jQuery.type = toType;
  42367. jQuery.now = Date.now;
  42368. jQuery.isNumeric = function (obj) {
  42369. // As of jQuery 3.0, isNumeric is limited to
  42370. // strings and numbers (primitives or objects)
  42371. // that can be coerced to finite numbers (gh-2662)
  42372. var type = jQuery.type(obj);
  42373. return (type === "number" || type === "string") &&
  42374. // parseFloat NaNs numeric-cast false positives ("")
  42375. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  42376. // subtraction forces infinities to NaN
  42377. !isNaN(obj - parseFloat(obj));
  42378. };
  42379. // Register as a named AMD module, since jQuery can be concatenated with other
  42380. // files that may use define, but not via a proper concatenation script that
  42381. // understands anonymous AMD modules. A named AMD is safest and most robust
  42382. // way to register. Lowercase jquery is used because AMD module names are
  42383. // derived from file names, and jQuery is normally delivered in a lowercase
  42384. // file name. Do this after creating the global so that if an AMD module wants
  42385. // to call noConflict to hide this version of jQuery, it will work.
  42386. // Note that for maximum portability, libraries that are not jQuery should
  42387. // declare themselves as anonymous modules, and avoid setting a global if an
  42388. // AMD loader is present. jQuery is a special case. For more information, see
  42389. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  42390. if (true) {
  42391. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  42392. return jQuery;
  42393. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  42394. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  42395. }
  42396. var
  42397. // Map over jQuery in case of overwrite
  42398. _jQuery = window.jQuery,
  42399. // Map over the $ in case of overwrite
  42400. _$ = window.$;
  42401. jQuery.noConflict = function (deep) {
  42402. if (window.$ === jQuery) {
  42403. window.$ = _$;
  42404. }
  42405. if (deep && window.jQuery === jQuery) {
  42406. window.jQuery = _jQuery;
  42407. }
  42408. return jQuery;
  42409. };
  42410. // Expose jQuery and $ identifiers, even in AMD
  42411. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  42412. // and CommonJS for browser emulators (#13566)
  42413. if (!noGlobal) {
  42414. window.jQuery = window.$ = jQuery;
  42415. }
  42416. return jQuery;
  42417. });
  42418. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
  42419. /***/ }),
  42420. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  42421. /*!********************************************************!*\
  42422. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  42423. \********************************************************/
  42424. /*! no static exports found */
  42425. /***/ (function(module, exports, __webpack_require__) {
  42426. "use strict";
  42427. Object.defineProperty(exports, "__esModule", {
  42428. value: true
  42429. });
  42430. var LanguageService = /** @class */function () {
  42431. function LanguageService(lsKey, defaultLang) {
  42432. if (defaultLang === void 0) {
  42433. defaultLang = 'pt';
  42434. }
  42435. this.lsKey = lsKey;
  42436. this.defaultLang = defaultLang;
  42437. this.listeners = [];
  42438. this.document = document;
  42439. this.setupListener();
  42440. }
  42441. LanguageService.prototype.setupListener = function () {
  42442. var _this = this;
  42443. if (this.document !== null) {
  42444. this.document.addEventListener("storage", function (event) {
  42445. var e = event;
  42446. if (e.key === _this.lsKey) {
  42447. _this.listeners.forEach(function (l) {
  42448. return l();
  42449. });
  42450. }
  42451. });
  42452. }
  42453. };
  42454. LanguageService.prototype.getLang = function () {
  42455. var lang = localStorage.getItem(this.lsKey);
  42456. if (lang === null || lang === undefined) {
  42457. console.warn("Internal Error: User language information has not been set. Returning default...");
  42458. return this.getDefaultLang();
  42459. }
  42460. return lang;
  42461. };
  42462. LanguageService.prototype.getDefaultLang = function () {
  42463. return this.defaultLang;
  42464. };
  42465. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  42466. this.listeners.push(listener);
  42467. };
  42468. return LanguageService;
  42469. }();
  42470. exports.LanguageService = LanguageService;
  42471. /***/ }),
  42472. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  42473. /*!************************************************************!*\
  42474. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  42475. \************************************************************/
  42476. /*! no static exports found */
  42477. /***/ (function(module, exports, __webpack_require__) {
  42478. "use strict";
  42479. Object.defineProperty(exports, "__esModule", {
  42480. value: true
  42481. });
  42482. var LanguageServiceNoLS = /** @class */function () {
  42483. function LanguageServiceNoLS(lang) {
  42484. this.lang = lang;
  42485. this.listeners = [];
  42486. }
  42487. LanguageServiceNoLS.prototype.setupListener = function () {};
  42488. LanguageServiceNoLS.prototype.notifyChange = function () {
  42489. this.listeners.forEach(function (l) {
  42490. return l();
  42491. });
  42492. };
  42493. LanguageServiceNoLS.prototype.setLang = function (lang) {
  42494. this.lang = lang;
  42495. this.notifyChange();
  42496. };
  42497. LanguageServiceNoLS.prototype.getLang = function () {
  42498. return this.lang;
  42499. };
  42500. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  42501. return this.lang;
  42502. };
  42503. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  42504. this.listeners.push(listener);
  42505. };
  42506. return LanguageServiceNoLS;
  42507. }();
  42508. exports.LanguageServiceNoLS = LanguageServiceNoLS;
  42509. /***/ }),
  42510. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  42511. /*!*********************************************************!*\
  42512. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  42513. \*********************************************************/
  42514. /*! no static exports found */
  42515. /***/ (function(module, exports, __webpack_require__) {
  42516. "use strict";
  42517. Object.defineProperty(exports, "__esModule", {
  42518. value: true
  42519. });
  42520. exports.LocalizedStrings = undefined;
  42521. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  42522. var LocalizedStrings = /** @class */function () {
  42523. function LocalizedStrings(service, i18nData, listenToChange) {
  42524. if (listenToChange === void 0) {
  42525. listenToChange = false;
  42526. }
  42527. var _this = this;
  42528. this.service = service;
  42529. this.i18nData = i18nData;
  42530. this.listenToChange = listenToChange;
  42531. this.document = document;
  42532. if (this.listenToChange) {
  42533. service.registerLanguageChangeListener(function () {
  42534. _this.updateTagText();
  42535. });
  42536. }
  42537. }
  42538. LocalizedStrings.prototype.getString = function (id, type) {
  42539. var i18nObj = this.i18nData[this.service.getLang()];
  42540. if (!!!i18nObj) {
  42541. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  42542. i18nObj = this.i18nData[this.service.getDefaultLang()];
  42543. }
  42544. if (!!!i18nObj[type]) {
  42545. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  42546. } else if (!!!i18nObj[type][id]) {
  42547. return "{MISSING_I18N_IDENTIFIER}";
  42548. } else {
  42549. return i18nObj[type][id];
  42550. }
  42551. };
  42552. LocalizedStrings.prototype.getOR = function () {
  42553. return this.getUI('join_or');
  42554. };
  42555. LocalizedStrings.prototype.getError = function (id, context) {
  42556. if (context === void 0) {
  42557. context = [];
  42558. }
  42559. var text = this.getString(id, _StringTypes.StringTypes.ERROR);
  42560. return this.processString(text, context);
  42561. };
  42562. LocalizedStrings.prototype.getMessage = function (id, context) {
  42563. if (context === void 0) {
  42564. context = [];
  42565. }
  42566. var text = this.getString(id, _StringTypes.StringTypes.MESSAGE);
  42567. return this.processString(text, context);
  42568. };
  42569. LocalizedStrings.prototype.getUI = function (id, context) {
  42570. if (context === void 0) {
  42571. context = [];
  42572. }
  42573. var text = this.getString(id, _StringTypes.StringTypes.UI);
  42574. return this.processString(text, context);
  42575. };
  42576. LocalizedStrings.prototype.processString = function (text, context) {
  42577. for (var i = 0; i < context.length; i++) {
  42578. var v = context[i];
  42579. text = text.replace('\$' + i, v);
  42580. }
  42581. return text;
  42582. };
  42583. LocalizedStrings.prototype.updateTagText = function (func) {
  42584. var _this = this;
  42585. if (func === void 0) {
  42586. func = null;
  42587. }
  42588. if (this.document !== null) {
  42589. var list = this.document.querySelectorAll("data.i18n");
  42590. list.forEach(function (node) {
  42591. if (func === null) {
  42592. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  42593. } else {
  42594. node.innerHTML = func(node.getAttribute("value"));
  42595. }
  42596. });
  42597. }
  42598. };
  42599. LocalizedStrings.prototype.processTagTex = function (text) {
  42600. if (text === null) {
  42601. return "<Invalid i18n identifier>";
  42602. }
  42603. var opts = text.split(':');
  42604. var type = opts[0].toLowerCase();
  42605. var id = opts[1];
  42606. if (_StringTypes.StringTypes.ERROR === type) {
  42607. return this.getError(id);
  42608. } else if (_StringTypes.StringTypes.MESSAGE === type) {
  42609. return this.getMessage(id);
  42610. } else if (_StringTypes.StringTypes.UI === type) {
  42611. return this.getUI(id);
  42612. } else {
  42613. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  42614. return this.getString(id, type);
  42615. }
  42616. };
  42617. return LocalizedStrings;
  42618. }();
  42619. exports.LocalizedStrings = LocalizedStrings;
  42620. /***/ }),
  42621. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  42622. /*!****************************************************!*\
  42623. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  42624. \****************************************************/
  42625. /*! no static exports found */
  42626. /***/ (function(module, exports, __webpack_require__) {
  42627. "use strict";
  42628. Object.defineProperty(exports, "__esModule", {
  42629. value: true
  42630. });
  42631. var StringTypes = exports.StringTypes = undefined;
  42632. (function (StringTypes) {
  42633. StringTypes["ERROR"] = "error";
  42634. StringTypes["MESSAGE"] = "message";
  42635. StringTypes["UI"] = "ui";
  42636. })(StringTypes || (exports.StringTypes = StringTypes = {}));
  42637. /***/ }),
  42638. /***/ "./node_modules/line-i18n/dist/index.js":
  42639. /*!**********************************************!*\
  42640. !*** ./node_modules/line-i18n/dist/index.js ***!
  42641. \**********************************************/
  42642. /*! no static exports found */
  42643. /***/ (function(module, exports, __webpack_require__) {
  42644. "use strict";
  42645. Object.defineProperty(exports, "__esModule", {
  42646. value: true
  42647. });
  42648. var _LanguageService = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  42649. var _LocalizedStrings = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  42650. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  42651. var _LanguageServiceNoLS = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  42652. exports.default = {
  42653. LanguageService: _LanguageService.LanguageService,
  42654. LanguageServiceNoLS: _LanguageServiceNoLS.LanguageServiceNoLS,
  42655. LocalizedStrings: _LocalizedStrings.LocalizedStrings,
  42656. StringTypes: _StringTypes.StringTypes
  42657. };
  42658. /***/ }),
  42659. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  42660. /*!***************************************************!*\
  42661. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  42662. \***************************************************/
  42663. /*! no static exports found */
  42664. /***/ (function(module, exports, __webpack_require__) {
  42665. "use strict";
  42666. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
  42667. * DEVELOPED BY
  42668. * GIL LOPES BUENO
  42669. * gilbueno.mail@gmail.com
  42670. *
  42671. * WORKS WITH:
  42672. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  42673. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  42674. *
  42675. * FORK:
  42676. * https://github.com/melanke/Watch.JS
  42677. *
  42678. * LICENSE: MIT
  42679. */
  42680. 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; };
  42681. (function (factory) {
  42682. if (( false ? undefined : _typeof(exports)) === 'object') {
  42683. // Node. Does not work with strict CommonJS, but
  42684. // only CommonJS-like enviroments that support module.exports,
  42685. // like Node.
  42686. module.exports = factory();
  42687. } else if (true) {
  42688. // AMD. Register as an anonymous module.
  42689. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  42690. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  42691. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  42692. __WEBPACK_AMD_DEFINE_FACTORY__),
  42693. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  42694. } else {}
  42695. })(function () {
  42696. var WatchJS = {
  42697. noMore: false, // use WatchJS.suspend(obj) instead
  42698. useDirtyCheck: false, // use only dirty checking to track changes.
  42699. preserveExistingSetters: false
  42700. },
  42701. lengthsubjects = [];
  42702. var dirtyChecklist = [];
  42703. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  42704. var supportDefineProperty = false;
  42705. try {
  42706. supportDefineProperty = Object.defineProperty && Object.defineProperty({}, 'x', {});
  42707. } catch (ex) {/* not supported */}
  42708. var isFunction = function isFunction(functionToCheck) {
  42709. var getType = {};
  42710. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  42711. };
  42712. var isInt = function isInt(x) {
  42713. return x % 1 === 0;
  42714. };
  42715. var isArray = function isArray(obj) {
  42716. return Object.prototype.toString.call(obj) === '[object Array]';
  42717. };
  42718. var isObject = function isObject(obj) {
  42719. return {}.toString.apply(obj) === '[object Object]';
  42720. };
  42721. var getObjDiff = function getObjDiff(a, b) {
  42722. var aplus = [],
  42723. bplus = [];
  42724. if (!(typeof a == "string") && !(typeof b == "string")) {
  42725. if (isArray(a) && b) {
  42726. for (var i = 0; i < a.length; i++) {
  42727. if (b[i] === undefined) aplus.push(i);
  42728. }
  42729. } else {
  42730. for (var i in a) {
  42731. if (a.hasOwnProperty(i)) {
  42732. if (b && !b.hasOwnProperty(i)) {
  42733. aplus.push(i);
  42734. }
  42735. }
  42736. }
  42737. }
  42738. if (isArray(b) && a) {
  42739. for (var j = 0; j < b.length; j++) {
  42740. if (a[j] === undefined) bplus.push(j);
  42741. }
  42742. } else {
  42743. for (var j in b) {
  42744. if (b.hasOwnProperty(j)) {
  42745. if (a && !a.hasOwnProperty(j)) {
  42746. bplus.push(j);
  42747. }
  42748. }
  42749. }
  42750. }
  42751. }
  42752. return {
  42753. added: aplus,
  42754. removed: bplus
  42755. };
  42756. };
  42757. var clone = function clone(obj) {
  42758. if (null == obj || "object" != (typeof obj === 'undefined' ? 'undefined' : _typeof(obj))) {
  42759. return obj;
  42760. }
  42761. var copy = obj.constructor();
  42762. for (var attr in obj) {
  42763. copy[attr] = obj[attr];
  42764. }
  42765. return copy;
  42766. };
  42767. var getExistingSetter = function getExistingSetter(obj, propName) {
  42768. if (WatchJS.preserveExistingSetters) {
  42769. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  42770. return existing.set;
  42771. }
  42772. return undefined;
  42773. };
  42774. var defineGetAndSet = function defineGetAndSet(obj, propName, getter, setter) {
  42775. try {
  42776. var existingSetter = getExistingSetter(obj, propName);
  42777. Object.defineProperty(obj, propName, {
  42778. get: getter,
  42779. set: function set(value) {
  42780. setter.call(this, value, true); // coalesce changes
  42781. if (existingSetter) {
  42782. existingSetter(value);
  42783. }
  42784. },
  42785. enumerable: true,
  42786. configurable: true
  42787. });
  42788. } catch (e1) {
  42789. try {
  42790. Object.prototype.__defineGetter__.call(obj, propName, getter);
  42791. Object.prototype.__defineSetter__.call(obj, propName, function (value) {
  42792. setter.call(this, value, true); // coalesce changes
  42793. });
  42794. } catch (e2) {
  42795. observeDirtyChanges(obj, propName, setter);
  42796. //throw new Error("watchJS error: browser not supported :/")
  42797. }
  42798. }
  42799. };
  42800. var defineProp = function defineProp(obj, propName, value) {
  42801. try {
  42802. Object.defineProperty(obj, propName, {
  42803. enumerable: false,
  42804. configurable: true,
  42805. writable: false,
  42806. value: value
  42807. });
  42808. } catch (error) {
  42809. obj[propName] = value;
  42810. }
  42811. };
  42812. var observeDirtyChanges = function observeDirtyChanges(obj, propName, setter) {
  42813. dirtyChecklist[dirtyChecklist.length] = {
  42814. prop: propName,
  42815. object: obj,
  42816. orig: clone(obj[propName]),
  42817. callback: setter
  42818. };
  42819. };
  42820. var watch = function watch() {
  42821. if (isFunction(arguments[1])) {
  42822. watchAll.apply(this, arguments);
  42823. } else if (isArray(arguments[1])) {
  42824. watchMany.apply(this, arguments);
  42825. } else {
  42826. watchOne.apply(this, arguments);
  42827. }
  42828. };
  42829. var watchAll = function watchAll(obj, watcher, level, addNRemove) {
  42830. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  42831. //accepts only objects and array (not string)
  42832. return;
  42833. }
  42834. if (isArray(obj)) {
  42835. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  42836. if (level === undefined || level > 0) {
  42837. for (var prop = 0; prop < obj.length; prop++) {
  42838. // watch objects in array
  42839. watchAll(obj[prop], watcher, level, addNRemove);
  42840. }
  42841. }
  42842. } else {
  42843. var prop,
  42844. props = [];
  42845. for (prop in obj) {
  42846. //for each attribute if obj is an object
  42847. if (prop == "$val" || !supportDefineProperty && prop === 'watchers') {
  42848. continue;
  42849. }
  42850. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  42851. props.push(prop); //put in the props
  42852. }
  42853. }
  42854. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  42855. }
  42856. if (addNRemove) {
  42857. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  42858. }
  42859. };
  42860. var watchMany = function watchMany(obj, props, watcher, level, addNRemove) {
  42861. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  42862. //accepts only objects and array (not string)
  42863. return;
  42864. }
  42865. for (var i = 0; i < props.length; i++) {
  42866. //watch each property
  42867. var prop = props[i];
  42868. watchOne(obj, prop, watcher, level, addNRemove);
  42869. }
  42870. };
  42871. var watchOne = function watchOne(obj, prop, watcher, level, addNRemove) {
  42872. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  42873. //accepts only objects and array (not string)
  42874. return;
  42875. }
  42876. if (isFunction(obj[prop])) {
  42877. //dont watch if it is a function
  42878. return;
  42879. }
  42880. if (obj[prop] != null && (level === undefined || level > 0)) {
  42881. watchAll(obj[prop], watcher, level !== undefined ? level - 1 : level); //recursively watch all attributes of this
  42882. }
  42883. defineWatcher(obj, prop, watcher, level);
  42884. if (addNRemove && (level === undefined || level > 0)) {
  42885. pushToLengthSubjects(obj, prop, watcher, level);
  42886. }
  42887. };
  42888. var unwatch = function unwatch() {
  42889. if (isFunction(arguments[1])) {
  42890. unwatchAll.apply(this, arguments);
  42891. } else if (isArray(arguments[1])) {
  42892. unwatchMany.apply(this, arguments);
  42893. } else {
  42894. unwatchOne.apply(this, arguments);
  42895. }
  42896. };
  42897. var unwatchAll = function unwatchAll(obj, watcher) {
  42898. if (obj instanceof String || !(obj instanceof Object) && !isArray(obj)) {
  42899. //accepts only objects and array (not string)
  42900. return;
  42901. }
  42902. if (isArray(obj)) {
  42903. var props = ['__watchall__'];
  42904. for (var prop = 0; prop < obj.length; prop++) {
  42905. //for each item if obj is an array
  42906. props.push(prop); //put in the props
  42907. }
  42908. unwatchMany(obj, props, watcher); //watch all itens of the props
  42909. } else {
  42910. var unwatchPropsInObject = function unwatchPropsInObject(obj2) {
  42911. var props = [];
  42912. for (var prop2 in obj2) {
  42913. //for each attribute if obj is an object
  42914. if (obj2.hasOwnProperty(prop2)) {
  42915. if (obj2[prop2] instanceof Object) {
  42916. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  42917. } else {
  42918. props.push(prop2); //put in the props
  42919. }
  42920. }
  42921. }
  42922. unwatchMany(obj2, props, watcher); //unwatch all of the props
  42923. };
  42924. unwatchPropsInObject(obj);
  42925. }
  42926. };
  42927. var unwatchMany = function unwatchMany(obj, props, watcher) {
  42928. for (var prop2 in props) {
  42929. //watch each attribute of "props" if is an object
  42930. if (props.hasOwnProperty(prop2)) {
  42931. unwatchOne(obj, props[prop2], watcher);
  42932. }
  42933. }
  42934. };
  42935. var timeouts = [],
  42936. timerID = null;
  42937. function clearTimerID() {
  42938. timerID = null;
  42939. for (var i = 0; i < timeouts.length; i++) {
  42940. timeouts[i]();
  42941. }
  42942. timeouts.length = 0;
  42943. }
  42944. var getTimerID = function getTimerID() {
  42945. if (!timerID) {
  42946. timerID = setTimeout(clearTimerID);
  42947. }
  42948. return timerID;
  42949. };
  42950. var registerTimeout = function registerTimeout(fn) {
  42951. // register function to be called on timeout
  42952. if (timerID == null) getTimerID();
  42953. timeouts[timeouts.length] = fn;
  42954. };
  42955. // Track changes made to an array, object or an object's property
  42956. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  42957. // Syntax:
  42958. // trackChange(obj, callback, recursive, addNRemove)
  42959. // trackChange(obj, prop, callback, recursive, addNRemove)
  42960. var trackChange = function trackChange() {
  42961. var fn = isFunction(arguments[2]) ? trackProperty : trackObject;
  42962. fn.apply(this, arguments);
  42963. };
  42964. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  42965. var trackObject = function trackObject(obj, callback, recursive, addNRemove) {
  42966. var change = null,
  42967. lastTimerID = -1;
  42968. var isArr = isArray(obj);
  42969. var level,
  42970. fn = function fn(prop, action, newValue, oldValue) {
  42971. var timerID = getTimerID();
  42972. if (lastTimerID !== timerID) {
  42973. // check if timer has changed since last update
  42974. lastTimerID = timerID;
  42975. change = {
  42976. type: 'update'
  42977. };
  42978. change['value'] = obj;
  42979. change['splices'] = null;
  42980. registerTimeout(function () {
  42981. callback.call(this, change);
  42982. change = null;
  42983. });
  42984. }
  42985. // create splices for array changes
  42986. if (isArr && obj === this && change !== null) {
  42987. if (action === 'pop' || action === 'shift') {
  42988. newValue = [];
  42989. oldValue = [oldValue];
  42990. } else if (action === 'push' || action === 'unshift') {
  42991. newValue = [newValue];
  42992. oldValue = [];
  42993. } else if (action !== 'splice') {
  42994. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  42995. }
  42996. if (!change.splices) change.splices = [];
  42997. change.splices[change.splices.length] = {
  42998. index: prop,
  42999. deleteCount: oldValue ? oldValue.length : 0,
  43000. addedCount: newValue ? newValue.length : 0,
  43001. added: newValue,
  43002. deleted: oldValue
  43003. };
  43004. }
  43005. };
  43006. level = recursive == true ? undefined : 0;
  43007. watchAll(obj, fn, level, addNRemove);
  43008. };
  43009. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  43010. var trackProperty = function trackProperty(obj, prop, callback, recursive, addNRemove) {
  43011. if (obj && prop) {
  43012. watchOne(obj, prop, function (prop, action, newvalue, oldvalue) {
  43013. var change = {
  43014. type: 'update'
  43015. };
  43016. change['value'] = newvalue;
  43017. change['oldvalue'] = oldvalue;
  43018. if (recursive && isObject(newvalue) || isArray(newvalue)) {
  43019. trackObject(newvalue, callback, recursive, addNRemove);
  43020. }
  43021. callback.call(this, change);
  43022. }, 0);
  43023. if (recursive && isObject(obj[prop]) || isArray(obj[prop])) {
  43024. trackObject(obj[prop], callback, recursive, addNRemove);
  43025. }
  43026. }
  43027. };
  43028. var defineWatcher = function defineWatcher(obj, prop, watcher, level) {
  43029. var newWatcher = false;
  43030. var isArr = isArray(obj);
  43031. if (!obj.watchers) {
  43032. defineProp(obj, "watchers", {});
  43033. if (isArr) {
  43034. // watch array functions
  43035. watchFunctions(obj, function (index, action, newValue, oldValue) {
  43036. addPendingChange(obj, index, action, newValue, oldValue);
  43037. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  43038. var i,
  43039. n,
  43040. ln,
  43041. wAll,
  43042. watchList = obj.watchers[prop];
  43043. if (wAll = obj.watchers['__watchall__']) {
  43044. watchList = watchList ? watchList.concat(wAll) : wAll;
  43045. }
  43046. ln = watchList ? watchList.length : 0;
  43047. for (i = 0; i < ln; i++) {
  43048. if (action !== 'splice') {
  43049. watchAll(newValue, watchList[i], level === undefined ? level : level - 1);
  43050. } else {
  43051. // watch spliced values
  43052. for (n = 0; n < newValue.length; n++) {
  43053. watchAll(newValue[n], watchList[i], level === undefined ? level : level - 1);
  43054. }
  43055. }
  43056. }
  43057. }
  43058. });
  43059. }
  43060. }
  43061. if (!obj.watchers[prop]) {
  43062. obj.watchers[prop] = [];
  43063. if (!isArr) newWatcher = true;
  43064. }
  43065. for (var i = 0; i < obj.watchers[prop].length; i++) {
  43066. if (obj.watchers[prop][i] === watcher) {
  43067. return;
  43068. }
  43069. }
  43070. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  43071. if (newWatcher) {
  43072. var val = obj[prop];
  43073. var getter = function getter() {
  43074. return val;
  43075. };
  43076. var setter = function setter(newval, delayWatcher) {
  43077. var oldval = val;
  43078. val = newval;
  43079. if (level !== 0 && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop])) && !obj[prop].watchers) {
  43080. // watch sub properties
  43081. var i,
  43082. ln = obj.watchers[prop].length;
  43083. for (i = 0; i < ln; i++) {
  43084. watchAll(obj[prop], obj.watchers[prop][i], level === undefined ? level : level - 1);
  43085. }
  43086. }
  43087. //watchFunctions(obj, prop);
  43088. if (isSuspended(obj, prop)) {
  43089. resume(obj, prop);
  43090. return;
  43091. }
  43092. if (!WatchJS.noMore) {
  43093. // this does not work with Object.observe
  43094. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  43095. if (oldval !== newval) {
  43096. if (!delayWatcher) {
  43097. callWatchers(obj, prop, "set", newval, oldval);
  43098. } else {
  43099. addPendingChange(obj, prop, "set", newval, oldval);
  43100. }
  43101. WatchJS.noMore = false;
  43102. }
  43103. }
  43104. };
  43105. if (WatchJS.useDirtyCheck) {
  43106. observeDirtyChanges(obj, prop, setter);
  43107. } else {
  43108. defineGetAndSet(obj, prop, getter, setter);
  43109. }
  43110. }
  43111. };
  43112. var callWatchers = function callWatchers(obj, prop, action, newval, oldval) {
  43113. if (prop !== undefined) {
  43114. var ln,
  43115. wl,
  43116. watchList = obj.watchers[prop];
  43117. if (wl = obj.watchers['__watchall__']) {
  43118. watchList = watchList ? watchList.concat(wl) : wl;
  43119. }
  43120. ln = watchList ? watchList.length : 0;
  43121. for (var wr = 0; wr < ln; wr++) {
  43122. watchList[wr].call(obj, prop, action, newval, oldval);
  43123. }
  43124. } else {
  43125. for (var prop in obj) {
  43126. //call all
  43127. if (obj.hasOwnProperty(prop)) {
  43128. callWatchers(obj, prop, action, newval, oldval);
  43129. }
  43130. }
  43131. }
  43132. };
  43133. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  43134. var defineArrayMethodWatcher = function defineArrayMethodWatcher(obj, original, methodName, callback) {
  43135. defineProp(obj, methodName, function () {
  43136. var index = 0;
  43137. var i, newValue, oldValue, response;
  43138. // get values before splicing array
  43139. if (methodName === 'splice') {
  43140. var start = arguments[0];
  43141. var end = start + arguments[1];
  43142. oldValue = obj.slice(start, end);
  43143. newValue = [];
  43144. for (i = 2; i < arguments.length; i++) {
  43145. newValue[i - 2] = arguments[i];
  43146. }
  43147. index = start;
  43148. } else {
  43149. newValue = arguments.length > 0 ? arguments[0] : undefined;
  43150. }
  43151. response = original.apply(obj, arguments);
  43152. if (methodName !== 'slice') {
  43153. if (methodName === 'pop') {
  43154. oldValue = response;
  43155. index = obj.length;
  43156. } else if (methodName === 'push') {
  43157. index = obj.length - 1;
  43158. } else if (methodName === 'shift') {
  43159. oldValue = response;
  43160. } else if (methodName !== 'unshift' && newValue === undefined) {
  43161. newValue = response;
  43162. }
  43163. callback.call(obj, index, methodName, newValue, oldValue);
  43164. }
  43165. return response;
  43166. });
  43167. };
  43168. var watchFunctions = function watchFunctions(obj, callback) {
  43169. if (!isFunction(callback) || !obj || obj instanceof String || !isArray(obj)) {
  43170. return;
  43171. }
  43172. for (var i = methodNames.length, methodName; i--;) {
  43173. methodName = methodNames[i];
  43174. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  43175. }
  43176. };
  43177. var unwatchOne = function unwatchOne(obj, prop, watcher) {
  43178. if (prop) {
  43179. if (obj.watchers && obj.watchers[prop]) {
  43180. if (watcher === undefined) {
  43181. delete obj.watchers[prop]; // remove all property watchers
  43182. } else {
  43183. for (var i = 0; i < obj.watchers[prop].length; i++) {
  43184. var w = obj.watchers[prop][i];
  43185. if (w == watcher) {
  43186. obj.watchers[prop].splice(i, 1);
  43187. }
  43188. }
  43189. }
  43190. }
  43191. } else {
  43192. delete obj.watchers;
  43193. }
  43194. removeFromLengthSubjects(obj, prop, watcher);
  43195. removeFromDirtyChecklist(obj, prop);
  43196. };
  43197. // suspend watchers until next update cycle
  43198. var suspend = function suspend(obj, prop) {
  43199. if (obj.watchers) {
  43200. var name = '__wjs_suspend__' + (prop !== undefined ? prop : '');
  43201. obj.watchers[name] = true;
  43202. }
  43203. };
  43204. var isSuspended = function isSuspended(obj, prop) {
  43205. return obj.watchers && (obj.watchers['__wjs_suspend__'] || obj.watchers['__wjs_suspend__' + prop]);
  43206. };
  43207. // resumes preivously suspended watchers
  43208. var resume = function resume(obj, prop) {
  43209. registerTimeout(function () {
  43210. delete obj.watchers['__wjs_suspend__'];
  43211. delete obj.watchers['__wjs_suspend__' + prop];
  43212. });
  43213. };
  43214. var pendingTimerID = null;
  43215. var addPendingChange = function addPendingChange(obj, prop, mode, newval, oldval) {
  43216. pendingChanges[pendingChanges.length] = {
  43217. obj: obj,
  43218. prop: prop,
  43219. mode: mode,
  43220. newval: newval,
  43221. oldval: oldval
  43222. };
  43223. if (pendingTimerID === null) {
  43224. pendingTimerID = setTimeout(applyPendingChanges);
  43225. }
  43226. };
  43227. var applyPendingChanges = function applyPendingChanges() {
  43228. // apply pending changes
  43229. var change = null;
  43230. pendingTimerID = null;
  43231. for (var i = 0; i < pendingChanges.length; i++) {
  43232. change = pendingChanges[i];
  43233. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  43234. }
  43235. if (change) {
  43236. pendingChanges = [];
  43237. change = null;
  43238. }
  43239. };
  43240. var loop = function loop() {
  43241. // check for new or deleted props
  43242. for (var i = 0; i < lengthsubjects.length; i++) {
  43243. var subj = lengthsubjects[i];
  43244. if (subj.prop === "$$watchlengthsubjectroot") {
  43245. var difference = getObjDiff(subj.obj, subj.actual);
  43246. if (difference.added.length || difference.removed.length) {
  43247. if (difference.added.length) {
  43248. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  43249. }
  43250. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  43251. }
  43252. subj.actual = clone(subj.obj);
  43253. } else {
  43254. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  43255. if (difference.added.length || difference.removed.length) {
  43256. if (difference.added.length) {
  43257. for (var j = 0; j < subj.obj.watchers[subj.prop].length; j++) {
  43258. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  43259. }
  43260. }
  43261. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  43262. }
  43263. subj.actual = clone(subj.obj[subj.prop]);
  43264. }
  43265. }
  43266. // start dirty check
  43267. var n, value;
  43268. if (dirtyChecklist.length > 0) {
  43269. for (var i = 0; i < dirtyChecklist.length; i++) {
  43270. n = dirtyChecklist[i];
  43271. value = n.object[n.prop];
  43272. if (!compareValues(n.orig, value)) {
  43273. n.orig = clone(value);
  43274. n.callback(value);
  43275. }
  43276. }
  43277. }
  43278. };
  43279. var compareValues = function compareValues(a, b) {
  43280. var i,
  43281. state = true;
  43282. if (a !== b) {
  43283. if (isObject(a)) {
  43284. for (i in a) {
  43285. if (!supportDefineProperty && i === 'watchers') continue;
  43286. if (a[i] !== b[i]) {
  43287. state = false;
  43288. break;
  43289. };
  43290. }
  43291. } else {
  43292. state = false;
  43293. }
  43294. }
  43295. return state;
  43296. };
  43297. var pushToLengthSubjects = function pushToLengthSubjects(obj, prop, watcher, level) {
  43298. var actual;
  43299. if (prop === "$$watchlengthsubjectroot") {
  43300. actual = clone(obj);
  43301. } else {
  43302. actual = clone(obj[prop]);
  43303. }
  43304. lengthsubjects.push({
  43305. obj: obj,
  43306. prop: prop,
  43307. actual: actual,
  43308. watcher: watcher,
  43309. level: level
  43310. });
  43311. };
  43312. var removeFromLengthSubjects = function removeFromLengthSubjects(obj, prop, watcher) {
  43313. for (var i = 0; i < lengthsubjects.length; i++) {
  43314. var subj = lengthsubjects[i];
  43315. if (subj.obj == obj) {
  43316. if (!prop || subj.prop == prop) {
  43317. if (!watcher || subj.watcher == watcher) {
  43318. // if we splice off one item at position i
  43319. // we need to decrement i as the array is one item shorter
  43320. // so when we increment i in the loop statement we
  43321. // will land at the correct index.
  43322. // if it's not decremented, you won't delete all length subjects
  43323. lengthsubjects.splice(i--, 1);
  43324. }
  43325. }
  43326. }
  43327. }
  43328. };
  43329. var removeFromDirtyChecklist = function removeFromDirtyChecklist(obj, prop) {
  43330. var notInUse;
  43331. for (var i = 0; i < dirtyChecklist.length; i++) {
  43332. var n = dirtyChecklist[i];
  43333. var watchers = n.object.watchers;
  43334. notInUse = n.object == obj && (!prop || n.prop == prop) && watchers && (!prop || !watchers[prop] || watchers[prop].length == 0);
  43335. if (notInUse) {
  43336. // we use the same syntax as in removeFromLengthSubjects
  43337. dirtyChecklist.splice(i--, 1);
  43338. }
  43339. }
  43340. };
  43341. setInterval(loop, 50);
  43342. WatchJS.watch = watch;
  43343. WatchJS.unwatch = unwatch;
  43344. WatchJS.callWatchers = callWatchers;
  43345. WatchJS.suspend = suspend; // suspend watchers
  43346. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  43347. return WatchJS;
  43348. });
  43349. /***/ }),
  43350. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  43351. /*!******************************************************!*\
  43352. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  43353. \******************************************************/
  43354. /*! no static exports found */
  43355. /***/ (function(module, exports, __webpack_require__) {
  43356. "use strict";
  43357. /***/ }),
  43358. /***/ "./node_modules/webpack/buildin/module.js":
  43359. /*!***********************************!*\
  43360. !*** (webpack)/buildin/module.js ***!
  43361. \***********************************/
  43362. /*! no static exports found */
  43363. /***/ (function(module, exports, __webpack_require__) {
  43364. "use strict";
  43365. module.exports = function (module) {
  43366. if (!module.webpackPolyfill) {
  43367. module.deprecate = function () {};
  43368. module.paths = [];
  43369. // module.parent = undefined by default
  43370. if (!module.children) module.children = [];
  43371. Object.defineProperty(module, "loaded", {
  43372. enumerable: true,
  43373. get: function get() {
  43374. return module.l;
  43375. }
  43376. });
  43377. Object.defineProperty(module, "id", {
  43378. enumerable: true,
  43379. get: function get() {
  43380. return module.i;
  43381. }
  43382. });
  43383. module.webpackPolyfill = 1;
  43384. }
  43385. return module;
  43386. };
  43387. /***/ })
  43388. /******/ });
  43389. });
  43390. //# sourceMappingURL=ivprog.bundle.js.map