ivprog.bundle.js 2.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313
  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. /***/ "./.ima_version.json":
  99. /*!***************************!*\
  100. !*** ./.ima_version.json ***!
  101. \***************************/
  102. /*! exports provided: version, default */
  103. /***/ (function(module) {
  104. module.exports = {"version":"2019_02_20 10_25"};
  105. /***/ }),
  106. /***/ "./grammar/en/ivprog.g4":
  107. /*!******************************!*\
  108. !*** ./grammar/en/ivprog.g4 ***!
  109. \******************************/
  110. /*! no static exports found */
  111. /***/ (function(module, exports, __webpack_require__) {
  112. module.exports =
  113. /******/ (function(modules) { // webpackBootstrap
  114. /******/ // The module cache
  115. /******/ var installedModules = {};
  116. /******/
  117. /******/ // The require function
  118. /******/ function __webpack_require__(moduleId) {
  119. /******/
  120. /******/ // Check if module is in cache
  121. /******/ if(installedModules[moduleId]) {
  122. /******/ return installedModules[moduleId].exports;
  123. /******/ }
  124. /******/ // Create a new module (and put it into the cache)
  125. /******/ var module = installedModules[moduleId] = {
  126. /******/ i: moduleId,
  127. /******/ l: false,
  128. /******/ exports: {}
  129. /******/ };
  130. /******/
  131. /******/ // Execute the module function
  132. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  133. /******/
  134. /******/ // Flag the module as loaded
  135. /******/ module.l = true;
  136. /******/
  137. /******/ // Return the exports of the module
  138. /******/ return module.exports;
  139. /******/ }
  140. /******/
  141. /******/
  142. /******/ // expose the modules object (__webpack_modules__)
  143. /******/ __webpack_require__.m = modules;
  144. /******/
  145. /******/ // expose the module cache
  146. /******/ __webpack_require__.c = installedModules;
  147. /******/
  148. /******/ // identity function for calling harmony imports with the correct context
  149. /******/ __webpack_require__.i = function(value) { return value; };
  150. /******/
  151. /******/ // define getter function for harmony exports
  152. /******/ __webpack_require__.d = function(exports, name, getter) {
  153. /******/ if(!__webpack_require__.o(exports, name)) {
  154. /******/ Object.defineProperty(exports, name, {
  155. /******/ configurable: false,
  156. /******/ enumerable: true,
  157. /******/ get: getter
  158. /******/ });
  159. /******/ }
  160. /******/ };
  161. /******/
  162. /******/ // getDefaultExport function for compatibility with non-harmony modules
  163. /******/ __webpack_require__.n = function(module) {
  164. /******/ var getter = module && module.__esModule ?
  165. /******/ function getDefault() { return module['default']; } :
  166. /******/ function getModuleExports() { return module; };
  167. /******/ __webpack_require__.d(getter, 'a', getter);
  168. /******/ return getter;
  169. /******/ };
  170. /******/
  171. /******/ // Object.prototype.hasOwnProperty.call
  172. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  173. /******/
  174. /******/ // __webpack_public_path__
  175. /******/ __webpack_require__.p = "";
  176. /******/
  177. /******/ // Load entry module and return exports
  178. /******/ return __webpack_require__(__webpack_require__.s = 1);
  179. /******/ })
  180. /************************************************************************/
  181. /******/ ([
  182. /* 0 */
  183. /***/ (function(module, exports, __webpack_require__) {
  184. // Generated from /tmp/tmp-7479iGf20Ya2uEko/ivprog.g4 by ANTLR 4.7
  185. // jshint ignore: start
  186. var antlr4 = __webpack_require__(2);
  187. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  188. "\u0002/\u01d1\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  189. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  190. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  191. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  192. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  193. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  194. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  195. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  196. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  197. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  198. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  199. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  200. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  201. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003",
  202. "\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
  203. "\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
  204. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003",
  205. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0007\u0003",
  206. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  207. "\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  208. "\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  209. "\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b\u0003\u000b\u0003",
  210. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003",
  211. "\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003",
  212. "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  213. "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  214. "\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u0010\u0003",
  215. "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003",
  216. "\u0011\u0003\u0011\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  217. "\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0014\u0003",
  218. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0015\u0003\u0015\u0003",
  219. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003",
  220. "\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0017\u0003",
  221. "\u0017\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  222. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  223. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  224. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  225. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  226. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0125\n&\u0003\'\u0003\'\u0003",
  227. "(\u0003(\u0003)\u0003)\u0007)\u012d\n)\f)\u000e)\u0130\u000b)\u0003",
  228. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0137\n+\r+\u000e+\u0138\u0003",
  229. "+\u0003+\u0003+\u0003+\u0005+\u013f\n+\u0003+\u0006+\u0142\n+\r+\u000e",
  230. "+\u0143\u0003+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d",
  231. "\n+\r+\u000e+\u014e\u0005+\u0151\n+\u0003,\u0006,\u0154\n,\r,\u000e",
  232. ",\u0155\u0003,\u0003,\u0006,\u015a\n,\r,\u000e,\u015b\u0003,\u0006,",
  233. "\u015f\n,\r,\u000e,\u0160\u0003,\u0003,\u0007,\u0165\n,\f,\u000e,\u0168",
  234. "\u000b,\u0003,\u0005,\u016b\n,\u0003-\u0003-\u0005-\u016f\n-\u0003-",
  235. "\u0006-\u0172\n-\r-\u000e-\u0173\u0003.\u0003.\u0007.\u0178\n.\f.\u000e",
  236. ".\u017b\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u0181\n/\u00030\u0003",
  237. "0\u00030\u00050\u0186\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  238. "2\u00032\u00033\u00063\u0191\n3\r3\u000e3\u0192\u00033\u00053\u0196",
  239. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01a0",
  240. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  241. "7\u00037\u00057\u01ad\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  242. "8\u00039\u00039\u00039\u00039\u00079\u01ba\n9\f9\u000e9\u01bd\u000b",
  243. "9\u00039\u00059\u01c0\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01c7",
  244. "\n9\f9\u000e9\u01ca\u000b9\u00039\u00039\u00059\u01ce\n9\u00039\u0003",
  245. "9\u0003\u01c8\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  246. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  247. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  248. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  249. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  250. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  251. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  252. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  253. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  254. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  255. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01e5\u0002\u0003\u0003",
  256. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  257. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  258. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  259. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  260. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  261. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  262. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  263. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  264. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  265. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  266. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  267. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  268. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  269. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  270. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  271. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  272. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  273. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  274. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  275. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  276. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  277. "s\u0003\u0002\u0002\u0002\u0005{\u0003\u0002\u0002\u0002\u0007\u0080",
  278. "\u0003\u0002\u0002\u0002\t\u0085\u0003\u0002\u0002\u0002\u000b\u008d",
  279. "\u0003\u0002\u0002\u0002\r\u0094\u0003\u0002\u0002\u0002\u000f\u009c",
  280. "\u0003\u0002\u0002\u0002\u0011\u00a6\u0003\u0002\u0002\u0002\u0013\u00ad",
  281. "\u0003\u0002\u0002\u0002\u0015\u00b2\u0003\u0002\u0002\u0002\u0017\u00bc",
  282. "\u0003\u0002\u0002\u0002\u0019\u00c2\u0003\u0002\u0002\u0002\u001b\u00cb",
  283. "\u0003\u0002\u0002\u0002\u001d\u00d2\u0003\u0002\u0002\u0002\u001f\u00d6",
  284. "\u0003\u0002\u0002\u0002!\u00dc\u0003\u0002\u0002\u0002#\u00df\u0003",
  285. "\u0002\u0002\u0002%\u00e5\u0003\u0002\u0002\u0002\'\u00e8\u0003\u0002",
  286. "\u0002\u0002)\u00ed\u0003\u0002\u0002\u0002+\u00f3\u0003\u0002\u0002",
  287. "\u0002-\u00f8\u0003\u0002\u0002\u0002/\u00fc\u0003\u0002\u0002\u0002",
  288. "1\u0100\u0003\u0002\u0002\u00023\u0103\u0003\u0002\u0002\u00025\u0105",
  289. "\u0003\u0002\u0002\u00027\u0107\u0003\u0002\u0002\u00029\u0109\u0003",
  290. "\u0002\u0002\u0002;\u010b\u0003\u0002\u0002\u0002=\u010d\u0003\u0002",
  291. "\u0002\u0002?\u010f\u0003\u0002\u0002\u0002A\u0111\u0003\u0002\u0002",
  292. "\u0002C\u0113\u0003\u0002\u0002\u0002E\u0115\u0003\u0002\u0002\u0002",
  293. "G\u0117\u0003\u0002\u0002\u0002I\u0119\u0003\u0002\u0002\u0002K\u0124",
  294. "\u0003\u0002\u0002\u0002M\u0126\u0003\u0002\u0002\u0002O\u0128\u0003",
  295. "\u0002\u0002\u0002Q\u012a\u0003\u0002\u0002\u0002S\u0131\u0003\u0002",
  296. "\u0002\u0002U\u0150\u0003\u0002\u0002\u0002W\u016a\u0003\u0002\u0002",
  297. "\u0002Y\u016c\u0003\u0002\u0002\u0002[\u0175\u0003\u0002\u0002\u0002",
  298. "]\u0180\u0003\u0002\u0002\u0002_\u0182\u0003\u0002\u0002\u0002a\u0189",
  299. "\u0003\u0002\u0002\u0002c\u018d\u0003\u0002\u0002\u0002e\u0195\u0003",
  300. "\u0002\u0002\u0002g\u0197\u0003\u0002\u0002\u0002i\u0199\u0003\u0002",
  301. "\u0002\u0002k\u019f\u0003\u0002\u0002\u0002m\u01ac\u0003\u0002\u0002",
  302. "\u0002o\u01ae\u0003\u0002\u0002\u0002q\u01cd\u0003\u0002\u0002\u0002",
  303. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  304. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  305. "\u0002z\u0004\u0003\u0002\u0002\u0002{|\u0007t\u0002\u0002|}\u0007g",
  306. "\u0002\u0002}~\u0007c\u0002\u0002~\u007f\u0007n\u0002\u0002\u007f\u0006",
  307. "\u0003\u0002\u0002\u0002\u0080\u0081\u0007x\u0002\u0002\u0081\u0082",
  308. "\u0007q\u0002\u0002\u0082\u0083\u0007k\u0002\u0002\u0083\u0084\u0007",
  309. "f\u0002\u0002\u0084\b\u0003\u0002\u0002\u0002\u0085\u0086\u0007d\u0002",
  310. "\u0002\u0086\u0087\u0007q\u0002\u0002\u0087\u0088\u0007q\u0002\u0002",
  311. "\u0088\u0089\u0007n\u0002\u0002\u0089\u008a\u0007g\u0002\u0002\u008a",
  312. "\u008b\u0007c\u0002\u0002\u008b\u008c\u0007p\u0002\u0002\u008c\n\u0003",
  313. "\u0002\u0002\u0002\u008d\u008e\u0007u\u0002\u0002\u008e\u008f\u0007",
  314. "v\u0002\u0002\u008f\u0090\u0007t\u0002\u0002\u0090\u0091\u0007k\u0002",
  315. "\u0002\u0091\u0092\u0007p\u0002\u0002\u0092\u0093\u0007i\u0002\u0002",
  316. "\u0093\f\u0003\u0002\u0002\u0002\u0094\u0095\u0007k\u0002\u0002\u0095",
  317. "\u0096\u0007p\u0002\u0002\u0096\u0097\u0007v\u0002\u0002\u0097\u0098",
  318. "\u0007g\u0002\u0002\u0098\u0099\u0007i\u0002\u0002\u0099\u009a\u0007",
  319. "g\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u000e\u0003\u0002",
  320. "\u0002\u0002\u009c\u009d\u0007e\u0002\u0002\u009d\u009e\u0007j\u0002",
  321. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  322. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  323. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  324. "\u0007t\u0002\u0002\u00a5\u0010\u0003\u0002\u0002\u0002\u00a6\u00a7",
  325. "\u0007u\u0002\u0002\u00a7\u00a8\u0007y\u0002\u0002\u00a8\u00a9\u0007",
  326. "k\u0002\u0002\u00a9\u00aa\u0007v\u0002\u0002\u00aa\u00ab\u0007e\u0002",
  327. "\u0002\u00ab\u00ac\u0007j\u0002\u0002\u00ac\u0012\u0003\u0002\u0002",
  328. "\u0002\u00ad\u00ae\u0007e\u0002\u0002\u00ae\u00af\u0007c\u0002\u0002",
  329. "\u00af\u00b0\u0007u\u0002\u0002\u00b0\u00b1\u0007g\u0002\u0002\u00b1",
  330. "\u0014\u0003\u0002\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3",
  331. "\u00b4\u0007v\u0002\u0002\u00b4\u00b5\u0007j\u0002\u0002\u00b5\u00b6",
  332. "\u0007g\u0002\u0002\u00b6\u00b7\u0007t\u0002\u0002\u00b7\u00b8\u0007",
  333. "y\u0002\u0002\u00b8\u00b9\u0007k\u0002\u0002\u00b9\u00ba\u0007u\u0002",
  334. "\u0002\u00ba\u00bb\u0007g\u0002\u0002\u00bb\u0016\u0003\u0002\u0002",
  335. "\u0002\u00bc\u00bd\u0007e\u0002\u0002\u00bd\u00be\u0007q\u0002\u0002",
  336. "\u00be\u00bf\u0007p\u0002\u0002\u00bf\u00c0\u0007u\u0002\u0002\u00c0",
  337. "\u00c1\u0007v\u0002\u0002\u00c1\u0018\u0003\u0002\u0002\u0002\u00c2",
  338. "\u00c3\u0007h\u0002\u0002\u00c3\u00c4\u0007w\u0002\u0002\u00c4\u00c5",
  339. "\u0007p\u0002\u0002\u00c5\u00c6\u0007e\u0002\u0002\u00c6\u00c7\u0007",
  340. "v\u0002\u0002\u00c7\u00c8\u0007k\u0002\u0002\u00c8\u00c9\u0007q\u0002",
  341. "\u0002\u00c9\u00ca\u0007p\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  342. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  343. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007w\u0002\u0002\u00cf",
  344. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u001c",
  345. "\u0003\u0002\u0002\u0002\u00d2\u00d3\u0007h\u0002\u0002\u00d3\u00d4",
  346. "\u0007q\u0002\u0002\u00d4\u00d5\u0007t\u0002\u0002\u00d5\u001e\u0003",
  347. "\u0002\u0002\u0002\u00d6\u00d7\u0007d\u0002\u0002\u00d7\u00d8\u0007",
  348. "t\u0002\u0002\u00d8\u00d9\u0007g\u0002\u0002\u00d9\u00da\u0007c\u0002",
  349. "\u0002\u00da\u00db\u0007m\u0002\u0002\u00db \u0003\u0002\u0002\u0002",
  350. "\u00dc\u00dd\u0007f\u0002\u0002\u00dd\u00de\u0007q\u0002\u0002\u00de",
  351. "\"\u0003\u0002\u0002\u0002\u00df\u00e0\u0007y\u0002\u0002\u00e0\u00e1",
  352. "\u0007j\u0002\u0002\u00e1\u00e2\u0007k\u0002\u0002\u00e2\u00e3\u0007",
  353. "n\u0002\u0002\u00e3\u00e4\u0007g\u0002\u0002\u00e4$\u0003\u0002\u0002",
  354. "\u0002\u00e5\u00e6\u0007k\u0002\u0002\u00e6\u00e7\u0007h\u0002\u0002",
  355. "\u00e7&\u0003\u0002\u0002\u0002\u00e8\u00e9\u0007g\u0002\u0002\u00e9",
  356. "\u00ea\u0007n\u0002\u0002\u00ea\u00eb\u0007u\u0002\u0002\u00eb\u00ec",
  357. "\u0007g\u0002\u0002\u00ec(\u0003\u0002\u0002\u0002\u00ed\u00ee\u0007",
  358. "h\u0002\u0002\u00ee\u00ef\u0007c\u0002\u0002\u00ef\u00f0\u0007n\u0002",
  359. "\u0002\u00f0\u00f1\u0007u\u0002\u0002\u00f1\u00f2\u0007g\u0002\u0002",
  360. "\u00f2*\u0003\u0002\u0002\u0002\u00f3\u00f4\u0007v\u0002\u0002\u00f4",
  361. "\u00f5\u0007t\u0002\u0002\u00f5\u00f6\u0007w\u0002\u0002\u00f6\u00f7",
  362. "\u0007g\u0002\u0002\u00f7,\u0003\u0002\u0002\u0002\u00f8\u00f9\u0007",
  363. "p\u0002\u0002\u00f9\u00fa\u0007q\u0002\u0002\u00fa\u00fb\u0007v\u0002",
  364. "\u0002\u00fb.\u0003\u0002\u0002\u0002\u00fc\u00fd\u0007C\u0002\u0002",
  365. "\u00fd\u00fe\u0007P\u0002\u0002\u00fe\u00ff\u0007F\u0002\u0002\u00ff",
  366. "0\u0003\u0002\u0002\u0002\u0100\u0101\u0007Q\u0002\u0002\u0101\u0102",
  367. "\u0007T\u0002\u0002\u01022\u0003\u0002\u0002\u0002\u0103\u0104\u0007",
  368. "*\u0002\u0002\u01044\u0003\u0002\u0002\u0002\u0105\u0106\u0007+\u0002",
  369. "\u0002\u01066\u0003\u0002\u0002\u0002\u0107\u0108\u0007]\u0002\u0002",
  370. "\u01088\u0003\u0002\u0002\u0002\u0109\u010a\u0007_\u0002\u0002\u010a",
  371. ":\u0003\u0002\u0002\u0002\u010b\u010c\u0007}\u0002\u0002\u010c<\u0003",
  372. "\u0002\u0002\u0002\u010d\u010e\u0007\u007f\u0002\u0002\u010e>\u0003",
  373. "\u0002\u0002\u0002\u010f\u0110\u0007.\u0002\u0002\u0110@\u0003\u0002",
  374. "\u0002\u0002\u0111\u0112\u0007?\u0002\u0002\u0112B\u0003\u0002\u0002",
  375. "\u0002\u0113\u0114\t\u0002\u0002\u0002\u0114D\u0003\u0002\u0002\u0002",
  376. "\u0115\u0116\t\u0003\u0002\u0002\u0116F\u0003\u0002\u0002\u0002\u0117",
  377. "\u0118\u0005/\u0018\u0002\u0118H\u0003\u0002\u0002\u0002\u0119\u011a",
  378. "\u00051\u0019\u0002\u011aJ\u0003\u0002\u0002\u0002\u011b\u011c\u0007",
  379. "@\u0002\u0002\u011c\u0125\u0007?\u0002\u0002\u011d\u011e\u0007?\u0002",
  380. "\u0002\u011e\u0125\u0007?\u0002\u0002\u011f\u0120\u0007>\u0002\u0002",
  381. "\u0120\u0125\u0007?\u0002\u0002\u0121\u0125\t\u0004\u0002\u0002\u0122",
  382. "\u0123\u0007#\u0002\u0002\u0123\u0125\u0007?\u0002\u0002\u0124\u011b",
  383. "\u0003\u0002\u0002\u0002\u0124\u011d\u0003\u0002\u0002\u0002\u0124\u011f",
  384. "\u0003\u0002\u0002\u0002\u0124\u0121\u0003\u0002\u0002\u0002\u0124\u0122",
  385. "\u0003\u0002\u0002\u0002\u0125L\u0003\u0002\u0002\u0002\u0126\u0127",
  386. "\u0007<\u0002\u0002\u0127N\u0003\u0002\u0002\u0002\u0128\u0129\u0005",
  387. "-\u0017\u0002\u0129P\u0003\u0002\u0002\u0002\u012a\u012e\t\u0005\u0002",
  388. "\u0002\u012b\u012d\t\u0006\u0002\u0002\u012c\u012b\u0003\u0002\u0002",
  389. "\u0002\u012d\u0130\u0003\u0002\u0002\u0002\u012e\u012c\u0003\u0002\u0002",
  390. "\u0002\u012e\u012f\u0003\u0002\u0002\u0002\u012fR\u0003\u0002\u0002",
  391. "\u0002\u0130\u012e\u0003\u0002\u0002\u0002\u0131\u0132\u0005Q)\u0002",
  392. "\u0132\u0133\u00070\u0002\u0002\u0133\u0134\u0005Q)\u0002\u0134T\u0003",
  393. "\u0002\u0002\u0002\u0135\u0137\t\u0007\u0002\u0002\u0136\u0135\u0003",
  394. "\u0002\u0002\u0002\u0137\u0138\u0003\u0002\u0002\u0002\u0138\u0136\u0003",
  395. "\u0002\u0002\u0002\u0138\u0139\u0003\u0002\u0002\u0002\u0139\u0151\u0003",
  396. "\u0002\u0002\u0002\u013a\u013b\u00072\u0002\u0002\u013b\u013f\u0007",
  397. "z\u0002\u0002\u013c\u013d\u00072\u0002\u0002\u013d\u013f\u0007Z\u0002",
  398. "\u0002\u013e\u013a\u0003\u0002\u0002\u0002\u013e\u013c\u0003\u0002\u0002",
  399. "\u0002\u013f\u0141\u0003\u0002\u0002\u0002\u0140\u0142\u0005g4\u0002",
  400. "\u0141\u0140\u0003\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002",
  401. "\u0143\u0141\u0003\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002",
  402. "\u0144\u0151\u0003\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002",
  403. "\u0146\u014a\u0007d\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148",
  404. "\u014a\u0007D\u0002\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149",
  405. "\u0147\u0003\u0002\u0002\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b",
  406. "\u014d\t\b\u0002\u0002\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e",
  407. "\u0003\u0002\u0002\u0002\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f",
  408. "\u0003\u0002\u0002\u0002\u014f\u0151\u0003\u0002\u0002\u0002\u0150\u0136",
  409. "\u0003\u0002\u0002\u0002\u0150\u013e\u0003\u0002\u0002\u0002\u0150\u0149",
  410. "\u0003\u0002\u0002\u0002\u0151V\u0003\u0002\u0002\u0002\u0152\u0154",
  411. "\t\u0007\u0002\u0002\u0153\u0152\u0003\u0002\u0002\u0002\u0154\u0155",
  412. "\u0003\u0002\u0002\u0002\u0155\u0153\u0003\u0002\u0002\u0002\u0155\u0156",
  413. "\u0003\u0002\u0002\u0002\u0156\u0157\u0003\u0002\u0002\u0002\u0157\u0159",
  414. "\u00070\u0002\u0002\u0158\u015a\t\u0007\u0002\u0002\u0159\u0158\u0003",
  415. "\u0002\u0002\u0002\u015a\u015b\u0003\u0002\u0002\u0002\u015b\u0159\u0003",
  416. "\u0002\u0002\u0002\u015b\u015c\u0003\u0002\u0002\u0002\u015c\u016b\u0003",
  417. "\u0002\u0002\u0002\u015d\u015f\t\u0007\u0002\u0002\u015e\u015d\u0003",
  418. "\u0002\u0002\u0002\u015f\u0160\u0003\u0002\u0002\u0002\u0160\u015e\u0003",
  419. "\u0002\u0002\u0002\u0160\u0161\u0003\u0002\u0002\u0002\u0161\u0162\u0003",
  420. "\u0002\u0002\u0002\u0162\u0166\u00070\u0002\u0002\u0163\u0165\t\u0007",
  421. "\u0002\u0002\u0164\u0163\u0003\u0002\u0002\u0002\u0165\u0168\u0003\u0002",
  422. "\u0002\u0002\u0166\u0164\u0003\u0002\u0002\u0002\u0166\u0167\u0003\u0002",
  423. "\u0002\u0002\u0167\u0169\u0003\u0002\u0002\u0002\u0168\u0166\u0003\u0002",
  424. "\u0002\u0002\u0169\u016b\u0005Y-\u0002\u016a\u0153\u0003\u0002\u0002",
  425. "\u0002\u016a\u015e\u0003\u0002\u0002\u0002\u016bX\u0003\u0002\u0002",
  426. "\u0002\u016c\u016e\t\t\u0002\u0002\u016d\u016f\t\u0002\u0002\u0002\u016e",
  427. "\u016d\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002\u016f",
  428. "\u0171\u0003\u0002\u0002\u0002\u0170\u0172\t\u0007\u0002\u0002\u0171",
  429. "\u0170\u0003\u0002\u0002\u0002\u0172\u0173\u0003\u0002\u0002\u0002\u0173",
  430. "\u0171\u0003\u0002\u0002\u0002\u0173\u0174\u0003\u0002\u0002\u0002\u0174",
  431. "Z\u0003\u0002\u0002\u0002\u0175\u0179\u0007$\u0002\u0002\u0176\u0178",
  432. "\u0005]/\u0002\u0177\u0176\u0003\u0002\u0002\u0002\u0178\u017b\u0003",
  433. "\u0002\u0002\u0002\u0179\u0177\u0003\u0002\u0002\u0002\u0179\u017a\u0003",
  434. "\u0002\u0002\u0002\u017a\u017c\u0003\u0002\u0002\u0002\u017b\u0179\u0003",
  435. "\u0002\u0002\u0002\u017c\u017d\u0007$\u0002\u0002\u017d\\\u0003\u0002",
  436. "\u0002\u0002\u017e\u0181\n\n\u0002\u0002\u017f\u0181\u0005k6\u0002\u0180",
  437. "\u017e\u0003\u0002\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181",
  438. "^\u0003\u0002\u0002\u0002\u0182\u0185\u0007)\u0002\u0002\u0183\u0186",
  439. "\u0005k6\u0002\u0184\u0186\n\u000b\u0002\u0002\u0185\u0183\u0003\u0002",
  440. "\u0002\u0002\u0185\u0184\u0003\u0002\u0002\u0002\u0186\u0187\u0003\u0002",
  441. "\u0002\u0002\u0187\u0188\u0007)\u0002\u0002\u0188`\u0003\u0002\u0002",
  442. "\u0002\u0189\u018a\t\f\u0002\u0002\u018a\u018b\u0003\u0002\u0002\u0002",
  443. "\u018b\u018c\b1\u0002\u0002\u018cb\u0003\u0002\u0002\u0002\u018d\u018e",
  444. "\u0007=\u0002\u0002\u018ed\u0003\u0002\u0002\u0002\u018f\u0191\t\r\u0002",
  445. "\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002\u0002",
  446. "\u0002\u0192\u0190\u0003\u0002\u0002\u0002\u0192\u0193\u0003\u0002\u0002",
  447. "\u0002\u0193\u0196\u0003\u0002\u0002\u0002\u0194\u0196\u0005c2\u0002",
  448. "\u0195\u0190\u0003\u0002\u0002\u0002\u0195\u0194\u0003\u0002\u0002\u0002",
  449. "\u0196f\u0003\u0002\u0002\u0002\u0197\u0198\t\u000e\u0002\u0002\u0198",
  450. "h\u0003\u0002\u0002\u0002\u0199\u019a\t\u000f\u0002\u0002\u019aj\u0003",
  451. "\u0002\u0002\u0002\u019b\u019c\u0007^\u0002\u0002\u019c\u01a0\t\u0010",
  452. "\u0002\u0002\u019d\u01a0\u0005o8\u0002\u019e\u01a0\u0005m7\u0002\u019f",
  453. "\u019b\u0003\u0002\u0002\u0002\u019f\u019d\u0003\u0002\u0002\u0002\u019f",
  454. "\u019e\u0003\u0002\u0002\u0002\u01a0l\u0003\u0002\u0002\u0002\u01a1",
  455. "\u01a2\u0007^\u0002\u0002\u01a2\u01a3\t\u0011\u0002\u0002\u01a3\u01a4",
  456. "\u0005i5\u0002\u01a4\u01a5\u0005i5\u0002\u01a5\u01ad\u0003\u0002\u0002",
  457. "\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01a8\u0005i5\u0002\u01a8",
  458. "\u01a9\u0005i5\u0002\u01a9\u01ad\u0003\u0002\u0002\u0002\u01aa\u01ab",
  459. "\u0007^\u0002\u0002\u01ab\u01ad\u0005i5\u0002\u01ac\u01a1\u0003\u0002",
  460. "\u0002\u0002\u01ac\u01a6\u0003\u0002\u0002\u0002\u01ac\u01aa\u0003\u0002",
  461. "\u0002\u0002\u01adn\u0003\u0002\u0002\u0002\u01ae\u01af\u0007^\u0002",
  462. "\u0002\u01af\u01b0\u0007w\u0002\u0002\u01b0\u01b1\u0005g4\u0002\u01b1",
  463. "\u01b2\u0005g4\u0002\u01b2\u01b3\u0005g4\u0002\u01b3\u01b4\u0005g4\u0002",
  464. "\u01b4p\u0003\u0002\u0002\u0002\u01b5\u01b6\u00071\u0002\u0002\u01b6",
  465. "\u01b7\u00071\u0002\u0002\u01b7\u01bb\u0003\u0002\u0002\u0002\u01b8",
  466. "\u01ba\n\r\u0002\u0002\u01b9\u01b8\u0003\u0002\u0002\u0002\u01ba\u01bd",
  467. "\u0003\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bb\u01bc",
  468. "\u0003\u0002\u0002\u0002\u01bc\u01bf\u0003\u0002\u0002\u0002\u01bd\u01bb",
  469. "\u0003\u0002\u0002\u0002\u01be\u01c0\u0007\u000f\u0002\u0002\u01bf\u01be",
  470. "\u0003\u0002\u0002\u0002\u01bf\u01c0\u0003\u0002\u0002\u0002\u01c0\u01c1",
  471. "\u0003\u0002\u0002\u0002\u01c1\u01ce\u0007\f\u0002\u0002\u01c2\u01c3",
  472. "\u00071\u0002\u0002\u01c3\u01c4\u0007,\u0002\u0002\u01c4\u01c8\u0003",
  473. "\u0002\u0002\u0002\u01c5\u01c7\u000b\u0002\u0002\u0002\u01c6\u01c5\u0003",
  474. "\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c9\u0003",
  475. "\u0002\u0002\u0002\u01c8\u01c6\u0003\u0002\u0002\u0002\u01c9\u01cb\u0003",
  476. "\u0002\u0002\u0002\u01ca\u01c8\u0003\u0002\u0002\u0002\u01cb\u01cc\u0007",
  477. ",\u0002\u0002\u01cc\u01ce\u00071\u0002\u0002\u01cd\u01b5\u0003\u0002",
  478. "\u0002\u0002\u01cd\u01c2\u0003\u0002\u0002\u0002\u01ce\u01cf\u0003\u0002",
  479. "\u0002\u0002\u01cf\u01d0\b9\u0003\u0002\u01d0r\u0003\u0002\u0002\u0002",
  480. "\u001d\u0002\u0124\u012e\u0138\u013e\u0143\u0149\u014e\u0150\u0155\u015b",
  481. "\u0160\u0166\u016a\u016e\u0173\u0179\u0180\u0185\u0192\u0195\u019f\u01ac",
  482. "\u01bb\u01bf\u01c8\u01cd\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  483. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  484. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  485. function ivprog(input) {
  486. antlr4.Lexer.call(this, input);
  487. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  488. return this;
  489. }
  490. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  491. ivprog.prototype.constructor = ivprog;
  492. ivprog.EOF = antlr4.Token.EOF;
  493. ivprog.RK_PROGRAM = 1;
  494. ivprog.RK_REAL = 2;
  495. ivprog.RK_VOID = 3;
  496. ivprog.RK_BOOLEAN = 4;
  497. ivprog.RK_STRING = 5;
  498. ivprog.RK_INTEGER = 6;
  499. ivprog.RK_CHARACTER = 7;
  500. ivprog.RK_SWITCH = 8;
  501. ivprog.RK_CASE = 9;
  502. ivprog.RK_DEFAULT = 10;
  503. ivprog.RK_CONST = 11;
  504. ivprog.RK_FUNCTION = 12;
  505. ivprog.RK_RETURN = 13;
  506. ivprog.RK_FOR = 14;
  507. ivprog.RK_BREAK = 15;
  508. ivprog.RK_DO = 16;
  509. ivprog.RK_WHILE = 17;
  510. ivprog.RK_IF = 18;
  511. ivprog.RK_ELSE = 19;
  512. ivprog.RK_FALSE = 20;
  513. ivprog.RK_TRUE = 21;
  514. ivprog.OPEN_PARENTHESIS = 22;
  515. ivprog.CLOSE_PARENTHESIS = 23;
  516. ivprog.OPEN_BRACE = 24;
  517. ivprog.CLOSE_BRACE = 25;
  518. ivprog.OPEN_CURLY = 26;
  519. ivprog.CLOSE_CURLY = 27;
  520. ivprog.COMMA = 28;
  521. ivprog.EQUAL = 29;
  522. ivprog.SUM_OP = 30;
  523. ivprog.MULTI_OP = 31;
  524. ivprog.AND_OPERATOR = 32;
  525. ivprog.OR_OPERATOR = 33;
  526. ivprog.RELATIONAL_OPERATOR = 34;
  527. ivprog.COLON = 35;
  528. ivprog.NOT_OPERATOR = 36;
  529. ivprog.ID = 37;
  530. ivprog.LIB_ID = 38;
  531. ivprog.INTEGER = 39;
  532. ivprog.REAL = 40;
  533. ivprog.STRING = 41;
  534. ivprog.CHARACTER = 42;
  535. ivprog.WHITESPACE = 43;
  536. ivprog.EOS = 44;
  537. ivprog.COMMENTS = 45;
  538. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  539. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  540. ivprog.prototype.literalNames = [ null, "'program'", "'real'", "'void'",
  541. "'boolean'", "'string'", "'integer'",
  542. "'character'", "'switch'", "'case'", "'otherwise'",
  543. "'const'", "'function'", "'return'", "'for'",
  544. "'break'", "'do'", "'while'", "'if'",
  545. "'else'", "'false'", "'true'", "'('",
  546. "')'", "'['", "']'", "'{'", "'}'", "','",
  547. "'='", null, null, null, null, null, "':'" ];
  548. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  549. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  550. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  551. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  552. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  553. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  554. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  555. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  556. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  557. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  558. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  559. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  560. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  561. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  562. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  563. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  564. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  565. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  566. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  567. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  568. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  569. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  570. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  571. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  572. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  573. "STRING", "STRING_CHARACTER", "CHARACTER",
  574. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  575. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  576. "COMMENTS" ];
  577. ivprog.prototype.grammarFileName = "ivprog.g4";
  578. exports.ivprog = ivprog;
  579. /***/ }),
  580. /* 1 */
  581. /***/ (function(module, exports, __webpack_require__) {
  582. module.exports = {
  583. ivprog: __webpack_require__(0).ivprog
  584. };
  585. /***/ }),
  586. /* 2 */
  587. /***/ (function(module, exports) {
  588. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  589. /***/ })
  590. /******/ ]);
  591. /***/ }),
  592. /***/ "./grammar/en/langFunctions.js":
  593. /*!*************************************!*\
  594. !*** ./grammar/en/langFunctions.js ***!
  595. \*************************************/
  596. /*! no static exports found */
  597. /***/ (function(module, exports, __webpack_require__) {
  598. "use strict";
  599. Object.defineProperty(exports, "__esModule", {
  600. value: true
  601. });
  602. /* This is a dictionary of the language defined functions
  603. **/
  604. exports.default = {
  605. main_function: "start",
  606. $read: "read",
  607. $write: "write",
  608. $numElements: "total_of_elements",
  609. $matrixLines: "total_of_lines",
  610. $matrixColumns: "total_of_columns",
  611. $substring: "subcadeia",
  612. $length: "comprimento",
  613. $uppercase: "caixa_alta",
  614. $lowercase: "caixa_baixa",
  615. $charAt: "char_at",
  616. $isReal: "is_real",
  617. $isInt: "is_integer",
  618. $isBool: "is_logic",
  619. $castReal: "to_real",
  620. $castInt: "to_integer",
  621. $castBool: "to_logic",
  622. $castString: "to_string",
  623. $sin: "sin",
  624. $cos: "cos",
  625. $tan: "tan",
  626. $sqrt: "sqrt",
  627. $pow: "pow",
  628. $log: "log",
  629. $abs: "abs",
  630. $negate: "negate",
  631. $invert: "invert",
  632. $max: "maximum",
  633. $min: "minimum"
  634. };
  635. /***/ }),
  636. /***/ "./grammar/en/langLibs.js":
  637. /*!********************************!*\
  638. !*** ./grammar/en/langLibs.js ***!
  639. \********************************/
  640. /*! no static exports found */
  641. /***/ (function(module, exports, __webpack_require__) {
  642. "use strict";
  643. Object.defineProperty(exports, "__esModule", {
  644. value: true
  645. });
  646. /**
  647. * This is the dictionary of the language defined libraries
  648. */
  649. exports.default = {
  650. $mathLib: "Mathematic",
  651. $ioLib: "ES",
  652. $strLib: "Texto",
  653. $arrayLib: "Arranjo",
  654. $langLib: "Conversion"
  655. };
  656. /***/ }),
  657. /***/ "./grammar/es/ivprog.g4":
  658. /*!******************************!*\
  659. !*** ./grammar/es/ivprog.g4 ***!
  660. \******************************/
  661. /*! no static exports found */
  662. /***/ (function(module, exports, __webpack_require__) {
  663. module.exports =
  664. /******/ (function(modules) { // webpackBootstrap
  665. /******/ // The module cache
  666. /******/ var installedModules = {};
  667. /******/
  668. /******/ // The require function
  669. /******/ function __webpack_require__(moduleId) {
  670. /******/
  671. /******/ // Check if module is in cache
  672. /******/ if(installedModules[moduleId]) {
  673. /******/ return installedModules[moduleId].exports;
  674. /******/ }
  675. /******/ // Create a new module (and put it into the cache)
  676. /******/ var module = installedModules[moduleId] = {
  677. /******/ i: moduleId,
  678. /******/ l: false,
  679. /******/ exports: {}
  680. /******/ };
  681. /******/
  682. /******/ // Execute the module function
  683. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  684. /******/
  685. /******/ // Flag the module as loaded
  686. /******/ module.l = true;
  687. /******/
  688. /******/ // Return the exports of the module
  689. /******/ return module.exports;
  690. /******/ }
  691. /******/
  692. /******/
  693. /******/ // expose the modules object (__webpack_modules__)
  694. /******/ __webpack_require__.m = modules;
  695. /******/
  696. /******/ // expose the module cache
  697. /******/ __webpack_require__.c = installedModules;
  698. /******/
  699. /******/ // identity function for calling harmony imports with the correct context
  700. /******/ __webpack_require__.i = function(value) { return value; };
  701. /******/
  702. /******/ // define getter function for harmony exports
  703. /******/ __webpack_require__.d = function(exports, name, getter) {
  704. /******/ if(!__webpack_require__.o(exports, name)) {
  705. /******/ Object.defineProperty(exports, name, {
  706. /******/ configurable: false,
  707. /******/ enumerable: true,
  708. /******/ get: getter
  709. /******/ });
  710. /******/ }
  711. /******/ };
  712. /******/
  713. /******/ // getDefaultExport function for compatibility with non-harmony modules
  714. /******/ __webpack_require__.n = function(module) {
  715. /******/ var getter = module && module.__esModule ?
  716. /******/ function getDefault() { return module['default']; } :
  717. /******/ function getModuleExports() { return module; };
  718. /******/ __webpack_require__.d(getter, 'a', getter);
  719. /******/ return getter;
  720. /******/ };
  721. /******/
  722. /******/ // Object.prototype.hasOwnProperty.call
  723. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  724. /******/
  725. /******/ // __webpack_public_path__
  726. /******/ __webpack_require__.p = "";
  727. /******/
  728. /******/ // Load entry module and return exports
  729. /******/ return __webpack_require__(__webpack_require__.s = 1);
  730. /******/ })
  731. /************************************************************************/
  732. /******/ ([
  733. /* 0 */
  734. /***/ (function(module, exports, __webpack_require__) {
  735. // Generated from /tmp/tmp-7479HVzvc2BxL2Mk/ivprog.g4 by ANTLR 4.7
  736. // jshint ignore: start
  737. var antlr4 = __webpack_require__(2);
  738. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  739. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  740. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  741. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  742. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  743. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  744. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  745. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  746. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  747. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  748. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  749. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  750. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  751. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  752. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  753. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  754. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  755. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  756. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  757. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  758. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  759. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  760. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  761. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  762. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  763. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  764. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  765. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  766. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  767. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  768. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  769. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  770. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  771. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  772. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  773. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  774. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  775. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  776. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  777. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  778. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  779. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  780. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  781. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  782. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  783. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  784. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  785. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  786. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  787. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  788. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  789. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  790. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  791. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  792. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  793. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  794. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  795. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  796. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  797. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  798. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  799. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  800. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  801. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  802. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  803. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  804. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  805. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  806. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  807. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  808. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  809. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  810. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  811. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  812. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  813. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  814. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  815. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  816. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  817. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  818. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  819. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  820. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  821. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  822. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  823. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  824. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  825. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  826. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  827. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  828. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  829. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  830. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  831. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  832. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  833. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  834. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  835. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  836. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  837. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  838. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  839. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  840. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  841. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  842. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  843. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  844. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  845. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  846. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  847. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  848. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  849. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  850. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  851. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  852. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  853. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  854. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  855. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  856. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  857. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  858. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  859. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  860. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  861. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  862. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  863. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  864. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  865. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  866. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  867. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  868. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  869. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  870. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  871. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  872. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  873. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  874. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  875. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  876. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  877. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  878. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  879. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  880. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  881. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  882. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  883. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  884. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  885. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  886. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  887. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  888. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  889. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  890. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  891. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  892. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  893. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  894. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  895. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  896. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  897. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  898. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  899. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  900. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  901. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  902. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  903. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  904. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  905. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  906. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  907. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  908. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  909. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  910. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  911. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  912. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  913. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  914. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  915. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  916. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  917. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  918. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  919. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  920. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  921. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  922. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  923. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  924. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  925. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  926. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  927. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  928. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  929. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  930. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  931. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  932. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  933. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  934. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  935. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  936. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  937. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  938. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  939. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  940. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  941. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  942. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  943. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  944. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  945. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  946. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  947. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  948. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  949. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  950. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  951. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  952. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  953. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  954. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  955. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  956. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  957. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  958. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  959. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  960. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  961. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  962. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  963. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  964. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  965. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  966. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  967. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  968. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  969. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  970. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  971. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  972. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  973. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  974. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  975. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  976. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  977. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  978. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  979. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  980. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  981. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  982. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  983. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  984. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  985. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  986. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  987. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  988. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  989. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  990. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  991. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  992. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  993. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  994. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  995. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  996. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  997. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  998. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  999. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  1000. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  1001. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  1002. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  1003. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1004. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1005. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1006. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1007. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1008. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1009. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1010. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1011. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1012. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1013. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1014. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1015. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1016. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1017. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1018. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1019. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1020. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1021. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1022. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1023. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1024. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1025. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1026. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1027. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1028. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1029. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1030. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1031. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1032. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1033. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1034. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1035. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1036. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1037. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1038. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1039. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1040. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1041. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1042. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1043. function ivprog(input) {
  1044. antlr4.Lexer.call(this, input);
  1045. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1046. return this;
  1047. }
  1048. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1049. ivprog.prototype.constructor = ivprog;
  1050. ivprog.EOF = antlr4.Token.EOF;
  1051. ivprog.RK_PROGRAM = 1;
  1052. ivprog.RK_REAL = 2;
  1053. ivprog.RK_VOID = 3;
  1054. ivprog.RK_BOOLEAN = 4;
  1055. ivprog.RK_STRING = 5;
  1056. ivprog.RK_INTEGER = 6;
  1057. ivprog.RK_CHARACTER = 7;
  1058. ivprog.RK_SWITCH = 8;
  1059. ivprog.RK_CASE = 9;
  1060. ivprog.RK_DEFAULT = 10;
  1061. ivprog.RK_CONST = 11;
  1062. ivprog.RK_FUNCTION = 12;
  1063. ivprog.RK_RETURN = 13;
  1064. ivprog.RK_FOR = 14;
  1065. ivprog.RK_BREAK = 15;
  1066. ivprog.RK_DO = 16;
  1067. ivprog.RK_WHILE = 17;
  1068. ivprog.RK_IF = 18;
  1069. ivprog.RK_ELSE = 19;
  1070. ivprog.RK_FALSE = 20;
  1071. ivprog.RK_TRUE = 21;
  1072. ivprog.OPEN_PARENTHESIS = 22;
  1073. ivprog.CLOSE_PARENTHESIS = 23;
  1074. ivprog.OPEN_BRACE = 24;
  1075. ivprog.CLOSE_BRACE = 25;
  1076. ivprog.OPEN_CURLY = 26;
  1077. ivprog.CLOSE_CURLY = 27;
  1078. ivprog.COMMA = 28;
  1079. ivprog.EQUAL = 29;
  1080. ivprog.SUM_OP = 30;
  1081. ivprog.MULTI_OP = 31;
  1082. ivprog.AND_OPERATOR = 32;
  1083. ivprog.OR_OPERATOR = 33;
  1084. ivprog.RELATIONAL_OPERATOR = 34;
  1085. ivprog.COLON = 35;
  1086. ivprog.NOT_OPERATOR = 36;
  1087. ivprog.ID = 37;
  1088. ivprog.LIB_ID = 38;
  1089. ivprog.INTEGER = 39;
  1090. ivprog.REAL = 40;
  1091. ivprog.STRING = 41;
  1092. ivprog.CHARACTER = 42;
  1093. ivprog.WHITESPACE = 43;
  1094. ivprog.EOS = 44;
  1095. ivprog.COMMENTS = 45;
  1096. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1097. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1098. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1099. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1100. "'escolha'", "'caso'", "'contrario'",
  1101. "'const'", "'funcao'", "'retorne'", "'para'",
  1102. "'pare'", "'faca'", "'enquanto'", "'se'",
  1103. "'senao'", "'falso'", "'verdadeiro'",
  1104. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1105. "','", "'='", null, null, null, null,
  1106. null, "':'" ];
  1107. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1108. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1109. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1110. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1111. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1112. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1113. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1114. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1115. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1116. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1117. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1118. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1119. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1120. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1121. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1122. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1123. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1124. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1125. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1126. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1127. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1128. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1129. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1130. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1131. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1132. "STRING", "STRING_CHARACTER", "CHARACTER",
  1133. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1134. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1135. "COMMENTS" ];
  1136. ivprog.prototype.grammarFileName = "ivprog.g4";
  1137. exports.ivprog = ivprog;
  1138. /***/ }),
  1139. /* 1 */
  1140. /***/ (function(module, exports, __webpack_require__) {
  1141. module.exports = {
  1142. ivprog: __webpack_require__(0).ivprog
  1143. };
  1144. /***/ }),
  1145. /* 2 */
  1146. /***/ (function(module, exports) {
  1147. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1148. /***/ })
  1149. /******/ ]);
  1150. /***/ }),
  1151. /***/ "./grammar/es/langFunctions.js":
  1152. /*!*************************************!*\
  1153. !*** ./grammar/es/langFunctions.js ***!
  1154. \*************************************/
  1155. /*! no static exports found */
  1156. /***/ (function(module, exports, __webpack_require__) {
  1157. "use strict";
  1158. Object.defineProperty(exports, "__esModule", {
  1159. value: true
  1160. });
  1161. /* This is a dictionary of the language defined functions
  1162. **/
  1163. exports.default = {
  1164. main_function: "inicio",
  1165. $read: "leia",
  1166. $write: "escreva",
  1167. $numElements: "total_of_elements",
  1168. $matrixLines: "total_of_lines",
  1169. $matrixColumns: "total_of_columns",
  1170. $substring: "subcadeia",
  1171. $length: "comprimento",
  1172. $uppercase: "caixa_alta",
  1173. $lowercase: "caixa_baixa",
  1174. $charAt: "char_at",
  1175. $isReal: "is_real",
  1176. $isInt: "is_integer",
  1177. $isBool: "is_logic",
  1178. $castReal: "to_real",
  1179. $castInt: "to_integer",
  1180. $castBool: "to_logic",
  1181. $castString: "to_string",
  1182. $sin: "sin",
  1183. $cos: "cos",
  1184. $tan: "tan",
  1185. $sqrt: "sqrt",
  1186. $pow: "pow",
  1187. $log: "log",
  1188. $abs: "abs",
  1189. $negate: "negate",
  1190. $invert: "invert",
  1191. $max: "maximum",
  1192. $min: "minimum"
  1193. };
  1194. /***/ }),
  1195. /***/ "./grammar/es/langLibs.js":
  1196. /*!********************************!*\
  1197. !*** ./grammar/es/langLibs.js ***!
  1198. \********************************/
  1199. /*! no static exports found */
  1200. /***/ (function(module, exports, __webpack_require__) {
  1201. "use strict";
  1202. Object.defineProperty(exports, "__esModule", {
  1203. value: true
  1204. });
  1205. /**
  1206. * This is the dictionary of the language defined libraries
  1207. */
  1208. exports.default = {
  1209. $mathLib: "Mathematic",
  1210. $ioLib: "ES",
  1211. $strLib: "Texto",
  1212. $arrayLib: "Arranjo",
  1213. $langLib: "Conversion"
  1214. };
  1215. /***/ }),
  1216. /***/ "./grammar/index.js":
  1217. /*!**************************!*\
  1218. !*** ./grammar/index.js ***!
  1219. \**************************/
  1220. /*! no static exports found */
  1221. /***/ (function(module, exports, __webpack_require__) {
  1222. "use strict";
  1223. var _ivprog = __webpack_require__(/*! ./pt/ivprog.g4 */ "./grammar/pt/ivprog.g4");
  1224. var PT = _interopRequireWildcard(_ivprog);
  1225. var _langFunctions = __webpack_require__(/*! ./pt/langFunctions */ "./grammar/pt/langFunctions.js");
  1226. var _langFunctions2 = _interopRequireDefault(_langFunctions);
  1227. var _langLibs = __webpack_require__(/*! ./pt/langLibs */ "./grammar/pt/langLibs.js");
  1228. var _langLibs2 = _interopRequireDefault(_langLibs);
  1229. var _ivprog2 = __webpack_require__(/*! ./en/ivprog.g4 */ "./grammar/en/ivprog.g4");
  1230. var EN = _interopRequireWildcard(_ivprog2);
  1231. var _langFunctions3 = __webpack_require__(/*! ./en/langFunctions */ "./grammar/en/langFunctions.js");
  1232. var _langFunctions4 = _interopRequireDefault(_langFunctions3);
  1233. var _langLibs3 = __webpack_require__(/*! ./en/langLibs */ "./grammar/en/langLibs.js");
  1234. var _langLibs4 = _interopRequireDefault(_langLibs3);
  1235. var _ivprog3 = __webpack_require__(/*! ./es/ivprog.g4 */ "./grammar/es/ivprog.g4");
  1236. var ES = _interopRequireWildcard(_ivprog3);
  1237. var _langFunctions5 = __webpack_require__(/*! ./es/langFunctions */ "./grammar/es/langFunctions.js");
  1238. var _langFunctions6 = _interopRequireDefault(_langFunctions5);
  1239. var _langLibs5 = __webpack_require__(/*! ./es/langLibs */ "./grammar/es/langLibs.js");
  1240. var _langLibs6 = _interopRequireDefault(_langLibs5);
  1241. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1242. 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; } }
  1243. exports.pt = { lexer: PT.ivprog, langFuncs: _langFunctions2.default, langLibs: _langLibs2.default };
  1244. exports.en = { lexer: EN.ivprog, langFuncs: _langFunctions4.default, langLibs: _langLibs4.default };
  1245. exports.es = { lexer: ES.ivprog, langFuncs: _langFunctions6.default, langLibs: _langLibs6.default };
  1246. /***/ }),
  1247. /***/ "./grammar/pt/ivprog.g4":
  1248. /*!******************************!*\
  1249. !*** ./grammar/pt/ivprog.g4 ***!
  1250. \******************************/
  1251. /*! no static exports found */
  1252. /***/ (function(module, exports, __webpack_require__) {
  1253. module.exports =
  1254. /******/ (function(modules) { // webpackBootstrap
  1255. /******/ // The module cache
  1256. /******/ var installedModules = {};
  1257. /******/
  1258. /******/ // The require function
  1259. /******/ function __webpack_require__(moduleId) {
  1260. /******/
  1261. /******/ // Check if module is in cache
  1262. /******/ if(installedModules[moduleId]) {
  1263. /******/ return installedModules[moduleId].exports;
  1264. /******/ }
  1265. /******/ // Create a new module (and put it into the cache)
  1266. /******/ var module = installedModules[moduleId] = {
  1267. /******/ i: moduleId,
  1268. /******/ l: false,
  1269. /******/ exports: {}
  1270. /******/ };
  1271. /******/
  1272. /******/ // Execute the module function
  1273. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1274. /******/
  1275. /******/ // Flag the module as loaded
  1276. /******/ module.l = true;
  1277. /******/
  1278. /******/ // Return the exports of the module
  1279. /******/ return module.exports;
  1280. /******/ }
  1281. /******/
  1282. /******/
  1283. /******/ // expose the modules object (__webpack_modules__)
  1284. /******/ __webpack_require__.m = modules;
  1285. /******/
  1286. /******/ // expose the module cache
  1287. /******/ __webpack_require__.c = installedModules;
  1288. /******/
  1289. /******/ // identity function for calling harmony imports with the correct context
  1290. /******/ __webpack_require__.i = function(value) { return value; };
  1291. /******/
  1292. /******/ // define getter function for harmony exports
  1293. /******/ __webpack_require__.d = function(exports, name, getter) {
  1294. /******/ if(!__webpack_require__.o(exports, name)) {
  1295. /******/ Object.defineProperty(exports, name, {
  1296. /******/ configurable: false,
  1297. /******/ enumerable: true,
  1298. /******/ get: getter
  1299. /******/ });
  1300. /******/ }
  1301. /******/ };
  1302. /******/
  1303. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1304. /******/ __webpack_require__.n = function(module) {
  1305. /******/ var getter = module && module.__esModule ?
  1306. /******/ function getDefault() { return module['default']; } :
  1307. /******/ function getModuleExports() { return module; };
  1308. /******/ __webpack_require__.d(getter, 'a', getter);
  1309. /******/ return getter;
  1310. /******/ };
  1311. /******/
  1312. /******/ // Object.prototype.hasOwnProperty.call
  1313. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  1314. /******/
  1315. /******/ // __webpack_public_path__
  1316. /******/ __webpack_require__.p = "";
  1317. /******/
  1318. /******/ // Load entry module and return exports
  1319. /******/ return __webpack_require__(__webpack_require__.s = 1);
  1320. /******/ })
  1321. /************************************************************************/
  1322. /******/ ([
  1323. /* 0 */
  1324. /***/ (function(module, exports, __webpack_require__) {
  1325. // Generated from /tmp/tmp-7479JCS9a3yQPz6d/ivprog.g4 by ANTLR 4.7
  1326. // jshint ignore: start
  1327. var antlr4 = __webpack_require__(2);
  1328. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  1329. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  1330. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  1331. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  1332. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  1333. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  1334. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  1335. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  1336. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  1337. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  1338. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  1339. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  1340. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  1341. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  1342. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  1343. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  1344. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  1345. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  1346. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  1347. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  1348. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  1349. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  1350. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  1351. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  1352. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  1353. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  1354. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  1355. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  1356. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  1357. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  1358. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  1359. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  1360. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  1361. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  1362. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  1363. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  1364. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  1365. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  1366. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  1367. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  1368. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  1369. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  1370. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  1371. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  1372. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  1373. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  1374. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  1375. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  1376. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  1377. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  1378. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  1379. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  1380. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  1381. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  1382. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  1383. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  1384. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  1385. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  1386. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  1387. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  1388. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  1389. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  1390. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  1391. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  1392. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  1393. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  1394. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  1395. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  1396. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  1397. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  1398. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  1399. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  1400. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  1401. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  1402. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  1403. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  1404. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  1405. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  1406. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  1407. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  1408. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  1409. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  1410. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  1411. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  1412. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  1413. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  1414. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  1415. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  1416. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  1417. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  1418. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  1419. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  1420. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  1421. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  1422. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  1423. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  1424. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  1425. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  1426. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  1427. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  1428. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  1429. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  1430. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  1431. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  1432. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  1433. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  1434. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  1435. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  1436. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  1437. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  1438. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  1439. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  1440. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  1441. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  1442. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  1443. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  1444. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  1445. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  1446. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  1447. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  1448. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  1449. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  1450. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  1451. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  1452. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  1453. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  1454. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  1455. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  1456. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  1457. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  1458. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  1459. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  1460. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  1461. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  1462. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  1463. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  1464. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  1465. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  1466. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  1467. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  1468. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  1469. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  1470. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  1471. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  1472. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  1473. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  1474. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  1475. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  1476. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  1477. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  1478. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  1479. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  1480. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  1481. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  1482. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  1483. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  1484. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  1485. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  1486. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  1487. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  1488. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  1489. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  1490. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  1491. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  1492. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  1493. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  1494. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  1495. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  1496. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  1497. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  1498. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  1499. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  1500. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  1501. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  1502. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  1503. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  1504. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  1505. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  1506. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  1507. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  1508. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  1509. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  1510. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  1511. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  1512. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  1513. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  1514. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  1515. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  1516. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  1517. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  1518. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  1519. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  1520. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  1521. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  1522. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  1523. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  1524. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  1525. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  1526. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  1527. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  1528. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  1529. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  1530. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  1531. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  1532. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  1533. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  1534. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  1535. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  1536. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  1537. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  1538. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  1539. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  1540. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  1541. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  1542. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  1543. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  1544. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  1545. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  1546. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  1547. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  1548. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  1549. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  1550. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  1551. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  1552. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  1553. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  1554. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  1555. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  1556. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  1557. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  1558. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  1559. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  1560. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  1561. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  1562. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  1563. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  1564. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  1565. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  1566. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  1567. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  1568. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  1569. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  1570. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  1571. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  1572. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  1573. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  1574. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  1575. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  1576. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  1577. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  1578. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  1579. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  1580. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  1581. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  1582. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  1583. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  1584. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  1585. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  1586. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  1587. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  1588. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  1589. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  1590. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  1591. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  1592. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  1593. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1594. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1595. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1596. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1597. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1598. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1599. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1600. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1601. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1602. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1603. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1604. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1605. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1606. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1607. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1608. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1609. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1610. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1611. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1612. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1613. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1614. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1615. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1616. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1617. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1618. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1619. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1620. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1621. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1622. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1623. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1624. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1625. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1626. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1627. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1628. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1629. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1630. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1631. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1632. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1633. function ivprog(input) {
  1634. antlr4.Lexer.call(this, input);
  1635. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1636. return this;
  1637. }
  1638. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1639. ivprog.prototype.constructor = ivprog;
  1640. ivprog.EOF = antlr4.Token.EOF;
  1641. ivprog.RK_PROGRAM = 1;
  1642. ivprog.RK_REAL = 2;
  1643. ivprog.RK_VOID = 3;
  1644. ivprog.RK_BOOLEAN = 4;
  1645. ivprog.RK_STRING = 5;
  1646. ivprog.RK_INTEGER = 6;
  1647. ivprog.RK_CHARACTER = 7;
  1648. ivprog.RK_SWITCH = 8;
  1649. ivprog.RK_CASE = 9;
  1650. ivprog.RK_DEFAULT = 10;
  1651. ivprog.RK_CONST = 11;
  1652. ivprog.RK_FUNCTION = 12;
  1653. ivprog.RK_RETURN = 13;
  1654. ivprog.RK_FOR = 14;
  1655. ivprog.RK_BREAK = 15;
  1656. ivprog.RK_DO = 16;
  1657. ivprog.RK_WHILE = 17;
  1658. ivprog.RK_IF = 18;
  1659. ivprog.RK_ELSE = 19;
  1660. ivprog.RK_FALSE = 20;
  1661. ivprog.RK_TRUE = 21;
  1662. ivprog.OPEN_PARENTHESIS = 22;
  1663. ivprog.CLOSE_PARENTHESIS = 23;
  1664. ivprog.OPEN_BRACE = 24;
  1665. ivprog.CLOSE_BRACE = 25;
  1666. ivprog.OPEN_CURLY = 26;
  1667. ivprog.CLOSE_CURLY = 27;
  1668. ivprog.COMMA = 28;
  1669. ivprog.EQUAL = 29;
  1670. ivprog.SUM_OP = 30;
  1671. ivprog.MULTI_OP = 31;
  1672. ivprog.AND_OPERATOR = 32;
  1673. ivprog.OR_OPERATOR = 33;
  1674. ivprog.RELATIONAL_OPERATOR = 34;
  1675. ivprog.COLON = 35;
  1676. ivprog.NOT_OPERATOR = 36;
  1677. ivprog.ID = 37;
  1678. ivprog.LIB_ID = 38;
  1679. ivprog.INTEGER = 39;
  1680. ivprog.REAL = 40;
  1681. ivprog.STRING = 41;
  1682. ivprog.CHARACTER = 42;
  1683. ivprog.WHITESPACE = 43;
  1684. ivprog.EOS = 44;
  1685. ivprog.COMMENTS = 45;
  1686. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1687. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1688. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1689. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1690. "'escolha'", "'caso'", "'contrario'",
  1691. "'const'", "'funcao'", "'retorne'", "'para'",
  1692. "'pare'", "'faca'", "'enquanto'", "'se'",
  1693. "'senao'", "'falso'", "'verdadeiro'",
  1694. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1695. "','", "'='", null, null, null, null,
  1696. null, "':'" ];
  1697. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1698. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1699. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1700. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1701. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1702. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1703. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1704. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1705. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1706. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1707. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1708. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1709. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1710. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1711. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1712. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1713. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1714. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1715. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1716. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1717. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1718. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1719. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1720. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1721. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1722. "STRING", "STRING_CHARACTER", "CHARACTER",
  1723. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1724. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1725. "COMMENTS" ];
  1726. ivprog.prototype.grammarFileName = "ivprog.g4";
  1727. exports.ivprog = ivprog;
  1728. /***/ }),
  1729. /* 1 */
  1730. /***/ (function(module, exports, __webpack_require__) {
  1731. module.exports = {
  1732. ivprog: __webpack_require__(0).ivprog
  1733. };
  1734. /***/ }),
  1735. /* 2 */
  1736. /***/ (function(module, exports) {
  1737. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1738. /***/ })
  1739. /******/ ]);
  1740. /***/ }),
  1741. /***/ "./grammar/pt/langFunctions.js":
  1742. /*!*************************************!*\
  1743. !*** ./grammar/pt/langFunctions.js ***!
  1744. \*************************************/
  1745. /*! no static exports found */
  1746. /***/ (function(module, exports, __webpack_require__) {
  1747. "use strict";
  1748. Object.defineProperty(exports, "__esModule", {
  1749. value: true
  1750. });
  1751. /* This is a dictionary of the language defined functions
  1752. **/
  1753. exports.default = {
  1754. main_function: "inicio",
  1755. $read: "leia",
  1756. $write: "escreva",
  1757. $numElements: "total_de_elementos",
  1758. $matrixLines: "total_de_linhas",
  1759. $matrixColumns: "total_de_colunas",
  1760. $substring: "subcadeia",
  1761. $length: "comprimento",
  1762. $uppercase: "caixa_alta",
  1763. $lowercase: "caixa_baixa",
  1764. $charAt: "char_at",
  1765. $isReal: "e_real",
  1766. $isInt: "e_inteiro",
  1767. $isBool: "e_logico",
  1768. $castReal: "como_real",
  1769. $castInt: "como_inteiro",
  1770. $castBool: "como_logico",
  1771. $castString: "como_cadeia",
  1772. $sin: "seno",
  1773. $cos: "cosseno",
  1774. $tan: "tangente",
  1775. $sqrt: "raiz_quadrada",
  1776. $pow: "potencia",
  1777. $log: "logaritmo",
  1778. $abs: "modulo",
  1779. $negate: "trocar_sinal",
  1780. $invert: "inverter_valor",
  1781. $max: "maximo",
  1782. $min: "minimo"
  1783. };
  1784. /***/ }),
  1785. /***/ "./grammar/pt/langLibs.js":
  1786. /*!********************************!*\
  1787. !*** ./grammar/pt/langLibs.js ***!
  1788. \********************************/
  1789. /*! no static exports found */
  1790. /***/ (function(module, exports, __webpack_require__) {
  1791. "use strict";
  1792. Object.defineProperty(exports, "__esModule", {
  1793. value: true
  1794. });
  1795. /**
  1796. * This is the dictionary of the language defined libraries
  1797. */
  1798. exports.default = {
  1799. $mathLib: "Matematica",
  1800. $ioLib: "ES",
  1801. $strLib: "Texto",
  1802. $arrayLib: "Arranjo",
  1803. $langLib: "Conversao"
  1804. };
  1805. /***/ }),
  1806. /***/ "./i18n/en/error.json":
  1807. /*!****************************!*\
  1808. !*** ./i18n/en/error.json ***!
  1809. \****************************/
  1810. /*! 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, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, test_case_few_reads, test_case_failed, default */
  1811. /***/ (function(module) {
  1812. 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","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição dos laços de repetição deve ser do tipo lógico","loop_condition_type":"A condição dos laços de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição de um comando se...senao 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_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","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_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $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","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"The amount of requests exceeded the amount of available inputs","test_case_few_reads":"Test case $0: Failed, there are input data remainig!","test_case_failed":"Test case $0: Failed, inputs:<$1>; expected output:<$2>; output:<$3>"};
  1813. /***/ }),
  1814. /***/ "./i18n/en/index.js":
  1815. /*!**************************!*\
  1816. !*** ./i18n/en/index.js ***!
  1817. \**************************/
  1818. /*! no static exports found */
  1819. /***/ (function(module, exports, __webpack_require__) {
  1820. "use strict";
  1821. Object.defineProperty(exports, "__esModule", {
  1822. value: true
  1823. });
  1824. var _error = __webpack_require__(/*! ./error.json */ "./i18n/en/error.json");
  1825. var _error2 = _interopRequireDefault(_error);
  1826. var _message = __webpack_require__(/*! ./message.json */ "./i18n/en/message.json");
  1827. var _message2 = _interopRequireDefault(_message);
  1828. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/en/ui.json");
  1829. var _ui2 = _interopRequireDefault(_ui);
  1830. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1831. exports.default = {
  1832. 'message': _message2.default,
  1833. 'error': _error2.default,
  1834. 'ui': _ui2.default
  1835. };
  1836. /***/ }),
  1837. /***/ "./i18n/en/message.json":
  1838. /*!******************************!*\
  1839. !*** ./i18n/en/message.json ***!
  1840. \******************************/
  1841. /*! exports provided: test_case_success, default */
  1842. /***/ (function(module) {
  1843. module.exports = {"test_case_success":"Test case $0: OK"};
  1844. /***/ }),
  1845. /***/ "./i18n/en/ui.json":
  1846. /*!*************************!*\
  1847. !*** ./i18n/en/ui.json ***!
  1848. \*************************/
  1849. /*! 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, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, text_ivprog_description, 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, expression_menu_select, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1850. /***/ (function(module) {
  1851. 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":"string","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":"Relational 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","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Mathematic","text_menu_functions_text":"Text","text_menu_functions_arrangement":"Arrangement","text_menu_functions_conversion":"Conversion","text_none_variable":"There is no declared variable","text_none_variable_instruction":"Create a new variable to use it","text_ivprog_description":"Interactive Visual Programming on the Internet","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","expression_menu_select":"Construct any logical condition","math":"Mathematic","text_t":"Text","inform_valid_name":"Inform a valid name!","inform_valid_content":"Enter some content!","inform_valid_expression":"Construct the logical condition!","inform_valid_name_duplicated":"This name is already in use by other function.","inform_valid_global_duplicated":"A global variable with this name already exists.","inform_valid_variable_duplicated":"A local variable with this name already exists.","arrangement":"Arrangement","conversion":"Conversion","$sin":"sin","$cos":"cos","$tan":"tan","$sqrt":"sqrt","$pow":"pow","$log":"log","$abs":"abs","$negate":"negate","$invert":"invert","$max":"maximum","$min":"minimum","$substring":"substring","$length":"length","$uppercase":"uppercase","$lowercase":"lowercase","$charAt":"char_at","$numElements":"total_of_elements","$matrixLines":"total_of_lines","$matrixColumns":"total_of_columns","$isReal":"is_real","$isInt":"is_integer","$isBool":"is_logic","$castReal":"to_real","$castInt":"to_integer","$castBool":"to_logic","$castString":"to_string","text_ivprog_version":"Version"};
  1852. /***/ }),
  1853. /***/ "./i18n/es/error.json":
  1854. /*!****************************!*\
  1855. !*** ./i18n/es/error.json ***!
  1856. \****************************/
  1857. /*! 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, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, test_case_few_reads, test_case_failed, default */
  1858. /***/ (function(module) {
  1859. 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","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição dos laços de repetição deve ser do tipo lógico","loop_condition_type":"A condição dos laços de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição de um comando se...senao 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_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","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_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $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","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.","test_case_few_reads":"Caso de teste $0: Falhou, ainda restam entradas!","test_case_failed":"Caso de teste $0: Falhou, entradas:<$1>; saída esperada:<$2>; saída:<$3>"};
  1860. /***/ }),
  1861. /***/ "./i18n/es/index.js":
  1862. /*!**************************!*\
  1863. !*** ./i18n/es/index.js ***!
  1864. \**************************/
  1865. /*! no static exports found */
  1866. /***/ (function(module, exports, __webpack_require__) {
  1867. "use strict";
  1868. Object.defineProperty(exports, "__esModule", {
  1869. value: true
  1870. });
  1871. var _error = __webpack_require__(/*! ./error.json */ "./i18n/es/error.json");
  1872. var _error2 = _interopRequireDefault(_error);
  1873. var _message = __webpack_require__(/*! ./message.json */ "./i18n/es/message.json");
  1874. var _message2 = _interopRequireDefault(_message);
  1875. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/es/ui.json");
  1876. var _ui2 = _interopRequireDefault(_ui);
  1877. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1878. exports.default = {
  1879. 'message': _message2.default,
  1880. 'error': _error2.default,
  1881. 'ui': _ui2.default
  1882. };
  1883. /***/ }),
  1884. /***/ "./i18n/es/message.json":
  1885. /*!******************************!*\
  1886. !*** ./i18n/es/message.json ***!
  1887. \******************************/
  1888. /*! exports provided: test_case_success, default */
  1889. /***/ (function(module) {
  1890. module.exports = {"test_case_success":"Caso de teste $0: OK"};
  1891. /***/ }),
  1892. /***/ "./i18n/es/ui.json":
  1893. /*!*************************!*\
  1894. !*** ./i18n/es/ui.json ***!
  1895. \*************************/
  1896. /*! 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, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, text_ivprog_description, 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, expression_menu_select, $sin, math, arrangement, conversion, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, text_t, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1897. /***/ (function(module) {
  1898. 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":"Relational 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","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Mathematics","text_menu_functions_text":"Text","text_menu_functions_arrangement":"Arrangement","text_menu_functions_conversion":"Conversion","text_none_variable":"There is no declared variable","text_none_variable_instruction":"Create a new variable to use it","text_ivprog_description":"Interactive Visual Programming on the Internet","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","expression_menu_select":"Construct any logical condition","$sin":"sin","math":"Mathematic","arrangement":"Arrangement","conversion":"Conversion","inform_valid_name":"Inform a valid name!","inform_valid_content":"Enter some content!","inform_valid_expression":"Construct the logical condition!","inform_valid_name_duplicated":"This name is already in use by other function.","inform_valid_global_duplicated":"A global variable with this name already exists.","inform_valid_variable_duplicated":"A local variable with this name already exists.","text_t":"Text","$cos":"cos","$tan":"tan","$sqrt":"sqrt","$pow":"pow","$log":"log","$abs":"abs","$negate":"negate","$invert":"invert","$max":"maximum","$min":"minimum","$substring":"substring","$length":"length","$uppercase":"uppercase","$lowercase":"lowercase","$charAt":"char_at","$numElements":"total_of_elements","$matrixLines":"total_of_lines","$matrixColumns":"total_of_columns","$isReal":"is_real","$isInt":"is_integer","$isBool":"is_logic","$castReal":"to_real","$castInt":"to_integer","$castBool":"to_logic","$castString":"to_string","text_ivprog_version":"Version"};
  1899. /***/ }),
  1900. /***/ "./i18n/index.js":
  1901. /*!***********************!*\
  1902. !*** ./i18n/index.js ***!
  1903. \***********************/
  1904. /*! no static exports found */
  1905. /***/ (function(module, exports, __webpack_require__) {
  1906. "use strict";
  1907. Object.defineProperty(exports, "__esModule", {
  1908. value: true
  1909. });
  1910. var _en = __webpack_require__(/*! ./en */ "./i18n/en/index.js");
  1911. var _en2 = _interopRequireDefault(_en);
  1912. var _pt = __webpack_require__(/*! ./pt */ "./i18n/pt/index.js");
  1913. var _pt2 = _interopRequireDefault(_pt);
  1914. var _es = __webpack_require__(/*! ./es */ "./i18n/es/index.js");
  1915. var _es2 = _interopRequireDefault(_es);
  1916. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1917. exports.default = {
  1918. 'en': _en2.default,
  1919. 'pt': _pt2.default,
  1920. 'es': _es2.default
  1921. };
  1922. /***/ }),
  1923. /***/ "./i18n/pt/error.json":
  1924. /*!****************************!*\
  1925. !*** ./i18n/pt/error.json ***!
  1926. \****************************/
  1927. /*! 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, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, test_case_few_reads, test_case_failed, default */
  1928. /***/ (function(module) {
  1929. 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","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do laço de repetição deve ser do tipo lógico","loop_condition_type":"A condição $0 do laço de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do comando se...senao deve ser do tipo lógico","if_condition_type":"A condição $0 do comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","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_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $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","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.","test_case_few_reads":"Caso de teste $0: Falhou, ainda restam entradas!","test_case_failed":"Caso de teste $0: Falhou, entradas:<$1>; saída esperada:<$2>; saída:<$3>"};
  1930. /***/ }),
  1931. /***/ "./i18n/pt/index.js":
  1932. /*!**************************!*\
  1933. !*** ./i18n/pt/index.js ***!
  1934. \**************************/
  1935. /*! no static exports found */
  1936. /***/ (function(module, exports, __webpack_require__) {
  1937. "use strict";
  1938. Object.defineProperty(exports, "__esModule", {
  1939. value: true
  1940. });
  1941. var _error = __webpack_require__(/*! ./error.json */ "./i18n/pt/error.json");
  1942. var _error2 = _interopRequireDefault(_error);
  1943. var _message = __webpack_require__(/*! ./message.json */ "./i18n/pt/message.json");
  1944. var _message2 = _interopRequireDefault(_message);
  1945. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/pt/ui.json");
  1946. var _ui2 = _interopRequireDefault(_ui);
  1947. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1948. exports.default = {
  1949. 'message': _message2.default,
  1950. 'error': _error2.default,
  1951. 'ui': _ui2.default
  1952. };
  1953. /***/ }),
  1954. /***/ "./i18n/pt/message.json":
  1955. /*!******************************!*\
  1956. !*** ./i18n/pt/message.json ***!
  1957. \******************************/
  1958. /*! exports provided: test_case_success, default */
  1959. /***/ (function(module) {
  1960. module.exports = {"test_case_success":"Caso de teste $0: OK"};
  1961. /***/ }),
  1962. /***/ "./i18n/pt/ui.json":
  1963. /*!*************************!*\
  1964. !*** ./i18n/pt/ui.json ***!
  1965. \*************************/
  1966. /*! 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, and, or, not, 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, matrix_string, vector_string, 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, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, text_ivprog_description, 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, expression_menu_select, $sin, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1967. /***/ (function(module) {
  1968. 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","and":"E","or":"OU","not":"nao","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","matrix_string":"matriz de $0","vector_string":"vetor de $0","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 Relacional","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","text_header_ivprog_functions":"Funções do iVProg","text_menu_functions_math":"Matemática","text_menu_functions_text":"Texto","text_menu_functions_arrangement":"Arranjo","text_menu_functions_conversion":"Conversão","text_none_variable":"Nenhuma variável declarada","text_none_variable_instruction":"Antes de utilizar uma variável, é necessário criá-la","text_ivprog_description":"Programação Visual interativa na Internet","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","expression_menu_select":"Construir uma expressão lógica","$sin":"seno","math":"Matematica","text_t":"Texto","inform_valid_name":"Informe um nome válido!","inform_valid_content":"Informe o conteúdo!","inform_valid_expression":"Construa uma expressão lógica!","inform_valid_name_duplicated":"Este nome já está em uso por outra função!","inform_valid_global_duplicated":"Já existe uma variável global com o nome informado.","inform_valid_variable_duplicated":"Já existe uma variável local com o nome informado.","arrangement":"Arranjo","conversion":"Conversao","$cos":"cosseno","$tan":"tangente","$sqrt":"raiz_quadrada","$pow":"potencia","$log":"logaritmo","$abs":"modulo","$negate":"trocar_sinal","$invert":"inverter_valor","$max":"maximo","$min":"minimo","$substring":"subcadeia","$length":"comprimento","$uppercase":"caixa_alta","$lowercase":"caixa_baixa","$charAt":"texto_na_posicao","$numElements":"total_de_elementos","$matrixLines":"total_de_linhas","$matrixColumns":"total_de_colunas","$isReal":"e_real","$isInt":"e_inteiro","$isBool":"e_logico","$castReal":"como_real","$castInt":"como_inteiro","$castBool":"como_logico","$castString":"como_cadeia","text_ivprog_version":"Versão"};
  1969. /***/ }),
  1970. /***/ "./js/Sortable.js":
  1971. /*!************************!*\
  1972. !*** ./js/Sortable.js ***!
  1973. \************************/
  1974. /*! no static exports found */
  1975. /***/ (function(module, exports, __webpack_require__) {
  1976. "use strict";
  1977. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  1978. 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; };
  1979. /**!
  1980. * Sortable
  1981. * @author RubaXa <trash@rubaxa.org>
  1982. * @license MIT
  1983. */
  1984. (function sortableModule(factory) {
  1985. "use strict";
  1986. if (true) {
  1987. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  1988. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  1989. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  1990. __WEBPACK_AMD_DEFINE_FACTORY__),
  1991. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1992. } else {}
  1993. })(function sortableFactory() {
  1994. "use strict";
  1995. if (typeof window == "undefined" || !window.document) {
  1996. return function sortableError() {
  1997. throw new Error("Sortable.js requires a window with a document");
  1998. };
  1999. }
  2000. var dragEl,
  2001. parentEl,
  2002. ghostEl,
  2003. cloneEl,
  2004. rootEl,
  2005. nextEl,
  2006. lastDownEl,
  2007. scrollEl,
  2008. scrollParentEl,
  2009. scrollCustomFn,
  2010. lastEl,
  2011. lastCSS,
  2012. lastParentCSS,
  2013. oldIndex,
  2014. newIndex,
  2015. activeGroup,
  2016. putSortable,
  2017. autoScroll = {},
  2018. tapEvt,
  2019. touchEvt,
  2020. moved,
  2021. /** @const */
  2022. R_SPACE = /\s+/g,
  2023. R_FLOAT = /left|right|inline/,
  2024. expando = 'Sortable' + new Date().getTime(),
  2025. win = window,
  2026. document = win.document,
  2027. parseInt = win.parseInt,
  2028. $ = win.jQuery || win.Zepto,
  2029. Polymer = win.Polymer,
  2030. captureMode = false,
  2031. supportDraggable = !!('draggable' in document.createElement('div')),
  2032. supportCssPointerEvents = function (el) {
  2033. // false when IE11
  2034. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  2035. return false;
  2036. }
  2037. el = document.createElement('x');
  2038. el.style.cssText = 'pointer-events:auto';
  2039. return el.style.pointerEvents === 'auto';
  2040. }(),
  2041. _silent = false,
  2042. abs = Math.abs,
  2043. min = Math.min,
  2044. savedInputChecked = [],
  2045. touchDragOverListeners = [],
  2046. _autoScroll = _throttle(function ( /**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
  2047. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  2048. if (rootEl && options.scroll) {
  2049. var _this = rootEl[expando],
  2050. el,
  2051. rect,
  2052. sens = options.scrollSensitivity,
  2053. speed = options.scrollSpeed,
  2054. x = evt.clientX,
  2055. y = evt.clientY,
  2056. winWidth = window.innerWidth,
  2057. winHeight = window.innerHeight,
  2058. vx,
  2059. vy,
  2060. scrollOffsetX,
  2061. scrollOffsetY;
  2062. // Delect scrollEl
  2063. if (scrollParentEl !== rootEl) {
  2064. scrollEl = options.scroll;
  2065. scrollParentEl = rootEl;
  2066. scrollCustomFn = options.scrollFn;
  2067. if (scrollEl === true) {
  2068. scrollEl = rootEl;
  2069. do {
  2070. if (scrollEl.offsetWidth < scrollEl.scrollWidth || scrollEl.offsetHeight < scrollEl.scrollHeight) {
  2071. break;
  2072. }
  2073. /* jshint boss:true */
  2074. } while (scrollEl = scrollEl.parentNode);
  2075. }
  2076. }
  2077. if (scrollEl) {
  2078. el = scrollEl;
  2079. rect = scrollEl.getBoundingClientRect();
  2080. vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
  2081. vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
  2082. }
  2083. if (!(vx || vy)) {
  2084. vx = (winWidth - x <= sens) - (x <= sens);
  2085. vy = (winHeight - y <= sens) - (y <= sens);
  2086. /* jshint expr:true */
  2087. (vx || vy) && (el = win);
  2088. }
  2089. if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
  2090. autoScroll.el = el;
  2091. autoScroll.vx = vx;
  2092. autoScroll.vy = vy;
  2093. clearInterval(autoScroll.pid);
  2094. if (el) {
  2095. autoScroll.pid = setInterval(function () {
  2096. scrollOffsetY = vy ? vy * speed : 0;
  2097. scrollOffsetX = vx ? vx * speed : 0;
  2098. if ('function' === typeof scrollCustomFn) {
  2099. return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
  2100. }
  2101. if (el === win) {
  2102. win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
  2103. } else {
  2104. el.scrollTop += scrollOffsetY;
  2105. el.scrollLeft += scrollOffsetX;
  2106. }
  2107. }, 24);
  2108. }
  2109. }
  2110. }
  2111. }, 30),
  2112. _prepareGroup = function _prepareGroup(options) {
  2113. function toFn(value, pull) {
  2114. if (value === void 0 || value === true) {
  2115. value = group.name;
  2116. }
  2117. if (typeof value === 'function') {
  2118. return value;
  2119. } else {
  2120. return function (to, from) {
  2121. var fromGroup = from.options.group.name;
  2122. return pull ? value : value && (value.join ? value.indexOf(fromGroup) > -1 : fromGroup == value);
  2123. };
  2124. }
  2125. }
  2126. var group = {};
  2127. var originalGroup = options.group;
  2128. if (!originalGroup || (typeof originalGroup === "undefined" ? "undefined" : _typeof(originalGroup)) != 'object') {
  2129. originalGroup = { name: originalGroup };
  2130. }
  2131. group.name = originalGroup.name;
  2132. group.checkPull = toFn(originalGroup.pull, true);
  2133. group.checkPut = toFn(originalGroup.put);
  2134. group.revertClone = originalGroup.revertClone;
  2135. options.group = group;
  2136. };
  2137. /**
  2138. * @class Sortable
  2139. * @param {HTMLElement} el
  2140. * @param {Object} [options]
  2141. */
  2142. function Sortable(el, options) {
  2143. if (!(el && el.nodeType && el.nodeType === 1)) {
  2144. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  2145. }
  2146. this.el = el; // root element
  2147. this.options = options = _extend({}, options);
  2148. // Export instance
  2149. el[expando] = this;
  2150. // Default options
  2151. var defaults = {
  2152. group: Math.random(),
  2153. sort: true,
  2154. disabled: false,
  2155. store: null,
  2156. handle: null,
  2157. scroll: true,
  2158. scrollSensitivity: 30,
  2159. scrollSpeed: 10,
  2160. draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
  2161. ghostClass: 'sortable-ghost',
  2162. chosenClass: 'sortable-chosen',
  2163. dragClass: 'sortable-drag',
  2164. ignore: 'a, img',
  2165. filter: null,
  2166. preventOnFilter: true,
  2167. animation: 0,
  2168. setData: function setData(dataTransfer, dragEl) {
  2169. dataTransfer.setData('Text', dragEl.textContent);
  2170. },
  2171. dropBubble: false,
  2172. dragoverBubble: false,
  2173. dataIdAttr: 'data-id',
  2174. delay: 0,
  2175. forceFallback: false,
  2176. fallbackClass: 'sortable-fallback',
  2177. fallbackOnBody: false,
  2178. fallbackTolerance: 0,
  2179. fallbackOffset: { x: 0, y: 0 }
  2180. };
  2181. // Set default options
  2182. for (var name in defaults) {
  2183. !(name in options) && (options[name] = defaults[name]);
  2184. }
  2185. _prepareGroup(options);
  2186. // Bind all private methods
  2187. for (var fn in this) {
  2188. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  2189. this[fn] = this[fn].bind(this);
  2190. }
  2191. }
  2192. // Setup drag mode
  2193. this.nativeDraggable = options.forceFallback ? false : supportDraggable;
  2194. // Bind events
  2195. _on(el, 'mousedown', this._onTapStart);
  2196. _on(el, 'touchstart', this._onTapStart);
  2197. _on(el, 'pointerdown', this._onTapStart);
  2198. if (this.nativeDraggable) {
  2199. _on(el, 'dragover', this);
  2200. _on(el, 'dragenter', this);
  2201. }
  2202. touchDragOverListeners.push(this._onDragOver);
  2203. // Restore sorting
  2204. options.store && this.sort(options.store.get(this));
  2205. }
  2206. Sortable.prototype = /** @lends Sortable.prototype */{
  2207. constructor: Sortable,
  2208. _onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {
  2209. var _this = this,
  2210. el = this.el,
  2211. options = this.options,
  2212. preventOnFilter = options.preventOnFilter,
  2213. type = evt.type,
  2214. touch = evt.touches && evt.touches[0],
  2215. target = (touch || evt).target,
  2216. originalTarget = evt.target.shadowRoot && evt.path && evt.path[0] || target,
  2217. filter = options.filter,
  2218. startIndex;
  2219. _saveInputCheckedState(el);
  2220. // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  2221. if (dragEl) {
  2222. return;
  2223. }
  2224. if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
  2225. return; // only left button or enabled
  2226. }
  2227. target = _closest(target, options.draggable, el);
  2228. if (!target) {
  2229. return;
  2230. }
  2231. if (lastDownEl === target) {
  2232. // Ignoring duplicate `down`
  2233. return;
  2234. }
  2235. // Get the index of the dragged element within its parent
  2236. startIndex = _index(target, options.draggable);
  2237. // Check filter
  2238. if (typeof filter === 'function') {
  2239. if (filter.call(this, evt, target, this)) {
  2240. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  2241. preventOnFilter && evt.preventDefault();
  2242. return; // cancel dnd
  2243. }
  2244. } else if (filter) {
  2245. filter = filter.split(',').some(function (criteria) {
  2246. criteria = _closest(originalTarget, criteria.trim(), el);
  2247. if (criteria) {
  2248. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  2249. return true;
  2250. }
  2251. });
  2252. if (filter) {
  2253. preventOnFilter && evt.preventDefault();
  2254. return; // cancel dnd
  2255. }
  2256. }
  2257. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  2258. return;
  2259. }
  2260. // Prepare `dragstart`
  2261. this._prepareDragStart(evt, touch, target, startIndex);
  2262. },
  2263. _prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target, /** Number */startIndex) {
  2264. var _this = this,
  2265. el = _this.el,
  2266. options = _this.options,
  2267. ownerDocument = el.ownerDocument,
  2268. dragStartFn;
  2269. if (target && !dragEl && target.parentNode === el) {
  2270. tapEvt = evt;
  2271. rootEl = el;
  2272. dragEl = target;
  2273. parentEl = dragEl.parentNode;
  2274. nextEl = dragEl.nextSibling;
  2275. lastDownEl = target;
  2276. activeGroup = options.group;
  2277. oldIndex = startIndex;
  2278. this._lastX = (touch || evt).clientX;
  2279. this._lastY = (touch || evt).clientY;
  2280. dragEl.style['will-change'] = 'transform';
  2281. dragStartFn = function dragStartFn() {
  2282. // Delayed drag has been triggered
  2283. // we can re-enable the events: touchmove/mousemove
  2284. _this._disableDelayedDrag();
  2285. // Make the element draggable
  2286. dragEl.draggable = _this.nativeDraggable;
  2287. // Chosen item
  2288. _toggleClass(dragEl, options.chosenClass, true);
  2289. // Bind the events: dragstart/dragend
  2290. _this._triggerDragStart(evt, touch);
  2291. // Drag start event
  2292. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  2293. };
  2294. // Disable "draggable"
  2295. options.ignore.split(',').forEach(function (criteria) {
  2296. _find(dragEl, criteria.trim(), _disableDraggable);
  2297. });
  2298. _on(ownerDocument, 'mouseup', _this._onDrop);
  2299. _on(ownerDocument, 'touchend', _this._onDrop);
  2300. _on(ownerDocument, 'touchcancel', _this._onDrop);
  2301. _on(ownerDocument, 'pointercancel', _this._onDrop);
  2302. _on(ownerDocument, 'selectstart', _this);
  2303. if (options.delay) {
  2304. // If the user moves the pointer or let go the click or touch
  2305. // before the delay has been reached:
  2306. // disable the delayed drag
  2307. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  2308. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  2309. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  2310. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  2311. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  2312. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  2313. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  2314. } else {
  2315. dragStartFn();
  2316. }
  2317. }
  2318. },
  2319. _disableDelayedDrag: function _disableDelayedDrag() {
  2320. var ownerDocument = this.el.ownerDocument;
  2321. clearTimeout(this._dragStartTimer);
  2322. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  2323. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  2324. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  2325. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  2326. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  2327. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  2328. },
  2329. _triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {
  2330. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  2331. if (touch) {
  2332. // Touch device support
  2333. tapEvt = {
  2334. target: dragEl,
  2335. clientX: touch.clientX,
  2336. clientY: touch.clientY
  2337. };
  2338. this._onDragStart(tapEvt, 'touch');
  2339. } else if (!this.nativeDraggable) {
  2340. this._onDragStart(tapEvt, true);
  2341. } else {
  2342. _on(dragEl, 'dragend', this);
  2343. _on(rootEl, 'dragstart', this._onDragStart);
  2344. }
  2345. try {
  2346. if (document.selection) {
  2347. // Timeout neccessary for IE9
  2348. setTimeout(function () {
  2349. document.selection.empty();
  2350. });
  2351. } else {
  2352. window.getSelection().removeAllRanges();
  2353. }
  2354. } catch (err) {}
  2355. },
  2356. _dragStarted: function _dragStarted() {
  2357. if (rootEl && dragEl) {
  2358. var options = this.options;
  2359. // Apply effect
  2360. _toggleClass(dragEl, options.ghostClass, true);
  2361. _toggleClass(dragEl, options.dragClass, false);
  2362. Sortable.active = this;
  2363. // Drag start event
  2364. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  2365. } else {
  2366. this._nulling();
  2367. }
  2368. },
  2369. _emulateDragOver: function _emulateDragOver() {
  2370. if (touchEvt) {
  2371. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  2372. return;
  2373. }
  2374. this._lastX = touchEvt.clientX;
  2375. this._lastY = touchEvt.clientY;
  2376. if (!supportCssPointerEvents) {
  2377. _css(ghostEl, 'display', 'none');
  2378. }
  2379. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  2380. parent = target,
  2381. i = touchDragOverListeners.length;
  2382. if (parent) {
  2383. do {
  2384. if (parent[expando]) {
  2385. while (i--) {
  2386. touchDragOverListeners[i]({
  2387. clientX: touchEvt.clientX,
  2388. clientY: touchEvt.clientY,
  2389. target: target,
  2390. rootEl: parent
  2391. });
  2392. }
  2393. break;
  2394. }
  2395. target = parent; // store last element
  2396. }
  2397. /* jshint boss:true */
  2398. while (parent = parent.parentNode);
  2399. }
  2400. if (!supportCssPointerEvents) {
  2401. _css(ghostEl, 'display', '');
  2402. }
  2403. }
  2404. },
  2405. _onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {
  2406. if (tapEvt) {
  2407. var options = this.options,
  2408. fallbackTolerance = options.fallbackTolerance,
  2409. fallbackOffset = options.fallbackOffset,
  2410. touch = evt.touches ? evt.touches[0] : evt,
  2411. dx = touch.clientX - tapEvt.clientX + fallbackOffset.x,
  2412. dy = touch.clientY - tapEvt.clientY + fallbackOffset.y,
  2413. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
  2414. // only set the status to dragging, when we are actually dragging
  2415. if (!Sortable.active) {
  2416. if (fallbackTolerance && min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance) {
  2417. return;
  2418. }
  2419. this._dragStarted();
  2420. }
  2421. // as well as creating the ghost element on the document body
  2422. this._appendGhost();
  2423. moved = true;
  2424. touchEvt = touch;
  2425. _css(ghostEl, 'webkitTransform', translate3d);
  2426. _css(ghostEl, 'mozTransform', translate3d);
  2427. _css(ghostEl, 'msTransform', translate3d);
  2428. _css(ghostEl, 'transform', translate3d);
  2429. evt.preventDefault();
  2430. }
  2431. },
  2432. _appendGhost: function _appendGhost() {
  2433. if (!ghostEl) {
  2434. var rect = dragEl.getBoundingClientRect(),
  2435. css = _css(dragEl),
  2436. options = this.options,
  2437. ghostRect;
  2438. ghostEl = dragEl.cloneNode(true);
  2439. _toggleClass(ghostEl, options.ghostClass, false);
  2440. _toggleClass(ghostEl, options.fallbackClass, true);
  2441. _toggleClass(ghostEl, options.dragClass, true);
  2442. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  2443. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  2444. _css(ghostEl, 'width', rect.width);
  2445. _css(ghostEl, 'height', rect.height);
  2446. _css(ghostEl, 'opacity', '0.8');
  2447. _css(ghostEl, 'position', 'fixed');
  2448. _css(ghostEl, 'zIndex', '100000');
  2449. _css(ghostEl, 'pointerEvents', 'none');
  2450. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
  2451. // Fixing dimensions.
  2452. ghostRect = ghostEl.getBoundingClientRect();
  2453. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  2454. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  2455. }
  2456. },
  2457. _onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/useFallback) {
  2458. var dataTransfer = evt.dataTransfer,
  2459. options = this.options;
  2460. this._offUpEvents();
  2461. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  2462. cloneEl = _clone(dragEl);
  2463. cloneEl.draggable = false;
  2464. cloneEl.style['will-change'] = '';
  2465. _css(cloneEl, 'display', 'none');
  2466. _toggleClass(cloneEl, this.options.chosenClass, false);
  2467. rootEl.insertBefore(cloneEl, dragEl);
  2468. _dispatchEvent(this, rootEl, 'clone', dragEl);
  2469. }
  2470. _toggleClass(dragEl, options.dragClass, true);
  2471. if (useFallback) {
  2472. if (useFallback === 'touch') {
  2473. // Bind touch events
  2474. _on(document, 'touchmove', this._onTouchMove);
  2475. _on(document, 'touchend', this._onDrop);
  2476. _on(document, 'touchcancel', this._onDrop);
  2477. _on(document, 'pointermove', this._onTouchMove);
  2478. _on(document, 'pointerup', this._onDrop);
  2479. } else {
  2480. // Old brwoser
  2481. _on(document, 'mousemove', this._onTouchMove);
  2482. _on(document, 'mouseup', this._onDrop);
  2483. }
  2484. this._loopId = setInterval(this._emulateDragOver, 50);
  2485. } else {
  2486. if (dataTransfer) {
  2487. dataTransfer.effectAllowed = 'move';
  2488. options.setData && options.setData.call(this, dataTransfer, dragEl);
  2489. }
  2490. _on(document, 'drop', this);
  2491. setTimeout(this._dragStarted, 0);
  2492. }
  2493. },
  2494. _onDragOver: function _onDragOver( /**Event*/evt) {
  2495. var el = this.el,
  2496. target,
  2497. dragRect,
  2498. targetRect,
  2499. revert,
  2500. options = this.options,
  2501. group = options.group,
  2502. activeSortable = Sortable.active,
  2503. isOwner = activeGroup === group,
  2504. isMovingBetweenSortable = false,
  2505. canSort = options.sort;
  2506. if (evt.preventDefault !== void 0) {
  2507. evt.preventDefault();
  2508. !options.dragoverBubble && evt.stopPropagation();
  2509. }
  2510. if (dragEl.animated) {
  2511. return;
  2512. }
  2513. moved = true;
  2514. if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  2515. : putSortable === this || (activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt)) && (evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
  2516. ) {
  2517. // Smart auto-scrolling
  2518. _autoScroll(evt, options, this.el);
  2519. if (_silent) {
  2520. return;
  2521. }
  2522. target = _closest(evt.target, options.draggable, el);
  2523. dragRect = dragEl.getBoundingClientRect();
  2524. if (putSortable !== this) {
  2525. putSortable = this;
  2526. isMovingBetweenSortable = true;
  2527. }
  2528. if (revert) {
  2529. _cloneHide(activeSortable, true);
  2530. parentEl = rootEl; // actualization
  2531. if (cloneEl || nextEl) {
  2532. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  2533. } else if (!canSort) {
  2534. rootEl.appendChild(dragEl);
  2535. }
  2536. return;
  2537. }
  2538. if (el.children.length === 0 || el.children[0] === ghostEl || el === evt.target && _ghostIsLast(el, evt)) {
  2539. //assign target only if condition is true
  2540. if (el.children.length !== 0 && el.children[0] !== ghostEl && el === evt.target) {
  2541. target = el.lastElementChild;
  2542. }
  2543. if (target) {
  2544. if (target.animated) {
  2545. return;
  2546. }
  2547. targetRect = target.getBoundingClientRect();
  2548. }
  2549. _cloneHide(activeSortable, isOwner);
  2550. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  2551. if (!dragEl.contains(el)) {
  2552. el.appendChild(dragEl);
  2553. parentEl = el; // actualization
  2554. }
  2555. this._animate(dragRect, dragEl);
  2556. target && this._animate(targetRect, target);
  2557. }
  2558. } else if (target && !target.animated && target !== dragEl && target.parentNode[expando] !== void 0) {
  2559. if (lastEl !== target) {
  2560. lastEl = target;
  2561. lastCSS = _css(target);
  2562. lastParentCSS = _css(target.parentNode);
  2563. }
  2564. targetRect = target.getBoundingClientRect();
  2565. var width = targetRect.right - targetRect.left,
  2566. height = targetRect.bottom - targetRect.top,
  2567. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display) || lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0,
  2568. isWide = target.offsetWidth > dragEl.offsetWidth,
  2569. isLong = target.offsetHeight > dragEl.offsetHeight,
  2570. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  2571. nextSibling = target.nextElementSibling,
  2572. after = false;
  2573. if (floating) {
  2574. var elTop = dragEl.offsetTop,
  2575. tgTop = target.offsetTop;
  2576. if (elTop === tgTop) {
  2577. after = target.previousElementSibling === dragEl && !isWide || halfway && isWide;
  2578. } else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  2579. after = (evt.clientY - targetRect.top) / height > 0.5;
  2580. } else {
  2581. after = tgTop > elTop;
  2582. }
  2583. } else if (!isMovingBetweenSortable) {
  2584. after = nextSibling !== dragEl && !isLong || halfway && isLong;
  2585. }
  2586. var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
  2587. if (moveVector !== false) {
  2588. if (moveVector === 1 || moveVector === -1) {
  2589. after = moveVector === 1;
  2590. }
  2591. _silent = true;
  2592. setTimeout(_unsilent, 30);
  2593. _cloneHide(activeSortable, isOwner);
  2594. if (!dragEl.contains(el)) {
  2595. if (after && !nextSibling) {
  2596. el.appendChild(dragEl);
  2597. } else {
  2598. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  2599. }
  2600. }
  2601. parentEl = dragEl.parentNode; // actualization
  2602. this._animate(dragRect, dragEl);
  2603. this._animate(targetRect, target);
  2604. }
  2605. }
  2606. }
  2607. },
  2608. _animate: function _animate(prevRect, target) {
  2609. var ms = this.options.animation;
  2610. if (ms) {
  2611. var currentRect = target.getBoundingClientRect();
  2612. if (prevRect.nodeType === 1) {
  2613. prevRect = prevRect.getBoundingClientRect();
  2614. }
  2615. _css(target, 'transition', 'none');
  2616. _css(target, 'transform', 'translate3d(' + (prevRect.left - currentRect.left) + 'px,' + (prevRect.top - currentRect.top) + 'px,0)');
  2617. target.offsetWidth; // repaint
  2618. _css(target, 'transition', 'all ' + ms + 'ms');
  2619. _css(target, 'transform', 'translate3d(0,0,0)');
  2620. clearTimeout(target.animated);
  2621. target.animated = setTimeout(function () {
  2622. _css(target, 'transition', '');
  2623. _css(target, 'transform', '');
  2624. target.animated = false;
  2625. }, ms);
  2626. }
  2627. },
  2628. _offUpEvents: function _offUpEvents() {
  2629. var ownerDocument = this.el.ownerDocument;
  2630. _off(document, 'touchmove', this._onTouchMove);
  2631. _off(document, 'pointermove', this._onTouchMove);
  2632. _off(ownerDocument, 'mouseup', this._onDrop);
  2633. _off(ownerDocument, 'touchend', this._onDrop);
  2634. _off(ownerDocument, 'pointerup', this._onDrop);
  2635. _off(ownerDocument, 'touchcancel', this._onDrop);
  2636. _off(ownerDocument, 'pointercancel', this._onDrop);
  2637. _off(ownerDocument, 'selectstart', this);
  2638. },
  2639. _onDrop: function _onDrop( /**Event*/evt) {
  2640. var el = this.el,
  2641. options = this.options;
  2642. clearInterval(this._loopId);
  2643. clearInterval(autoScroll.pid);
  2644. clearTimeout(this._dragStartTimer);
  2645. // Unbind events
  2646. _off(document, 'mousemove', this._onTouchMove);
  2647. if (this.nativeDraggable) {
  2648. _off(document, 'drop', this);
  2649. _off(el, 'dragstart', this._onDragStart);
  2650. }
  2651. this._offUpEvents();
  2652. if (evt) {
  2653. if (moved) {
  2654. evt.preventDefault();
  2655. !options.dropBubble && evt.stopPropagation();
  2656. }
  2657. ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
  2658. if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
  2659. // Remove clone
  2660. cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
  2661. }
  2662. if (dragEl) {
  2663. if (this.nativeDraggable) {
  2664. _off(dragEl, 'dragend', this);
  2665. }
  2666. _disableDraggable(dragEl);
  2667. dragEl.style['will-change'] = '';
  2668. // Remove class's
  2669. _toggleClass(dragEl, this.options.ghostClass, false);
  2670. _toggleClass(dragEl, this.options.chosenClass, false);
  2671. // Drag stop event
  2672. _dispatchEvent(this, rootEl, 'unchoose', dragEl, rootEl, oldIndex);
  2673. if (rootEl !== parentEl) {
  2674. newIndex = _index(dragEl, options.draggable);
  2675. if (newIndex >= 0) {
  2676. // Add event
  2677. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
  2678. // Remove event
  2679. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
  2680. // drag from one list and drop into another
  2681. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2682. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2683. }
  2684. } else {
  2685. if (dragEl.nextSibling !== nextEl) {
  2686. // Get the index of the dragged element within its parent
  2687. newIndex = _index(dragEl, options.draggable);
  2688. if (newIndex >= 0) {
  2689. // drag & drop within the same list
  2690. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  2691. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2692. }
  2693. }
  2694. }
  2695. if (Sortable.active) {
  2696. /* jshint eqnull:true */
  2697. if (newIndex == null || newIndex === -1) {
  2698. newIndex = oldIndex;
  2699. }
  2700. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
  2701. // Save sorting
  2702. this.save();
  2703. }
  2704. }
  2705. }
  2706. this._nulling();
  2707. },
  2708. _nulling: function _nulling() {
  2709. rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = scrollEl = scrollParentEl = tapEvt = touchEvt = moved = newIndex = lastEl = lastCSS = putSortable = activeGroup = Sortable.active = null;
  2710. savedInputChecked.forEach(function (el) {
  2711. el.checked = true;
  2712. });
  2713. savedInputChecked.length = 0;
  2714. },
  2715. handleEvent: function handleEvent( /**Event*/evt) {
  2716. switch (evt.type) {
  2717. case 'drop':
  2718. case 'dragend':
  2719. this._onDrop(evt);
  2720. break;
  2721. case 'dragover':
  2722. case 'dragenter':
  2723. if (dragEl) {
  2724. this._onDragOver(evt);
  2725. _globalDragOver(evt);
  2726. }
  2727. break;
  2728. case 'selectstart':
  2729. evt.preventDefault();
  2730. break;
  2731. }
  2732. },
  2733. /**
  2734. * Serializes the item into an array of string.
  2735. * @returns {String[]}
  2736. */
  2737. toArray: function toArray() {
  2738. var order = [],
  2739. el,
  2740. children = this.el.children,
  2741. i = 0,
  2742. n = children.length,
  2743. options = this.options;
  2744. for (; i < n; i++) {
  2745. el = children[i];
  2746. if (_closest(el, options.draggable, this.el)) {
  2747. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  2748. }
  2749. }
  2750. return order;
  2751. },
  2752. /**
  2753. * Sorts the elements according to the array.
  2754. * @param {String[]} order order of the items
  2755. */
  2756. sort: function sort(order) {
  2757. var items = {},
  2758. rootEl = this.el;
  2759. this.toArray().forEach(function (id, i) {
  2760. var el = rootEl.children[i];
  2761. if (_closest(el, this.options.draggable, rootEl)) {
  2762. items[id] = el;
  2763. }
  2764. }, this);
  2765. order.forEach(function (id) {
  2766. if (items[id]) {
  2767. rootEl.removeChild(items[id]);
  2768. rootEl.appendChild(items[id]);
  2769. }
  2770. });
  2771. },
  2772. /**
  2773. * Save the current sorting
  2774. */
  2775. save: function save() {
  2776. var store = this.options.store;
  2777. store && store.set(this);
  2778. },
  2779. /**
  2780. * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
  2781. * @param {HTMLElement} el
  2782. * @param {String} [selector] default: `options.draggable`
  2783. * @returns {HTMLElement|null}
  2784. */
  2785. closest: function closest(el, selector) {
  2786. return _closest(el, selector || this.options.draggable, this.el);
  2787. },
  2788. /**
  2789. * Set/get option
  2790. * @param {string} name
  2791. * @param {*} [value]
  2792. * @returns {*}
  2793. */
  2794. option: function option(name, value) {
  2795. var options = this.options;
  2796. if (value === void 0) {
  2797. return options[name];
  2798. } else {
  2799. options[name] = value;
  2800. if (name === 'group') {
  2801. _prepareGroup(options);
  2802. }
  2803. }
  2804. },
  2805. /**
  2806. * Destroy
  2807. */
  2808. destroy: function destroy() {
  2809. var el = this.el;
  2810. el[expando] = null;
  2811. _off(el, 'mousedown', this._onTapStart);
  2812. _off(el, 'touchstart', this._onTapStart);
  2813. _off(el, 'pointerdown', this._onTapStart);
  2814. if (this.nativeDraggable) {
  2815. _off(el, 'dragover', this);
  2816. _off(el, 'dragenter', this);
  2817. }
  2818. // Remove draggable attributes
  2819. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  2820. el.removeAttribute('draggable');
  2821. });
  2822. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  2823. this._onDrop();
  2824. this.el = el = null;
  2825. }
  2826. };
  2827. function _cloneHide(sortable, state) {
  2828. if (sortable.lastPullMode !== 'clone') {
  2829. state = true;
  2830. }
  2831. if (cloneEl && cloneEl.state !== state) {
  2832. _css(cloneEl, 'display', state ? 'none' : '');
  2833. if (!state) {
  2834. if (cloneEl.state) {
  2835. if (sortable.options.group.revertClone) {
  2836. rootEl.insertBefore(cloneEl, nextEl);
  2837. sortable._animate(dragEl, cloneEl);
  2838. } else {
  2839. rootEl.insertBefore(cloneEl, dragEl);
  2840. }
  2841. }
  2842. }
  2843. cloneEl.state = state;
  2844. }
  2845. }
  2846. function _closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
  2847. if (el) {
  2848. ctx = ctx || document;
  2849. do {
  2850. if (selector === '>*' && el.parentNode === ctx || _matches(el, selector)) {
  2851. return el;
  2852. }
  2853. /* jshint boss:true */
  2854. } while (el = _getParentOrHost(el));
  2855. }
  2856. return null;
  2857. }
  2858. function _getParentOrHost(el) {
  2859. var parent = el.host;
  2860. return parent && parent.nodeType ? parent : el.parentNode;
  2861. }
  2862. function _globalDragOver( /**Event*/evt) {
  2863. if (evt.dataTransfer) {
  2864. evt.dataTransfer.dropEffect = 'move';
  2865. }
  2866. evt.preventDefault();
  2867. }
  2868. function _on(el, event, fn) {
  2869. el.addEventListener(event, fn, captureMode);
  2870. }
  2871. function _off(el, event, fn) {
  2872. el.removeEventListener(event, fn, captureMode);
  2873. }
  2874. function _toggleClass(el, name, state) {
  2875. if (el) {
  2876. if (el.classList) {
  2877. el.classList[state ? 'add' : 'remove'](name);
  2878. } else {
  2879. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  2880. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  2881. }
  2882. }
  2883. }
  2884. function _css(el, prop, val) {
  2885. var style = el && el.style;
  2886. if (style) {
  2887. if (val === void 0) {
  2888. if (document.defaultView && document.defaultView.getComputedStyle) {
  2889. val = document.defaultView.getComputedStyle(el, '');
  2890. } else if (el.currentStyle) {
  2891. val = el.currentStyle;
  2892. }
  2893. return prop === void 0 ? val : val[prop];
  2894. } else {
  2895. if (!(prop in style)) {
  2896. prop = '-webkit-' + prop;
  2897. }
  2898. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  2899. }
  2900. }
  2901. }
  2902. function _find(ctx, tagName, iterator) {
  2903. if (ctx) {
  2904. var list = ctx.getElementsByTagName(tagName),
  2905. i = 0,
  2906. n = list.length;
  2907. if (iterator) {
  2908. for (; i < n; i++) {
  2909. iterator(list[i], i);
  2910. }
  2911. }
  2912. return list;
  2913. }
  2914. return [];
  2915. }
  2916. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  2917. sortable = sortable || rootEl[expando];
  2918. var evt = document.createEvent('Event'),
  2919. options = sortable.options,
  2920. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  2921. evt.initEvent(name, true, true);
  2922. evt.to = rootEl;
  2923. evt.from = fromEl || rootEl;
  2924. evt.item = targetEl || rootEl;
  2925. evt.clone = cloneEl;
  2926. evt.oldIndex = startIndex;
  2927. evt.newIndex = newIndex;
  2928. rootEl.dispatchEvent(evt);
  2929. if (options[onName]) {
  2930. options[onName].call(sortable, evt);
  2931. }
  2932. }
  2933. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt, willInsertAfter) {
  2934. var evt,
  2935. sortable = fromEl[expando],
  2936. onMoveFn = sortable.options.onMove,
  2937. retVal;
  2938. evt = document.createEvent('Event');
  2939. evt.initEvent('move', true, true);
  2940. evt.to = toEl;
  2941. evt.from = fromEl;
  2942. evt.dragged = dragEl;
  2943. evt.draggedRect = dragRect;
  2944. evt.related = targetEl || toEl;
  2945. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  2946. evt.willInsertAfter = willInsertAfter;
  2947. fromEl.dispatchEvent(evt);
  2948. if (onMoveFn) {
  2949. retVal = onMoveFn.call(sortable, evt, originalEvt);
  2950. }
  2951. return retVal;
  2952. }
  2953. function _disableDraggable(el) {
  2954. el.draggable = false;
  2955. }
  2956. function _unsilent() {
  2957. _silent = false;
  2958. }
  2959. /** @returns {HTMLElement|false} */
  2960. function _ghostIsLast(el, evt) {
  2961. var lastEl = el.lastElementChild,
  2962. rect = lastEl.getBoundingClientRect();
  2963. // 5 — min delta
  2964. // abs — нельзя добавлять, а то глюки при наведении сверху
  2965. return evt.clientY - (rect.top + rect.height) > 5 || evt.clientX - (rect.left + rect.width) > 5;
  2966. }
  2967. /**
  2968. * Generate id
  2969. * @param {HTMLElement} el
  2970. * @returns {String}
  2971. * @private
  2972. */
  2973. function _generateId(el) {
  2974. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  2975. i = str.length,
  2976. sum = 0;
  2977. while (i--) {
  2978. sum += str.charCodeAt(i);
  2979. }
  2980. return sum.toString(36);
  2981. }
  2982. /**
  2983. * Returns the index of an element within its parent for a selected set of
  2984. * elements
  2985. * @param {HTMLElement} el
  2986. * @param {selector} selector
  2987. * @return {number}
  2988. */
  2989. function _index(el, selector) {
  2990. var index = 0;
  2991. if (!el || !el.parentNode) {
  2992. return -1;
  2993. }
  2994. while (el && (el = el.previousElementSibling)) {
  2995. if (el.nodeName.toUpperCase() !== 'TEMPLATE' && (selector === '>*' || _matches(el, selector))) {
  2996. index++;
  2997. }
  2998. }
  2999. return index;
  3000. }
  3001. function _matches( /**HTMLElement*/el, /**String*/selector) {
  3002. if (el) {
  3003. selector = selector.split('.');
  3004. var tag = selector.shift().toUpperCase(),
  3005. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  3006. return (tag === '' || el.nodeName.toUpperCase() == tag) && (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length);
  3007. }
  3008. return false;
  3009. }
  3010. function _throttle(callback, ms) {
  3011. var args, _this;
  3012. return function () {
  3013. if (args === void 0) {
  3014. args = arguments;
  3015. _this = this;
  3016. setTimeout(function () {
  3017. if (args.length === 1) {
  3018. callback.call(_this, args[0]);
  3019. } else {
  3020. callback.apply(_this, args);
  3021. }
  3022. args = void 0;
  3023. }, ms);
  3024. }
  3025. };
  3026. }
  3027. function _extend(dst, src) {
  3028. if (dst && src) {
  3029. for (var key in src) {
  3030. if (src.hasOwnProperty(key)) {
  3031. dst[key] = src[key];
  3032. }
  3033. }
  3034. }
  3035. return dst;
  3036. }
  3037. function _clone(el) {
  3038. return $ ? $(el).clone(true)[0] : Polymer && Polymer.dom ? Polymer.dom(el).cloneNode(true) : el.cloneNode(true);
  3039. }
  3040. function _saveInputCheckedState(root) {
  3041. var inputs = root.getElementsByTagName('input');
  3042. var idx = inputs.length;
  3043. while (idx--) {
  3044. var el = inputs[idx];
  3045. el.checked && savedInputChecked.push(el);
  3046. }
  3047. }
  3048. // Fixed #973:
  3049. _on(document, 'touchmove', function (evt) {
  3050. if (Sortable.active) {
  3051. evt.preventDefault();
  3052. }
  3053. });
  3054. try {
  3055. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  3056. get: function get() {
  3057. captureMode = {
  3058. capture: false,
  3059. passive: false
  3060. };
  3061. }
  3062. }));
  3063. } catch (err) {}
  3064. // Export utils
  3065. Sortable.utils = {
  3066. on: _on,
  3067. off: _off,
  3068. css: _css,
  3069. find: _find,
  3070. is: function is(el, selector) {
  3071. return !!_closest(el, selector, el);
  3072. },
  3073. extend: _extend,
  3074. throttle: _throttle,
  3075. closest: _closest,
  3076. toggleClass: _toggleClass,
  3077. clone: _clone,
  3078. index: _index
  3079. };
  3080. /**
  3081. * Create sortable instance
  3082. * @param {HTMLElement} el
  3083. * @param {Object} [options]
  3084. */
  3085. Sortable.create = function (el, options) {
  3086. return new Sortable(el, options);
  3087. };
  3088. // Export
  3089. Sortable.version = '1.6.1';
  3090. return Sortable;
  3091. });
  3092. /***/ }),
  3093. /***/ "./js/assessment/ivprogAssessment.js":
  3094. /*!*******************************************!*\
  3095. !*** ./js/assessment/ivprogAssessment.js ***!
  3096. \*******************************************/
  3097. /*! no static exports found */
  3098. /***/ (function(module, exports, __webpack_require__) {
  3099. "use strict";
  3100. Object.defineProperty(exports, "__esModule", {
  3101. value: true
  3102. });
  3103. exports.IVProgAssessment = undefined;
  3104. 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; }; }();
  3105. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  3106. var _semanticAnalyser = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  3107. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  3108. var _inputTest = __webpack_require__(/*! ./../util/inputTest */ "./js/util/inputTest.js");
  3109. var _outputTest = __webpack_require__(/*! ./../util/outputTest */ "./js/util/outputTest.js");
  3110. var _localizedStringsService = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3111. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3112. var IVProgAssessment = exports.IVProgAssessment = function () {
  3113. function IVProgAssessment(textCode, testCases, domConsole) {
  3114. _classCallCheck(this, IVProgAssessment);
  3115. this.textCode = textCode;
  3116. this.testCases = testCases;
  3117. this.domConsole = domConsole;
  3118. }
  3119. _createClass(IVProgAssessment, [{
  3120. key: "runTest",
  3121. value: function runTest() {
  3122. var _this = this;
  3123. try {
  3124. // try and show error messages through domconsole
  3125. var parser = _ivprogParser.IVProgParser.createParser(this.textCode);
  3126. var semantic = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  3127. var validTree = semantic.analyseTree();
  3128. // loop test cases and show messages through domconsole
  3129. var partialTests = this.testCases.map(function (t, name) {
  3130. return _this.partialEvaluateTestCase(new _ivprogProcessor.IVProgProcessor(validTree), t.input, t.output, name);
  3131. });
  3132. var testResult = partialTests.reduce(function (acc, curr) {
  3133. return acc.then(curr);
  3134. }, Promise.resolve(0));
  3135. return testResult.then(function (total) {
  3136. return Promise.resolve(total / _this.testCases.length);
  3137. }).catch(function (err) {
  3138. _this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3139. _this.domConsole.err(err.message);
  3140. return Promise.resolve(0);
  3141. });
  3142. } catch (error) {
  3143. this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3144. this.domConsole.err(error.message);
  3145. return Promise.resolve(0);
  3146. }
  3147. }
  3148. }, {
  3149. key: "evaluateTestCase",
  3150. value: function evaluateTestCase(prog, inputList, outputList, name, accumulator) {
  3151. var _this2 = this;
  3152. var outerThis = this;
  3153. var input = new _inputTest.InputTest(inputList);
  3154. var output = new _outputTest.OutputTest();
  3155. prog.registerInput(input);
  3156. prog.registerOutput(output);
  3157. var startTime = Date.now();
  3158. return prog.interpretAST().then(function (_) {
  3159. var millis = Date.now() - startTime;
  3160. if (input.inputList.length !== input.index) {
  3161. outerThis.showErrorMessage('test_case_few_reads', name + 1);
  3162. outerThis.domConsole.info("Levou " + millis + "ms");
  3163. return Promise.resolve(accumulator + 1 * (input.index / inputList.length));
  3164. } else if (output.list.length < outputList.length) {
  3165. outerThis.showErrorMessage('test_case_failed', name + 1, inputList.join(','), outputList.join(','), output.list.join(','));
  3166. outerThis.domConsole.info("Levou " + millis + "ms");
  3167. return Promise.resolve(accumulator + 1 * (output.list.length / outputList.length));
  3168. } else if (output.list.length > outputList.length) {
  3169. outerThis.showErrorMessage('test_case_failed', name + 1, inputList.join(','), outputList.join(','), output.list.join(','));
  3170. outerThis.domConsole.info("Levou " + millis + "ms");
  3171. return Promise.resolve(accumulator + 1 * (outputList.length / output.list.length));
  3172. } else {
  3173. var isOk = outerThis.checkOutput(output.list, outputList);
  3174. if (!isOk) {
  3175. outerThis.showErrorMessage('test_case_failed', name + 1, inputList.join(','), outputList.join(','), output.list.join(','));
  3176. outerThis.domConsole.info("Levou " + millis + "ms");
  3177. return Promise.resolve(accumulator);
  3178. } else {
  3179. outerThis.showMessage('test_case_success', name + 1);
  3180. outerThis.domConsole.info("Levou " + millis + "ms");
  3181. return Promise.resolve(accumulator + 1);
  3182. }
  3183. }
  3184. }).catch(function (error) {
  3185. _this2.domConsole.err("Execu\xE7\xE3o do caso de teste " + (name + 1) + " falhou!"); // try and show error messages through domconsole
  3186. _this2.domConsole.err(error.message);
  3187. return Promise.resolve(accumulator);
  3188. });
  3189. }
  3190. }, {
  3191. key: "partialEvaluateTestCase",
  3192. value: function partialEvaluateTestCase(prog, inputList, outputList, name) {
  3193. return this.evaluateTestCase.bind(this, prog, inputList, outputList, name);
  3194. }
  3195. }, {
  3196. key: "checkOutput",
  3197. value: function checkOutput(aList, bList) {
  3198. for (var i = 0; i < aList.length; i++) {
  3199. var outValue = aList[i];
  3200. if (outValue != bList[i]) {
  3201. return false;
  3202. }
  3203. }
  3204. return true;
  3205. }
  3206. }, {
  3207. key: "showErrorMessage",
  3208. value: function showErrorMessage(errorID) {
  3209. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  3210. args[_key - 1] = arguments[_key];
  3211. }
  3212. this.domConsole.err(_localizedStringsService.LocalizedStrings.getError(errorID, args));
  3213. }
  3214. }, {
  3215. key: "showMessage",
  3216. value: function showMessage(msgID) {
  3217. for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  3218. args[_key2 - 1] = arguments[_key2];
  3219. }
  3220. this.domConsole.info(_localizedStringsService.LocalizedStrings.getMessage(msgID, args));
  3221. }
  3222. }]);
  3223. return IVProgAssessment;
  3224. }();
  3225. /***/ }),
  3226. /***/ "./js/ast/commands/arrayAssign.js":
  3227. /*!****************************************!*\
  3228. !*** ./js/ast/commands/arrayAssign.js ***!
  3229. \****************************************/
  3230. /*! no static exports found */
  3231. /***/ (function(module, exports, __webpack_require__) {
  3232. "use strict";
  3233. Object.defineProperty(exports, "__esModule", {
  3234. value: true
  3235. });
  3236. exports.ArrayIndexAssign = undefined;
  3237. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3238. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3239. 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; }
  3240. 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; }
  3241. var ArrayIndexAssign = exports.ArrayIndexAssign = function (_Assign) {
  3242. _inherits(ArrayIndexAssign, _Assign);
  3243. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  3244. _classCallCheck(this, ArrayIndexAssign);
  3245. var _this = _possibleConstructorReturn(this, (ArrayIndexAssign.__proto__ || Object.getPrototypeOf(ArrayIndexAssign)).call(this, id, expression));
  3246. _this.line = lineExpression;
  3247. _this.column = columnExpression;
  3248. return _this;
  3249. }
  3250. return ArrayIndexAssign;
  3251. }(_assign.Assign);
  3252. /***/ }),
  3253. /***/ "./js/ast/commands/arrayDeclaration.js":
  3254. /*!*********************************************!*\
  3255. !*** ./js/ast/commands/arrayDeclaration.js ***!
  3256. \*********************************************/
  3257. /*! no static exports found */
  3258. /***/ (function(module, exports, __webpack_require__) {
  3259. "use strict";
  3260. Object.defineProperty(exports, "__esModule", {
  3261. value: true
  3262. });
  3263. exports.ArrayDeclaration = undefined;
  3264. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3265. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3266. 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; }
  3267. 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; }
  3268. var ArrayDeclaration = exports.ArrayDeclaration = function (_Declaration) {
  3269. _inherits(ArrayDeclaration, _Declaration);
  3270. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  3271. _classCallCheck(this, ArrayDeclaration);
  3272. var _this = _possibleConstructorReturn(this, (ArrayDeclaration.__proto__ || Object.getPrototypeOf(ArrayDeclaration)).call(this, id, type, initial, isConst));
  3273. _this.lines = lines;
  3274. _this.columns = columns;
  3275. return _this;
  3276. }
  3277. return ArrayDeclaration;
  3278. }(_declaration.Declaration);
  3279. /***/ }),
  3280. /***/ "./js/ast/commands/assign.js":
  3281. /*!***********************************!*\
  3282. !*** ./js/ast/commands/assign.js ***!
  3283. \***********************************/
  3284. /*! no static exports found */
  3285. /***/ (function(module, exports, __webpack_require__) {
  3286. "use strict";
  3287. Object.defineProperty(exports, "__esModule", {
  3288. value: true
  3289. });
  3290. exports.Assign = undefined;
  3291. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3292. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3293. 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; }
  3294. 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; }
  3295. var Assign = exports.Assign = function (_Command) {
  3296. _inherits(Assign, _Command);
  3297. function Assign(id, expression) {
  3298. _classCallCheck(this, Assign);
  3299. var _this = _possibleConstructorReturn(this, (Assign.__proto__ || Object.getPrototypeOf(Assign)).call(this));
  3300. _this.id = id;
  3301. _this.expression = expression;
  3302. return _this;
  3303. }
  3304. return Assign;
  3305. }(_command.Command);
  3306. /***/ }),
  3307. /***/ "./js/ast/commands/break.js":
  3308. /*!**********************************!*\
  3309. !*** ./js/ast/commands/break.js ***!
  3310. \**********************************/
  3311. /*! no static exports found */
  3312. /***/ (function(module, exports, __webpack_require__) {
  3313. "use strict";
  3314. Object.defineProperty(exports, "__esModule", {
  3315. value: true
  3316. });
  3317. exports.Break = undefined;
  3318. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3319. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3320. 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; }
  3321. 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; }
  3322. var Break = exports.Break = function (_Command) {
  3323. _inherits(Break, _Command);
  3324. function Break() {
  3325. _classCallCheck(this, Break);
  3326. return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).call(this));
  3327. }
  3328. return Break;
  3329. }(_command.Command);
  3330. /***/ }),
  3331. /***/ "./js/ast/commands/case.js":
  3332. /*!*********************************!*\
  3333. !*** ./js/ast/commands/case.js ***!
  3334. \*********************************/
  3335. /*! no static exports found */
  3336. /***/ (function(module, exports, __webpack_require__) {
  3337. "use strict";
  3338. Object.defineProperty(exports, "__esModule", {
  3339. value: true
  3340. });
  3341. exports.Case = undefined;
  3342. 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; }; }();
  3343. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3344. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3345. 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; }
  3346. 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; }
  3347. var Case = exports.Case = function (_Command) {
  3348. _inherits(Case, _Command);
  3349. function Case(expression) {
  3350. _classCallCheck(this, Case);
  3351. var _this = _possibleConstructorReturn(this, (Case.__proto__ || Object.getPrototypeOf(Case)).call(this));
  3352. _this.expression = expression;
  3353. _this.commands = [];
  3354. return _this;
  3355. }
  3356. _createClass(Case, [{
  3357. key: 'setCommands',
  3358. value: function setCommands(commands) {
  3359. this.commands = commands;
  3360. }
  3361. }, {
  3362. key: 'isDefault',
  3363. get: function get() {
  3364. return this.expression === null;
  3365. }
  3366. }]);
  3367. return Case;
  3368. }(_command.Command);
  3369. /***/ }),
  3370. /***/ "./js/ast/commands/command.js":
  3371. /*!************************************!*\
  3372. !*** ./js/ast/commands/command.js ***!
  3373. \************************************/
  3374. /*! no static exports found */
  3375. /***/ (function(module, exports, __webpack_require__) {
  3376. "use strict";
  3377. Object.defineProperty(exports, "__esModule", {
  3378. value: true
  3379. });
  3380. 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; }; }();
  3381. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3382. var Command = exports.Command = function () {
  3383. function Command() {
  3384. _classCallCheck(this, Command);
  3385. this._sourceInfo = null;
  3386. }
  3387. _createClass(Command, [{
  3388. key: "sourceInfo",
  3389. set: function set(sourceInfo) {
  3390. this._sourceInfo = sourceInfo;
  3391. },
  3392. get: function get() {
  3393. return this._sourceInfo;
  3394. }
  3395. }]);
  3396. return Command;
  3397. }();
  3398. /***/ }),
  3399. /***/ "./js/ast/commands/commandBlock.js":
  3400. /*!*****************************************!*\
  3401. !*** ./js/ast/commands/commandBlock.js ***!
  3402. \*****************************************/
  3403. /*! no static exports found */
  3404. /***/ (function(module, exports, __webpack_require__) {
  3405. "use strict";
  3406. Object.defineProperty(exports, "__esModule", {
  3407. value: true
  3408. });
  3409. 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; }; }();
  3410. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3411. var CommandBlock = exports.CommandBlock = function () {
  3412. function CommandBlock(variables, commands) {
  3413. _classCallCheck(this, CommandBlock);
  3414. this.variables = variables;
  3415. this.commands = commands;
  3416. this._sourceInfo = null;
  3417. }
  3418. _createClass(CommandBlock, [{
  3419. key: "sourceInfo",
  3420. set: function set(sourceInfo) {
  3421. this._sourceInfo = sourceInfo;
  3422. },
  3423. get: function get() {
  3424. return this._sourceInfo;
  3425. }
  3426. }]);
  3427. return CommandBlock;
  3428. }();
  3429. /***/ }),
  3430. /***/ "./js/ast/commands/declaration.js":
  3431. /*!****************************************!*\
  3432. !*** ./js/ast/commands/declaration.js ***!
  3433. \****************************************/
  3434. /*! no static exports found */
  3435. /***/ (function(module, exports, __webpack_require__) {
  3436. "use strict";
  3437. Object.defineProperty(exports, "__esModule", {
  3438. value: true
  3439. });
  3440. exports.Declaration = undefined;
  3441. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3442. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3443. 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; }
  3444. 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; }
  3445. var Declaration = exports.Declaration = function (_Command) {
  3446. _inherits(Declaration, _Command);
  3447. function Declaration(id, type, initial, isConst) {
  3448. _classCallCheck(this, Declaration);
  3449. var _this = _possibleConstructorReturn(this, (Declaration.__proto__ || Object.getPrototypeOf(Declaration)).call(this));
  3450. _this.id = id;
  3451. _this.type = type;
  3452. _this.initial = initial;
  3453. _this.isConst = isConst;
  3454. return _this;
  3455. }
  3456. return Declaration;
  3457. }(_command.Command);
  3458. /***/ }),
  3459. /***/ "./js/ast/commands/doWhile.js":
  3460. /*!************************************!*\
  3461. !*** ./js/ast/commands/doWhile.js ***!
  3462. \************************************/
  3463. /*! no static exports found */
  3464. /***/ (function(module, exports, __webpack_require__) {
  3465. "use strict";
  3466. Object.defineProperty(exports, "__esModule", {
  3467. value: true
  3468. });
  3469. exports.DoWhile = undefined;
  3470. 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; }; }();
  3471. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3472. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3473. 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; }
  3474. 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; }
  3475. var DoWhile = exports.DoWhile = function (_While) {
  3476. _inherits(DoWhile, _While);
  3477. function DoWhile(condition, commandBlock) {
  3478. _classCallCheck(this, DoWhile);
  3479. return _possibleConstructorReturn(this, (DoWhile.__proto__ || Object.getPrototypeOf(DoWhile)).call(this, condition, commandBlock));
  3480. }
  3481. _createClass(DoWhile, [{
  3482. key: 'testFirst',
  3483. get: function get() {
  3484. return false;
  3485. }
  3486. }]);
  3487. return DoWhile;
  3488. }(_while.While);
  3489. /***/ }),
  3490. /***/ "./js/ast/commands/for.js":
  3491. /*!********************************!*\
  3492. !*** ./js/ast/commands/for.js ***!
  3493. \********************************/
  3494. /*! no static exports found */
  3495. /***/ (function(module, exports, __webpack_require__) {
  3496. "use strict";
  3497. Object.defineProperty(exports, "__esModule", {
  3498. value: true
  3499. });
  3500. exports.For = undefined;
  3501. 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; }; }();
  3502. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3503. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3504. 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; }
  3505. 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; }
  3506. var For = exports.For = function (_Command) {
  3507. _inherits(For, _Command);
  3508. function For(assignment, condition, increment, commandBlock) {
  3509. _classCallCheck(this, For);
  3510. var _this = _possibleConstructorReturn(this, (For.__proto__ || Object.getPrototypeOf(For)).call(this));
  3511. _this.assignment = assignment;
  3512. _this.condition = condition;
  3513. _this.increment = increment;
  3514. _this.commandBlock = commandBlock;
  3515. return _this;
  3516. }
  3517. _createClass(For, [{
  3518. key: 'commands',
  3519. get: function get() {
  3520. return this.commandBlock.commands;
  3521. }
  3522. }]);
  3523. return For;
  3524. }(_command.Command);
  3525. /***/ }),
  3526. /***/ "./js/ast/commands/formalParameter.js":
  3527. /*!********************************************!*\
  3528. !*** ./js/ast/commands/formalParameter.js ***!
  3529. \********************************************/
  3530. /*! no static exports found */
  3531. /***/ (function(module, exports, __webpack_require__) {
  3532. "use strict";
  3533. Object.defineProperty(exports, "__esModule", {
  3534. value: true
  3535. });
  3536. 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; }; }();
  3537. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3538. var FormalParameter = exports.FormalParameter = function () {
  3539. function FormalParameter(type, id) {
  3540. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3541. _classCallCheck(this, FormalParameter);
  3542. this.type = type;
  3543. this.id = id;
  3544. this.byRef = byRef;
  3545. this._sourceInfo = null;
  3546. }
  3547. _createClass(FormalParameter, [{
  3548. key: "sourceInfo",
  3549. set: function set(sourceInfo) {
  3550. this._sourceInfo = sourceInfo;
  3551. },
  3552. get: function get() {
  3553. return this._sourceInfo;
  3554. }
  3555. }]);
  3556. return FormalParameter;
  3557. }();
  3558. /***/ }),
  3559. /***/ "./js/ast/commands/function.js":
  3560. /*!*************************************!*\
  3561. !*** ./js/ast/commands/function.js ***!
  3562. \*************************************/
  3563. /*! no static exports found */
  3564. /***/ (function(module, exports, __webpack_require__) {
  3565. "use strict";
  3566. Object.defineProperty(exports, "__esModule", {
  3567. value: true
  3568. });
  3569. exports.Function = undefined;
  3570. 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; }; }();
  3571. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3572. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3573. var Function = exports.Function = function () {
  3574. function Function(name, returnType, formalParameters, commandBlock) {
  3575. _classCallCheck(this, Function);
  3576. this.name = name;
  3577. this.returnType = returnType;
  3578. this.formalParameters = formalParameters;
  3579. this.commandBlock = commandBlock;
  3580. this._sourceInfo = null;
  3581. }
  3582. _createClass(Function, [{
  3583. key: 'isMain',
  3584. get: function get() {
  3585. return this.name === null && this.returnType.isCompatible(_types.Types.VOID);
  3586. }
  3587. }, {
  3588. key: 'commands',
  3589. get: function get() {
  3590. return this.commandBlock.commands;
  3591. }
  3592. }, {
  3593. key: 'variablesDeclarations',
  3594. get: function get() {
  3595. return this.commandBlock.variables;
  3596. }
  3597. }, {
  3598. key: 'sourceInfo',
  3599. set: function set(sourceInfo) {
  3600. this._sourceInfo = sourceInfo;
  3601. },
  3602. get: function get() {
  3603. return this._sourceInfo;
  3604. }
  3605. }]);
  3606. return Function;
  3607. }();
  3608. /***/ }),
  3609. /***/ "./js/ast/commands/ifThenElse.js":
  3610. /*!***************************************!*\
  3611. !*** ./js/ast/commands/ifThenElse.js ***!
  3612. \***************************************/
  3613. /*! no static exports found */
  3614. /***/ (function(module, exports, __webpack_require__) {
  3615. "use strict";
  3616. Object.defineProperty(exports, "__esModule", {
  3617. value: true
  3618. });
  3619. exports.IfThenElse = undefined;
  3620. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3621. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3622. 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; }
  3623. 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; }
  3624. var IfThenElse = exports.IfThenElse = function (_Command) {
  3625. _inherits(IfThenElse, _Command);
  3626. function IfThenElse(condition, ifTrue, ifFalse) {
  3627. _classCallCheck(this, IfThenElse);
  3628. var _this = _possibleConstructorReturn(this, (IfThenElse.__proto__ || Object.getPrototypeOf(IfThenElse)).call(this));
  3629. _this.condition = condition;
  3630. _this.ifTrue = ifTrue;
  3631. _this.ifFalse = ifFalse;
  3632. return _this;
  3633. }
  3634. return IfThenElse;
  3635. }(_command.Command);
  3636. /***/ }),
  3637. /***/ "./js/ast/commands/index.js":
  3638. /*!**********************************!*\
  3639. !*** ./js/ast/commands/index.js ***!
  3640. \**********************************/
  3641. /*! no static exports found */
  3642. /***/ (function(module, exports, __webpack_require__) {
  3643. "use strict";
  3644. Object.defineProperty(exports, "__esModule", {
  3645. value: true
  3646. });
  3647. 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;
  3648. var _break = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  3649. var _return = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  3650. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3651. var _arrayAssign = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  3652. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3653. var _arrayDeclaration = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  3654. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3655. var _for = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  3656. var _function = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  3657. var _ifThenElse = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  3658. var _commandBlock = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  3659. var _doWhile = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js");
  3660. var _switch = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  3661. var _case = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  3662. var _sysCall = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  3663. var _formalParameter = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  3664. var _functionCall = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  3665. //Proxy to expression since they do exatcly the same thing
  3666. exports.Break = _break.Break;
  3667. exports.Return = _return.Return;
  3668. exports.Assign = _assign.Assign;
  3669. exports.ArrayIndexAssign = _arrayAssign.ArrayIndexAssign;
  3670. exports.Declaration = _declaration.Declaration;
  3671. exports.ArrayDeclaration = _arrayDeclaration.ArrayDeclaration;
  3672. exports.While = _while.While;
  3673. exports.For = _for.For;
  3674. exports.Function = _function.Function;
  3675. exports.IfThenElse = _ifThenElse.IfThenElse;
  3676. exports.CommandBlock = _commandBlock.CommandBlock;
  3677. exports.DoWhile = _doWhile.DoWhile;
  3678. exports.Switch = _switch.Switch;
  3679. exports.Case = _case.Case;
  3680. exports.SysCall = _sysCall.SysCall;
  3681. exports.FormalParameter = _formalParameter.FormalParameter;
  3682. exports.FunctionCall = _functionCall.FunctionCall;
  3683. /***/ }),
  3684. /***/ "./js/ast/commands/return.js":
  3685. /*!***********************************!*\
  3686. !*** ./js/ast/commands/return.js ***!
  3687. \***********************************/
  3688. /*! no static exports found */
  3689. /***/ (function(module, exports, __webpack_require__) {
  3690. "use strict";
  3691. Object.defineProperty(exports, "__esModule", {
  3692. value: true
  3693. });
  3694. exports.Return = undefined;
  3695. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3696. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3697. 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; }
  3698. 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; }
  3699. var Return = exports.Return = function (_Command) {
  3700. _inherits(Return, _Command);
  3701. function Return(expression) {
  3702. _classCallCheck(this, Return);
  3703. var _this = _possibleConstructorReturn(this, (Return.__proto__ || Object.getPrototypeOf(Return)).call(this));
  3704. _this.expression = expression;
  3705. return _this;
  3706. }
  3707. return Return;
  3708. }(_command.Command);
  3709. /***/ }),
  3710. /***/ "./js/ast/commands/switch.js":
  3711. /*!***********************************!*\
  3712. !*** ./js/ast/commands/switch.js ***!
  3713. \***********************************/
  3714. /*! no static exports found */
  3715. /***/ (function(module, exports, __webpack_require__) {
  3716. "use strict";
  3717. Object.defineProperty(exports, "__esModule", {
  3718. value: true
  3719. });
  3720. exports.Switch = undefined;
  3721. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3722. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3723. 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; }
  3724. 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; }
  3725. var Switch = exports.Switch = function (_Command) {
  3726. _inherits(Switch, _Command);
  3727. function Switch(expression, cases) {
  3728. _classCallCheck(this, Switch);
  3729. var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this));
  3730. _this.expression = expression;
  3731. _this.cases = cases;
  3732. return _this;
  3733. }
  3734. return Switch;
  3735. }(_command.Command);
  3736. /***/ }),
  3737. /***/ "./js/ast/commands/sysCall.js":
  3738. /*!************************************!*\
  3739. !*** ./js/ast/commands/sysCall.js ***!
  3740. \************************************/
  3741. /*! no static exports found */
  3742. /***/ (function(module, exports, __webpack_require__) {
  3743. "use strict";
  3744. Object.defineProperty(exports, "__esModule", {
  3745. value: true
  3746. });
  3747. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3748. /**
  3749. * This class represents all the language defined functions.
  3750. * The language processor uses the id provided here to properly execute the desired function.
  3751. * The function is actually implemented inside the language processor.
  3752. * All the functions can be found at: js/processor/definedFunctions.js
  3753. */
  3754. var SysCall = exports.SysCall = function SysCall(langFunc) {
  3755. _classCallCheck(this, SysCall);
  3756. this.langFunc = langFunc;
  3757. };
  3758. /***/ }),
  3759. /***/ "./js/ast/commands/while.js":
  3760. /*!**********************************!*\
  3761. !*** ./js/ast/commands/while.js ***!
  3762. \**********************************/
  3763. /*! no static exports found */
  3764. /***/ (function(module, exports, __webpack_require__) {
  3765. "use strict";
  3766. Object.defineProperty(exports, "__esModule", {
  3767. value: true
  3768. });
  3769. exports.While = undefined;
  3770. 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; }; }();
  3771. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3772. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3773. 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; }
  3774. 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; }
  3775. var While = exports.While = function (_Command) {
  3776. _inherits(While, _Command);
  3777. function While(expression, commandBlock) {
  3778. _classCallCheck(this, While);
  3779. var _this = _possibleConstructorReturn(this, (While.__proto__ || Object.getPrototypeOf(While)).call(this));
  3780. _this.expression = expression;
  3781. _this.commandBlock = commandBlock;
  3782. return _this;
  3783. }
  3784. _createClass(While, [{
  3785. key: 'commands',
  3786. get: function get() {
  3787. return this.commandBlock.commands;
  3788. }
  3789. }, {
  3790. key: 'testFirst',
  3791. get: function get() {
  3792. return true;
  3793. }
  3794. }]);
  3795. return While;
  3796. }(_command.Command);
  3797. /***/ }),
  3798. /***/ "./js/ast/error/syntaxError.js":
  3799. /*!*************************************!*\
  3800. !*** ./js/ast/error/syntaxError.js ***!
  3801. \*************************************/
  3802. /*! no static exports found */
  3803. /***/ (function(module, exports, __webpack_require__) {
  3804. "use strict";
  3805. Object.defineProperty(exports, "__esModule", {
  3806. value: true
  3807. });
  3808. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3809. 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; }
  3810. 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; }
  3811. var SyntaxError = exports.SyntaxError = function (_Error) {
  3812. _inherits(SyntaxError, _Error);
  3813. function SyntaxError() {
  3814. var _ref;
  3815. _classCallCheck(this, SyntaxError);
  3816. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  3817. msg[_key] = arguments[_key];
  3818. }
  3819. var _this = _possibleConstructorReturn(this, (_ref = SyntaxError.__proto__ || Object.getPrototypeOf(SyntaxError)).call.apply(_ref, [this].concat(msg)));
  3820. if (Error.captureStackTrace) Error.captureStackTrace(_this, SyntaxError);
  3821. return _this;
  3822. }
  3823. return SyntaxError;
  3824. }(Error);
  3825. /***/ }),
  3826. /***/ "./js/ast/error/syntaxErrorFactory.js":
  3827. /*!********************************************!*\
  3828. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  3829. \********************************************/
  3830. /*! no static exports found */
  3831. /***/ (function(module, exports, __webpack_require__) {
  3832. "use strict";
  3833. Object.defineProperty(exports, "__esModule", {
  3834. value: true
  3835. });
  3836. exports.SyntaxErrorFactory = undefined;
  3837. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3838. var _syntaxError = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  3839. var SyntaxErrorFactory = exports.SyntaxErrorFactory = Object.freeze({
  3840. extra_lines: function extra_lines() {
  3841. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("extra_lines"));
  3842. },
  3843. token_missing_one: function token_missing_one(expected, token) {
  3844. var context = [expected, token.text, token.line, token.column];
  3845. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("token_missing_one", context));
  3846. },
  3847. token_missing_list: function token_missing_list(expectedList, token) {
  3848. var line = expectedList.join(_localizedStringsService.LocalizedStrings.getOR());
  3849. return SyntaxErrorFactory.token_missing_one(line, token);
  3850. },
  3851. id_missing: function id_missing(token) {
  3852. var context = [token.text, token.line, token.column];
  3853. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("id_missing", context));
  3854. },
  3855. eos_missing: function eos_missing(token) {
  3856. var context = [token.line, token.column];
  3857. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("eos_missing", context));
  3858. },
  3859. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  3860. var context = [token.line, token.column, typeName];
  3861. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_dimension", context));
  3862. },
  3863. invalid_array_size: function invalid_array_size(token) {
  3864. var context = [token.line];
  3865. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_size", context));
  3866. },
  3867. invalid_main_return: function invalid_main_return(name, typeName, token) {
  3868. var context = [name, typeName, token.line];
  3869. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_main_return", context));
  3870. },
  3871. invalid_var_declaration: function invalid_var_declaration(token) {
  3872. var context = [token.line];
  3873. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_var_declaration", context));
  3874. },
  3875. invalid_break_command: function invalid_break_command(cmdName, token) {
  3876. var context = [token.line, cmdName];
  3877. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_break_command", context));
  3878. },
  3879. invalid_terminal: function invalid_terminal(token) {
  3880. var context = [token.text, token.line, token.column];
  3881. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError('invalid_terminal', context));
  3882. },
  3883. invalid_type: function invalid_type(list, token) {
  3884. var line = list.join(_localizedStringsService.LocalizedStrings.getOR());
  3885. var context = [token.text, token.line, token.column, line];
  3886. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_type", context));
  3887. },
  3888. const_not_init: function const_not_init(token) {
  3889. var context = [token.line, token.column];
  3890. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("const_not_init", context));
  3891. },
  3892. invalid_id_format: function invalid_id_format(token) {
  3893. var context = [token.text, token.line, token.column];
  3894. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_id_format", context));
  3895. },
  3896. duplicate_function: function duplicate_function(token) {
  3897. var context = [token.text, token.line, token.column];
  3898. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_function", context));
  3899. },
  3900. main_parameters: function main_parameters() {
  3901. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("main_parameters"));
  3902. },
  3903. duplicate_variable: function duplicate_variable(token) {
  3904. var context = [token.text, token.line, token.column];
  3905. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_variable", context));
  3906. }
  3907. });
  3908. /***/ }),
  3909. /***/ "./js/ast/expressions/arrayAccess.js":
  3910. /*!*******************************************!*\
  3911. !*** ./js/ast/expressions/arrayAccess.js ***!
  3912. \*******************************************/
  3913. /*! no static exports found */
  3914. /***/ (function(module, exports, __webpack_require__) {
  3915. "use strict";
  3916. Object.defineProperty(exports, "__esModule", {
  3917. value: true
  3918. });
  3919. exports.ArrayAccess = undefined;
  3920. 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; }; }();
  3921. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  3922. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3923. 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; }
  3924. 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; }
  3925. var ArrayAccess = exports.ArrayAccess = function (_Expression) {
  3926. _inherits(ArrayAccess, _Expression);
  3927. function ArrayAccess(id, line, column) {
  3928. _classCallCheck(this, ArrayAccess);
  3929. var _this = _possibleConstructorReturn(this, (ArrayAccess.__proto__ || Object.getPrototypeOf(ArrayAccess)).call(this));
  3930. _this.id = id;
  3931. _this.line = line;
  3932. _this.column = column;
  3933. return _this;
  3934. }
  3935. _createClass(ArrayAccess, [{
  3936. key: 'toString',
  3937. value: function toString() {
  3938. var strLine = this.line.toString();
  3939. var strColumn = null;
  3940. if (this.column) {
  3941. strColumn = this.column.toString();
  3942. }
  3943. if (strColumn) {
  3944. return this.id + '[' + strLine + '][' + strColumn + ']';
  3945. } else {
  3946. return this.id + '[' + strLine + ']';
  3947. }
  3948. }
  3949. }]);
  3950. return ArrayAccess;
  3951. }(_expression.Expression);
  3952. /***/ }),
  3953. /***/ "./js/ast/expressions/arrayLiteral.js":
  3954. /*!********************************************!*\
  3955. !*** ./js/ast/expressions/arrayLiteral.js ***!
  3956. \********************************************/
  3957. /*! no static exports found */
  3958. /***/ (function(module, exports, __webpack_require__) {
  3959. "use strict";
  3960. Object.defineProperty(exports, "__esModule", {
  3961. value: true
  3962. });
  3963. exports.ArrayLiteral = undefined;
  3964. 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; }; }();
  3965. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3966. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3967. 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; }
  3968. 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; }
  3969. var ArrayLiteral = exports.ArrayLiteral = function (_Literal) {
  3970. _inherits(ArrayLiteral, _Literal);
  3971. function ArrayLiteral(type, value) {
  3972. _classCallCheck(this, ArrayLiteral);
  3973. var _this = _possibleConstructorReturn(this, (ArrayLiteral.__proto__ || Object.getPrototypeOf(ArrayLiteral)).call(this, type));
  3974. _this.value = value;
  3975. return _this;
  3976. }
  3977. _createClass(ArrayLiteral, [{
  3978. key: 'validateType',
  3979. value: function validateType() {
  3980. // let valid = true;
  3981. // if(this.columns !== null) {
  3982. // const len = this.columns;
  3983. // const len2 = this.lines;
  3984. // for (let i = len - 1; i >= 0; i--) {
  3985. // for (let j = len2 - 1; j >= 0; j--) {
  3986. // if(this.value[i].value[j].type !== this.subtype) {
  3987. // valid = false;
  3988. // break;
  3989. // }
  3990. // }
  3991. // }
  3992. // } else {
  3993. // const len = this.lines;
  3994. // for (var i = len - 1; i >= 0; i--) {
  3995. // if(this.value[i].type !== this.subtype) {
  3996. // valid = false;
  3997. // break;
  3998. // }
  3999. // }
  4000. // }
  4001. return true; //valid;
  4002. }
  4003. }, {
  4004. key: 'validateSize',
  4005. value: function validateSize() {
  4006. var valid = true;
  4007. if (this.columns !== null) {
  4008. var equalityTest = data.value.map(function (v) {
  4009. return v.length;
  4010. }).reduce(function (old, next) {
  4011. if (old === null) {
  4012. return next;
  4013. } else if (old === next) {
  4014. return old;
  4015. } else {
  4016. return -1;
  4017. }
  4018. }, null);
  4019. valid = equalityTest !== -1;
  4020. }
  4021. return valid;
  4022. }
  4023. }, {
  4024. key: 'toString',
  4025. value: function toString() {
  4026. var strList = this.value.map(function (arrayLiteral) {
  4027. return arrayLiteral.toString();
  4028. });
  4029. return "{" + strList.join(',') + "}";
  4030. }
  4031. }, {
  4032. key: 'subtype',
  4033. get: function get() {
  4034. var element = this.value[0];
  4035. if (element instanceof ArrayLiteral) {
  4036. return element.value[0].type;
  4037. } else {
  4038. return element.type;
  4039. }
  4040. }
  4041. }, {
  4042. key: 'lines',
  4043. get: function get() {
  4044. return this.value.length;
  4045. }
  4046. }, {
  4047. key: 'columns',
  4048. get: function get() {
  4049. var element = this.value[0];
  4050. if (!(element instanceof ArrayLiteral)) {
  4051. return null;
  4052. } else {
  4053. return element.value[0].length;
  4054. }
  4055. }
  4056. }, {
  4057. key: 'isVector',
  4058. get: function get() {
  4059. return this.columns === null;
  4060. }
  4061. }, {
  4062. key: 'isValid',
  4063. get: function get() {
  4064. return true; //this.validateType() && this.validateSize();
  4065. }
  4066. }]);
  4067. return ArrayLiteral;
  4068. }(_literal.Literal);
  4069. /***/ }),
  4070. /***/ "./js/ast/expressions/boolLiteral.js":
  4071. /*!*******************************************!*\
  4072. !*** ./js/ast/expressions/boolLiteral.js ***!
  4073. \*******************************************/
  4074. /*! no static exports found */
  4075. /***/ (function(module, exports, __webpack_require__) {
  4076. "use strict";
  4077. Object.defineProperty(exports, "__esModule", {
  4078. value: true
  4079. });
  4080. exports.BoolLiteral = undefined;
  4081. 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; }; }();
  4082. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4083. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4084. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4085. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4086. 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; }
  4087. 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; }
  4088. var BoolLiteral = exports.BoolLiteral = function (_Literal) {
  4089. _inherits(BoolLiteral, _Literal);
  4090. function BoolLiteral(value) {
  4091. _classCallCheck(this, BoolLiteral);
  4092. var _this = _possibleConstructorReturn(this, (BoolLiteral.__proto__ || Object.getPrototypeOf(BoolLiteral)).call(this, _types.Types.BOOLEAN));
  4093. _this.value = value;
  4094. return _this;
  4095. }
  4096. _createClass(BoolLiteral, [{
  4097. key: 'toString',
  4098. value: function toString() {
  4099. return (0, _parsers.convertBoolToString)(this.value);
  4100. }
  4101. }]);
  4102. return BoolLiteral;
  4103. }(_literal.Literal);
  4104. /***/ }),
  4105. /***/ "./js/ast/expressions/expression.js":
  4106. /*!******************************************!*\
  4107. !*** ./js/ast/expressions/expression.js ***!
  4108. \******************************************/
  4109. /*! no static exports found */
  4110. /***/ (function(module, exports, __webpack_require__) {
  4111. "use strict";
  4112. Object.defineProperty(exports, "__esModule", {
  4113. value: true
  4114. });
  4115. 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; }; }();
  4116. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4117. var Expression = exports.Expression = function () {
  4118. function Expression() {
  4119. _classCallCheck(this, Expression);
  4120. this._sourceInfo = null;
  4121. }
  4122. _createClass(Expression, [{
  4123. key: "sourceInfo",
  4124. set: function set(sourceInfo) {
  4125. this._sourceInfo = sourceInfo;
  4126. },
  4127. get: function get() {
  4128. return this._sourceInfo;
  4129. }
  4130. }]);
  4131. return Expression;
  4132. }();
  4133. /***/ }),
  4134. /***/ "./js/ast/expressions/functionCall.js":
  4135. /*!********************************************!*\
  4136. !*** ./js/ast/expressions/functionCall.js ***!
  4137. \********************************************/
  4138. /*! no static exports found */
  4139. /***/ (function(module, exports, __webpack_require__) {
  4140. "use strict";
  4141. Object.defineProperty(exports, "__esModule", {
  4142. value: true
  4143. });
  4144. exports.FunctionCall = undefined;
  4145. 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; }; }();
  4146. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4147. var _definedFunctions = __webpack_require__(/*! ../../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4148. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4149. 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; }
  4150. 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; }
  4151. var FunctionCall = exports.FunctionCall = function (_Expression) {
  4152. _inherits(FunctionCall, _Expression);
  4153. function FunctionCall(id, actualParameters) {
  4154. _classCallCheck(this, FunctionCall);
  4155. var _this = _possibleConstructorReturn(this, (FunctionCall.__proto__ || Object.getPrototypeOf(FunctionCall)).call(this));
  4156. _this.id = id;
  4157. _this.actualParameters = actualParameters;
  4158. return _this;
  4159. }
  4160. _createClass(FunctionCall, [{
  4161. key: 'toString',
  4162. value: function toString() {
  4163. var name = null;
  4164. if (this.isMainCall) {
  4165. name = _definedFunctions.LanguageDefinedFunction.getMainFunctionName();
  4166. } else {
  4167. name = _definedFunctions.LanguageDefinedFunction.getLocalName(this.id);
  4168. }
  4169. var params = null;
  4170. if (this.actualParameters.length == 0) {
  4171. params = "()";
  4172. } else {
  4173. var strParams = this.actualParameters.map(function (v) {
  4174. return v.toString();
  4175. });
  4176. params = "(" + strParams.join(",") + ")";
  4177. }
  4178. return name + params;
  4179. }
  4180. }, {
  4181. key: 'isMainCall',
  4182. get: function get() {
  4183. return this.id === null;
  4184. }
  4185. }, {
  4186. key: 'parametersSize',
  4187. get: function get() {
  4188. return this.actualParameters.length;
  4189. }
  4190. }]);
  4191. return FunctionCall;
  4192. }(_expression.Expression);
  4193. /***/ }),
  4194. /***/ "./js/ast/expressions/index.js":
  4195. /*!*************************************!*\
  4196. !*** ./js/ast/expressions/index.js ***!
  4197. \*************************************/
  4198. /*! no static exports found */
  4199. /***/ (function(module, exports, __webpack_require__) {
  4200. "use strict";
  4201. Object.defineProperty(exports, "__esModule", {
  4202. value: true
  4203. });
  4204. exports.UnaryApp = exports.InfixApp = exports.VariableLiteral = exports.ArrayLiteral = exports.StringLiteral = exports.BoolLiteral = exports.RealLiteral = exports.IntLiteral = exports.FunctionCall = exports.ArrayAccess = undefined;
  4205. var _arrayAccess = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  4206. var _functionCall = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  4207. var _intLiteral = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  4208. var _realLiteral = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  4209. var _boolLiteral = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  4210. var _stringLiteral = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  4211. var _arrayLiteral = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  4212. var _variableLiteral = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  4213. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4214. var _unaryApp = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  4215. exports.ArrayAccess = _arrayAccess.ArrayAccess;
  4216. exports.FunctionCall = _functionCall.FunctionCall;
  4217. exports.IntLiteral = _intLiteral.IntLiteral;
  4218. exports.RealLiteral = _realLiteral.RealLiteral;
  4219. exports.BoolLiteral = _boolLiteral.BoolLiteral;
  4220. exports.StringLiteral = _stringLiteral.StringLiteral;
  4221. exports.ArrayLiteral = _arrayLiteral.ArrayLiteral;
  4222. exports.VariableLiteral = _variableLiteral.VariableLiteral;
  4223. exports.InfixApp = _infixApp.InfixApp;
  4224. exports.UnaryApp = _unaryApp.UnaryApp;
  4225. /***/ }),
  4226. /***/ "./js/ast/expressions/infixApp.js":
  4227. /*!****************************************!*\
  4228. !*** ./js/ast/expressions/infixApp.js ***!
  4229. \****************************************/
  4230. /*! no static exports found */
  4231. /***/ (function(module, exports, __webpack_require__) {
  4232. "use strict";
  4233. Object.defineProperty(exports, "__esModule", {
  4234. value: true
  4235. });
  4236. exports.InfixApp = undefined;
  4237. 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; }; }();
  4238. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4239. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4240. 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; }
  4241. 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; }
  4242. var InfixApp = exports.InfixApp = function (_Expression) {
  4243. _inherits(InfixApp, _Expression);
  4244. function InfixApp(op, left, right) {
  4245. _classCallCheck(this, InfixApp);
  4246. var _this = _possibleConstructorReturn(this, (InfixApp.__proto__ || Object.getPrototypeOf(InfixApp)).call(this));
  4247. _this.op = op;
  4248. _this.left = left;
  4249. _this.right = right;
  4250. return _this;
  4251. }
  4252. _createClass(InfixApp, [{
  4253. key: 'toString',
  4254. value: function toString() {
  4255. var l = this.left.toString();
  4256. var op = this.op.value;
  4257. var r = this.right.toString();
  4258. return l + op + r;
  4259. }
  4260. }]);
  4261. return InfixApp;
  4262. }(_expression.Expression);
  4263. /***/ }),
  4264. /***/ "./js/ast/expressions/intLiteral.js":
  4265. /*!******************************************!*\
  4266. !*** ./js/ast/expressions/intLiteral.js ***!
  4267. \******************************************/
  4268. /*! no static exports found */
  4269. /***/ (function(module, exports, __webpack_require__) {
  4270. "use strict";
  4271. Object.defineProperty(exports, "__esModule", {
  4272. value: true
  4273. });
  4274. exports.IntLiteral = undefined;
  4275. 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; }; }();
  4276. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4277. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4278. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4279. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4280. 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; }
  4281. 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; }
  4282. var IntLiteral = exports.IntLiteral = function (_Literal) {
  4283. _inherits(IntLiteral, _Literal);
  4284. function IntLiteral(value) {
  4285. _classCallCheck(this, IntLiteral);
  4286. var _this = _possibleConstructorReturn(this, (IntLiteral.__proto__ || Object.getPrototypeOf(IntLiteral)).call(this, _types.Types.INTEGER));
  4287. _this.value = value;
  4288. return _this;
  4289. }
  4290. _createClass(IntLiteral, [{
  4291. key: 'toString',
  4292. value: function toString() {
  4293. return (0, _parsers.convertToString)(this.value, this.type);
  4294. }
  4295. }]);
  4296. return IntLiteral;
  4297. }(_literal.Literal);
  4298. /***/ }),
  4299. /***/ "./js/ast/expressions/literal.js":
  4300. /*!***************************************!*\
  4301. !*** ./js/ast/expressions/literal.js ***!
  4302. \***************************************/
  4303. /*! no static exports found */
  4304. /***/ (function(module, exports, __webpack_require__) {
  4305. "use strict";
  4306. Object.defineProperty(exports, "__esModule", {
  4307. value: true
  4308. });
  4309. exports.Literal = undefined;
  4310. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4311. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4312. 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; }
  4313. 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; }
  4314. var Literal = exports.Literal = function (_Expression) {
  4315. _inherits(Literal, _Expression);
  4316. function Literal(type) {
  4317. _classCallCheck(this, Literal);
  4318. var _this = _possibleConstructorReturn(this, (Literal.__proto__ || Object.getPrototypeOf(Literal)).call(this));
  4319. _this.type = type;
  4320. return _this;
  4321. }
  4322. return Literal;
  4323. }(_expression.Expression);
  4324. /***/ }),
  4325. /***/ "./js/ast/expressions/realLiteral.js":
  4326. /*!*******************************************!*\
  4327. !*** ./js/ast/expressions/realLiteral.js ***!
  4328. \*******************************************/
  4329. /*! no static exports found */
  4330. /***/ (function(module, exports, __webpack_require__) {
  4331. "use strict";
  4332. Object.defineProperty(exports, "__esModule", {
  4333. value: true
  4334. });
  4335. exports.RealLiteral = undefined;
  4336. 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; }; }();
  4337. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4338. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4339. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4340. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4341. 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; }
  4342. 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; }
  4343. var RealLiteral = exports.RealLiteral = function (_Literal) {
  4344. _inherits(RealLiteral, _Literal);
  4345. function RealLiteral(value) {
  4346. _classCallCheck(this, RealLiteral);
  4347. var _this = _possibleConstructorReturn(this, (RealLiteral.__proto__ || Object.getPrototypeOf(RealLiteral)).call(this, _types.Types.REAL));
  4348. _this.value = value;
  4349. return _this;
  4350. }
  4351. _createClass(RealLiteral, [{
  4352. key: 'toString',
  4353. value: function toString() {
  4354. return (0, _parsers.convertToString)(this.value, this.type);
  4355. }
  4356. }]);
  4357. return RealLiteral;
  4358. }(_literal.Literal);
  4359. /***/ }),
  4360. /***/ "./js/ast/expressions/stringLiteral.js":
  4361. /*!*********************************************!*\
  4362. !*** ./js/ast/expressions/stringLiteral.js ***!
  4363. \*********************************************/
  4364. /*! no static exports found */
  4365. /***/ (function(module, exports, __webpack_require__) {
  4366. "use strict";
  4367. Object.defineProperty(exports, "__esModule", {
  4368. value: true
  4369. });
  4370. exports.StringLiteral = undefined;
  4371. 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; }; }();
  4372. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4373. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4374. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4375. 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; }
  4376. 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; }
  4377. var StringLiteral = exports.StringLiteral = function (_Literal) {
  4378. _inherits(StringLiteral, _Literal);
  4379. function StringLiteral(value) {
  4380. _classCallCheck(this, StringLiteral);
  4381. var _this = _possibleConstructorReturn(this, (StringLiteral.__proto__ || Object.getPrototypeOf(StringLiteral)).call(this, _types.Types.STRING));
  4382. _this.value = value;
  4383. return _this;
  4384. }
  4385. _createClass(StringLiteral, [{
  4386. key: 'toString',
  4387. value: function toString() {
  4388. return '"' + this.value + '"';
  4389. }
  4390. }]);
  4391. return StringLiteral;
  4392. }(_literal.Literal);
  4393. /***/ }),
  4394. /***/ "./js/ast/expressions/unaryApp.js":
  4395. /*!****************************************!*\
  4396. !*** ./js/ast/expressions/unaryApp.js ***!
  4397. \****************************************/
  4398. /*! no static exports found */
  4399. /***/ (function(module, exports, __webpack_require__) {
  4400. "use strict";
  4401. Object.defineProperty(exports, "__esModule", {
  4402. value: true
  4403. });
  4404. exports.UnaryApp = undefined;
  4405. 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; }; }();
  4406. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4407. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4408. 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; }
  4409. 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; }
  4410. var UnaryApp = exports.UnaryApp = function (_InfixApp) {
  4411. _inherits(UnaryApp, _InfixApp);
  4412. function UnaryApp(op, left) {
  4413. _classCallCheck(this, UnaryApp);
  4414. return _possibleConstructorReturn(this, (UnaryApp.__proto__ || Object.getPrototypeOf(UnaryApp)).call(this, op, left, null));
  4415. }
  4416. _createClass(UnaryApp, [{
  4417. key: 'toString',
  4418. value: function toString() {
  4419. var l = this.left.toString();
  4420. var op = this.op.value;
  4421. return op + l;
  4422. }
  4423. }]);
  4424. return UnaryApp;
  4425. }(_infixApp.InfixApp);
  4426. /***/ }),
  4427. /***/ "./js/ast/expressions/variableLiteral.js":
  4428. /*!***********************************************!*\
  4429. !*** ./js/ast/expressions/variableLiteral.js ***!
  4430. \***********************************************/
  4431. /*! no static exports found */
  4432. /***/ (function(module, exports, __webpack_require__) {
  4433. "use strict";
  4434. Object.defineProperty(exports, "__esModule", {
  4435. value: true
  4436. });
  4437. exports.VariableLiteral = undefined;
  4438. 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; }; }();
  4439. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4440. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4441. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4442. 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; }
  4443. 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; }
  4444. var VariableLiteral = exports.VariableLiteral = function (_Literal) {
  4445. _inherits(VariableLiteral, _Literal);
  4446. function VariableLiteral(id) {
  4447. _classCallCheck(this, VariableLiteral);
  4448. var _this = _possibleConstructorReturn(this, (VariableLiteral.__proto__ || Object.getPrototypeOf(VariableLiteral)).call(this, _types.Types.UNDEFINED));
  4449. _this.id = id;
  4450. return _this;
  4451. }
  4452. _createClass(VariableLiteral, [{
  4453. key: 'toString',
  4454. value: function toString() {
  4455. return this.id;
  4456. }
  4457. }]);
  4458. return VariableLiteral;
  4459. }(_literal.Literal);
  4460. /***/ }),
  4461. /***/ "./js/ast/ivprogParser.js":
  4462. /*!********************************!*\
  4463. !*** ./js/ast/ivprogParser.js ***!
  4464. \********************************/
  4465. /*! no static exports found */
  4466. /***/ (function(module, exports, __webpack_require__) {
  4467. "use strict";
  4468. Object.defineProperty(exports, "__esModule", {
  4469. value: true
  4470. });
  4471. exports.IVProgParser = undefined;
  4472. 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; }; }();
  4473. var _index = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  4474. var _expressions = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js");
  4475. var Expressions = _interopRequireWildcard(_expressions);
  4476. var _commands = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js");
  4477. var Commands = _interopRequireWildcard(_commands);
  4478. var _parsers = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4479. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  4480. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  4481. var _sourceInfo2 = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  4482. var _operators = __webpack_require__(/*! ./operators */ "./js/ast/operators.js");
  4483. var _syntaxErrorFactory = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  4484. var _definedFunctions = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4485. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  4486. 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; } }
  4487. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4488. var IVProgParser = exports.IVProgParser = function () {
  4489. _createClass(IVProgParser, null, [{
  4490. key: 'createParser',
  4491. value: function createParser(input) {
  4492. var lexerClass = _languageService.LanguageService.getCurrentLexer();
  4493. return new IVProgParser(input, lexerClass);
  4494. }
  4495. // <BEGIN scope consts>
  4496. }, {
  4497. key: 'BASE',
  4498. get: function get() {
  4499. return 0;
  4500. }
  4501. }, {
  4502. key: 'FUNCTION',
  4503. get: function get() {
  4504. return 1;
  4505. }
  4506. }, {
  4507. key: 'COMMAND',
  4508. get: function get() {
  4509. return 2;
  4510. }
  4511. }, {
  4512. key: 'BREAKABLE',
  4513. get: function get() {
  4514. return 4;
  4515. }
  4516. // </ END scope consts>
  4517. }]);
  4518. function IVProgParser(input, lexerClass) {
  4519. _classCallCheck(this, IVProgParser);
  4520. this.lexerClass = lexerClass;
  4521. this.lexer = new lexerClass(new _index.InputStream(input));
  4522. this.tokenStream = new _index.CommonTokenStream(this.lexer);
  4523. this.tokenStream.fill();
  4524. this.pos = 1;
  4525. this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING];
  4526. this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID);
  4527. this.parsingArrayDimension = 0;
  4528. this.scope = [];
  4529. this.langFuncs = _languageService.LanguageService.getCurrentLangFuncs();
  4530. this.definedFuncsNameList = [];
  4531. this.definedVariablesStack = [];
  4532. }
  4533. _createClass(IVProgParser, [{
  4534. key: 'parseTree',
  4535. value: function parseTree() {
  4536. return this.parseProgram();
  4537. }
  4538. }, {
  4539. key: 'getToken',
  4540. value: function getToken() {
  4541. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  4542. // if(index === null)
  4543. // index = this.pos;
  4544. return this.tokenStream.LT(index);
  4545. }
  4546. }, {
  4547. key: 'insideScope',
  4548. value: function insideScope(scope) {
  4549. if (this.scope.length <= 0) {
  4550. return IVProgParser.BASE === scope;
  4551. } else {
  4552. return this.scope[this.scope.length - 1] === scope;
  4553. }
  4554. }
  4555. }, {
  4556. key: 'pushScope',
  4557. value: function pushScope(scope) {
  4558. this.scope.push(scope);
  4559. }
  4560. }, {
  4561. key: 'pushVariableStack',
  4562. value: function pushVariableStack() {
  4563. this.definedVariablesStack.push([]);
  4564. }
  4565. }, {
  4566. key: 'popScope',
  4567. value: function popScope() {
  4568. return this.scope.pop();
  4569. }
  4570. }, {
  4571. key: 'popVariableStack',
  4572. value: function popVariableStack() {
  4573. return this.definedVariablesStack.pop();
  4574. }
  4575. }, {
  4576. key: 'getCurrentVariableStack',
  4577. value: function getCurrentVariableStack() {
  4578. return this.definedVariablesStack[this.definedVariablesStack.length - 1];
  4579. }
  4580. }, {
  4581. key: 'isEOF',
  4582. value: function isEOF() {
  4583. this.getToken(this.pos);
  4584. return this.tokenStream.fetchedEOF;
  4585. }
  4586. }, {
  4587. key: 'parseProgram',
  4588. value: function parseProgram() {
  4589. var token = this.getToken();
  4590. var globalVars = [];
  4591. var functions = [];
  4592. if (this.lexerClass.RK_PROGRAM === token.type) {
  4593. this.pos++;
  4594. this.consumeNewLines();
  4595. this.checkOpenCurly();
  4596. this.pos++;
  4597. this.pushVariableStack();
  4598. while (true) {
  4599. this.consumeNewLines();
  4600. var _token = this.getToken();
  4601. if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) {
  4602. globalVars = globalVars.concat(this.parseGlobalVariables());
  4603. } else if (_token.type === this.lexerClass.RK_FUNCTION) {
  4604. this.pushVariableStack();
  4605. functions = functions.concat(this.parseFunction());
  4606. this.popVariableStack();
  4607. } else {
  4608. break;
  4609. }
  4610. }
  4611. this.consumeNewLines();
  4612. this.checkCloseCurly();
  4613. this.pos++;
  4614. this.consumeNewLines();
  4615. if (!this.isEOF()) {
  4616. throw _syntaxErrorFactory.SyntaxErrorFactory.extra_lines();
  4617. }
  4618. this.popVariableStack();
  4619. return { global: globalVars, functions: functions };
  4620. } else {
  4621. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token);
  4622. }
  4623. }
  4624. }, {
  4625. key: 'checkOpenCurly',
  4626. value: function checkOpenCurly() {
  4627. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4628. var token = this.getToken();
  4629. if (this.lexerClass.OPEN_CURLY !== token.type) {
  4630. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('{', token);else return false;
  4631. }
  4632. return true;
  4633. }
  4634. }, {
  4635. key: 'checkCloseCurly',
  4636. value: function checkCloseCurly() {
  4637. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4638. var token = this.getToken();
  4639. if (this.lexerClass.CLOSE_CURLY !== token.type) {
  4640. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('}', token);else return false;
  4641. }
  4642. return true;
  4643. }
  4644. /* It checks if the current token at position pos is a ']'.
  4645. * As a check function it doesn't increment pos.
  4646. *
  4647. * @params bool:attempt, indicates that the token is optional. Defaults: false
  4648. *
  4649. * @returns true if the attempt is true and current token is '[',
  4650. * false is attempt is true and current token is not '['
  4651. **/
  4652. }, {
  4653. key: 'checkOpenBrace',
  4654. value: function checkOpenBrace() {
  4655. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4656. var token = this.getToken();
  4657. if (this.lexerClass.OPEN_BRACE !== token.type) {
  4658. if (!attempt) {
  4659. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('[', token);
  4660. } else {
  4661. return false;
  4662. }
  4663. }
  4664. return true;
  4665. }
  4666. }, {
  4667. key: 'checkCloseBrace',
  4668. value: function checkCloseBrace() {
  4669. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4670. var token = this.getToken();
  4671. if (this.lexerClass.CLOSE_BRACE !== token.type) {
  4672. if (!attempt) {
  4673. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(']', token);
  4674. } else {
  4675. return false;
  4676. }
  4677. }
  4678. return true;
  4679. }
  4680. }, {
  4681. key: 'checkOpenParenthesis',
  4682. value: function checkOpenParenthesis() {
  4683. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4684. var token = this.getToken();
  4685. if (this.lexerClass.OPEN_PARENTHESIS !== token.type) {
  4686. if (!attempt) {
  4687. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('(', token);
  4688. } else {
  4689. return false;
  4690. }
  4691. }
  4692. return true;
  4693. }
  4694. }, {
  4695. key: 'checkCloseParenthesis',
  4696. value: function checkCloseParenthesis() {
  4697. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4698. var token = this.getToken();
  4699. if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) {
  4700. if (!attempt) {
  4701. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(')', token);
  4702. } else {
  4703. return false;
  4704. }
  4705. }
  4706. return true;
  4707. }
  4708. }, {
  4709. key: 'checkEOS',
  4710. value: function checkEOS() {
  4711. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4712. var eosToken = this.getToken();
  4713. if (eosToken.type !== this.lexerClass.EOS) {
  4714. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.eos_missing(eosToken);else return false;
  4715. }
  4716. return true;
  4717. }
  4718. }, {
  4719. key: 'checkFunctionDuplicate',
  4720. value: function checkFunctionDuplicate(functionID, funcIDToken) {
  4721. var id = functionID === null ? "$main" : functionID;
  4722. var index = this.definedFuncsNameList.indexOf(id);
  4723. if (index !== -1) {
  4724. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_function(funcIDToken);
  4725. }
  4726. this.definedFuncsNameList.push(id);
  4727. }
  4728. }, {
  4729. key: 'checkVariableDuplicate',
  4730. value: function checkVariableDuplicate(variableID, variableIDToken) {
  4731. var index = this.getCurrentVariableStack().indexOf(variableID);
  4732. if (index !== -1) {
  4733. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_variable(variableIDToken);
  4734. }
  4735. this.getCurrentVariableStack().push(variableID);
  4736. }
  4737. }, {
  4738. key: 'consumeForSemiColon',
  4739. value: function consumeForSemiColon() {
  4740. var eosToken = this.getToken();
  4741. if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
  4742. this.pos++;
  4743. return;
  4744. }
  4745. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(';', eosToken);
  4746. }
  4747. }, {
  4748. key: 'parseGlobalVariables',
  4749. value: function parseGlobalVariables() {
  4750. var decl = this.parseMaybeConst();
  4751. this.checkEOS();
  4752. this.pos++;
  4753. return decl;
  4754. }
  4755. /*
  4756. * Checks if the next token is PR_CONST. It's only available
  4757. * at global variables declaration level
  4758. * @returns Declararion(const, type, id, initVal?)
  4759. **/
  4760. }, {
  4761. key: 'parseMaybeConst',
  4762. value: function parseMaybeConst() {
  4763. var constToken = this.getToken();
  4764. if (constToken.type === this.lexerClass.RK_CONST) {
  4765. this.pos++;
  4766. var typeString = this.parseType();
  4767. return this.parseDeclaration(typeString, true);
  4768. } else if (this.isVariableType(constToken)) {
  4769. var _typeString = this.parseType();
  4770. return this.parseDeclaration(_typeString);
  4771. } else {
  4772. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken);
  4773. }
  4774. }
  4775. /*
  4776. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  4777. * @returns a list of Declararion(const, type, id, initVal?)
  4778. **/
  4779. }, {
  4780. key: 'parseDeclaration',
  4781. value: function parseDeclaration(typeString) {
  4782. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4783. var initial = null;
  4784. var dim1 = null;
  4785. var dim2 = null;
  4786. var idToken = this.getToken();
  4787. var idString = this.parseID();
  4788. this.checkVariableDuplicate(idString, idToken);
  4789. // Check for array or vector
  4790. // ID[int/IDi][int/IDj]
  4791. if (this.checkOpenBrace(true)) {
  4792. this.pos++;
  4793. this.consumeNewLines();
  4794. dim1 = this.parseArrayDimension();
  4795. this.consumeNewLines();
  4796. this.checkCloseBrace();
  4797. this.pos++;
  4798. if (this.checkOpenBrace(true)) {
  4799. this.pos++;
  4800. this.consumeNewLines();
  4801. dim2 = this.parseArrayDimension();
  4802. this.consumeNewLines();
  4803. this.checkCloseBrace();
  4804. this.pos++;
  4805. }
  4806. }
  4807. var equalsToken = this.getToken();
  4808. if (isConst && equalsToken.type !== this.lexerClass.EQUAL) {
  4809. throw _syntaxErrorFactory.SyntaxErrorFactory.const_not_init(idToken);
  4810. }
  4811. if (equalsToken.type === this.lexerClass.EQUAL) {
  4812. this.pos++;
  4813. initial = this.parseExpressionOR();
  4814. }
  4815. var declaration = null;
  4816. var dimensions = 0;
  4817. if (dim1 !== null) {
  4818. dimensions++;
  4819. if (dim2 !== null) {
  4820. dimensions++;
  4821. }
  4822. declaration = new Commands.ArrayDeclaration(idString, new _compoundType.CompoundType(typeString, dimensions), dim1, dim2, initial, isConst);
  4823. } else {
  4824. declaration = new Commands.Declaration(idString, typeString, initial, isConst);
  4825. }
  4826. declaration.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(idToken);
  4827. var commaToken = this.getToken();
  4828. if (commaToken.type === this.lexerClass.COMMA) {
  4829. this.pos++;
  4830. this.consumeNewLines();
  4831. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  4832. } else {
  4833. return [declaration];
  4834. }
  4835. }
  4836. }, {
  4837. key: 'consumeNewLines',
  4838. value: function consumeNewLines() {
  4839. var token = this.getToken();
  4840. while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) {
  4841. this.pos++;
  4842. token = this.getToken();
  4843. }
  4844. }
  4845. }, {
  4846. key: 'isVariableType',
  4847. value: function isVariableType(token) {
  4848. return this.variableTypes.find(function (v) {
  4849. return v === token.type;
  4850. });
  4851. }
  4852. /*
  4853. * Reads the next token of the stream to check if it is a Integer or an ID.
  4854. * @returns Integer | ID
  4855. **/
  4856. }, {
  4857. key: 'parseArrayDimension',
  4858. value: function parseArrayDimension() {
  4859. var dimToken = this.getToken();
  4860. if (dimToken.type === this.lexerClass.INTEGER) {
  4861. //parse as int literal
  4862. this.pos++;
  4863. return this.getIntLiteral(dimToken);
  4864. } else if (dimToken.type === this.lexerClass.ID) {
  4865. //parse as variable
  4866. this.pos++;
  4867. return this.parseVariable(dimToken);
  4868. } else {
  4869. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken);
  4870. }
  4871. }
  4872. /*
  4873. * Returns an object {type: 'int', value: value}.
  4874. * It checks for binary and hexadecimal integers.
  4875. * @returns object with fields type and value
  4876. **/
  4877. }, {
  4878. key: 'getIntLiteral',
  4879. value: function getIntLiteral(token) {
  4880. var text = token.text;
  4881. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4882. var exp = new Expressions.IntLiteral((0, _parsers.toInt)(text));
  4883. exp.sourceInfo = sourceInfo;
  4884. return exp;
  4885. }
  4886. }, {
  4887. key: 'getRealLiteral',
  4888. value: function getRealLiteral(token) {
  4889. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4890. var exp = new Expressions.RealLiteral((0, _parsers.toReal)(token.text));
  4891. exp.sourceInfo = sourceInfo;
  4892. return exp;
  4893. }
  4894. }, {
  4895. key: 'getStringLiteral',
  4896. value: function getStringLiteral(token) {
  4897. var text = token.text;
  4898. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4899. var exp = new Expressions.StringLiteral((0, _parsers.toString)(text));
  4900. exp.sourceInfo = sourceInfo;
  4901. return exp;
  4902. }
  4903. }, {
  4904. key: 'getBoolLiteral',
  4905. value: function getBoolLiteral(token) {
  4906. var val = (0, _parsers.toBool)(token.text);
  4907. var exp = new Expressions.BoolLiteral(val);
  4908. exp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);;
  4909. return exp;
  4910. }
  4911. }, {
  4912. key: 'parseArrayLiteral',
  4913. value: function parseArrayLiteral() {
  4914. this.checkOpenCurly();
  4915. var beginArray = this.getToken();
  4916. if (this.parsingArrayDimension >= 2) {
  4917. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list('Array dimensions exceed maximum size of 2 at line ' + beginArray.line);
  4918. }
  4919. this.pos++;
  4920. this.parsingArrayDimension++;
  4921. this.consumeNewLines();
  4922. var data = this.parseExpressionList();
  4923. this.consumeNewLines();
  4924. this.checkCloseCurly();
  4925. var endArray = this.getToken();
  4926. this.pos++;
  4927. this.parsingArrayDimension--;
  4928. if (this.parsingArrayDimension === 0) {
  4929. // if (!data.isValid) {
  4930. // // TODO: better error message
  4931. // console.log('invalid array');
  4932. // throw new Error(`Invalid array at line ${beginArray.line}`);
  4933. // }
  4934. }
  4935. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(beginArray, endArray);
  4936. var dataDim = 1;
  4937. if (data[0] instanceof Expressions.ArrayLiteral) {
  4938. dataDim++;
  4939. }
  4940. var type = new _compoundType.CompoundType(_types.Types.UNDEFINED, dataDim);
  4941. var exp = new Expressions.ArrayLiteral(type, data);
  4942. exp.sourceInfo = sourceInfo;
  4943. return exp;
  4944. }
  4945. /*
  4946. * Returns an object {type: 'variable', value: value}.
  4947. * @returns object with fields type and value
  4948. **/
  4949. }, {
  4950. key: 'parseVariable',
  4951. value: function parseVariable(token) {
  4952. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4953. var exp = new Expressions.VariableLiteral(token.text);
  4954. exp.sourceInfo = sourceInfo;
  4955. return exp;
  4956. }
  4957. /*
  4958. * Returns an object representing a function. It has
  4959. * four attributes: returnType, id, formalParams and block.
  4960. * The block object has two attributes: declarations and commands
  4961. **/
  4962. }, {
  4963. key: 'parseFunction',
  4964. value: function parseFunction() {
  4965. this.pushScope(IVProgParser.FUNCTION);
  4966. var formalParams = [];
  4967. var token = this.getToken();
  4968. if (token.type !== this.lexerClass.RK_FUNCTION) {
  4969. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  4970. return null;
  4971. }
  4972. this.pos++;
  4973. var funType = this.parseType();
  4974. var dimensions = 0;
  4975. if (this.checkOpenBrace(true)) {
  4976. this.pos++;
  4977. this.checkCloseBrace();
  4978. this.pos++;
  4979. dimensions++;
  4980. if (this.checkOpenBrace(true)) {
  4981. this.pos++;
  4982. this.checkCloseBrace();
  4983. this.pos++;
  4984. dimensions++;
  4985. }
  4986. }
  4987. var funcIDToken = this.getToken();
  4988. var functionID = this.parseID();
  4989. this.checkFunctionDuplicate(functionID, funcIDToken);
  4990. this.checkOpenParenthesis();
  4991. this.pos++;
  4992. this.consumeNewLines();
  4993. if (!this.checkCloseParenthesis(true)) {
  4994. formalParams = this.parseFormalParameters(); // formal parameters
  4995. this.consumeNewLines();
  4996. this.checkCloseParenthesis();
  4997. this.pos++;
  4998. } else {
  4999. this.pos++;
  5000. }
  5001. this.consumeNewLines();
  5002. var commandsBlock = this.parseCommandBlock();
  5003. var returnType = funType;
  5004. if (dimensions > 0) {
  5005. returnType = new _compoundType.CompoundType(funType, dimensions);
  5006. }
  5007. var func = new Commands.Function(functionID, returnType, formalParams, commandsBlock);
  5008. if (functionID === null && !func.isMain) {
  5009. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_main_return(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line);
  5010. } else if (func.isMain && formalParams.length !== 0) {
  5011. throw _syntaxErrorFactory.SyntaxErrorFactory.main_parameters();
  5012. }
  5013. this.popScope();
  5014. return func;
  5015. }
  5016. /*
  5017. * Parse the formal parameters of a function.
  5018. * @returns a list of objects with the following attributes: type, id and dimensions.
  5019. **/
  5020. }, {
  5021. key: 'parseFormalParameters',
  5022. value: function parseFormalParameters() {
  5023. var list = [];
  5024. while (true) {
  5025. var dimensions = 0;
  5026. var typeString = this.parseType();
  5027. var idToken = this.getToken();
  5028. var idString = this.parseID();
  5029. this.checkVariableDuplicate(idString, idToken);
  5030. if (this.checkOpenBrace(true)) {
  5031. this.pos++;
  5032. dimensions++;
  5033. this.checkCloseBrace();
  5034. this.pos++;
  5035. if (this.checkOpenBrace(true)) {
  5036. this.pos++;
  5037. dimensions++;
  5038. this.checkCloseBrace();
  5039. this.pos++;
  5040. }
  5041. }
  5042. var type = null;
  5043. if (dimensions > 0) {
  5044. type = new _compoundType.CompoundType(typeString, dimensions);
  5045. } else {
  5046. type = typeString;
  5047. }
  5048. list.push(new Commands.FormalParameter(type, idString));
  5049. var commaToken = this.getToken();
  5050. if (commaToken.type !== this.lexerClass.COMMA) break;
  5051. this.pos++;
  5052. this.consumeNewLines();
  5053. }
  5054. return list;
  5055. }
  5056. }, {
  5057. key: 'parseID',
  5058. value: function parseID() {
  5059. var token = this.getToken();
  5060. if (token.type !== this.lexerClass.ID) {
  5061. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5062. }
  5063. this.pos++;
  5064. if (this.insideScope(IVProgParser.FUNCTION)) {
  5065. if (token.text === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5066. return null;
  5067. }
  5068. }
  5069. return token.text;
  5070. }
  5071. }, {
  5072. key: 'parseMaybeLibID',
  5073. value: function parseMaybeLibID() {
  5074. var token = this.getToken();
  5075. if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) {
  5076. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5077. }
  5078. this.pos++;
  5079. return token.text;
  5080. }
  5081. }, {
  5082. key: 'parseType',
  5083. value: function parseType() {
  5084. var token = this.getToken();
  5085. if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) {
  5086. return _types.Types.VOID;
  5087. } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  5088. this.pos++;
  5089. return _types.Types.VOID;
  5090. } else if (this.isVariableType(token)) {
  5091. this.pos++;
  5092. switch (token.type) {
  5093. case this.lexerClass.RK_INTEGER:
  5094. return _types.Types.INTEGER;
  5095. case this.lexerClass.RK_BOOLEAN:
  5096. return _types.Types.BOOLEAN;
  5097. case this.lexerClass.RK_REAL:
  5098. return _types.Types.REAL;
  5099. case this.lexerClass.RK_STRING:
  5100. return _types.Types.STRING;
  5101. default:
  5102. break;
  5103. }
  5104. }
  5105. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_type(this.getTypeArray(), token);
  5106. }
  5107. }, {
  5108. key: 'parseCommandBlock',
  5109. value: function parseCommandBlock() {
  5110. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5111. var variablesDecl = [];
  5112. var commands = [];
  5113. var hasOpen = false;
  5114. if (this.checkOpenCurly(optionalCurly)) {
  5115. this.pos++;
  5116. hasOpen = true;
  5117. }
  5118. this.consumeNewLines();
  5119. while (true) {
  5120. var cmd = this.parseCommand();
  5121. if (cmd === null) break;
  5122. if (cmd !== -1) {
  5123. if (cmd instanceof Array) {
  5124. variablesDecl = variablesDecl.concat(cmd);
  5125. } else {
  5126. commands.push(cmd);
  5127. }
  5128. }
  5129. }
  5130. this.consumeNewLines();
  5131. if (hasOpen) {
  5132. this.checkCloseCurly();
  5133. this.pos++;
  5134. this.consumeNewLines();
  5135. }
  5136. return new Commands.CommandBlock(variablesDecl, commands);
  5137. }
  5138. }, {
  5139. key: 'parseCommand',
  5140. value: function parseCommand() {
  5141. var token = this.getToken();
  5142. if (this.isVariableType(token)) {
  5143. if (!this.insideScope(IVProgParser.FUNCTION)) {
  5144. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_var_declaration(token.line);
  5145. }
  5146. this.pushScope(IVProgParser.BASE);
  5147. var varType = this.parseType();
  5148. this.popScope();
  5149. var cmd = this.parseDeclaration(varType);
  5150. this.checkEOS();
  5151. this.pos++;
  5152. return cmd;
  5153. } else if (token.type === this.lexerClass.ID) {
  5154. return this.parseIDCommand();
  5155. } else if (token.type === this.lexerClass.LIB_ID) {
  5156. return this.parseIDCommand();
  5157. } else if (token.type === this.lexerClass.RK_RETURN) {
  5158. return this.parseReturn();
  5159. } else if (token.type === this.lexerClass.RK_WHILE) {
  5160. return this.parseWhile();
  5161. } else if (token.type === this.lexerClass.RK_FOR) {
  5162. return this.parseFor();
  5163. } else if (token.type === this.lexerClass.RK_BREAK) {
  5164. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  5165. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token);
  5166. }
  5167. return this.parseBreak();
  5168. } else if (token.type === this.lexerClass.RK_SWITCH) {
  5169. return this.parseSwitchCase();
  5170. } else if (token.type === this.lexerClass.RK_DO) {
  5171. return this.parseDoWhile();
  5172. } else if (token.type === this.lexerClass.RK_IF) {
  5173. return this.parseIfThenElse();
  5174. } else if (this.checkEOS(true)) {
  5175. this.pos++;
  5176. return -1;
  5177. } else {
  5178. return null;
  5179. }
  5180. }
  5181. }, {
  5182. key: 'parseSwitchCase',
  5183. value: function parseSwitchCase() {
  5184. this.pushScope(IVProgParser.BREAKABLE);
  5185. this.pos++;
  5186. this.checkOpenParenthesis();
  5187. this.pos++;
  5188. this.consumeNewLines();
  5189. var exp = this.parseExpressionOR();
  5190. this.consumeNewLines();
  5191. this.checkCloseParenthesis();
  5192. this.pos++;
  5193. this.consumeNewLines();
  5194. this.checkOpenCurly();
  5195. this.pos++;
  5196. this.consumeNewLines();
  5197. var casesList = this.parseCases();
  5198. this.consumeNewLines();
  5199. this.checkCloseCurly();
  5200. this.pos++;
  5201. this.consumeNewLines();
  5202. this.popScope();
  5203. return new Commands.Switch(exp, casesList);
  5204. }
  5205. }, {
  5206. key: 'parseDoWhile',
  5207. value: function parseDoWhile() {
  5208. this.pos++;
  5209. this.consumeNewLines();
  5210. this.pushScope(IVProgParser.BREAKABLE);
  5211. var commandsBlock = this.parseCommandBlock();
  5212. this.consumeNewLines(); //Maybe not...
  5213. var whileToken = this.getToken();
  5214. if (whileToken.type !== this.lexerClass.RK_WHILE) {
  5215. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
  5216. }
  5217. this.pos++;
  5218. this.checkOpenParenthesis();
  5219. this.pos++;
  5220. this.consumeNewLines();
  5221. var condition = this.parseExpressionOR();
  5222. this.consumeNewLines();
  5223. this.checkCloseParenthesis();
  5224. this.pos++;
  5225. this.checkEOS();
  5226. this.popScope();
  5227. return new Commands.DoWhile(condition, commandsBlock);
  5228. }
  5229. }, {
  5230. key: 'parseIfThenElse',
  5231. value: function parseIfThenElse() {
  5232. if (this.insideScope(IVProgParser.BREAKABLE)) {
  5233. this.pushScope(IVProgParser.BREAKABLE);
  5234. } else {
  5235. this.pushScope(IVProgParser.COMMAND);
  5236. }
  5237. var token = this.getToken();
  5238. this.pos++;
  5239. this.checkOpenParenthesis();
  5240. this.pos++;
  5241. this.consumeNewLines();
  5242. var logicalExpression = this.parseExpressionOR();
  5243. this.consumeNewLines();
  5244. this.checkCloseParenthesis();
  5245. this.pos++;
  5246. this.consumeNewLines();
  5247. var cmdBlocks = this.parseCommandBlock();
  5248. var maybeElse = this.getToken();
  5249. if (maybeElse.type === this.lexerClass.RK_ELSE) {
  5250. this.pos++;
  5251. this.consumeNewLines();
  5252. var maybeIf = this.getToken();
  5253. var elseBlock = null;
  5254. if (this.checkOpenCurly(true)) {
  5255. elseBlock = this.parseCommandBlock();
  5256. } else if (maybeIf.type === this.lexerClass.RK_IF) {
  5257. elseBlock = this.parseIfThenElse();
  5258. } else {
  5259. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf);
  5260. }
  5261. this.popScope();
  5262. var _cmd = new Commands.IfThenElse(logicalExpression, cmdBlocks, elseBlock);
  5263. _cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  5264. return _cmd;
  5265. }
  5266. this.popScope();
  5267. var cmd = new Commands.IfThenElse(logicalExpression, cmdBlocks, null);
  5268. cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  5269. return cmd;
  5270. }
  5271. }, {
  5272. key: 'parseFor',
  5273. value: function parseFor() {
  5274. this.pushScope(IVProgParser.BREAKABLE);
  5275. this.pos++;
  5276. this.checkOpenParenthesis();
  5277. this.pos++;
  5278. this.consumeNewLines();
  5279. var attribution = this.parseForAssign();
  5280. this.consumeNewLines();
  5281. var condition = this.parseExpressionOR();
  5282. this.consumeForSemiColon();
  5283. var increment = this.parseForAssign(true);
  5284. this.checkCloseParenthesis();
  5285. this.pos++;
  5286. this.consumeNewLines();
  5287. var commandsBlock = this.parseCommandBlock();
  5288. this.popScope();
  5289. return new Commands.For(attribution, condition, increment, commandsBlock);
  5290. }
  5291. }, {
  5292. key: 'parseWhile',
  5293. value: function parseWhile() {
  5294. this.pushScope(IVProgParser.BREAKABLE);
  5295. var token = this.getToken();
  5296. this.pos++;
  5297. this.checkOpenParenthesis();
  5298. this.pos++;
  5299. this.consumeNewLines();
  5300. var logicalExpression = this.parseExpressionOR();
  5301. this.consumeNewLines();
  5302. this.checkCloseParenthesis();
  5303. this.pos++;
  5304. this.consumeNewLines();
  5305. var cmdBlocks = this.parseCommandBlock();
  5306. this.popScope();
  5307. var cmd = new Commands.While(logicalExpression, cmdBlocks);
  5308. cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  5309. return cmd;
  5310. }
  5311. }, {
  5312. key: 'parseBreak',
  5313. value: function parseBreak() {
  5314. this.pos++;
  5315. this.checkEOS();
  5316. this.pos++;
  5317. return new Commands.Break();
  5318. }
  5319. }, {
  5320. key: 'parseReturn',
  5321. value: function parseReturn() {
  5322. this.pos++;
  5323. var exp = null;
  5324. if (!this.checkEOS(true)) {
  5325. exp = this.parseExpressionOR();
  5326. this.checkEOS();
  5327. }
  5328. this.pos++;
  5329. return new Commands.Return(exp);
  5330. }
  5331. }, {
  5332. key: 'parseIDCommand',
  5333. value: function parseIDCommand() {
  5334. var refToken = this.getToken();
  5335. var isID = refToken.type === this.lexerClass.ID;
  5336. var id = this.parseMaybeLibID();
  5337. if (this.checkOpenBrace(true)) {
  5338. this.pos++;
  5339. var lineExpression = null;
  5340. var columnExpression = null;
  5341. this.consumeNewLines();
  5342. lineExpression = this.parseExpression();
  5343. this.consumeNewLines();
  5344. this.checkCloseBrace();
  5345. this.pos++;
  5346. if (this.checkOpenBrace(true)) {
  5347. this.pos++;
  5348. this.consumeNewLines();
  5349. columnExpression = this.parseExpression();
  5350. this.consumeNewLines();
  5351. this.checkCloseBrace();
  5352. this.pos++;
  5353. }
  5354. var equalToken = this.getToken();
  5355. if (equalToken.type !== this.lexerClass.EQUAL) {
  5356. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equalToken);
  5357. }
  5358. this.pos++;
  5359. var exp = this.parseExpressionOR();
  5360. this.checkEOS();
  5361. this.pos++;
  5362. var cmd = new Commands.ArrayIndexAssign(id, lineExpression, columnExpression, exp);
  5363. cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalToken);
  5364. return cmd;
  5365. }
  5366. var equalOrParenthesis = this.getToken();
  5367. if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) {
  5368. this.pos++;
  5369. var _exp = this.parseExpressionOR();
  5370. this.checkEOS();
  5371. this.pos++;
  5372. var _cmd2 = new Commands.Assign(id, _exp);
  5373. _cmd2.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalOrParenthesis);
  5374. return _cmd2;
  5375. } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) {
  5376. var funcCall = this.parseFunctionCallCommand(id);
  5377. this.checkEOS();
  5378. this.pos++;
  5379. return funcCall;
  5380. } else if (isID) {
  5381. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list(['=', '('], equalOrParenthesis);
  5382. } else {
  5383. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(refToken);
  5384. }
  5385. }
  5386. }, {
  5387. key: 'parseForAssign',
  5388. value: function parseForAssign() {
  5389. var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5390. if (!isLast) this.consumeNewLines();
  5391. if (this.checkEOS(true)) {
  5392. return null;
  5393. }
  5394. var id = this.parseID();
  5395. var equal = this.getToken();
  5396. if (equal.type !== this.lexerClass.EQUAL) {
  5397. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equal);
  5398. }
  5399. this.pos++;
  5400. var exp = this.parseExpressionOR();
  5401. if (!isLast) {
  5402. this.consumeForSemiColon();
  5403. }
  5404. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equal);
  5405. var cmd = new Commands.Assign(id, exp);
  5406. cmd.sourceInfo = sourceInfo;
  5407. return cmd;
  5408. }
  5409. }, {
  5410. key: 'parseCases',
  5411. value: function parseCases() {
  5412. var token = this.getToken();
  5413. if (token.type !== this.lexerClass.RK_CASE) {
  5414. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token);
  5415. }
  5416. this.pos++;
  5417. var nextToken = this.getToken();
  5418. if (nextToken.type === this.lexerClass.RK_DEFAULT) {
  5419. this.pos++;
  5420. var colonToken = this.getToken();
  5421. if (colonToken.type !== this.lexerClass.COLON) {
  5422. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', colonToken);
  5423. }
  5424. this.pos++;
  5425. this.consumeNewLines();
  5426. var block = this.parseCommandBlock(true);
  5427. var defaultCase = new Commands.Case(null);
  5428. defaultCase.setCommands(block.commands);
  5429. return [defaultCase];
  5430. } else {
  5431. var exp = this.parseExpressionOR();
  5432. var _colonToken = this.getToken();
  5433. if (_colonToken.type !== this.lexerClass.COLON) {
  5434. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', _colonToken);
  5435. }
  5436. this.pos++;
  5437. this.consumeNewLines();
  5438. var _block = this.parseCommandBlock(true);
  5439. var aCase = new Commands.Case(exp);
  5440. aCase.setCommands(_block.commands);
  5441. var caseToken = this.getToken();
  5442. if (caseToken.type === this.lexerClass.RK_CASE) {
  5443. return [aCase].concat(this.parseCases());
  5444. } else {
  5445. return [aCase];
  5446. }
  5447. }
  5448. }
  5449. /*
  5450. * Parses an Expression following the structure:
  5451. *
  5452. * EOR => EAnd ( 'or' EOR)? #expression and
  5453. *
  5454. * EOR => ENot ('and' EOR)? #expression or
  5455. *
  5456. * ENot => 'not'? ER #expression not
  5457. *
  5458. * ER => E ((>=, <=, ==, >, <) E)? #expression relational
  5459. *
  5460. * E => factor ((+, -) E)? #expression
  5461. *
  5462. * factor=> term ((*, /, %) factor)?
  5463. *
  5464. * term => literal || arrayAccess || FuncCall || ID || '('EAnd')'
  5465. **/
  5466. }, {
  5467. key: 'parseExpressionOR',
  5468. value: function parseExpressionOR() {
  5469. var exp1 = this.parseExpressionAND();
  5470. while (this.getToken().type === this.lexerClass.OR_OPERATOR) {
  5471. var opToken = this.getToken();
  5472. this.pos++;
  5473. var or = (0, _operators.convertFromString)('or');
  5474. this.consumeNewLines();
  5475. var exp2 = this.parseExpressionAND();
  5476. var _finalExp = new Expressions.InfixApp(or, exp1, exp2);
  5477. _finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5478. exp1 = _finalExp;
  5479. }
  5480. return exp1;
  5481. }
  5482. }, {
  5483. key: 'parseExpressionAND',
  5484. value: function parseExpressionAND() {
  5485. var exp1 = this.parseExpressionNot();
  5486. while (this.getToken().type === this.lexerClass.AND_OPERATOR) {
  5487. var opToken = this.getToken();
  5488. this.pos++;
  5489. var and = (0, _operators.convertFromString)('and');
  5490. this.consumeNewLines();
  5491. var exp2 = this.parseExpressionNot();
  5492. var _finalExp2 = new Expressions.InfixApp(and, exp1, exp2);
  5493. _finalExp2.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5494. exp1 = _finalExp2;
  5495. }
  5496. return exp1;
  5497. }
  5498. }, {
  5499. key: 'parseExpressionNot',
  5500. value: function parseExpressionNot() {
  5501. var maybeNotToken = this.getToken();
  5502. if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) {
  5503. var opToken = this.getToken();
  5504. this.pos++;
  5505. var not = (0, _operators.convertFromString)('not');
  5506. var exp1 = this.parseExpressionRel();
  5507. finalExp = new Expressions.UnaryApp(not, exp1);
  5508. finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5509. return finalExp;
  5510. } else {
  5511. return this.parseExpressionRel();
  5512. }
  5513. }
  5514. }, {
  5515. key: 'parseExpressionRel',
  5516. value: function parseExpressionRel() {
  5517. var exp1 = this.parseExpression();
  5518. while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) {
  5519. var relToken = this.getToken();
  5520. this.pos++;
  5521. var rel = (0, _operators.convertFromString)(relToken.text);
  5522. var exp2 = this.parseExpression();
  5523. var _finalExp3 = new Expressions.InfixApp(rel, exp1, exp2);
  5524. _finalExp3.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(relToken);
  5525. exp1 = _finalExp3;
  5526. }
  5527. return exp1;
  5528. }
  5529. }, {
  5530. key: 'parseExpression',
  5531. value: function parseExpression() {
  5532. var factor = this.parseFactor();
  5533. while (this.getToken().type === this.lexerClass.SUM_OP) {
  5534. var sumOpToken = this.getToken();
  5535. this.pos++;
  5536. var op = (0, _operators.convertFromString)(sumOpToken.text);
  5537. var factor2 = this.parseFactor();
  5538. var _finalExp4 = new Expressions.InfixApp(op, factor, factor2);
  5539. _finalExp4.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(sumOpToken);
  5540. factor = _finalExp4;
  5541. }
  5542. return factor;
  5543. }
  5544. }, {
  5545. key: 'parseFactor',
  5546. value: function parseFactor() {
  5547. var term = this.parseTerm();
  5548. while (this.getToken().type === this.lexerClass.MULTI_OP) {
  5549. var multOpToken = this.getToken();
  5550. this.pos++;
  5551. var op = (0, _operators.convertFromString)(multOpToken.text);
  5552. var term2 = this.parseTerm();
  5553. var _finalExp5 = new Expressions.InfixApp(op, term, term2);
  5554. _finalExp5.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(multOpToken);
  5555. term = _finalExp5;
  5556. }
  5557. return term;
  5558. }
  5559. }, {
  5560. key: 'parseTerm',
  5561. value: function parseTerm() {
  5562. var token = this.getToken();
  5563. var sourceInfo = null;
  5564. switch (token.type) {
  5565. case this.lexerClass.SUM_OP:
  5566. this.pos++;
  5567. sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  5568. var exp = new Expressions.UnaryApp((0, _operators.convertFromString)(token.text), this.parseTerm());
  5569. exp.sourceInfo = sourceInfo;
  5570. return exp;
  5571. case this.lexerClass.INTEGER:
  5572. this.pos++;
  5573. return this.getIntLiteral(token);
  5574. case this.lexerClass.REAL:
  5575. this.pos++;
  5576. return this.getRealLiteral(token);
  5577. case this.lexerClass.STRING:
  5578. this.pos++;
  5579. return this.getStringLiteral(token);
  5580. case this.lexerClass.RK_TRUE:
  5581. case this.lexerClass.RK_FALSE:
  5582. this.pos++;
  5583. return this.getBoolLiteral(token);
  5584. case this.lexerClass.OPEN_CURLY:
  5585. return this.parseArrayLiteral();
  5586. case this.lexerClass.ID:
  5587. case this.lexerClass.LIB_ID:
  5588. return this.parseIDTerm();
  5589. case this.lexerClass.OPEN_PARENTHESIS:
  5590. return this.parseParenthesisExp();
  5591. default:
  5592. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_terminal(token);
  5593. }
  5594. }
  5595. }, {
  5596. key: 'parseIDTerm',
  5597. value: function parseIDTerm() {
  5598. var tokenA = this.getToken();
  5599. var id = this.parseMaybeLibID();
  5600. var isID = tokenA.type === this.lexerClass.ID;
  5601. if (isID && this.checkOpenBrace(true)) {
  5602. var tokenB = null;
  5603. this.pos++;
  5604. var firstIndex = this.parseExpression();
  5605. var secondIndex = null;
  5606. this.consumeNewLines();
  5607. this.checkCloseBrace();
  5608. tokenB = this.getToken();
  5609. this.pos++;
  5610. if (this.checkOpenBrace(true)) {
  5611. this.pos++;
  5612. secondIndex = this.parseExpression();
  5613. this.consumeNewLines();
  5614. this.checkCloseBrace();
  5615. tokenB = this.getToken();
  5616. this.pos++;
  5617. }
  5618. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5619. var exp = new Expressions.ArrayAccess(id, firstIndex, secondIndex);
  5620. exp.sourceInfo = sourceInfo;
  5621. return exp;
  5622. } else if (this.checkOpenParenthesis(true)) {
  5623. return this.parseFunctionCallExpression(id);
  5624. } else if (isID) {
  5625. var _sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(tokenA);
  5626. var _exp2 = new Expressions.VariableLiteral(id);
  5627. _exp2.sourceInfo = _sourceInfo;
  5628. return _exp2;
  5629. } else {
  5630. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(tokenA);
  5631. }
  5632. }
  5633. }, {
  5634. key: 'getFunctionName',
  5635. value: function getFunctionName(id) {
  5636. var name = _definedFunctions.LanguageDefinedFunction.getInternalName(id);
  5637. if (name === null) {
  5638. if (id === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5639. return null;
  5640. }
  5641. return id;
  5642. } else {
  5643. return name;
  5644. }
  5645. }
  5646. }, {
  5647. key: 'parseFunctionCallExpression',
  5648. value: function parseFunctionCallExpression(id) {
  5649. var tokenA = this.getToken(this.pos - 1);
  5650. var actualParameters = this.parseActualParameters();
  5651. var tokenB = this.getToken(this.pos - 1);
  5652. var funcName = this.getFunctionName(id);
  5653. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5654. var cmd = new Expressions.FunctionCall(funcName, actualParameters);
  5655. cmd.sourceInfo = sourceInfo;
  5656. return cmd;
  5657. }
  5658. }, {
  5659. key: 'parseFunctionCallCommand',
  5660. value: function parseFunctionCallCommand(id) {
  5661. return this.parseFunctionCallExpression(id);
  5662. }
  5663. }, {
  5664. key: 'parseParenthesisExp',
  5665. value: function parseParenthesisExp() {
  5666. this.checkOpenParenthesis();
  5667. var tokenA = this.getToken();
  5668. this.pos++;
  5669. this.consumeNewLines();
  5670. var exp = this.parseExpressionOR();
  5671. this.consumeNewLines();
  5672. this.checkCloseParenthesis();
  5673. var tokenB = this.getToken();
  5674. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5675. this.pos++;
  5676. exp.sourceInfo = sourceInfo;
  5677. return exp;
  5678. }
  5679. }, {
  5680. key: 'parseActualParameters',
  5681. value: function parseActualParameters() {
  5682. this.checkOpenParenthesis();
  5683. this.pos++;
  5684. if (this.checkCloseParenthesis(true)) {
  5685. this.pos++;
  5686. return [];
  5687. }
  5688. this.consumeNewLines();
  5689. var list = this.parseExpressionList();
  5690. this.consumeNewLines();
  5691. this.checkCloseParenthesis();
  5692. this.pos++;
  5693. return list;
  5694. }
  5695. }, {
  5696. key: 'parseExpressionList',
  5697. value: function parseExpressionList() {
  5698. var list = [];
  5699. while (true) {
  5700. var exp = this.parseExpressionOR();
  5701. list.push(exp);
  5702. var maybeToken = this.getToken();
  5703. if (maybeToken.type !== this.lexerClass.COMMA) {
  5704. break;
  5705. } else {
  5706. this.pos++;
  5707. this.consumeNewLines();
  5708. }
  5709. }
  5710. return list;
  5711. }
  5712. }, {
  5713. key: 'getTypeArray',
  5714. value: function getTypeArray() {
  5715. var _this = this;
  5716. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  5717. return types.map(function (x) {
  5718. return _this.lexer.literalNames[x];
  5719. });
  5720. }
  5721. }]);
  5722. return IVProgParser;
  5723. }();
  5724. /***/ }),
  5725. /***/ "./js/ast/operators.js":
  5726. /*!*****************************!*\
  5727. !*** ./js/ast/operators.js ***!
  5728. \*****************************/
  5729. /*! no static exports found */
  5730. /***/ (function(module, exports, __webpack_require__) {
  5731. "use strict";
  5732. Object.defineProperty(exports, "__esModule", {
  5733. value: true
  5734. });
  5735. exports.convertFromString = convertFromString;
  5736. var Operators = exports.Operators = Object.freeze({
  5737. ADD: { ord: 0, value: "+" },
  5738. SUB: { ord: 1, value: "-" },
  5739. MULT: { ord: 2, value: '*' },
  5740. DIV: { ord: 3, value: '/' },
  5741. MOD: { ord: 4, value: '%' },
  5742. GT: { ord: 5, value: '>' },
  5743. GE: { ord: 6, value: '>=' },
  5744. LT: { ord: 7, value: '<' },
  5745. LE: { ord: 8, value: '<=' },
  5746. EQ: { ord: 9, value: '==' },
  5747. NEQ: { ord: 10, value: '!=' },
  5748. AND: { ord: 11, value: 'and' },
  5749. OR: { ord: 12, value: 'or' },
  5750. NOT: { ord: 13, value: 'not' }
  5751. });
  5752. function convertFromString(op) {
  5753. switch (op) {
  5754. case '+':
  5755. return Operators.ADD;
  5756. case '-':
  5757. return Operators.SUB;
  5758. case '*':
  5759. return Operators.MULT;
  5760. case '/':
  5761. return Operators.DIV;
  5762. case '%':
  5763. return Operators.MOD;
  5764. case '>':
  5765. return Operators.GT;
  5766. case '>=':
  5767. return Operators.GE;
  5768. case '<':
  5769. return Operators.LT;
  5770. case '<=':
  5771. return Operators.LE;
  5772. case '==':
  5773. return Operators.EQ;
  5774. case '!=':
  5775. return Operators.NEQ;
  5776. case 'and':
  5777. return Operators.AND;
  5778. case 'or':
  5779. return Operators.OR;
  5780. case 'not':
  5781. return Operators.NOT;
  5782. }
  5783. }
  5784. /***/ }),
  5785. /***/ "./js/ast/sourceInfo.js":
  5786. /*!******************************!*\
  5787. !*** ./js/ast/sourceInfo.js ***!
  5788. \******************************/
  5789. /*! no static exports found */
  5790. /***/ (function(module, exports, __webpack_require__) {
  5791. "use strict";
  5792. Object.defineProperty(exports, "__esModule", {
  5793. value: true
  5794. });
  5795. 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; }; }();
  5796. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5797. var SourceInfo = exports.SourceInfo = function () {
  5798. _createClass(SourceInfo, null, [{
  5799. key: "createSourceInfo",
  5800. value: function createSourceInfo(token) {
  5801. return new SourceInfo(token.line, token.column, token.text.length);
  5802. }
  5803. }, {
  5804. key: "createSourceInfoFromList",
  5805. value: function createSourceInfoFromList(tokenA, tokenB) {
  5806. var line = tokenA.line;
  5807. var column = tokenA.column;
  5808. // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  5809. // No idea why...
  5810. var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex;
  5811. return new SourceInfo(line, column, size);
  5812. }
  5813. }]);
  5814. function SourceInfo(line, column, size) {
  5815. _classCallCheck(this, SourceInfo);
  5816. this.line = line;
  5817. this.column = column;
  5818. this.size = size;
  5819. }
  5820. return SourceInfo;
  5821. }();
  5822. /***/ }),
  5823. /***/ "./js/io/domConsole.js":
  5824. /*!*****************************!*\
  5825. !*** ./js/io/domConsole.js ***!
  5826. \*****************************/
  5827. /*! no static exports found */
  5828. /***/ (function(module, exports, __webpack_require__) {
  5829. "use strict";
  5830. Object.defineProperty(exports, "__esModule", {
  5831. value: true
  5832. });
  5833. exports.DOMConsole = undefined;
  5834. 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; }; }();
  5835. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  5836. var _jquery2 = _interopRequireDefault(_jquery);
  5837. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5838. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5839. var DOMConsole = exports.DOMConsole = function () {
  5840. _createClass(DOMConsole, null, [{
  5841. key: 'USER',
  5842. get: function get() {
  5843. return 0;
  5844. }
  5845. }, {
  5846. key: 'INFO',
  5847. get: function get() {
  5848. return 1;
  5849. }
  5850. }, {
  5851. key: 'ERR',
  5852. get: function get() {
  5853. return 2;
  5854. }
  5855. }]);
  5856. function DOMConsole(elementID) {
  5857. _classCallCheck(this, DOMConsole);
  5858. this.input = null;
  5859. this.needInput = false;
  5860. this.termDiv = null;
  5861. this.anyKey = false;
  5862. this.parent = (0, _jquery2.default)(elementID);
  5863. this.setup();
  5864. this.inputListeners = [];
  5865. }
  5866. _createClass(DOMConsole, [{
  5867. key: 'setup',
  5868. value: function setup() {
  5869. this._setupDom();
  5870. this._setupEvents();
  5871. }
  5872. }, {
  5873. key: '_setupEvents',
  5874. value: function _setupEvents() {
  5875. var _this = this;
  5876. this.input.on("keydown", function (event) {
  5877. if (!_this.needInput) {
  5878. event.preventDefault();
  5879. return;
  5880. }
  5881. var keyCode = event.which;
  5882. if (keyCode === 13 || _this.anyKey) {
  5883. var text = _this.input.val();
  5884. text = text.replace('[\n\r]+', '');
  5885. _this.notifyListeners(text);
  5886. _this.write(text);
  5887. _this.input.val("");
  5888. }
  5889. });
  5890. }
  5891. }, {
  5892. key: '_setupDom',
  5893. value: function _setupDom() {
  5894. this.termDiv = (0, _jquery2.default)("<div></div>");
  5895. this.termDiv.addClass("ivprog-term-div");
  5896. this.input = (0, _jquery2.default)('<input text="type">');
  5897. this.input.addClass("ivprog-term-input");
  5898. this.termDiv.append(this.input);
  5899. this.parent.append(this.termDiv);
  5900. }
  5901. }, {
  5902. key: 'notifyListeners',
  5903. value: function notifyListeners(text) {
  5904. this.inputListeners.forEach(function (resolve) {
  5905. return resolve(text);
  5906. });
  5907. this.inputListeners.splice(0, this.inputListeners.length);
  5908. this.hideInput();
  5909. this.anyKey = false;
  5910. }
  5911. }, {
  5912. key: 'write',
  5913. value: function write(text) {
  5914. this._appendText(text, DOMConsole.USER);
  5915. }
  5916. }, {
  5917. key: 'info',
  5918. value: function info(text) {
  5919. this._appendText(text, DOMConsole.INFO);
  5920. }
  5921. }, {
  5922. key: 'err',
  5923. value: function err(text) {
  5924. this._appendText(text, DOMConsole.ERR);
  5925. }
  5926. }, {
  5927. key: '_appendText',
  5928. value: function _appendText(text, type) {
  5929. var divClass = this.getClassForType(type);
  5930. var textDiv = (0, _jquery2.default)("<div></div>");
  5931. textDiv.addClass(divClass);
  5932. textDiv.append(text);
  5933. textDiv.insertBefore(this.input);
  5934. this.scrollTerm();
  5935. }
  5936. }, {
  5937. key: 'scrollTerm',
  5938. value: function scrollTerm() {
  5939. this.termDiv.animate({
  5940. scrollTop: this.termDiv.prop('scrollHeight')
  5941. }, 0);
  5942. }
  5943. }, {
  5944. key: 'getClassForType',
  5945. value: function getClassForType(type) {
  5946. switch (type) {
  5947. case DOMConsole.USER:
  5948. return "ivprog-term-userText";
  5949. case DOMConsole.INFO:
  5950. return "ivprog-term-info";
  5951. case DOMConsole.ERR:
  5952. return "ivprog-term-error";
  5953. }
  5954. }
  5955. }, {
  5956. key: 'dispose',
  5957. value: function dispose() {
  5958. this.parent.off();
  5959. this.input.off();
  5960. this.input = null;
  5961. this.parent.empty();
  5962. }
  5963. }, {
  5964. key: 'showInput',
  5965. value: function showInput() {
  5966. this.needInput = true;
  5967. this.input.show();
  5968. this.input.focus();
  5969. }
  5970. }, {
  5971. key: 'hideInput',
  5972. value: function hideInput() {
  5973. this.needInput = false;
  5974. this.input.hide();
  5975. }
  5976. }, {
  5977. key: 'requestInput',
  5978. value: function requestInput(callback) {
  5979. var anyKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5980. this.inputListeners.push(callback);
  5981. this.anyKey = anyKey;
  5982. this.showInput();
  5983. }
  5984. }, {
  5985. key: 'sendOutput',
  5986. value: function sendOutput(text) {
  5987. var _this2 = this;
  5988. var output = "" + text;
  5989. output.split("\n").forEach(function (t) {
  5990. t = t.replace(/\t/g, '&#9;');
  5991. _this2.write(t);
  5992. });
  5993. }
  5994. }, {
  5995. key: 'clear',
  5996. value: function clear() {
  5997. this.input.parent().children().not(this.input).remove();
  5998. this.input.val("");
  5999. }
  6000. }]);
  6001. return DOMConsole;
  6002. }();
  6003. /***/ }),
  6004. /***/ "./js/io/input.js":
  6005. /*!************************!*\
  6006. !*** ./js/io/input.js ***!
  6007. \************************/
  6008. /*! no static exports found */
  6009. /***/ (function(module, exports, __webpack_require__) {
  6010. "use strict";
  6011. Object.defineProperty(exports, "__esModule", {
  6012. value: true
  6013. });
  6014. 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; }; }();
  6015. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6016. var Input = exports.Input = function () {
  6017. function Input() {
  6018. _classCallCheck(this, Input);
  6019. }
  6020. _createClass(Input, [{
  6021. key: "requestInput",
  6022. value: function requestInput(callback) {
  6023. throw new Error("Must be implemented");
  6024. }
  6025. }]);
  6026. return Input;
  6027. }();
  6028. /***/ }),
  6029. /***/ "./js/io/output.js":
  6030. /*!*************************!*\
  6031. !*** ./js/io/output.js ***!
  6032. \*************************/
  6033. /*! no static exports found */
  6034. /***/ (function(module, exports, __webpack_require__) {
  6035. "use strict";
  6036. Object.defineProperty(exports, "__esModule", {
  6037. value: true
  6038. });
  6039. 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; }; }();
  6040. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6041. var Output = exports.Output = function () {
  6042. function Output() {
  6043. _classCallCheck(this, Output);
  6044. }
  6045. _createClass(Output, [{
  6046. key: "sendOutput",
  6047. value: function sendOutput(text) {
  6048. throw new Error("Must be implemented");
  6049. }
  6050. }]);
  6051. return Output;
  6052. }();
  6053. /***/ }),
  6054. /***/ "./js/main.js":
  6055. /*!********************!*\
  6056. !*** ./js/main.js ***!
  6057. \********************/
  6058. /*! no static exports found */
  6059. /***/ (function(module, exports, __webpack_require__) {
  6060. "use strict";
  6061. Object.defineProperty(exports, "__esModule", {
  6062. value: true
  6063. });
  6064. exports.i18n = exports.LocalizedStrings = exports.initVisualUI = exports.runner = undefined;
  6065. var _runner = __webpack_require__(/*! ./runner */ "./js/runner.js");
  6066. var _functions = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js");
  6067. var _localizedStringsService = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6068. var _i18nHelper = __webpack_require__(/*! ./services/i18nHelper */ "./js/services/i18nHelper.js");
  6069. var i18n = _i18nHelper.i18nHelper.i18n;
  6070. exports.runner = _runner.runner;
  6071. exports.initVisualUI = _functions.initVisualUI;
  6072. exports.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  6073. exports.i18n = i18n;
  6074. /***/ }),
  6075. /***/ "./js/processor/compatibilityTable.js":
  6076. /*!********************************************!*\
  6077. !*** ./js/processor/compatibilityTable.js ***!
  6078. \********************************************/
  6079. /*! no static exports found */
  6080. /***/ (function(module, exports, __webpack_require__) {
  6081. "use strict";
  6082. Object.defineProperty(exports, "__esModule", {
  6083. value: true
  6084. });
  6085. exports.resultTypeAfterInfixOp = resultTypeAfterInfixOp;
  6086. exports.resultTypeAfterUnaryOp = resultTypeAfterUnaryOp;
  6087. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6088. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6089. var _multiType = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6090. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6091. function buildInfixAddTable() {
  6092. var table = [[], [], [], []];
  6093. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6094. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6095. table[_types.Types.INTEGER.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6096. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6097. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6098. table[_types.Types.REAL.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6099. table[_types.Types.STRING.ord][_types.Types.INTEGER.ord] = _types.Types.STRING;
  6100. table[_types.Types.STRING.ord][_types.Types.REAL.ord] = _types.Types.STRING;
  6101. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6102. table[_types.Types.STRING.ord][_types.Types.BOOLEAN.ord] = _types.Types.STRING;
  6103. return table;
  6104. }
  6105. function buildInfixMultiDivSubTable() {
  6106. var table = [[], [], [], []];
  6107. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6108. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6109. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6110. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6111. return table;
  6112. }
  6113. function buildInfixEqualityInequalityTable() {
  6114. var table = [[], [], [], []];
  6115. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  6116. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  6117. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6118. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6119. return table;
  6120. }
  6121. function buildInfixRelationalTable() {
  6122. var table = [[], [], [], []];
  6123. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  6124. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  6125. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6126. return table;
  6127. }
  6128. function buildInfixAndOrTable() {
  6129. var table = [[], [], [], []];
  6130. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6131. return table;
  6132. }
  6133. function buildInfixModTable() {
  6134. var table = [[], [], [], []];
  6135. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6136. return table;
  6137. }
  6138. function buildUnarySumSubList() {
  6139. var list = [];
  6140. list[_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6141. list[_types.Types.REAL.ord] = _types.Types.REAL;
  6142. return list;
  6143. }
  6144. function buildUnaryNegList() {
  6145. var list = [];
  6146. list[_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6147. return list;
  6148. }
  6149. function buildInfixCompatibilityTable() {
  6150. var compatibilityMap = new WeakMap();
  6151. compatibilityMap.set(_operators.Operators.ADD, buildInfixAddTable());
  6152. compatibilityMap.set(_operators.Operators.SUB, buildInfixMultiDivSubTable());
  6153. compatibilityMap.set(_operators.Operators.MULT, buildInfixMultiDivSubTable());
  6154. compatibilityMap.set(_operators.Operators.DIV, buildInfixMultiDivSubTable());
  6155. compatibilityMap.set(_operators.Operators.EQ, buildInfixEqualityInequalityTable());
  6156. compatibilityMap.set(_operators.Operators.NEQ, buildInfixEqualityInequalityTable());
  6157. compatibilityMap.set(_operators.Operators.GE, buildInfixRelationalTable());
  6158. compatibilityMap.set(_operators.Operators.GT, buildInfixRelationalTable());
  6159. compatibilityMap.set(_operators.Operators.LE, buildInfixRelationalTable());
  6160. compatibilityMap.set(_operators.Operators.LT, buildInfixRelationalTable());
  6161. compatibilityMap.set(_operators.Operators.OR, buildInfixAndOrTable());
  6162. compatibilityMap.set(_operators.Operators.AND, buildInfixAndOrTable());
  6163. compatibilityMap.set(_operators.Operators.MOD, buildInfixModTable());
  6164. return compatibilityMap;
  6165. }
  6166. function buildUnaryCompatibilityTable() {
  6167. var compatibilityMap = new WeakMap();
  6168. compatibilityMap.set(_operators.Operators.ADD, buildUnarySumSubList());
  6169. compatibilityMap.set(_operators.Operators.SUB, buildUnarySumSubList());
  6170. compatibilityMap.set(_operators.Operators.NOT, buildUnaryNegList());
  6171. return compatibilityMap;
  6172. }
  6173. var infixMap = buildInfixCompatibilityTable();
  6174. var unaryMap = buildUnaryCompatibilityTable();
  6175. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  6176. try {
  6177. if (leftExpressionType instanceof _multiType.MultiType && rightExpressionType instanceof _multiType.MultiType) {
  6178. var newMulti = [];
  6179. for (var i = 0; i < leftExpressionType.types.length; i++) {
  6180. var element = leftExpressionType.types[i];
  6181. if (rightExpressionType.types.indexOf(element) !== -1) {
  6182. newMulti.push(element);
  6183. }
  6184. }
  6185. if (newMulti.length <= 0) {
  6186. if (_config.Config.enable_type_casting) {
  6187. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6188. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6189. return new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]);
  6190. }
  6191. }
  6192. }
  6193. return _types.Types.UNDEFINED;
  6194. } else {
  6195. return new _multiType.MultiType(newMulti);
  6196. }
  6197. } else if (leftExpressionType instanceof _multiType.MultiType) {
  6198. if (leftExpressionType.isCompatible(rightExpressionType)) {
  6199. return rightExpressionType;
  6200. } else {
  6201. if (_config.Config.enable_type_casting) {
  6202. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6203. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6204. return rightExpressionType;
  6205. }
  6206. }
  6207. }
  6208. return _types.Types.UNDEFINED;
  6209. }
  6210. } else if (rightExpressionType instanceof _multiType.MultiType) {
  6211. if (rightExpressionType.isCompatible(leftExpressionType)) {
  6212. return leftExpressionType;
  6213. } else {
  6214. if (_config.Config.enable_type_casting) {
  6215. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6216. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6217. return leftExpressionType;
  6218. }
  6219. }
  6220. }
  6221. return _types.Types.UNDEFINED;
  6222. }
  6223. }
  6224. var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
  6225. if (resultType === null || resultType === undefined) {
  6226. if (_config.Config.enable_type_casting) {
  6227. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6228. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6229. if (operator === _operators.Operators.MOD) {
  6230. return _types.Types.INTEGER;
  6231. } else if (operator.ord >= 5 && operator.ord <= 10) {
  6232. return _types.Types.BOOLEAN;
  6233. }
  6234. }
  6235. }
  6236. }
  6237. return _types.Types.UNDEFINED;
  6238. }
  6239. return resultType;
  6240. } catch (e) {
  6241. if (e instanceof TypeError) {
  6242. return _types.Types.UNDEFINED;
  6243. } else {
  6244. throw e;
  6245. }
  6246. }
  6247. }
  6248. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  6249. try {
  6250. if (leftExpressionType instanceof _multiType.MultiType) {
  6251. return leftExpressionType;
  6252. }
  6253. return unaryMap.get(operator)[leftExpressionType.ord];
  6254. } catch (e) {
  6255. if (e instanceof TypeError) {
  6256. return _types.Types.UNDEFINED;
  6257. } else {
  6258. throw e;
  6259. }
  6260. }
  6261. }
  6262. /***/ }),
  6263. /***/ "./js/processor/context.js":
  6264. /*!*********************************!*\
  6265. !*** ./js/processor/context.js ***!
  6266. \*********************************/
  6267. /*! no static exports found */
  6268. /***/ (function(module, exports, __webpack_require__) {
  6269. "use strict";
  6270. Object.defineProperty(exports, "__esModule", {
  6271. value: true
  6272. });
  6273. var Context = exports.Context = Object.freeze({
  6274. BASE: Symbol('context:base'),
  6275. BREAKABLE: Symbol('context:breakable'),
  6276. FUNCTION: Symbol('context:function')
  6277. });
  6278. /***/ }),
  6279. /***/ "./js/processor/definedFunctions.js":
  6280. /*!******************************************!*\
  6281. !*** ./js/processor/definedFunctions.js ***!
  6282. \******************************************/
  6283. /*! no static exports found */
  6284. /***/ (function(module, exports, __webpack_require__) {
  6285. "use strict";
  6286. Object.defineProperty(exports, "__esModule", {
  6287. value: true
  6288. });
  6289. exports.LanguageDefinedFunction = undefined;
  6290. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  6291. var _io = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  6292. var _strings = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  6293. var _arrays = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  6294. var _lang = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  6295. var _math = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  6296. function valueToKey(value, object) {
  6297. for (var key in object) {
  6298. if (object.hasOwnProperty(key)) {
  6299. if (object[key] === value) {
  6300. return key;
  6301. }
  6302. }
  6303. }
  6304. return null;
  6305. }
  6306. function concatObjects() {
  6307. var result = {};
  6308. for (var _len = arguments.length, objs = Array(_len), _key = 0; _key < _len; _key++) {
  6309. objs[_key] = arguments[_key];
  6310. }
  6311. for (var i = 0; i < objs.length; i++) {
  6312. var obj = objs[i];
  6313. for (var key in obj) {
  6314. if (obj.hasOwnProperty(key)) {
  6315. result[key] = obj[key];
  6316. }
  6317. }
  6318. }
  6319. return result;
  6320. }
  6321. var libsObject = {
  6322. $mathLib: {
  6323. $sin: (0, _math.createSinFun)(),
  6324. $cos: (0, _math.createCosFun)(),
  6325. $tan: (0, _math.createTanFun)(),
  6326. $sqrt: (0, _math.createSqrtFun)(),
  6327. $pow: (0, _math.createPowFun)(),
  6328. $log: (0, _math.createLogFun)(),
  6329. $abs: (0, _math.createAbsFun)(),
  6330. $negate: (0, _math.createNegateFun)(),
  6331. $invert: (0, _math.createInvertFun)(),
  6332. $max: (0, _math.createMaxFun)(),
  6333. $min: (0, _math.createMinFun)()
  6334. },
  6335. $ioLib: {
  6336. $read: (0, _io.createInputFun)(),
  6337. $write: (0, _io.createOutputFun)()
  6338. },
  6339. $strLib: {
  6340. $substring: (0, _strings.createSubstringFun)(),
  6341. $length: (0, _strings.createLengthFun)(),
  6342. $uppercase: (0, _strings.createUppercaseFun)(),
  6343. $lowercase: (0, _strings.createLowercaseFun)(),
  6344. $charAt: (0, _strings.createrCharAtFun)()
  6345. },
  6346. $arrayLib: {
  6347. $numElements: (0, _arrays.createNumElementsFun)(),
  6348. $matrixLines: (0, _arrays.createMatrixLinesFun)(),
  6349. $matrixColumns: (0, _arrays.createMatrixColumnsFun)()
  6350. },
  6351. $langLib: {
  6352. $isReal: (0, _lang.createIsRealFun)(),
  6353. $isInt: (0, _lang.createIsIntFun)(),
  6354. $isBool: (0, _lang.createIsBoolFun)(),
  6355. $castReal: (0, _lang.createCastRealFun)(),
  6356. $castInt: (0, _lang.createCastIntFun)(),
  6357. $castBool: (0, _lang.createCastBoolFun)(),
  6358. $castString: (0, _lang.createCastStringFun)()
  6359. }
  6360. };
  6361. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  6362. var LanguageDefinedFunction = exports.LanguageDefinedFunction = Object.freeze({
  6363. getMainFunctionName: function getMainFunctionName() {
  6364. return _languageService.LanguageService.getCurrentLangFuncs().main_function;
  6365. },
  6366. getInternalName: function getInternalName(localName) {
  6367. if (localName.indexOf(".") !== -1) {
  6368. var names = localName.split(".");
  6369. var lib = valueToKey(names[0], _languageService.LanguageService.getCurrentLangLibs());
  6370. var internalName = valueToKey(names[1], _languageService.LanguageService.getCurrentLangFuncs());
  6371. if (lib === null || internalName === null) {
  6372. return null;
  6373. }
  6374. return lib + "." + internalName;
  6375. }
  6376. var funcName = valueToKey(localName, _languageService.LanguageService.getCurrentLangFuncs());
  6377. if (funcName !== null) {
  6378. if (funcsObject[funcName]) {
  6379. return funcName;
  6380. }
  6381. }
  6382. return null;
  6383. },
  6384. getFunction: function getFunction(internalName) {
  6385. if (internalName.indexOf(".") !== -1) {
  6386. var names = internalName.split(".");
  6387. var libName = names[0];
  6388. var funName = names[1];
  6389. return libsObject[libName][funName];
  6390. }
  6391. return funcsObject[internalName];
  6392. },
  6393. getLocalName: function getLocalName(internalName) {
  6394. if (internalName.indexOf(".") !== -1) {
  6395. var names = internalName.split(".");
  6396. var libName = _languageService.LanguageService.getCurrentLangLibs()[names[0]];
  6397. var funName = _languageService.LanguageService.getCurrentLangFuncs()[names[1]];
  6398. return libName + '.' + funName;
  6399. } else if (_languageService.LanguageService.getCurrentLangFuncs()[internalName]) {
  6400. return _languageService.LanguageService.getCurrentLangFuncs()[internalName];
  6401. } else {
  6402. return internalName;
  6403. }
  6404. }
  6405. });
  6406. /***/ }),
  6407. /***/ "./js/processor/error/processorErrorFactory.js":
  6408. /*!*****************************************************!*\
  6409. !*** ./js/processor/error/processorErrorFactory.js ***!
  6410. \*****************************************************/
  6411. /*! no static exports found */
  6412. /***/ (function(module, exports, __webpack_require__) {
  6413. "use strict";
  6414. Object.defineProperty(exports, "__esModule", {
  6415. value: true
  6416. });
  6417. exports.ProcessorErrorFactory = undefined;
  6418. var _runtimeError = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  6419. var _semanticError = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  6420. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6421. var _operators = __webpack_require__(/*! ../../ast/operators */ "./js/ast/operators.js");
  6422. function translateType(type, dim) {
  6423. switch (dim) {
  6424. case 0:
  6425. return _localizedStringsService.LocalizedStrings.getUI(type);
  6426. default:
  6427. var transType = _localizedStringsService.LocalizedStrings.getUI(type);
  6428. if (dim === 1) return _localizedStringsService.LocalizedStrings.getUI("vector_string", [transType]);else return _localizedStringsService.LocalizedStrings.getUI("matrix_string", [transType]);
  6429. }
  6430. }
  6431. function translateOp(op) {
  6432. switch (op.ord) {
  6433. case _operators.Operators.AND.ord:
  6434. case _operators.Operators.OR.ord:
  6435. case _operators.Operators.NOT.ord:
  6436. return _localizedStringsService.LocalizedStrings.getUI(op.value);
  6437. default:
  6438. return op.value;
  6439. }
  6440. }
  6441. var ProcessorErrorFactory = exports.ProcessorErrorFactory = Object.freeze({
  6442. symbol_not_found_full: function symbol_not_found_full(id, sourceInfo) {
  6443. if (sourceInfo) {
  6444. var context = [id, sourceInfo.line, sourceInfo.column];
  6445. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found_full", context));
  6446. } else {
  6447. return ProcessorErrorFactory.symbol_not_found(id);
  6448. }
  6449. },
  6450. symbol_not_found: function symbol_not_found(id) {
  6451. var context = [id];
  6452. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found", context));
  6453. },
  6454. function_missing_full: function function_missing_full(id, sourceInfo) {
  6455. if (sourceInfo) {
  6456. var context = [id, sourceInfo.line, sourceInfo.column];
  6457. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing_full", context));
  6458. } else {
  6459. return ProcessorErrorFactory.function_missing(id);
  6460. }
  6461. },
  6462. function_missing: function function_missing(id) {
  6463. var context = [id];
  6464. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing", context));
  6465. },
  6466. main_missing: function main_missing() {
  6467. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("main_missing"));
  6468. }, // TODO: better urgent error message
  6469. array_dimension_not_int_full: function array_dimension_not_int_full(sourceInfo) {
  6470. if (sourceInfo) {
  6471. var context = [sourceInfo.line];
  6472. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int_full", context));
  6473. } else {
  6474. return ProcessorErrorFactory.array_dimension_not_int();
  6475. }
  6476. },
  6477. array_dimension_not_int: function array_dimension_not_int() {
  6478. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int"));
  6479. },
  6480. unknown_command_full: function unknown_command_full(sourceInfo) {
  6481. if (sourceInfo) {
  6482. var context = [sourceInfo.line];
  6483. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command_full", context));
  6484. } else {
  6485. return ProcessorErrorFactory.unknown_command();
  6486. }
  6487. },
  6488. unknown_command: function unknown_command() {
  6489. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command"));
  6490. },
  6491. incompatible_types_full: function incompatible_types_full(type, dim, sourceInfo) {
  6492. if (sourceInfo) {
  6493. var context = [translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6494. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_full", context));
  6495. } else {
  6496. return ProcessorErrorFactory.incompatible_types(type, dim);
  6497. }
  6498. },
  6499. incompatible_types: function incompatible_types(type, dim) {
  6500. var context = [translateType(type, dim)];
  6501. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types", context));
  6502. },
  6503. incompatible_types_array_full: function incompatible_types_array_full(exp, type, dim, sourceInfo) {
  6504. if (sourceInfo) {
  6505. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6506. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array_full", context));
  6507. } else {
  6508. return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
  6509. }
  6510. },
  6511. incompatible_types_array: function incompatible_types_array(exp, type, dim) {
  6512. var context = [exp, translateType(type, dim)];
  6513. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array", context));
  6514. },
  6515. loop_condition_type_full: function loop_condition_type_full(exp, sourceInfo) {
  6516. if (sourceInfo) {
  6517. var context = [sourceInfo.line, sourceInfo.column, exp];
  6518. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type_full", context));
  6519. } else {
  6520. return ProcessorErrorFactory.loop_condition_type(exp);
  6521. }
  6522. },
  6523. loop_condition_type: function loop_condition_type(exp) {
  6524. var context = [exp];
  6525. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type", context));
  6526. },
  6527. endless_loop_full: function endless_loop_full(sourceInfo) {
  6528. if (sourceInfo) {
  6529. var context = [sourceInfo.line];
  6530. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop_full", context));
  6531. } else {
  6532. return ProcessorErrorFactory.endless_loop();
  6533. }
  6534. },
  6535. endless_loop: function endless_loop() {
  6536. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop"));
  6537. },
  6538. for_condition_type_full: function for_condition_type_full(exp, sourceInfo) {
  6539. if (sourceInfo) {
  6540. var context = [sourceInfo.line, sourceInfo.column, exp];
  6541. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type_full", context));
  6542. } else {
  6543. return ProcessorErrorFactory.for_condition_type(exp);
  6544. }
  6545. },
  6546. for_condition_type: function for_condition_type(exp) {
  6547. var context = [exp];
  6548. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type", context));
  6549. },
  6550. if_condition_type_full: function if_condition_type_full(exp, sourceInfo) {
  6551. if (sourceInfo) {
  6552. var context = [sourceInfo.line, sourceInfo.column, exp];
  6553. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type_full", context));
  6554. } else {
  6555. return ProcessorErrorFactory.if_condition_type(exp);
  6556. }
  6557. },
  6558. if_condition_type: function if_condition_type(exp) {
  6559. var context = [exp];
  6560. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type", context));
  6561. },
  6562. invalid_global_var: function invalid_global_var() {
  6563. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_global_var"));
  6564. },
  6565. not_implemented: function not_implemented(id) {
  6566. var context = [id];
  6567. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("not_implemented", context));
  6568. },
  6569. invalid_case_type_full: function invalid_case_type_full(exp, type, dim, sourceInfo) {
  6570. if (sourceInfo) {
  6571. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6572. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type_full", context));
  6573. } else {
  6574. return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
  6575. }
  6576. },
  6577. invalid_case_type: function invalid_case_type(exp, type, dim) {
  6578. var context = [exp, translateType(type, dim)];
  6579. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type", context));
  6580. },
  6581. void_in_expression_full: function void_in_expression_full(id, sourceInfo) {
  6582. if (sourceInfo) {
  6583. var context = [sourceInfo.line, sourceInfo.column, id];
  6584. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression_full", context));
  6585. } else {
  6586. return ProcessorErrorFactory.void_in_expression(id);
  6587. }
  6588. },
  6589. void_in_expression: function void_in_expression(id) {
  6590. var context = [id];
  6591. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression", context));
  6592. },
  6593. invalid_array_access_full: function invalid_array_access_full(id, sourceInfo) {
  6594. if (sourceInfo) {
  6595. var context = [id, sourceInfo.line, sourceInfo.column];
  6596. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access_full", context));
  6597. } else {
  6598. return ProcessorErrorFactory.invalid_array_access(id);
  6599. }
  6600. },
  6601. invalid_array_access: function invalid_array_access(id) {
  6602. var context = [id];
  6603. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access", context));
  6604. },
  6605. invalid_matrix_access_full: function invalid_matrix_access_full(id, sourceInfo) {
  6606. if (sourceInfo) {
  6607. var context = [id, sourceInfo.line, sourceInfo.column];
  6608. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access_full", context));
  6609. } else {
  6610. return ProcessorErrorFactory.invalid_matrix_access(id);
  6611. }
  6612. },
  6613. invalid_matrix_access: function invalid_matrix_access(id) {
  6614. var context = [id];
  6615. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access", context));
  6616. },
  6617. matrix_column_outbounds_full: function matrix_column_outbounds_full(id, value, columns, sourceInfo) {
  6618. if (sourceInfo) {
  6619. var context = [sourceInfo.line, value, id, columns];
  6620. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds_full", context));
  6621. } else {
  6622. return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
  6623. }
  6624. },
  6625. matrix_column_outbounds: function matrix_column_outbounds(id, value, columns) {
  6626. var context = [value, id, columns];
  6627. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds", context));
  6628. },
  6629. matrix_line_outbounds_full: function matrix_line_outbounds_full(id, value, lines, sourceInfo) {
  6630. if (sourceInfo) {
  6631. var context = [sourceInfo.line, value, id, lines];
  6632. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds_full", context));
  6633. } else {
  6634. return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
  6635. }
  6636. },
  6637. matrix_line_outbounds: function matrix_line_outbounds(id, value, lines) {
  6638. var context = [value, id, lines];
  6639. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds", context));
  6640. },
  6641. vector_line_outbounds_full: function vector_line_outbounds_full(id, value, lines, sourceInfo) {
  6642. if (sourceInfo) {
  6643. var context = [sourceInfo.line, value, id, lines];
  6644. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds_full", context));
  6645. } else {
  6646. return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
  6647. }
  6648. },
  6649. vector_line_outbounds: function vector_line_outbounds(id, value, lines) {
  6650. var context = [value, id, lines];
  6651. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds", context));
  6652. },
  6653. vector_not_matrix_full: function vector_not_matrix_full(id, sourceInfo) {
  6654. if (sourceInfo) {
  6655. var context = [sourceInfo.line, id];
  6656. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix_full", context));
  6657. } else {
  6658. return ProcessorErrorFactory.vector_not_matrix(id);
  6659. }
  6660. },
  6661. vector_not_matrix: function vector_not_matrix(id) {
  6662. var context = [id];
  6663. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix", context));
  6664. },
  6665. function_no_return: function function_no_return(id) {
  6666. var context = [id];
  6667. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_no_return", context));
  6668. },
  6669. invalid_void_return_full: function invalid_void_return_full(id, type, dim, sourceInfo) {
  6670. if (sourceInfo) {
  6671. var context = [sourceInfo.line, id, translateType(type, dim)];
  6672. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6673. } else {
  6674. return ProcessorErrorFactory.invalid_void_return(id, type, dim);
  6675. }
  6676. },
  6677. invalid_void_return: function invalid_void_return(id, type, dim) {
  6678. var context = [id, translateType(type, dim)];
  6679. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6680. },
  6681. invalid_return_type_full: function invalid_return_type_full(id, type, dim, sourceInfo) {
  6682. if (sourceInfo) {
  6683. var context = [sourceInfo.line, id, translateType(type, dim)];
  6684. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type_full", context));
  6685. } else {
  6686. return ProcessorErrorFactory.invalid_return_type(id, type, dim);
  6687. }
  6688. },
  6689. invalid_return_type: function invalid_return_type(id, type, dim) {
  6690. var context = [id, translateType(type, dim)];
  6691. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type", context));
  6692. },
  6693. invalid_parameters_size_full: function invalid_parameters_size_full(id, expected, actual, sourceInfo) {
  6694. if (sourceInfo) {
  6695. var context = [sourceInfo.line, id, expected, actual];
  6696. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size_full", context));
  6697. } else {
  6698. return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
  6699. }
  6700. },
  6701. invalid_parameters_size: function invalid_parameters_size(id, expected, actual) {
  6702. var context = [id, expected, actual];
  6703. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size", context));
  6704. },
  6705. invalid_parameter_type_full: function invalid_parameter_type_full(id, exp, sourceInfo) {
  6706. if (sourceInfo) {
  6707. var context = [exp, id, sourceInfo.line];
  6708. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6709. } else {
  6710. return ProcessorErrorFactory.invalid_parameter_type(id, exp);
  6711. }
  6712. },
  6713. invalid_parameter_type: function invalid_parameter_type(id, exp) {
  6714. var context = [exp, id];
  6715. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6716. },
  6717. invalid_ref_full: function invalid_ref_full(id, exp, sourceInfo) {
  6718. if (sourceInfo) {
  6719. var context = [exp, id, sourceInfo.line];
  6720. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref_full", context));
  6721. } else {
  6722. return ProcessorErrorFactory.invalid_ref(id, exp);
  6723. }
  6724. },
  6725. invalid_ref: function invalid_ref(id, exp) {
  6726. var context = [exp, id];
  6727. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref", context));
  6728. },
  6729. unexpected_break_command_full: function unexpected_break_command_full(sourceInfo) {
  6730. if (sourceInfo) {
  6731. var context = [sourceInfo.line];
  6732. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command_full", context));
  6733. } else {
  6734. return ProcessorErrorFactory.unexpected_break_command();
  6735. }
  6736. },
  6737. unexpected_break_command: function unexpected_break_command() {
  6738. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command"));
  6739. },
  6740. invalid_array_literal_type_full: function invalid_array_literal_type_full(exp, sourceInfo) {
  6741. if (sourceInfo) {
  6742. var context = [sourceInfo.line, exp];
  6743. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type_full", context));
  6744. } else {
  6745. return ProcessorErrorFactory.invalid_array_literal_type(exp);
  6746. }
  6747. },
  6748. invalid_array_literal_type: function invalid_array_literal_type(exp) {
  6749. var context = [exp];
  6750. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type", context));
  6751. },
  6752. invalid_array_literal_line_full: function invalid_array_literal_line_full(expected, actual, sourceInfo) {
  6753. if (sourceInfo) {
  6754. var context = [sourceInfo.line, expected, actual];
  6755. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line_full", context));
  6756. } else {
  6757. return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
  6758. }
  6759. },
  6760. invalid_array_literal_line: function invalid_array_literal_line(expected, actual) {
  6761. var context = [expected, actual];
  6762. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line", context));
  6763. },
  6764. invalid_array_literal_column_full: function invalid_array_literal_column_full(expected, actual, sourceInfo) {
  6765. if (sourceInfo) {
  6766. var context = [sourceInfo.line, expected, actual];
  6767. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column_full", context));
  6768. } else {
  6769. return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
  6770. }
  6771. },
  6772. invalid_array_literal_column: function invalid_array_literal_column(expected, actual) {
  6773. var context = [expected, actual];
  6774. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column", context));
  6775. },
  6776. invalid_unary_op_full: function invalid_unary_op_full(opName, type, dim, sourceInfo) {
  6777. if (sourceInfo) {
  6778. var context = [sourceInfo.line, translateOp(opName), translateType(type, dim)];
  6779. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op_full", context));
  6780. } else {
  6781. return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
  6782. }
  6783. },
  6784. invalid_unary_op: function invalid_unary_op(opName, type, dim) {
  6785. var context = [translateOp(opName), translateType(type, dim)];
  6786. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op", context));
  6787. },
  6788. invalid_infix_op_full: function invalid_infix_op_full(opName, typeLeft, dimLeft, typeRight, dimRight, sourceInfo) {
  6789. if (sourceInfo) {
  6790. var context = [sourceInfo.line, translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6791. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op_full", context));
  6792. } else {
  6793. return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
  6794. }
  6795. },
  6796. invalid_infix_op: function invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight) {
  6797. var context = [translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6798. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op", context));
  6799. },
  6800. array_dimension_not_positive_full: function array_dimension_not_positive_full(sourceInfo) {
  6801. if (sourceInfo) {
  6802. var context = [sourceInfo.line];
  6803. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive_full", context));
  6804. } else {
  6805. return ProcessorErrorFactory.array_dimension_not_positive();
  6806. }
  6807. },
  6808. array_dimension_not_positive: function array_dimension_not_positive() {
  6809. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive"));
  6810. }
  6811. });
  6812. /***/ }),
  6813. /***/ "./js/processor/error/runtimeError.js":
  6814. /*!********************************************!*\
  6815. !*** ./js/processor/error/runtimeError.js ***!
  6816. \********************************************/
  6817. /*! no static exports found */
  6818. /***/ (function(module, exports, __webpack_require__) {
  6819. "use strict";
  6820. Object.defineProperty(exports, "__esModule", {
  6821. value: true
  6822. });
  6823. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6824. 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; }
  6825. 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; }
  6826. var RuntimeError = exports.RuntimeError = function (_Error) {
  6827. _inherits(RuntimeError, _Error);
  6828. function RuntimeError() {
  6829. var _ref;
  6830. _classCallCheck(this, RuntimeError);
  6831. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6832. msg[_key] = arguments[_key];
  6833. }
  6834. var _this = _possibleConstructorReturn(this, (_ref = RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).call.apply(_ref, [this].concat(msg)));
  6835. if (Error.captureStackTrace) Error.captureStackTrace(_this, RuntimeError);
  6836. return _this;
  6837. }
  6838. return RuntimeError;
  6839. }(Error);
  6840. /***/ }),
  6841. /***/ "./js/processor/error/semanticError.js":
  6842. /*!*********************************************!*\
  6843. !*** ./js/processor/error/semanticError.js ***!
  6844. \*********************************************/
  6845. /*! no static exports found */
  6846. /***/ (function(module, exports, __webpack_require__) {
  6847. "use strict";
  6848. Object.defineProperty(exports, "__esModule", {
  6849. value: true
  6850. });
  6851. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6852. 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; }
  6853. 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; }
  6854. var SemanticError = exports.SemanticError = function (_Error) {
  6855. _inherits(SemanticError, _Error);
  6856. function SemanticError() {
  6857. var _ref;
  6858. _classCallCheck(this, SemanticError);
  6859. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6860. msg[_key] = arguments[_key];
  6861. }
  6862. var _this = _possibleConstructorReturn(this, (_ref = SemanticError.__proto__ || Object.getPrototypeOf(SemanticError)).call.apply(_ref, [this].concat(msg)));
  6863. if (Error.captureStackTrace) Error.captureStackTrace(_this, SemanticError);
  6864. return _this;
  6865. }
  6866. return SemanticError;
  6867. }(Error);
  6868. /***/ }),
  6869. /***/ "./js/processor/ivprogProcessor.js":
  6870. /*!*****************************************!*\
  6871. !*** ./js/processor/ivprogProcessor.js ***!
  6872. \*****************************************/
  6873. /*! no static exports found */
  6874. /***/ (function(module, exports, __webpack_require__) {
  6875. "use strict";
  6876. Object.defineProperty(exports, "__esModule", {
  6877. value: true
  6878. });
  6879. exports.IVProgProcessor = undefined;
  6880. 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; }; }();
  6881. var _store = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js");
  6882. var _storeObject = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js");
  6883. var _storeObjectArray = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  6884. var _storeObjectRef = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js");
  6885. var _modes = __webpack_require__(/*! ./modes */ "./js/processor/modes.js");
  6886. var _context = __webpack_require__(/*! ./context */ "./js/processor/context.js");
  6887. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6888. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6889. var _definedFunctions = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  6890. var _compatibilityTable = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js");
  6891. var _commands = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  6892. var Commands = _interopRequireWildcard(_commands);
  6893. var _expressions = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  6894. var Expressions = _interopRequireWildcard(_expressions);
  6895. var _storeObjectArrayAddress = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js");
  6896. var _storeObjectArrayAddressRef = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js");
  6897. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6898. var _parsers = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6899. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6900. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  6901. var _decimal2 = _interopRequireDefault(_decimal);
  6902. var _processorErrorFactory = __webpack_require__(/*! ./error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  6903. var _runtimeError = __webpack_require__(/*! ./error/runtimeError */ "./js/processor/error/runtimeError.js");
  6904. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6905. 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; } }
  6906. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6907. var IVProgProcessor = exports.IVProgProcessor = function () {
  6908. _createClass(IVProgProcessor, null, [{
  6909. key: 'LOOP_TIMEOUT',
  6910. get: function get() {
  6911. return _config.Config.loopTimeout;
  6912. },
  6913. set: function set(ms) {
  6914. _config.Config.setConfig({ loopTimeout: ms });
  6915. }
  6916. }, {
  6917. key: 'MAIN_INTERNAL_ID',
  6918. get: function get() {
  6919. return "$main";
  6920. }
  6921. }]);
  6922. function IVProgProcessor(ast) {
  6923. _classCallCheck(this, IVProgProcessor);
  6924. this.ast = ast;
  6925. this.globalStore = new _store.Store("$global");
  6926. this.stores = [this.globalStore];
  6927. this.context = [_context.Context.BASE];
  6928. this.input = null;
  6929. this.forceKill = false;
  6930. this.loopTimers = [];
  6931. this.output = null;
  6932. }
  6933. _createClass(IVProgProcessor, [{
  6934. key: 'registerInput',
  6935. value: function registerInput(input) {
  6936. if (this.input !== null) this.input = null;
  6937. this.input = input;
  6938. }
  6939. }, {
  6940. key: 'registerOutput',
  6941. value: function registerOutput(output) {
  6942. if (this.output !== null) this.output = null;
  6943. this.output = output;
  6944. }
  6945. }, {
  6946. key: 'checkContext',
  6947. value: function checkContext(context) {
  6948. return this.context[this.context.length - 1] === context;
  6949. }
  6950. }, {
  6951. key: 'ignoreSwitchCases',
  6952. value: function ignoreSwitchCases(store) {
  6953. if (store.mode === _modes.Modes.RETURN) {
  6954. return true;
  6955. } else if (store.mode === _modes.Modes.BREAK) {
  6956. return true;
  6957. } else {
  6958. return false;
  6959. }
  6960. }
  6961. }, {
  6962. key: 'prepareState',
  6963. value: function prepareState() {
  6964. if (this.stores !== null) {
  6965. for (var i = 0; i < this.stores.length; i++) {
  6966. delete this.stores[i];
  6967. }
  6968. this.stores = null;
  6969. }
  6970. if (this.globalStore !== null) this.globalStore = null;
  6971. this.globalStore = new _store.Store("$global");
  6972. this.stores = [this.globalStore];
  6973. this.context = [_context.Context.BASE];
  6974. }
  6975. }, {
  6976. key: 'interpretAST',
  6977. value: function interpretAST() {
  6978. var _this = this;
  6979. this.prepareState();
  6980. return this.initGlobal().then(function (_) {
  6981. var mainFunc = _this.findMainFunction();
  6982. if (mainFunc === null) {
  6983. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  6984. }
  6985. return _this.runFunction(mainFunc, [], _this.globalStore);
  6986. });
  6987. }
  6988. }, {
  6989. key: 'initGlobal',
  6990. value: function initGlobal() {
  6991. if (!this.checkContext(_context.Context.BASE)) {
  6992. throw _processorErrorFactory.ProcessorErrorFactory.invalid_global_var();
  6993. }
  6994. return this.executeCommands(this.globalStore, this.ast.global);
  6995. }
  6996. }, {
  6997. key: 'findMainFunction',
  6998. value: function findMainFunction() {
  6999. return this.ast.functions.find(function (v) {
  7000. return v.isMain;
  7001. });
  7002. }
  7003. }, {
  7004. key: 'findFunction',
  7005. value: function findFunction(name) {
  7006. if (name.match(/^\$.+$/)) {
  7007. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  7008. if (!!!fun) {
  7009. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  7010. }
  7011. return fun;
  7012. } else {
  7013. var val = this.ast.functions.find(function (v) {
  7014. return v.name === name;
  7015. });
  7016. if (!!!val) {
  7017. // TODO: better error message;
  7018. throw _processorErrorFactory.ProcessorErrorFactory.function_missing(name);
  7019. }
  7020. return val;
  7021. }
  7022. }
  7023. }, {
  7024. key: 'runFunction',
  7025. value: function runFunction(func, actualParameters, store) {
  7026. var _this2 = this;
  7027. var funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
  7028. var funcStore = new _store.Store(funcName);
  7029. funcStore.extendStore(this.globalStore);
  7030. var returnStoreObject = null;
  7031. if (func.returnType instanceof _compoundType.CompoundType) {
  7032. if (func.returnType.dimensions > 1) {
  7033. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, -1, [[]]);
  7034. } else {
  7035. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, null, []);
  7036. }
  7037. } else {
  7038. returnStoreObject = new _storeObject.StoreObject(func.returnType, null);
  7039. }
  7040. funcStore.insertStore('$', returnStoreObject);
  7041. var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  7042. return newFuncStore$.then(function (sto) {
  7043. _this2.context.push(_context.Context.FUNCTION);
  7044. _this2.stores.push(sto);
  7045. return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) {
  7046. return _this2.executeCommands(stoWithVars, func.commands);
  7047. }).then(function (finalSto) {
  7048. _this2.stores.pop();
  7049. _this2.context.pop();
  7050. return finalSto;
  7051. });
  7052. });
  7053. }
  7054. }, {
  7055. key: 'associateParameters',
  7056. value: function associateParameters(formalList, actualList, callerStore, calleeStore) {
  7057. var _this3 = this;
  7058. var funcName = calleeStore.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : calleeStore.name;
  7059. if (formalList.length != actualList.length) {
  7060. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size(funcName, formalList.length, actualList.length);
  7061. }
  7062. var promises$ = actualList.map(function (actualParameter) {
  7063. return _this3.evaluateExpression(callerStore, actualParameter);
  7064. });
  7065. return Promise.all(promises$).then(function (values) {
  7066. for (var i = 0; i < values.length; i++) {
  7067. var stoObj = values[i];
  7068. var exp = actualList[i];
  7069. var shouldTypeCast = false;
  7070. var formalParameter = formalList[i];
  7071. if (!formalParameter.type.isCompatible(stoObj.type)) {
  7072. if (_config.Config.enable_type_casting && !formalParameter.byRef && _store.Store.canImplicitTypeCast(formalParameter.type, stoObj.type)) {
  7073. shouldTypeCast = true;
  7074. } else {
  7075. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type(funcName, exp.toString());
  7076. }
  7077. }
  7078. if (formalParameter.byRef && !stoObj.inStore) {
  7079. throw _processorErrorFactory.ProcessorErrorFactory.invalid_ref(funcName, exp.toString());
  7080. }
  7081. if (formalParameter.byRef) {
  7082. var ref = null;
  7083. if (stoObj instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7084. ref = new _storeObjectArrayAddressRef.StoreObjectArrayAddressRef(stoObj);
  7085. } else {
  7086. ref = new _storeObjectRef.StoreObjectRef(stoObj.id, callerStore);
  7087. }
  7088. calleeStore.insertStore(formalParameter.id, ref);
  7089. } else {
  7090. var realValue = _this3.parseStoreObjectValue(stoObj);
  7091. if (shouldTypeCast) {
  7092. realValue = _store.Store.doImplicitCasting(formalParameter.type, realValue);
  7093. }
  7094. calleeStore.insertStore(formalParameter.id, realValue);
  7095. }
  7096. }
  7097. return calleeStore;
  7098. });
  7099. }
  7100. }, {
  7101. key: 'executeCommands',
  7102. value: function executeCommands(store, cmds) {
  7103. // helper to partially apply a function, in this case executeCommand
  7104. var outerRef = this;
  7105. var partial = function partial(fun, cmd) {
  7106. return function (sto) {
  7107. return fun(sto, cmd);
  7108. };
  7109. };
  7110. return cmds.reduce(function (lastCommand, next) {
  7111. var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
  7112. return lastCommand.then(nextCommand);
  7113. }, Promise.resolve(store));
  7114. }
  7115. }, {
  7116. key: 'executeCommand',
  7117. value: function executeCommand(store, cmd) {
  7118. if (this.forceKill) {
  7119. return Promise.reject("FORCED_KILL!");
  7120. } else if (store.mode === _modes.Modes.PAUSE) {
  7121. return Promise.resolve(this.executeCommand(store, cmd));
  7122. } else if (store.mode === _modes.Modes.RETURN) {
  7123. return Promise.resolve(store);
  7124. } else if (this.checkContext(_context.Context.BREAKABLE) && store.mode === _modes.Modes.BREAK) {
  7125. return Promise.resolve(store);
  7126. }
  7127. if (cmd instanceof Commands.Declaration) {
  7128. return this.executeDeclaration(store, cmd);
  7129. } else if (cmd instanceof Commands.ArrayIndexAssign) {
  7130. return this.executeArrayIndexAssign(store, cmd);
  7131. } else if (cmd instanceof Commands.Assign) {
  7132. return this.executeAssign(store, cmd);
  7133. } else if (cmd instanceof Commands.Break) {
  7134. return this.executeBreak(store, cmd);
  7135. } else if (cmd instanceof Commands.Return) {
  7136. return this.executeReturn(store, cmd);
  7137. } else if (cmd instanceof Commands.IfThenElse) {
  7138. return this.executeIfThenElse(store, cmd);
  7139. } else if (cmd instanceof Commands.DoWhile) {
  7140. return this.executeDoWhile(store, cmd);
  7141. } else if (cmd instanceof Commands.While) {
  7142. return this.executeWhile(store, cmd);
  7143. } else if (cmd instanceof Commands.For) {
  7144. return this.executeFor(store, cmd);
  7145. } else if (cmd instanceof Commands.Switch) {
  7146. return this.executeSwitch(store, cmd);
  7147. } else if (cmd instanceof Expressions.FunctionCall) {
  7148. return this.executeFunctionCall(store, cmd);
  7149. } else if (cmd instanceof Commands.SysCall) {
  7150. return this.executeSysCall(store, cmd);
  7151. } else {
  7152. throw _processorErrorFactory.ProcessorErrorFactory.unknown_command(cmd.sourceInfo);
  7153. }
  7154. }
  7155. }, {
  7156. key: 'executeSysCall',
  7157. value: function executeSysCall(store, cmd) {
  7158. var func = cmd.langFunc.bind(this);
  7159. return func(store, cmd);
  7160. }
  7161. }, {
  7162. key: 'executeFunctionCall',
  7163. value: function executeFunctionCall(store, cmd) {
  7164. var func = null;
  7165. if (cmd.isMainCall) {
  7166. func = this.findMainFunction();
  7167. } else {
  7168. func = this.findFunction(cmd.id);
  7169. }
  7170. return this.runFunction(func, cmd.actualParameters, store).then(function (sto) {
  7171. if (!_types.Types.VOID.isCompatible(func.returnType) && sto.mode !== _modes.Modes.RETURN) {
  7172. var funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : func.name;
  7173. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.function_no_return(funcName));
  7174. } else {
  7175. return store;
  7176. }
  7177. });
  7178. }
  7179. }, {
  7180. key: 'executeSwitch',
  7181. value: function executeSwitch(store, cmd) {
  7182. var _this4 = this;
  7183. this.context.push(_context.Context.BREAKABLE);
  7184. var auxCaseFun = function auxCaseFun(promise, switchExp, aCase) {
  7185. return promise.then(function (result) {
  7186. var sto = result.sto;
  7187. if (_this4.ignoreSwitchCases(sto)) {
  7188. return Promise.resolve(result);
  7189. } else if (result.wasTrue || aCase.isDefault) {
  7190. var $newSto = _this4.executeCommands(result.sto, aCase.commands);
  7191. return $newSto.then(function (nSto) {
  7192. return Promise.resolve({ wasTrue: true, sto: nSto });
  7193. });
  7194. } else {
  7195. var $value = _this4.evaluateExpression(sto, new Expressions.InfixApp(_operators.Operators.EQ, switchExp, aCase.expression));
  7196. return $value.then(function (vl) {
  7197. if (vl.value) {
  7198. var _$newSto = _this4.executeCommands(result.sto, aCase.commands);
  7199. return _$newSto.then(function (nSto) {
  7200. return Promise.resolve({ wasTrue: true, sto: nSto });
  7201. });
  7202. } else {
  7203. return Promise.resolve({ wasTrue: false, sto: sto });
  7204. }
  7205. });
  7206. }
  7207. });
  7208. };
  7209. try {
  7210. var breakLoop = false;
  7211. var $result = Promise.resolve({ wasTrue: false, sto: store });
  7212. for (var index = 0; index < cmd.cases.length && !breakLoop; index++) {
  7213. var aCase = cmd.cases[index];
  7214. $result = auxCaseFun($result, cmd.expression, aCase);
  7215. $result.then(function (r) {
  7216. return breakLoop = _this4.ignoreSwitchCases(r.sto);
  7217. });
  7218. }
  7219. return $result.then(function (r) {
  7220. _this4.context.pop();
  7221. if (r.sto.mode === _modes.Modes.BREAK) {
  7222. r.sto.mode = _modes.Modes.RUN;
  7223. }
  7224. return r.sto;
  7225. });
  7226. } catch (error) {
  7227. return Promise.reject(error);
  7228. }
  7229. }
  7230. }, {
  7231. key: 'executeFor',
  7232. value: function executeFor(store, cmd) {
  7233. try {
  7234. //BEGIN for -> while rewrite
  7235. var initCmd = cmd.assignment;
  7236. var condition = cmd.condition;
  7237. var increment = cmd.increment;
  7238. var whileBlock = new Commands.CommandBlock([], cmd.commands.concat(increment));
  7239. var forAsWhile = new Commands.While(condition, whileBlock);
  7240. forAsWhile.sourceInfo = cmd.sourceInfo;
  7241. //END for -> while rewrite
  7242. var newCmdList = [initCmd, forAsWhile];
  7243. return this.executeCommands(store, newCmdList);
  7244. } catch (error) {
  7245. return Promise.reject(error);
  7246. }
  7247. }
  7248. }, {
  7249. key: 'executeDoWhile',
  7250. value: function executeDoWhile(store, cmd) {
  7251. var outerRef = this;
  7252. try {
  7253. outerRef.loopTimers.push(Date.now());
  7254. outerRef.context.push(_context.Context.BREAKABLE);
  7255. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7256. return $newStore.then(function (sto) {
  7257. if (sto.mode === _modes.Modes.BREAK) {
  7258. outerRef.context.pop();
  7259. sto.mode = _modes.Modes.RUN;
  7260. outerRef.loopTimers.pop();
  7261. return sto;
  7262. }
  7263. var $value = outerRef.evaluateExpression(sto, cmd.expression);
  7264. return $value.then(function (vl) {
  7265. if (!vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7266. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  7267. }
  7268. if (vl.value) {
  7269. outerRef.context.pop();
  7270. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7271. var time = outerRef.loopTimers[i];
  7272. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7273. outerRef.forceKill = true;
  7274. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7275. }
  7276. }
  7277. return outerRef.executeCommand(sto, cmd);
  7278. } else {
  7279. outerRef.context.pop();
  7280. outerRef.loopTimers.pop();
  7281. return sto;
  7282. }
  7283. });
  7284. });
  7285. } catch (error) {
  7286. return Promise.reject(error);
  7287. }
  7288. }
  7289. }, {
  7290. key: 'executeWhile',
  7291. value: function executeWhile(store, cmd) {
  7292. var outerRef = this;
  7293. try {
  7294. outerRef.loopTimers.push(Date.now());
  7295. outerRef.context.push(_context.Context.BREAKABLE);
  7296. var $value = outerRef.evaluateExpression(store, cmd.expression);
  7297. return $value.then(function (vl) {
  7298. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7299. if (vl.value) {
  7300. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7301. return $newStore.then(function (sto) {
  7302. outerRef.context.pop();
  7303. if (sto.mode === _modes.Modes.BREAK) {
  7304. outerRef.loopTimers.pop();
  7305. sto.mode = _modes.Modes.RUN;
  7306. return sto;
  7307. }
  7308. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7309. var time = outerRef.loopTimers[i];
  7310. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7311. outerRef.forceKill = true;
  7312. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7313. }
  7314. }
  7315. return outerRef.executeCommand(sto, cmd);
  7316. });
  7317. } else {
  7318. outerRef.context.pop();
  7319. outerRef.loopTimers.pop();
  7320. return store;
  7321. }
  7322. } else {
  7323. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.expression.toString(), cmd.sourceInfo));
  7324. }
  7325. });
  7326. } catch (error) {
  7327. return Promise.reject(error);
  7328. }
  7329. }
  7330. }, {
  7331. key: 'executeIfThenElse',
  7332. value: function executeIfThenElse(store, cmd) {
  7333. var _this5 = this;
  7334. try {
  7335. var $value = this.evaluateExpression(store, cmd.condition);
  7336. return $value.then(function (vl) {
  7337. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7338. if (vl.value) {
  7339. return _this5.executeCommands(store, cmd.ifTrue.commands);
  7340. } else if (cmd.ifFalse !== null) {
  7341. if (cmd.ifFalse instanceof Commands.IfThenElse) {
  7342. return _this5.executeCommand(store, cmd.ifFalse);
  7343. } else {
  7344. return _this5.executeCommands(store, cmd.ifFalse.commands);
  7345. }
  7346. } else {
  7347. return Promise.resolve(store);
  7348. }
  7349. } else {
  7350. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.condition.toString(), cmd.sourceInfo));
  7351. }
  7352. });
  7353. } catch (error) {
  7354. return Promise.reject(error);
  7355. }
  7356. }
  7357. }, {
  7358. key: 'executeReturn',
  7359. value: function executeReturn(store, cmd) {
  7360. var _this6 = this;
  7361. try {
  7362. var funcType = store.applyStore('$').type;
  7363. var $value = this.evaluateExpression(store, cmd.expression);
  7364. var funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : store.name;
  7365. return $value.then(function (vl) {
  7366. if (vl === null && funcType.isCompatible(_types.Types.VOID)) {
  7367. return Promise.resolve(store);
  7368. }
  7369. if (vl === null || !funcType.isCompatible(vl.type)) {
  7370. var stringInfo = funcType.stringInfo();
  7371. var info = stringInfo[0];
  7372. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo));
  7373. } else {
  7374. var realValue = _this6.parseStoreObjectValue(vl);
  7375. store.updateStore('$', realValue);
  7376. store.mode = _modes.Modes.RETURN;
  7377. return Promise.resolve(store);
  7378. }
  7379. });
  7380. } catch (error) {
  7381. return Promise.reject(error);
  7382. }
  7383. }
  7384. }, {
  7385. key: 'executeBreak',
  7386. value: function executeBreak(store, cmd) {
  7387. if (this.checkContext(_context.Context.BREAKABLE)) {
  7388. store.mode = _modes.Modes.BREAK;
  7389. return Promise.resolve(store);
  7390. } else {
  7391. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.unexpected_break_command_full(cmd.sourceInfo));
  7392. }
  7393. }
  7394. }, {
  7395. key: 'executeAssign',
  7396. value: function executeAssign(store, cmd) {
  7397. var _this7 = this;
  7398. try {
  7399. var inStore = store.applyStore(cmd.id);
  7400. var $value = this.evaluateExpression(store, cmd.expression);
  7401. return $value.then(function (vl) {
  7402. var realValue = _this7.parseStoreObjectValue(vl);
  7403. if (!inStore.type.isCompatible(realValue.type)) {
  7404. if (_config.Config.enable_type_casting && _store.Store.canImplicitTypeCast(inStore.type, vl.type)) {
  7405. realValue = _store.Store.doImplicitCasting(inStore.type, realValue);
  7406. } else {
  7407. var stringInfo = inStore.type.stringInfo();
  7408. var info = stringInfo[0];
  7409. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7410. }
  7411. }
  7412. store.updateStore(cmd.id, realValue);
  7413. return store;
  7414. });
  7415. } catch (error) {
  7416. return Promise.reject(error);
  7417. }
  7418. }
  7419. }, {
  7420. key: 'executeArrayIndexAssign',
  7421. value: function executeArrayIndexAssign(store, cmd) {
  7422. var _this8 = this;
  7423. var mustBeArray = store.applyStore(cmd.id);
  7424. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7425. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo));
  7426. }
  7427. var line$ = this.evaluateExpression(store, cmd.line);
  7428. var column$ = this.evaluateExpression(store, cmd.column);
  7429. var value$ = this.evaluateExpression(store, cmd.expression);
  7430. return Promise.all([line$, column$, value$]).then(function (results) {
  7431. var lineSO = results[0];
  7432. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7433. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7434. }
  7435. var line = lineSO.number;
  7436. var columnSO = results[1];
  7437. var column = null;
  7438. if (columnSO !== null) {
  7439. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7440. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7441. }
  7442. column = columnSO.number;
  7443. }
  7444. var value = _this8.parseStoreObjectValue(results[2]);
  7445. if (line >= mustBeArray.lines) {
  7446. if (mustBeArray.isVector) {
  7447. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7448. } else {
  7449. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7450. }
  7451. } else if (line < 0) {
  7452. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7453. }
  7454. if (column !== null && mustBeArray.columns === null) {
  7455. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(cmd.id, cmd.sourceInfo));
  7456. }
  7457. if (column !== null) {
  7458. if (column >= mustBeArray.columns) {
  7459. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(cmd.id, column, mustBeArray.columns, cmd.sourceInfo));
  7460. } else if (column < 0) {
  7461. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7462. }
  7463. }
  7464. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), mustBeArray);
  7465. if (column !== null) {
  7466. if (value.type instanceof _compoundType.CompoundType || !newArray.type.canAccept(value.type)) {
  7467. var type = mustBeArray.type.innerType;
  7468. var stringInfo = type.stringInfo();
  7469. var info = stringInfo[0];
  7470. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7471. }
  7472. newArray.value[line].value[column] = value;
  7473. store.updateStore(cmd.id, newArray);
  7474. } else {
  7475. if (mustBeArray.columns !== null && value.type instanceof _compoundType.CompoundType || !newArray.type.canAccept(value.type)) {
  7476. var _type = mustBeArray.type;
  7477. var _stringInfo = _type.stringInfo();
  7478. var _info = _stringInfo[0];
  7479. var exp = cmd.expression.toString();
  7480. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(exp, _info.type, _info.dim - 1, cmd.sourceInfo));
  7481. }
  7482. newArray.value[line] = value;
  7483. store.updateStore(cmd.id, newArray);
  7484. }
  7485. return store;
  7486. });
  7487. }
  7488. }, {
  7489. key: 'executeDeclaration',
  7490. value: function executeDeclaration(store, cmd) {
  7491. try {
  7492. var $value = this.evaluateExpression(store, cmd.initial);
  7493. if (cmd instanceof Commands.ArrayDeclaration) {
  7494. var $lines = this.evaluateExpression(store, cmd.lines);
  7495. var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns);
  7496. return Promise.all([$lines, $columns, $value]).then(function (values) {
  7497. var lineSO = values[0];
  7498. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7499. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7500. }
  7501. var line = lineSO.number;
  7502. if (line < 0) {
  7503. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7504. }
  7505. var columnSO = values[1];
  7506. var column = null;
  7507. if (columnSO !== null) {
  7508. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7509. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7510. }
  7511. column = columnSO.number;
  7512. if (column < 0) {
  7513. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7514. }
  7515. }
  7516. var value = values[2];
  7517. var temp = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, null);
  7518. store.insertStore(cmd.id, temp);
  7519. var realValue = value;
  7520. if (value !== null) {
  7521. if (value instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7522. if (value.type instanceof _compoundType.CompoundType) {
  7523. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), value.refValue);
  7524. } else {
  7525. realValue = Object.assign(new _storeObject.StoreObject(null, null), value.refValue);
  7526. }
  7527. }
  7528. } else {
  7529. realValue = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, []);
  7530. if (column !== null) {
  7531. for (var i = 0; i < line; i++) {
  7532. realValue.value.push(new _storeObjectArray.StoreObjectArray(new _compoundType.CompoundType(cmd.type.innerType, 1), column, null, []));
  7533. }
  7534. }
  7535. }
  7536. realValue.readOnly = cmd.isConst;
  7537. store.updateStore(cmd.id, realValue);
  7538. return store;
  7539. });
  7540. } else {
  7541. var temp = new _storeObject.StoreObject(cmd.type, null);
  7542. store.insertStore(cmd.id, temp);
  7543. return $value.then(function (vl) {
  7544. var realValue = vl;
  7545. if (vl !== null) {
  7546. if (!vl.type.isCompatible(cmd.type)) {
  7547. if (_config.Config.enable_type_casting && _store.Store.canImplicitTypeCast(cmd.type, vl.type)) {
  7548. realValue = _store.Store.doImplicitCasting(cmd.type, realValue);
  7549. } else {
  7550. var stringInfo = typeInfo.type.stringInfo();
  7551. var info = stringInfo[0];
  7552. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7553. }
  7554. }
  7555. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7556. if (vl.type instanceof _compoundType.CompoundType) {
  7557. return Promise.reject(new Error("!!!Critical Error: Compatibility check failed, a Type accepts a CompoundType"));
  7558. } else {
  7559. realValue = Object.assign(new _storeObject.StoreObject(null, null), vl.refValue);
  7560. }
  7561. }
  7562. } else {
  7563. realValue = new _storeObject.StoreObject(cmd.type, 0);
  7564. }
  7565. realValue.readOnly = cmd.isConst;
  7566. store.updateStore(cmd.id, realValue);
  7567. return store;
  7568. });
  7569. }
  7570. } catch (e) {
  7571. return Promise.reject(e);
  7572. }
  7573. }
  7574. }, {
  7575. key: 'evaluateExpression',
  7576. value: function evaluateExpression(store, exp) {
  7577. if (exp instanceof Expressions.UnaryApp) {
  7578. return this.evaluateUnaryApp(store, exp);
  7579. } else if (exp instanceof Expressions.InfixApp) {
  7580. return this.evaluateInfixApp(store, exp);
  7581. } else if (exp instanceof Expressions.ArrayAccess) {
  7582. return this.evaluateArrayAccess(store, exp);
  7583. } else if (exp instanceof Expressions.VariableLiteral) {
  7584. return this.evaluateVariableLiteral(store, exp);
  7585. } else if (exp instanceof Expressions.IntLiteral) {
  7586. return this.evaluateLiteral(store, exp);
  7587. } else if (exp instanceof Expressions.RealLiteral) {
  7588. return this.evaluateLiteral(store, exp);
  7589. } else if (exp instanceof Expressions.BoolLiteral) {
  7590. return this.evaluateLiteral(store, exp);
  7591. } else if (exp instanceof Expressions.StringLiteral) {
  7592. return this.evaluateLiteral(store, exp);
  7593. } else if (exp instanceof Expressions.ArrayLiteral) {
  7594. return this.evaluateArrayLiteral(store, exp);
  7595. } else if (exp instanceof Expressions.FunctionCall) {
  7596. return this.evaluateFunctionCall(store, exp);
  7597. }
  7598. return Promise.resolve(null);
  7599. }
  7600. }, {
  7601. key: 'evaluateFunctionCall',
  7602. value: function evaluateFunctionCall(store, exp) {
  7603. if (exp.isMainCall) {
  7604. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), exp.sourceInfo));
  7605. }
  7606. var func = this.findFunction(exp.id);
  7607. if (_types.Types.VOID.isCompatible(func.returnType)) {
  7608. // TODO: better error message
  7609. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(exp.id, exp.sourceInfo));
  7610. }
  7611. var $newStore = this.runFunction(func, exp.actualParameters, store);
  7612. return $newStore.then(function (sto) {
  7613. if (sto.mode !== _modes.Modes.RETURN) {
  7614. return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id));
  7615. }
  7616. var val = sto.applyStore('$');
  7617. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7618. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null, null), val));
  7619. } else {
  7620. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7621. }
  7622. });
  7623. }
  7624. }, {
  7625. key: 'evaluateArrayLiteral',
  7626. value: function evaluateArrayLiteral(store, exp) {
  7627. var errorHelperFunction = function errorHelperFunction(validationResult, exp) {
  7628. var errorCode = validationResult[0];
  7629. switch (errorCode) {
  7630. case _storeObjectArray.StoreObjectArray.WRONG_COLUMN_NUMBER:
  7631. {
  7632. var columnValue = validationResult[1];
  7633. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_column_full(arr.columns, columnValue, exp.sourceInfo));
  7634. }
  7635. case _storeObjectArray.StoreObjectArray.WRONG_LINE_NUMBER:
  7636. {
  7637. var lineValue = validationResult[1];
  7638. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_line_full(arr.lines, lineValue, exp.sourceInfo));
  7639. }
  7640. case _storeObjectArray.StoreObjectArray.WRONG_TYPE:
  7641. {
  7642. var line = null;
  7643. var strExp = null;
  7644. if (validationResult.length > 2) {
  7645. line = validationResult[1];
  7646. var column = validationResult[2];
  7647. strExp = exp.value[line].value[column].toString();
  7648. } else {
  7649. line = validationResult[1];
  7650. strExp = exp.value[line].toString();
  7651. }
  7652. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_type_full(strExp, exp.sourceInfo));
  7653. }
  7654. }
  7655. };
  7656. if (!exp.isVector) {
  7657. var $matrix = this.evaluateMatrix(store, exp.value);
  7658. return $matrix.then(function (list) {
  7659. var type = new _compoundType.CompoundType(list[0].type.innerType, 2);
  7660. var arr = new _storeObjectArray.StoreObjectArray(type, list.length, list[0].lines, list);
  7661. var checkResult = arr.isValid;
  7662. if (checkResult.length == 0) return Promise.resolve(arr);else {
  7663. return errorHelperFunction(checkResult, exp);
  7664. }
  7665. });
  7666. } else {
  7667. return this.evaluateVector(store, exp.value).then(function (list) {
  7668. var type = new _compoundType.CompoundType(list[0].type, 1);
  7669. var stoArray = new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7670. var checkResult = stoArray.isValid;
  7671. if (checkResult.length == 0) return Promise.resolve(stoArray);else {
  7672. return errorHelperFunction(checkResult, exp);
  7673. }
  7674. });
  7675. }
  7676. }
  7677. }, {
  7678. key: 'evaluateVector',
  7679. value: function evaluateVector(store, exps) {
  7680. var _this9 = this;
  7681. return Promise.all(exps.map(function (exp) {
  7682. return _this9.evaluateExpression(store, exp);
  7683. }));
  7684. }
  7685. }, {
  7686. key: 'evaluateMatrix',
  7687. value: function evaluateMatrix(store, exps) {
  7688. var _this10 = this;
  7689. return Promise.all(exps.map(function (vector) {
  7690. var $vector = _this10.evaluateVector(store, vector.value);
  7691. return $vector.then(function (list) {
  7692. var type = new _compoundType.CompoundType(list[0].type, 1);
  7693. return new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7694. });
  7695. }));
  7696. }
  7697. }, {
  7698. key: 'evaluateLiteral',
  7699. value: function evaluateLiteral(_, exp) {
  7700. return Promise.resolve(new _storeObject.StoreObject(exp.type, exp.value));
  7701. }
  7702. }, {
  7703. key: 'evaluateVariableLiteral',
  7704. value: function evaluateVariableLiteral(store, exp) {
  7705. try {
  7706. var val = store.applyStore(exp.id);
  7707. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7708. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null), val));
  7709. } else {
  7710. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7711. }
  7712. } catch (error) {
  7713. return Promise.reject(error);
  7714. }
  7715. }
  7716. }, {
  7717. key: 'evaluateArrayAccess',
  7718. value: function evaluateArrayAccess(store, exp) {
  7719. var mustBeArray = store.applyStore(exp.id);
  7720. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7721. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(exp.id, exp.sourceInfo));
  7722. }
  7723. var $line = this.evaluateExpression(store, exp.line);
  7724. var $column = this.evaluateExpression(store, exp.column);
  7725. return Promise.all([$line, $column]).then(function (values) {
  7726. var lineSO = values[0];
  7727. var columnSO = values[1];
  7728. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7729. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7730. }
  7731. var line = lineSO.number;
  7732. var column = null;
  7733. if (columnSO !== null) {
  7734. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7735. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7736. }
  7737. column = columnSO.number;
  7738. }
  7739. if (line >= mustBeArray.lines) {
  7740. if (mustBeArray.isVector) {
  7741. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7742. } else {
  7743. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7744. }
  7745. } else if (line < 0) {
  7746. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7747. }
  7748. if (column !== null && mustBeArray.columns === null) {
  7749. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(exp.id, exp.sourceInfo));
  7750. }
  7751. if (column !== null) {
  7752. if (column >= mustBeArray.columns) {
  7753. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(exp.id, column, mustBeArray.columns, exp.sourceInfo));
  7754. } else if (column < 0) {
  7755. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7756. }
  7757. }
  7758. return Promise.resolve(new _storeObjectArrayAddress.StoreObjectArrayAddress(mustBeArray.id, line, column, store));
  7759. });
  7760. }
  7761. }, {
  7762. key: 'evaluateUnaryApp',
  7763. value: function evaluateUnaryApp(store, unaryApp) {
  7764. var $left = this.evaluateExpression(store, unaryApp.left);
  7765. return $left.then(function (left) {
  7766. var resultType = (0, _compatibilityTable.resultTypeAfterUnaryOp)(unaryApp.op, left.type);
  7767. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7768. var stringInfo = left.type.stringInfo();
  7769. var info = stringInfo[0];
  7770. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo));
  7771. }
  7772. switch (unaryApp.op.ord) {
  7773. case _operators.Operators.ADD.ord:
  7774. return new _storeObject.StoreObject(resultType, left.value);
  7775. case _operators.Operators.SUB.ord:
  7776. return new _storeObject.StoreObject(resultType, left.value.negated());
  7777. case _operators.Operators.NOT.ord:
  7778. return new _storeObject.StoreObject(resultType, !left.value);
  7779. default:
  7780. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid UnaryApp ' + unaryApp.op));
  7781. }
  7782. });
  7783. }
  7784. }, {
  7785. key: 'evaluateInfixApp',
  7786. value: function evaluateInfixApp(store, infixApp) {
  7787. var $left = this.evaluateExpression(store, infixApp.left);
  7788. var $right = this.evaluateExpression(store, infixApp.right);
  7789. return Promise.all([$left, $right]).then(function (values) {
  7790. var shouldImplicitCast = false;
  7791. var left = values[0];
  7792. var right = values[1];
  7793. var resultType = (0, _compatibilityTable.resultTypeAfterInfixOp)(infixApp.op, left.type, right.type);
  7794. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7795. if (_config.Config.enable_type_casting && _store.Store.canImplicitTypeCast(left.type, right.type)) {
  7796. shouldImplicitCast = true;
  7797. } else {
  7798. var stringInfoLeft = left.type.stringInfo();
  7799. var infoLeft = stringInfoLeft[0];
  7800. var stringInfoRight = right.type.stringInfo();
  7801. var infoRight = stringInfoRight[0];
  7802. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, infixApp.sourceInfo));
  7803. }
  7804. }
  7805. var result = null;
  7806. switch (infixApp.op.ord) {
  7807. case _operators.Operators.ADD.ord:
  7808. {
  7809. if (_types.Types.STRING.isCompatible(left.type)) {
  7810. var rightStr = (0, _parsers.convertToString)(right.value, right.type);
  7811. return new _storeObject.StoreObject(resultType, left.value + rightStr);
  7812. } else if (_types.Types.STRING.isCompatible(right.type)) {
  7813. var leftStr = (0, _parsers.convertToString)(left.value, left.type);
  7814. return new _storeObject.StoreObject(resultType, leftStr + right.value);
  7815. } else {
  7816. return new _storeObject.StoreObject(resultType, left.value.plus(right.value));
  7817. }
  7818. }
  7819. case _operators.Operators.SUB.ord:
  7820. return new _storeObject.StoreObject(resultType, left.value.minus(right.value));
  7821. case _operators.Operators.MULT.ord:
  7822. {
  7823. result = left.value.times(right.value);
  7824. if (result.dp() > _config.Config.decimalPlaces) {
  7825. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7826. }
  7827. return new _storeObject.StoreObject(resultType, result);
  7828. }
  7829. case _operators.Operators.DIV.ord:
  7830. {
  7831. if (_types.Types.INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value);
  7832. if (result.dp() > _config.Config.decimalPlaces) {
  7833. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7834. }
  7835. return new _storeObject.StoreObject(resultType, result);
  7836. }
  7837. case _operators.Operators.MOD.ord:
  7838. {
  7839. var leftValue = left.value;
  7840. var rightValue = right.value;
  7841. if (shouldImplicitCast) {
  7842. resultType = _types.Types.INTEGER;
  7843. leftValue = leftValue.trunc();
  7844. rightValue = rightValue.trunc();
  7845. }
  7846. result = leftValue.modulo(rightValue);
  7847. if (result.dp() > _config.Config.decimalPlaces) {
  7848. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7849. }
  7850. return new _storeObject.StoreObject(resultType, result);
  7851. }
  7852. case _operators.Operators.GT.ord:
  7853. {
  7854. var _leftValue = left.value;
  7855. var _rightValue = right.value;
  7856. if (_types.Types.STRING.isCompatible(left.type)) {
  7857. result = left.value.length > right.value.length;
  7858. } else {
  7859. if (shouldImplicitCast) {
  7860. resultType = _types.Types.BOOLEAN;
  7861. _leftValue = _leftValue.trunc();
  7862. _rightValue = _rightValue.trunc();
  7863. }
  7864. result = _leftValue.gt(_rightValue);
  7865. }
  7866. return new _storeObject.StoreObject(resultType, result);
  7867. }
  7868. case _operators.Operators.GE.ord:
  7869. {
  7870. var _leftValue2 = left.value;
  7871. var _rightValue2 = right.value;
  7872. if (_types.Types.STRING.isCompatible(left.type)) {
  7873. result = left.value.length >= right.value.length;
  7874. } else {
  7875. if (shouldImplicitCast) {
  7876. resultType = _types.Types.BOOLEAN;
  7877. _leftValue2 = _leftValue2.trunc();
  7878. _rightValue2 = _rightValue2.trunc();
  7879. }
  7880. result = _leftValue2.gte(_rightValue2);
  7881. }
  7882. return new _storeObject.StoreObject(resultType, result);
  7883. }
  7884. case _operators.Operators.LT.ord:
  7885. {
  7886. var _leftValue3 = left.value;
  7887. var _rightValue3 = right.value;
  7888. if (_types.Types.STRING.isCompatible(left.type)) {
  7889. result = left.value.length < right.value.length;
  7890. } else {
  7891. if (shouldImplicitCast) {
  7892. resultType = _types.Types.BOOLEAN;
  7893. _leftValue3 = _leftValue3.trunc();
  7894. _rightValue3 = _rightValue3.trunc();
  7895. }
  7896. result = _leftValue3.lt(_rightValue3);
  7897. }
  7898. return new _storeObject.StoreObject(resultType, result);
  7899. }
  7900. case _operators.Operators.LE.ord:
  7901. {
  7902. var _leftValue4 = left.value;
  7903. var _rightValue4 = right.value;
  7904. if (_types.Types.STRING.isCompatible(left.type)) {
  7905. result = left.value.length <= right.value.length;
  7906. } else {
  7907. if (shouldImplicitCast) {
  7908. resultType = _types.Types.BOOLEAN;
  7909. _leftValue4 = _leftValue4.trunc();
  7910. _rightValue4 = _rightValue4.trunc();
  7911. }
  7912. result = _leftValue4.lte(_rightValue4);
  7913. }
  7914. return new _storeObject.StoreObject(resultType, result);
  7915. }
  7916. case _operators.Operators.EQ.ord:
  7917. {
  7918. var _leftValue5 = left.value;
  7919. var _rightValue5 = right.value;
  7920. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7921. if (shouldImplicitCast) {
  7922. resultType = _types.Types.BOOLEAN;
  7923. _leftValue5 = _leftValue5.trunc();
  7924. _rightValue5 = _rightValue5.trunc();
  7925. }
  7926. result = _leftValue5.eq(_rightValue5);
  7927. } else {
  7928. result = left.value === right.value;
  7929. }
  7930. return new _storeObject.StoreObject(resultType, result);
  7931. }
  7932. case _operators.Operators.NEQ.ord:
  7933. {
  7934. var _leftValue6 = left.value;
  7935. var _rightValue6 = right.value;
  7936. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7937. if (shouldImplicitCast) {
  7938. resultType = _types.Types.BOOLEAN;
  7939. _leftValue6 = _leftValue6.trunc();
  7940. _rightValue6 = _rightValue6.trunc();
  7941. }
  7942. result = !_leftValue6.eq(_rightValue6);
  7943. } else {
  7944. result = left.value !== right.value;
  7945. }
  7946. return new _storeObject.StoreObject(resultType, result);
  7947. }
  7948. case _operators.Operators.AND.ord:
  7949. return new _storeObject.StoreObject(resultType, left.value && right.value);
  7950. case _operators.Operators.OR.ord:
  7951. return new _storeObject.StoreObject(resultType, left.value || right.value);
  7952. default:
  7953. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid InfixApp ' + infixApp.op));
  7954. }
  7955. });
  7956. }
  7957. }, {
  7958. key: 'parseStoreObjectValue',
  7959. value: function parseStoreObjectValue(vl) {
  7960. var realValue = vl;
  7961. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7962. if (vl.type instanceof _compoundType.CompoundType) {
  7963. switch (vl.type.dimensions) {
  7964. case 1:
  7965. {
  7966. realValue = new _storeObjectArray.StoreObjectArray(vl.type, vl.value);
  7967. break;
  7968. }
  7969. default:
  7970. {
  7971. throw new _runtimeError.RuntimeError("Three dimensional array address...");
  7972. }
  7973. }
  7974. } else {
  7975. realValue = new _storeObject.StoreObject(vl.type, vl.value);
  7976. }
  7977. }
  7978. return realValue;
  7979. }
  7980. }]);
  7981. return IVProgProcessor;
  7982. }();
  7983. /***/ }),
  7984. /***/ "./js/processor/lib/arrays.js":
  7985. /*!************************************!*\
  7986. !*** ./js/processor/lib/arrays.js ***!
  7987. \************************************/
  7988. /*! no static exports found */
  7989. /***/ (function(module, exports, __webpack_require__) {
  7990. "use strict";
  7991. Object.defineProperty(exports, "__esModule", {
  7992. value: true
  7993. });
  7994. exports.createNumElementsFun = createNumElementsFun;
  7995. exports.createMatrixLinesFun = createMatrixLinesFun;
  7996. exports.createMatrixColumnsFun = createMatrixColumnsFun;
  7997. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  7998. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7999. var Commands = _interopRequireWildcard(_commands);
  8000. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8001. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8002. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8003. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8004. 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; } }
  8005. /**
  8006. * num_elements
  8007. * matrix_lines
  8008. * matrix_columns
  8009. */
  8010. function createNumElementsFun() {
  8011. var numElementsFun = function numElementsFun(sto, _) {
  8012. var vector = sto.applyStore("vector");
  8013. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(vector.lines));
  8014. sto.mode = _modes.Modes.RETURN;
  8015. return Promise.resolve(sto.updateStore("$", temp));
  8016. };
  8017. var block = new Commands.CommandBlock([], [new Commands.SysCall(numElementsFun)]);
  8018. var func = new Commands.Function('$numElements', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 1), 'vector', false)], block);
  8019. return func;
  8020. }
  8021. function createMatrixLinesFun() {
  8022. var matrixLinesFun = function matrixLinesFun(sto, _) {
  8023. var matrix = sto.applyStore("matrix");
  8024. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.lines));
  8025. sto.mode = _modes.Modes.RETURN;
  8026. return Promise.resolve(sto.updateStore("$", temp));
  8027. };
  8028. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixLinesFun)]);
  8029. var func = new Commands.Function('$matrixLines', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  8030. return func;
  8031. }
  8032. function createMatrixColumnsFun() {
  8033. var matrixColumnsFun = function matrixColumnsFun(sto, _) {
  8034. var matrix = sto.applyStore("matrix");
  8035. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.columns));
  8036. sto.mode = _modes.Modes.RETURN;
  8037. return Promise.resolve(sto.updateStore("$", temp));
  8038. };
  8039. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixColumnsFun)]);
  8040. var func = new Commands.Function('$matrixColumns', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  8041. return func;
  8042. }
  8043. /***/ }),
  8044. /***/ "./js/processor/lib/io.js":
  8045. /*!********************************!*\
  8046. !*** ./js/processor/lib/io.js ***!
  8047. \********************************/
  8048. /*! no static exports found */
  8049. /***/ (function(module, exports, __webpack_require__) {
  8050. "use strict";
  8051. Object.defineProperty(exports, "__esModule", {
  8052. value: true
  8053. });
  8054. exports.createOutputFun = createOutputFun;
  8055. exports.createInputFun = createInputFun;
  8056. var _storeObject = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js");
  8057. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8058. var Commands = _interopRequireWildcard(_commands);
  8059. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8060. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8061. 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; } }
  8062. function createOutputFun() {
  8063. var writeFunction = function writeFunction(store, _) {
  8064. var val = store.applyStore('p1');
  8065. this.output.sendOutput((0, _parsers.convertToString)(val.value, val.type));
  8066. return Promise.resolve(store);
  8067. };
  8068. var block = new Commands.CommandBlock([], [new Commands.SysCall(writeFunction)]);
  8069. var func = new Commands.Function('$write', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', false)], block);
  8070. return func;
  8071. }
  8072. function createInputFun() {
  8073. var readFunction = function readFunction(store, _) {
  8074. var _this = this;
  8075. var request = new Promise(function (resolve, _) {
  8076. _this.input.requestInput(resolve);
  8077. });
  8078. return request.then(function (text) {
  8079. var typeToConvert = store.applyStore('p1').type;
  8080. var stoObj = null;
  8081. if (typeToConvert.isCompatible(_types.Types.INTEGER)) {
  8082. var val = (0, _parsers.toInt)(text);
  8083. stoObj = new _storeObject.StoreObject(_types.Types.INTEGER, val.trunc());
  8084. } else if (typeToConvert.isCompatible(_types.Types.REAL)) {
  8085. stoObj = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(text));
  8086. } else if (typeToConvert.isCompatible(_types.Types.BOOLEAN)) {
  8087. stoObj = new _storeObject.StoreObject(_types.Types.BOOLEAN, (0, _parsers.toBool)(text));
  8088. } else if (typeToConvert.isCompatible(_types.Types.STRING)) {
  8089. stoObj = new _storeObject.StoreObject(_types.Types.STRING, (0, _parsers.toString)(text));
  8090. }
  8091. _this.loopTimers.splice(0, _this.loopTimers.length);
  8092. store.updateStore('p1', stoObj);
  8093. return Promise.resolve(store);
  8094. });
  8095. };
  8096. var block = new Commands.CommandBlock([], [new Commands.SysCall(readFunction)]);
  8097. var func = new Commands.Function('$read', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', true)], block);
  8098. return func;
  8099. }
  8100. /***/ }),
  8101. /***/ "./js/processor/lib/lang.js":
  8102. /*!**********************************!*\
  8103. !*** ./js/processor/lib/lang.js ***!
  8104. \**********************************/
  8105. /*! no static exports found */
  8106. /***/ (function(module, exports, __webpack_require__) {
  8107. "use strict";
  8108. Object.defineProperty(exports, "__esModule", {
  8109. value: true
  8110. });
  8111. exports.createIsRealFun = createIsRealFun;
  8112. exports.createIsIntFun = createIsIntFun;
  8113. exports.createIsBoolFun = createIsBoolFun;
  8114. exports.createCastRealFun = createCastRealFun;
  8115. exports.createCastIntFun = createCastIntFun;
  8116. exports.createCastBoolFun = createCastBoolFun;
  8117. exports.createCastStringFun = createCastStringFun;
  8118. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8119. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8120. var Commands = _interopRequireWildcard(_commands);
  8121. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8122. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8123. var _ivprogParser = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  8124. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8125. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8126. 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; } }
  8127. /**
  8128. *
  8129. * is_real
  8130. * is_int
  8131. * is_bool
  8132. * cast_real
  8133. * cast_int
  8134. * cast_bool
  8135. * cast_string
  8136. */
  8137. function createIsRealFun() {
  8138. var isRealFun = function isRealFun(sto, _) {
  8139. var str = sto.applyStore("str");
  8140. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8141. var result = false;
  8142. try {
  8143. var val = parser.parseTerm();
  8144. if (val instanceof _expressions.RealLiteral) {
  8145. result = true;
  8146. }
  8147. } catch (error) {}
  8148. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8149. sto.mode = _modes.Modes.RETURN;
  8150. return Promise.resolve(sto.updateStore("$", temp));
  8151. };
  8152. var block = new Commands.CommandBlock([], [new Commands.SysCall(isRealFun)]);
  8153. var func = new Commands.Function('$isReal', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8154. return func;
  8155. }
  8156. function createIsIntFun() {
  8157. var isIntFun = function isIntFun(sto, _) {
  8158. var str = sto.applyStore("str");
  8159. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8160. var result = false;
  8161. try {
  8162. var val = parser.parseTerm();
  8163. if (val instanceof _expressions.IntLiteral) {
  8164. result = true;
  8165. }
  8166. } catch (error) {}
  8167. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8168. sto.mode = _modes.Modes.RETURN;
  8169. return Promise.resolve(sto.updateStore("$", temp));
  8170. };
  8171. var block = new Commands.CommandBlock([], [new Commands.SysCall(isIntFun)]);
  8172. var func = new Commands.Function('$isInt', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8173. return func;
  8174. }
  8175. function createIsBoolFun() {
  8176. var isBoolFun = function isBoolFun(sto, _) {
  8177. var str = sto.applyStore("str");
  8178. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8179. var result = false;
  8180. try {
  8181. var val = parser.parseTerm();
  8182. if (val instanceof _expressions.BoolLiteral) {
  8183. result = true;
  8184. }
  8185. } catch (error) {}
  8186. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8187. sto.mode = _modes.Modes.RETURN;
  8188. return Promise.resolve(sto.updateStore("$", temp));
  8189. };
  8190. var block = new Commands.CommandBlock([], [new Commands.SysCall(isBoolFun)]);
  8191. var func = new Commands.Function('$isBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8192. return func;
  8193. }
  8194. function createCastRealFun() {
  8195. var castRealFun = function castRealFun(sto, _) {
  8196. var val = sto.applyStore("val");
  8197. switch (val.type.ord) {
  8198. case _types.Types.INTEGER.ord:
  8199. {
  8200. var temp = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(val.number));
  8201. sto.mode = _modes.Modes.RETURN;
  8202. return Promise.resolve(sto.updateStore("$", temp));
  8203. }
  8204. case _types.Types.STRING.ord:
  8205. {
  8206. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8207. try {
  8208. var result = parser.parseTerm();
  8209. if (result instanceof _expressions.RealLiteral) {
  8210. var _temp = new _storeObject.StoreObject(_types.Types.REAL, result.value);
  8211. sto.mode = _modes.Modes.RETURN;
  8212. return Promise.resolve(sto.updateStore("$", _temp));
  8213. }
  8214. } catch (error) {
  8215. return Promise.reject("cannot convert string to real");
  8216. }
  8217. }
  8218. }
  8219. };
  8220. var block = new Commands.CommandBlock([], [new Commands.SysCall(castRealFun)]);
  8221. var func = new Commands.Function('$castReal', _types.Types.REAL, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8222. return func;
  8223. }
  8224. function createCastIntFun() {
  8225. var castIntFun = function castIntFun(sto, _) {
  8226. var val = sto.applyStore("val");
  8227. switch (val.type.ord) {
  8228. case _types.Types.REAL.ord:
  8229. {
  8230. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, Math.floor(val.number));
  8231. sto.mode = _modes.Modes.RETURN;
  8232. return Promise.resolve(sto.updateStore("$", temp));
  8233. }
  8234. case _types.Types.STRING.ord:
  8235. {
  8236. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8237. try {
  8238. var result = parser.parseTerm();
  8239. if (result instanceof _expressions.IntLiteral) {
  8240. var _temp2 = new _storeObject.StoreObject(_types.Types.INTEGER, result.value);
  8241. sto.mode = _modes.Modes.RETURN;
  8242. return Promise.resolve(sto.updateStore("$", _temp2));
  8243. }
  8244. } catch (error) {
  8245. return Promise.reject("cannot convert string to real");
  8246. }
  8247. }
  8248. }
  8249. };
  8250. var block = new Commands.CommandBlock([], [new Commands.SysCall(castIntFun)]);
  8251. var func = new Commands.Function('$castInt', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8252. return func;
  8253. }
  8254. function createCastBoolFun() {
  8255. var castBoolFun = function castBoolFun(sto, _) {
  8256. var str = sto.applyStore("str");
  8257. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8258. try {
  8259. var val = parser.parseTerm();
  8260. if (val instanceof _expressions.BoolLiteral) {
  8261. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, val.value);
  8262. sto.mode = _modes.Modes.RETURN;
  8263. return Promise.resolve(sto.updateStore("$", temp));
  8264. }
  8265. } catch (error) {}
  8266. return Promise.reject("cannot convert " + str.value + " to boolean");
  8267. };
  8268. var block = new Commands.CommandBlock([], [new Commands.SysCall(castBoolFun)]);
  8269. var func = new Commands.Function('$castBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8270. return func;
  8271. }
  8272. function createCastStringFun() {
  8273. var castStringFun = function castStringFun(store, _) {
  8274. var val = store.applyStore('str');
  8275. var result = (0, _parsers.convertToString)(val);
  8276. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8277. sto.mode = _modes.Modes.RETURN;
  8278. return Promise.resolve(sto.updateStore("$", temp));
  8279. };
  8280. var block = new Commands.CommandBlock([], [new Commands.SysCall(castStringFun)]);
  8281. var func = new Commands.Function('$castString', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.ALL, 'str', false)], block);
  8282. return func;
  8283. }
  8284. /***/ }),
  8285. /***/ "./js/processor/lib/math.js":
  8286. /*!**********************************!*\
  8287. !*** ./js/processor/lib/math.js ***!
  8288. \**********************************/
  8289. /*! no static exports found */
  8290. /***/ (function(module, exports, __webpack_require__) {
  8291. "use strict";
  8292. Object.defineProperty(exports, "__esModule", {
  8293. value: true
  8294. });
  8295. exports.createSinFun = createSinFun;
  8296. exports.createCosFun = createCosFun;
  8297. exports.createTanFun = createTanFun;
  8298. exports.createSqrtFun = createSqrtFun;
  8299. exports.createPowFun = createPowFun;
  8300. exports.createLogFun = createLogFun;
  8301. exports.createAbsFun = createAbsFun;
  8302. exports.createNegateFun = createNegateFun;
  8303. exports.createInvertFun = createInvertFun;
  8304. exports.createMaxFun = createMaxFun;
  8305. exports.createMinFun = createMinFun;
  8306. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8307. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8308. var Commands = _interopRequireWildcard(_commands);
  8309. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8310. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8311. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8312. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8313. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8314. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8315. var _config = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8316. 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; } }
  8317. 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); } }
  8318. /**
  8319. * sin
  8320. * cos
  8321. * tan
  8322. * sqrt
  8323. * pow
  8324. * log
  8325. * abs
  8326. * negate
  8327. * invert
  8328. * max
  8329. * min
  8330. */
  8331. function convertToRadians(degrees) {
  8332. return degrees.times(_decimal.Decimal.acos(-1)).div(180);
  8333. }
  8334. function createSinFun() {
  8335. var sinFun = function sinFun(sto, _) {
  8336. var x = sto.applyStore('x');
  8337. var angle = x.value.mod(360);
  8338. var result = null;
  8339. if (angle.eq(90)) {
  8340. result = new _decimal.Decimal(1);
  8341. } else if (angle.eq(180)) {
  8342. result = new _decimal.Decimal(0);
  8343. } else if (angle.eq(270)) {
  8344. result = new _decimal.Decimal(-1);
  8345. } else {
  8346. result = _decimal.Decimal.sin(convertToRadians(angle));
  8347. }
  8348. if (result.dp() > _config.Config.decimalPlaces) {
  8349. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8350. }
  8351. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8352. sto.mode = _modes.Modes.RETURN;
  8353. return Promise.resolve(sto.updateStore('$', temp));
  8354. };
  8355. var block = new Commands.CommandBlock([], [new Commands.SysCall(sinFun)]);
  8356. var func = new Commands.Function('$sin', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8357. return func;
  8358. }
  8359. function createCosFun() {
  8360. var cosFun = function cosFun(sto, _) {
  8361. var x = sto.applyStore('x');
  8362. var angle = x.value.mod(360);
  8363. var result = null;
  8364. if (angle.eq(90)) {
  8365. result = new _decimal.Decimal(0);
  8366. } else if (angle.eq(180)) {
  8367. result = new _decimal.Decimal(-1);
  8368. } else if (angle.eq(270)) {
  8369. result = new _decimal.Decimal(0);
  8370. }
  8371. result = _decimal.Decimal.cos(convertToRadians(angle));
  8372. if (result.dp() > _config.Config.decimalPlaces) {
  8373. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8374. }
  8375. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8376. sto.mode = _modes.Modes.RETURN;
  8377. return Promise.resolve(sto.updateStore('$', temp));
  8378. };
  8379. var block = new Commands.CommandBlock([], [new Commands.SysCall(cosFun)]);
  8380. var func = new Commands.Function('$cos', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8381. return func;
  8382. }
  8383. function createTanFun() {
  8384. var tanFun = function tanFun(sto, _) {
  8385. var x = sto.applyStore('x');
  8386. var angle = x.value.mod(360);
  8387. if (angle.eq(90) || angle.eq(270)) {
  8388. return Promise.reject("Tangent of " + x.value.toNumber() + "° is undefined.");
  8389. }
  8390. var result = _decimal.Decimal.tan(convertToRadians(angle));
  8391. if (result.dp() > _config.Config.decimalPlaces) {
  8392. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8393. }
  8394. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8395. sto.mode = _modes.Modes.RETURN;
  8396. return Promise.resolve(sto.updateStore('$', temp));
  8397. };
  8398. var block = new Commands.CommandBlock([], [new Commands.SysCall(tanFun)]);
  8399. var func = new Commands.Function('$tan', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8400. return func;
  8401. }
  8402. function createSqrtFun() {
  8403. var sqrtFun = function sqrtFun(sto, _) {
  8404. var x = sto.applyStore('x');
  8405. var result = x.value.sqrt();
  8406. if (result.dp() > _config.Config.decimalPlaces) {
  8407. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8408. }
  8409. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8410. sto.mode = _modes.Modes.RETURN;
  8411. return Promise.resolve(sto.updateStore('$', temp));
  8412. };
  8413. var block = new Commands.CommandBlock([], [new Commands.SysCall(sqrtFun)]);
  8414. var func = new Commands.Function('$sqrt', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8415. return func;
  8416. }
  8417. function createPowFun() {
  8418. var powFun = function powFun(sto, _) {
  8419. var x = sto.applyStore('x');
  8420. var y = sto.applyStore('y');
  8421. var result = x.value.pow(y.value);
  8422. if (result.dp() > _config.Config.decimalPlaces) {
  8423. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8424. }
  8425. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8426. sto.mode = _modes.Modes.RETURN;
  8427. return Promise.resolve(sto.updateStore('$', temp));
  8428. };
  8429. var block = new Commands.CommandBlock([], [new Commands.SysCall(powFun)]);
  8430. 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);
  8431. return func;
  8432. }
  8433. function createLogFun() {
  8434. var logFun = function logFun(sto, _) {
  8435. var x = sto.applyStore('x');
  8436. if (x.value.isNegative()) {
  8437. return Promise.reject("the value passed to log function cannot be negative");
  8438. }
  8439. var result = _decimal.Decimal.log10(x.value);
  8440. if (result.dp() > _config.Config.decimalPlaces) {
  8441. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8442. }
  8443. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8444. sto.mode = _modes.Modes.RETURN;
  8445. return Promise.resolve(sto.updateStore('$', temp));
  8446. };
  8447. var block = new Commands.CommandBlock([], [new Commands.SysCall(logFun)]);
  8448. var func = new Commands.Function('$log', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8449. return func;
  8450. }
  8451. function createAbsFun() {
  8452. var absFun = function absFun(sto, _) {
  8453. var x = sto.applyStore('x');
  8454. var result = x.value.abs();
  8455. var temp = new _storeObject.StoreObject(x.type, result);
  8456. sto.mode = _modes.Modes.RETURN;
  8457. return Promise.resolve(sto.updateStore('$', temp));
  8458. };
  8459. var block = new Commands.CommandBlock([], [new Commands.SysCall(absFun)]);
  8460. 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);
  8461. return func;
  8462. }
  8463. function createNegateFun() {
  8464. var negateFun = function negateFun(sto, _) {
  8465. var x = sto.applyStore('x');
  8466. var result = x.value.negated();
  8467. var temp = new _storeObject.StoreObject(x.type, result);
  8468. sto.mode = _modes.Modes.RETURN;
  8469. return Promise.resolve(sto.updateStore('$', temp));
  8470. };
  8471. var block = new Commands.CommandBlock([], [new Commands.SysCall(negateFun)]);
  8472. 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);
  8473. return func;
  8474. }
  8475. function createInvertFun() {
  8476. var invertFun = function invertFun(sto, _) {
  8477. var x = sto.applyStore('x');
  8478. var result = (0, _parsers.toReal)(1).dividedBy(x.value);
  8479. if (result.dp() > _config.Config.decimalPlaces) {
  8480. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8481. }
  8482. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8483. sto.mode = _modes.Modes.RETURN;
  8484. return Promise.resolve(sto.updateStore('$', temp));
  8485. };
  8486. var block = new Commands.CommandBlock([], [new Commands.SysCall(invertFun)]);
  8487. var func = new Commands.Function('$invert', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8488. return func;
  8489. }
  8490. function createMaxFun() {
  8491. var maxFun = function maxFun(sto, _) {
  8492. var x = sto.applyStore('x');
  8493. var numbers = x.value.map(function (stoObj) {
  8494. return stoObj.value;
  8495. });
  8496. var result = _decimal.Decimal.max.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8497. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8498. sto.mode = _modes.Modes.RETURN;
  8499. return Promise.resolve(sto.updateStore('$', temp));
  8500. };
  8501. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8502. var block = new Commands.CommandBlock([], [new Commands.SysCall(maxFun)]);
  8503. var func = new Commands.Function('$max', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8504. return func;
  8505. }
  8506. function createMinFun() {
  8507. var minFun = function minFun(sto, _) {
  8508. var x = sto.applyStore('x');
  8509. var numbers = x.value.map(function (stoObj) {
  8510. return stoObj.value;
  8511. });
  8512. var result = _decimal.Decimal.min.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8513. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8514. sto.mode = _modes.Modes.RETURN;
  8515. return Promise.resolve(sto.updateStore('$', temp));
  8516. };
  8517. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8518. var block = new Commands.CommandBlock([], [new Commands.SysCall(minFun)]);
  8519. var func = new Commands.Function('$min', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8520. return func;
  8521. }
  8522. /***/ }),
  8523. /***/ "./js/processor/lib/strings.js":
  8524. /*!*************************************!*\
  8525. !*** ./js/processor/lib/strings.js ***!
  8526. \*************************************/
  8527. /*! no static exports found */
  8528. /***/ (function(module, exports, __webpack_require__) {
  8529. "use strict";
  8530. Object.defineProperty(exports, "__esModule", {
  8531. value: true
  8532. });
  8533. exports.createSubstringFun = createSubstringFun;
  8534. exports.createLengthFun = createLengthFun;
  8535. exports.createUppercaseFun = createUppercaseFun;
  8536. exports.createLowercaseFun = createLowercaseFun;
  8537. exports.createrCharAtFun = createrCharAtFun;
  8538. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8539. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8540. var Commands = _interopRequireWildcard(_commands);
  8541. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8542. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8543. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8544. 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; } }
  8545. /*
  8546. * substring
  8547. * length
  8548. * uppercase
  8549. * lowercase
  8550. * charAt
  8551. **/
  8552. function createSubstringFun() {
  8553. var substringFun = function substringFun(sto, _) {
  8554. var str = sto.applyStore("str");
  8555. var start = sto.applyStore("start");
  8556. var end = sto.applyStore("end");
  8557. var result = str.value.substring(start.value, end.value);
  8558. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8559. sto.mode = _modes.Modes.RETURN;
  8560. return Promise.resolve(sto.updateStore("$", temp));
  8561. };
  8562. var block = new Commands.CommandBlock([], [new Commands.SysCall(substringFun)]);
  8563. 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);
  8564. return func;
  8565. }
  8566. function createLengthFun() {
  8567. var lengthFun = function lengthFun(sto, _) {
  8568. var str = sto.applyStore("str");
  8569. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(str.value.length));
  8570. sto.mode = _modes.Modes.RETURN;
  8571. return Promise.resolve(sto.updateStore("$", temp));
  8572. };
  8573. var block = new Commands.CommandBlock([], [new Commands.SysCall(lengthFun)]);
  8574. var func = new Commands.Function('$length', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8575. return func;
  8576. }
  8577. function createUppercaseFun() {
  8578. var uppercaseFun = function uppercaseFun(sto, _) {
  8579. var str = sto.applyStore("str");
  8580. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toUpperCase());
  8581. sto.mode = _modes.Modes.RETURN;
  8582. return Promise.resolve(sto.updateStore("$", temp));
  8583. };
  8584. var block = new Commands.CommandBlock([], [new Commands.SysCall(uppercaseFun)]);
  8585. var func = new Commands.Function('$uppercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8586. return func;
  8587. }
  8588. function createLowercaseFun() {
  8589. var lowercaseFun = function lowercaseFun(sto, _) {
  8590. var str = sto.applyStore("str");
  8591. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toLowerCase());
  8592. sto.mode = _modes.Modes.RETURN;
  8593. return Promise.resolve(sto.updateStore("$", temp));
  8594. };
  8595. var block = new Commands.CommandBlock([], [new Commands.SysCall(lowercaseFun)]);
  8596. var func = new Commands.Function('$lowercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8597. return func;
  8598. }
  8599. function createrCharAtFun() {
  8600. var charAtFun = function charAtFun(sto, _) {
  8601. var str = sto.applyStore("str");
  8602. var idx = sto.applyStore("index");
  8603. if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
  8604. return Promise.reject(new Error("invalid string position"));
  8605. }
  8606. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.charAt(idx.value.toNumber()));
  8607. sto.mode = _modes.Modes.RETURN;
  8608. return Promise.resolve(sto.updateStore("$", temp));
  8609. };
  8610. var block = new Commands.CommandBlock([], [new Commands.SysCall(charAtFun)]);
  8611. 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);
  8612. return func;
  8613. }
  8614. /***/ }),
  8615. /***/ "./js/processor/modes.js":
  8616. /*!*******************************!*\
  8617. !*** ./js/processor/modes.js ***!
  8618. \*******************************/
  8619. /*! no static exports found */
  8620. /***/ (function(module, exports, __webpack_require__) {
  8621. "use strict";
  8622. Object.defineProperty(exports, "__esModule", {
  8623. value: true
  8624. });
  8625. var Modes = exports.Modes = Object.freeze({
  8626. RETURN: Symbol('mode:return'),
  8627. BREAK: Symbol('mode:break'),
  8628. PAUSE: Symbol('mode:pause'),
  8629. RUN: Symbol('mode:run')
  8630. });
  8631. /***/ }),
  8632. /***/ "./js/processor/semantic/semanticAnalyser.js":
  8633. /*!***************************************************!*\
  8634. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  8635. \***************************************************/
  8636. /*! no static exports found */
  8637. /***/ (function(module, exports, __webpack_require__) {
  8638. "use strict";
  8639. Object.defineProperty(exports, "__esModule", {
  8640. value: true
  8641. });
  8642. exports.SemanticAnalyser = undefined;
  8643. 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; }; }();
  8644. var _processorErrorFactory = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8645. var _definedFunctions = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  8646. var _languageService = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js");
  8647. var _commands = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  8648. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8649. var _literal = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  8650. var _compatibilityTable = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js");
  8651. var _types = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js");
  8652. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8653. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8654. var _config = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8655. var _store = __webpack_require__(/*! ../store/store */ "./js/processor/store/store.js");
  8656. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8657. var SemanticAnalyser = exports.SemanticAnalyser = function () {
  8658. function SemanticAnalyser(ast) {
  8659. _classCallCheck(this, SemanticAnalyser);
  8660. this.ast = ast;
  8661. this.lexerClass = _languageService.LanguageService.getCurrentLexer();
  8662. var lexer = new this.lexerClass(null);
  8663. this.literalNames = lexer.literalNames;
  8664. this.symbolMap = null;
  8665. this.currentFunction = null;
  8666. }
  8667. _createClass(SemanticAnalyser, [{
  8668. key: 'pushMap',
  8669. value: function pushMap() {
  8670. if (this.symbolMap === null) {
  8671. this.symbolMap = { map: {}, next: null };
  8672. } else {
  8673. var n = { map: {}, next: this.symbolMap };
  8674. this.symbolMap = n;
  8675. }
  8676. }
  8677. }, {
  8678. key: 'popMap',
  8679. value: function popMap() {
  8680. if (this.symbolMap !== null) {
  8681. this.symbolMap = this.symbolMap.next;
  8682. }
  8683. }
  8684. }, {
  8685. key: 'insertSymbol',
  8686. value: function insertSymbol(id, typeInfo) {
  8687. this.symbolMap.map[id] = typeInfo;
  8688. }
  8689. }, {
  8690. key: 'findSymbol',
  8691. value: function findSymbol(id, symMap) {
  8692. if (!symMap.map[id]) {
  8693. if (symMap.next) {
  8694. return this.findSymbol(id, symMap.next);
  8695. }
  8696. return null;
  8697. } else {
  8698. return symMap.map[id];
  8699. }
  8700. }
  8701. }, {
  8702. key: 'getMainFunction',
  8703. value: function getMainFunction() {
  8704. return this.ast.functions.find(function (v) {
  8705. return v.isMain;
  8706. });
  8707. }
  8708. }, {
  8709. key: 'findFunction',
  8710. value: function findFunction(name) {
  8711. console.log(name);
  8712. if (name.match(/^\$.+$/)) {
  8713. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  8714. if (!!!fun) {
  8715. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  8716. }
  8717. return fun;
  8718. } else {
  8719. var val = this.ast.functions.find(function (v) {
  8720. return v.name === name;
  8721. });
  8722. if (!!!val) {
  8723. return null;
  8724. }
  8725. return val;
  8726. }
  8727. }
  8728. }, {
  8729. key: 'analyseTree',
  8730. value: function analyseTree() {
  8731. var globalVars = this.ast.global;
  8732. this.pushMap();
  8733. this.assertDeclarations(globalVars);
  8734. var functions = this.ast.functions;
  8735. var mainFunc = functions.filter(function (f) {
  8736. return f.name === null;
  8737. });
  8738. if (mainFunc.length <= 0) {
  8739. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  8740. }
  8741. for (var i = 0; i < functions.length; i++) {
  8742. var fun = functions[i];
  8743. this.assertFunction(fun);
  8744. }
  8745. return this.ast;
  8746. }
  8747. }, {
  8748. key: 'assertDeclarations',
  8749. value: function assertDeclarations(list) {
  8750. for (var i = 0; i < list.length; i++) {
  8751. this.assertDeclaration(list[i]);
  8752. }
  8753. }
  8754. }, {
  8755. key: 'assertDeclaration',
  8756. value: function assertDeclaration(declaration) {
  8757. if (declaration instanceof _commands.ArrayDeclaration) {
  8758. if (declaration.initial === null) {
  8759. var lineType = this.evaluateExpressionType(declaration.lines);
  8760. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8761. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8762. }
  8763. if (declaration.columns !== null) {
  8764. var columnType = this.evaluateExpressionType(declaration.columns);
  8765. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8766. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8767. }
  8768. }
  8769. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8770. return;
  8771. }
  8772. this.evaluateArrayLiteral(declaration.id, declaration.lines, declaration.columns, declaration.type, declaration.initial);
  8773. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8774. } else {
  8775. if (declaration.initial === null) {
  8776. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8777. return;
  8778. }
  8779. var resultType = this.evaluateExpressionType(declaration.initial);
  8780. if (resultType instanceof _multiType.MultiType) {
  8781. if (!resultType.isCompatible(declaration.type)) {
  8782. var stringInfo = declaration.type.stringInfo();
  8783. var info = stringInfo[0];
  8784. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, declaration.sourceInfo);
  8785. }
  8786. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8787. } else if (!declaration.type.isCompatible(resultType) && !_config.Config.enable_type_casting || !declaration.type.isCompatible(resultType) && _config.Config.enable_type_casting && !_store.Store.canImplicitTypeCast(declaration.type, resultType)) {
  8788. var _stringInfo = declaration.type.stringInfo();
  8789. var _info = _stringInfo[0];
  8790. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info.type, _info.dim, declaration.sourceInfo);
  8791. } else {
  8792. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8793. }
  8794. }
  8795. }
  8796. }, {
  8797. key: 'evaluateExpressionType',
  8798. value: function evaluateExpressionType(expression) {
  8799. if (expression instanceof _expressions.UnaryApp) {
  8800. var op = expression.op;
  8801. var resultType = this.evaluateExpressionType(expression.left);
  8802. return (0, _compatibilityTable.resultTypeAfterUnaryOp)(op, resultType);
  8803. } else if (expression instanceof _expressions.InfixApp) {
  8804. var _op = expression.op;
  8805. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  8806. var resultTypeRight = this.evaluateExpressionType(expression.right);
  8807. return (0, _compatibilityTable.resultTypeAfterInfixOp)(_op, resultTypeLeft, resultTypeRight);
  8808. } else if (expression instanceof _literal.Literal) {
  8809. return this.evaluateLiteralType(expression);
  8810. } else if (expression instanceof _expressions.FunctionCall) {
  8811. if (expression.isMainCall) {
  8812. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), expression.sourceInfo);
  8813. }
  8814. var fun = this.findFunction(expression.id);
  8815. if (fun === null) {
  8816. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(expression.id, expression.sourceInfo);
  8817. }
  8818. if (fun.returnType.isCompatible(_types.Types.VOID)) {
  8819. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(expression.id, expression.sourceInfo);
  8820. }
  8821. this.assertParameters(fun, expression.actualParameters);
  8822. return fun.returnType;
  8823. } else if (expression instanceof _expressions.ArrayAccess) {
  8824. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  8825. if (arrayTypeInfo === null) {
  8826. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(expression.id, expression.sourceInfo);
  8827. }
  8828. if (!(arrayTypeInfo.type instanceof _compoundType.CompoundType)) {
  8829. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(expression.id, expression.sourceInfo);
  8830. }
  8831. var lineType = this.evaluateExpressionType(expression.line);
  8832. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8833. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8834. }
  8835. if (expression.column !== null) {
  8836. if (arrayTypeInfo.columns === null) {
  8837. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(expression.id, expression.sourceInfo);
  8838. }
  8839. var columnType = this.evaluateExpressionType(expression.column);
  8840. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8841. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8842. }
  8843. }
  8844. var arrType = arrayTypeInfo.type;
  8845. if (expression.column !== null) {
  8846. // indexing matrix
  8847. return arrType.innerType;
  8848. } else {
  8849. if (arrayTypeInfo.columns === null) {
  8850. return arrType.innerType;
  8851. }
  8852. return new _compoundType.CompoundType(arrType.innerType, 1);
  8853. }
  8854. }
  8855. }
  8856. }, {
  8857. key: 'evaluateLiteralType',
  8858. value: function evaluateLiteralType(literal) {
  8859. if (literal instanceof _expressions.IntLiteral) {
  8860. return literal.type;
  8861. } else if (literal instanceof _expressions.RealLiteral) {
  8862. return literal.type;
  8863. } else if (literal instanceof _expressions.StringLiteral) {
  8864. return literal.type;
  8865. } else if (literal instanceof _expressions.BoolLiteral) {
  8866. return literal.type;
  8867. } else if (literal instanceof _expressions.VariableLiteral) {
  8868. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  8869. if (typeInfo === null) {
  8870. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(literal.id, literal.sourceInfo);
  8871. }
  8872. if (typeInfo.type instanceof _compoundType.CompoundType) {
  8873. return typeInfo.type;
  8874. }
  8875. return typeInfo.type;
  8876. } else {
  8877. console.warn("Evaluating type only for an array literal...");
  8878. var last = null;
  8879. if (literal.value.length === 1) {
  8880. last = this.evaluateExpressionType(literal.value[0]);
  8881. } else {
  8882. for (var i = 0; i < literal.value.length; i++) {
  8883. var e = this.evaluateExpressionType(literal.value[i]);
  8884. if (last === null) {
  8885. last = e;
  8886. } else if (!last.isCompatible(e)) {
  8887. var strInfo = last.stringInfo();
  8888. var info = strInfo[0];
  8889. var strExp = literal.toString();
  8890. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8891. }
  8892. }
  8893. }
  8894. if (last instanceof _compoundType.CompoundType) {
  8895. return new _compoundType.CompoundType(last.innerType, last.dimensions + 1);
  8896. }
  8897. return new _compoundType.CompoundType(last, 1);
  8898. }
  8899. }
  8900. }, {
  8901. key: 'evaluateArrayLiteral',
  8902. value: function evaluateArrayLiteral(id, lines, columns, type, literal) {
  8903. /* if (literal instanceof ArrayLiteral) {
  8904. const dimType = this.evaluateExpressionType(lines);
  8905. if (!dimType.isCompatible(Types.INTEGER)) {
  8906. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8907. }
  8908. if ((lines instanceof IntLiteral)) {
  8909. if (!lines.value.eq(literal.value.length)) {
  8910. if(type.dimensions > 1) {
  8911. throw ProcessorErrorFactory.matrix_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  8912. } else {
  8913. throw ProcessorErrorFactory.vector_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  8914. }
  8915. } else if (lines.value.isNeg()) {
  8916. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8917. }
  8918. }
  8919. if (columns === null) {
  8920. // it's a vector...
  8921. literal.value.reduce((last, next) => {
  8922. const eType = this.evaluateExpressionType(next);
  8923. if (!last.canAccept(eType)) {
  8924. const strInfo = last.stringInfo();
  8925. const info = strInfo[0];
  8926. const strExp = literal.toString();
  8927. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  8928. }
  8929. return last;
  8930. }, type);
  8931. return true;
  8932. } else {
  8933. const dimType = this.evaluateExpressionType(columns);
  8934. if (!dimType.isCompatible(Types.INTEGER)) {
  8935. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8936. }
  8937. if ((columns instanceof IntLiteral)) {
  8938. const columnValue = literal.value[0].value.length;
  8939. if (!columns.value.eq(columnValue)) {
  8940. if(type.dimensions > 1) {
  8941. throw ProcessorErrorFactory.matrix_column_outbounds_full(id, literal.value.length, columns.value.toNumber(), literal.sourceInfo)
  8942. } else {
  8943. throw ProcessorErrorFactory.invalid_matrix_access_full(id, literal.sourceInfo);
  8944. }
  8945. } else if (columns.value.isNeg()) {
  8946. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8947. }
  8948. for (let i = 0; i < columns; i++) {
  8949. const anotherArray = literal.value[i];
  8950. this.evaluateArrayLiteral(id, columns, null, type, anotherArray)
  8951. }
  8952. }
  8953. }
  8954. } else {
  8955. const resultType = this.evaluateExpressionType(literal);
  8956. if (!(resultType instanceof CompoundType)) {
  8957. const strInfo = type.stringInfo();
  8958. const info = strInfo[0];
  8959. const strExp = literal.toString();
  8960. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  8961. }
  8962. if (!type.isCompatible(resultType)) {
  8963. const strInfo = type.stringInfo();
  8964. const info = strInfo[0];
  8965. const strExp = literal.toString();
  8966. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  8967. }
  8968. return true;
  8969. } */
  8970. return true;
  8971. }
  8972. }, {
  8973. key: 'assertFunction',
  8974. value: function assertFunction(fun) {
  8975. var _this = this;
  8976. this.pushMap();
  8977. this.currentFunction = fun;
  8978. fun.formalParameters.forEach(function (formalParam) {
  8979. if (formalParam.type instanceof _compoundType.CompoundType) {
  8980. if (formalParam.type.dimensions > 1) {
  8981. _this.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: -1, type: formalParam.type });
  8982. } else {
  8983. _this.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: null, type: formalParam.type });
  8984. }
  8985. } else {
  8986. _this.insertSymbol(formalParam.id, { id: formalParam.id, type: formalParam.type });
  8987. }
  8988. });
  8989. this.assertDeclarations(fun.variablesDeclarations);
  8990. var optional = fun.returnType.isCompatible(_types.Types.VOID);
  8991. var valid = this.assertReturn(fun, optional);
  8992. if (!valid) {
  8993. throw _processorErrorFactory.ProcessorErrorFactory.function_no_return(fun.name);
  8994. }
  8995. this.popMap();
  8996. }
  8997. }, {
  8998. key: 'assertReturn',
  8999. value: function assertReturn(fun, optional) {
  9000. var _this2 = this;
  9001. return fun.commands.reduce(function (last, next) {
  9002. return _this2.checkCommand(fun.returnType, next, optional) || last;
  9003. }, optional);
  9004. }
  9005. }, {
  9006. key: 'checkCommand',
  9007. value: function checkCommand(type, cmd, optional) {
  9008. if (cmd instanceof _commands.While) {
  9009. var resultType = this.evaluateExpressionType(cmd.expression);
  9010. if (!resultType.isCompatible(_types.Types.BOOLEAN)) {
  9011. throw _processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.expression.toString(), cmd.sourceInfo);
  9012. }
  9013. this.checkCommands(type, cmd.commands, optional);
  9014. return false;
  9015. } else if (cmd instanceof _commands.For) {
  9016. this.checkCommand(type, cmd.assignment, optional);
  9017. var _resultType = this.evaluateExpressionType(cmd.condition);
  9018. if (!_resultType.isCompatible(_types.Types.BOOLEAN)) {
  9019. throw _processorErrorFactory.ProcessorErrorFactory.for_condition_type_full(cmd.condition.toString(), cmd.sourceInfo);
  9020. }
  9021. this.checkCommand(type, cmd.increment, optional);
  9022. this.checkCommands(type, cmd.commands, optional);
  9023. return false;
  9024. } else if (cmd instanceof _commands.Switch) {
  9025. var sType = this.evaluateExpressionType(cmd.expression);
  9026. var result = optional;
  9027. var hasDefault = false;
  9028. for (var i = 0; i < cmd.cases.length; i++) {
  9029. var aCase = cmd.cases[i];
  9030. if (aCase.expression !== null) {
  9031. var caseType = this.evaluateExpressionType(aCase.expression);
  9032. if (!sType.isCompatible(caseType)) {
  9033. var strInfo = sType.stringInfo();
  9034. var info = strInfo[0];
  9035. var strExp = aCase.expression.toString();
  9036. throw _processorErrorFactory.ProcessorErrorFactory.invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
  9037. }
  9038. } else {
  9039. hasDefault = true;
  9040. }
  9041. result = result && this.checkCommands(type, aCase.commands, result);
  9042. }
  9043. return result && hasDefault;
  9044. } else if (cmd instanceof _commands.ArrayIndexAssign) {
  9045. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9046. if (typeInfo === null) {
  9047. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9048. }
  9049. if (!(typeInfo.type instanceof _compoundType.CompoundType)) {
  9050. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo);
  9051. }
  9052. var exp = cmd.expression;
  9053. var lineExp = cmd.line;
  9054. var lineType = this.evaluateExpressionType(lineExp);
  9055. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  9056. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  9057. }
  9058. var columnExp = cmd.column;
  9059. if (typeInfo.columns === null && columnExp !== null) {
  9060. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
  9061. } else if (columnExp !== null) {
  9062. var columnType = this.evaluateExpressionType(columnExp);
  9063. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  9064. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  9065. }
  9066. }
  9067. // exp can be a arrayLiteral, a single value exp or an array access
  9068. if (exp instanceof _expressions.ArrayLiteral) {
  9069. this.evaluateArrayLiteral(cmd.id, typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp);
  9070. } else {
  9071. // cannot properly evaluate since type system is poorly constructed
  9072. }
  9073. return optional;
  9074. } else if (cmd instanceof _commands.Assign) {
  9075. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9076. if (_typeInfo === null) {
  9077. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9078. }
  9079. var _exp = cmd.expression;
  9080. if (_exp instanceof _expressions.ArrayLiteral) {
  9081. if (!(_typeInfo.type instanceof _compoundType.CompoundType)) {
  9082. var stringInfo = _typeInfo.type.stringInfo();
  9083. var _info2 = stringInfo[0];
  9084. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info2.type, _info2.dim, cmd.sourceInfo);
  9085. }
  9086. this.evaluateArrayLiteral(cmd.id, _typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp);
  9087. } else {
  9088. var _resultType2 = this.evaluateExpressionType(_exp);
  9089. if (!_resultType2.isCompatible(_typeInfo.type) && !_config.Config.enable_type_casting || !_resultType2.isCompatible(_typeInfo.type) && _config.Config.enable_type_casting && !_store.Store.canImplicitTypeCast(_typeInfo.type, _resultType2)) {
  9090. var _stringInfo2 = _typeInfo.type.stringInfo();
  9091. var _info3 = _stringInfo2[0];
  9092. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info3.type, _info3.dim, cmd.sourceInfo);
  9093. }
  9094. }
  9095. return optional;
  9096. } else if (cmd instanceof _commands.Break) {
  9097. return optional;
  9098. } else if (cmd instanceof _commands.IfThenElse) {
  9099. var _resultType3 = this.evaluateExpressionType(cmd.condition);
  9100. if (!_resultType3.isCompatible(_types.Types.BOOLEAN)) {
  9101. throw _processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.condition.toString(), cmd.sourceInfo);
  9102. }
  9103. if (cmd.ifFalse instanceof _commands.IfThenElse) {
  9104. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  9105. } else {
  9106. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  9107. }
  9108. } else if (cmd instanceof _expressions.FunctionCall) {
  9109. var fun = null;
  9110. if (cmd.isMainCall) {
  9111. fun = this.getMainFunction();
  9112. } else {
  9113. fun = this.findFunction(cmd.id);
  9114. }
  9115. if (fun === null) {
  9116. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(cmd.id, cmd.sourceInfo);
  9117. }
  9118. this.assertParameters(fun, cmd.actualParameters);
  9119. return optional;
  9120. } else if (cmd instanceof _commands.Return) {
  9121. var funcName = this.currentFunction.isMain ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : this.currentFunction.name;
  9122. if (cmd.expression === null && !type.isCompatible(_types.Types.VOID)) {
  9123. var _stringInfo3 = type.stringInfo();
  9124. var _info4 = _stringInfo3[0];
  9125. throw _processorErrorFactory.ProcessorErrorFactory.invalid_void_return_full(funcName, _info4.type, _info4.dim, cmd.sourceInfo);
  9126. } else if (cmd.expression !== null) {
  9127. var _resultType4 = this.evaluateExpressionType(cmd.expression);
  9128. if (!type.isCompatible(_resultType4)) {
  9129. var _stringInfo4 = type.stringInfo();
  9130. var _info5 = _stringInfo4[0];
  9131. throw _processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, _info5.type, _info5.dim, cmd.sourceInfo);
  9132. } else {
  9133. return true;
  9134. }
  9135. } else {
  9136. return true;
  9137. }
  9138. }
  9139. }
  9140. }, {
  9141. key: 'checkCommands',
  9142. value: function checkCommands(type, cmds, optional) {
  9143. var _this3 = this;
  9144. return cmds.reduce(function (last, next) {
  9145. return _this3.checkCommand(type, next, optional) || last;
  9146. }, optional);
  9147. }
  9148. }, {
  9149. key: 'assertParameters',
  9150. value: function assertParameters(fun, actualParametersList) {
  9151. if (fun.formalParameters.length !== actualParametersList.length) {
  9152. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
  9153. }
  9154. for (var i = 0; i < actualParametersList.length; i++) {
  9155. var param = actualParametersList[i];
  9156. var formalParam = fun.formalParameters[i];
  9157. var id = formalParam.id;
  9158. if (formalParam.byRef) {
  9159. if (!(param instanceof _expressions.VariableLiteral || param instanceof _expressions.ArrayAccess)) {
  9160. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9161. }
  9162. }
  9163. var resultType = this.evaluateExpressionType(param);
  9164. if (resultType instanceof _multiType.MultiType && formalParam.type instanceof _multiType.MultiType) {
  9165. var shared = 0;
  9166. for (var j = 0; j < resultType.types.length; j++) {
  9167. var element = resultType.types[j];
  9168. if (formalParam.type.types.indexOf(element) !== -1) {
  9169. shared++;
  9170. }
  9171. }
  9172. if (shared <= 0) {
  9173. if (_config.Config.enable_type_casting && !formalParam.byRef) {
  9174. if (resultType.isCompatible(_types.Types.INTEGER) || resultType.isCompatible(_types.Types.REAL)) {
  9175. if (formalParam.type.isCompatible(_types.Types.INTEGER) || formalParam.type.isCompatible(_types.Types.REAL)) {
  9176. continue;
  9177. }
  9178. }
  9179. }
  9180. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9181. }
  9182. } else if (resultType instanceof _multiType.MultiType) {
  9183. if (!resultType.isCompatible(formalParam.type)) {
  9184. if (_config.Config.enable_type_casting && !formalParam.byRef) {
  9185. if (resultType.isCompatible(_types.Types.INTEGER) || resultType.isCompatible(_types.Types.REAL)) {
  9186. if (formalParam.type.isCompatible(_types.Types.INTEGER) || formalParam.type.isCompatible(_types.Types.REAL)) {
  9187. continue;
  9188. }
  9189. }
  9190. }
  9191. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9192. }
  9193. } else if (!formalParam.type.isCompatible(resultType)) {
  9194. if (_config.Config.enable_type_casting && !formalParam.byRef) {
  9195. if (_store.Store.canImplicitTypeCast(formalParam.type, resultType)) {
  9196. continue;
  9197. }
  9198. }
  9199. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9200. }
  9201. }
  9202. }
  9203. }]);
  9204. return SemanticAnalyser;
  9205. }();
  9206. /***/ }),
  9207. /***/ "./js/processor/store/store.js":
  9208. /*!*************************************!*\
  9209. !*** ./js/processor/store/store.js ***!
  9210. \*************************************/
  9211. /*! no static exports found */
  9212. /***/ (function(module, exports, __webpack_require__) {
  9213. "use strict";
  9214. Object.defineProperty(exports, "__esModule", {
  9215. value: true
  9216. });
  9217. exports.Store = undefined;
  9218. 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; }; }();
  9219. var _modes = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js");
  9220. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  9221. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9222. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9223. var Store = exports.Store = function () {
  9224. _createClass(Store, null, [{
  9225. key: 'canImplicitTypeCast',
  9226. value: function canImplicitTypeCast(castType, sourceType) {
  9227. if (castType.isCompatible(_types.Types.INTEGER) || castType.isCompatible(_types.Types.REAL)) {
  9228. if (sourceType.isCompatible(_types.Types.INTEGER) || sourceType.isCompatible(_types.Types.REAL)) {
  9229. return true;
  9230. }
  9231. }
  9232. return false;
  9233. }
  9234. }, {
  9235. key: 'doImplicitCasting',
  9236. value: function doImplicitCasting(castType, stoObj) {
  9237. if (!Store.canImplicitTypeCast(castType, stoObj.type)) {
  9238. throw new Error("!!!Critical error: attempted to type cast invalid types");
  9239. }
  9240. if (_types.Types.INTEGER.isCompatible(castType)) {
  9241. return new _storeObject.StoreObject(castType, stoObj.value.trunc());
  9242. } else {
  9243. return new _storeObject.StoreObject(castType, stoObj.value);
  9244. }
  9245. }
  9246. }]);
  9247. function Store(name) {
  9248. _classCallCheck(this, Store);
  9249. this.name = name;
  9250. this.store = {};
  9251. this.nextStore = null;
  9252. this.mode = _modes.Modes.RUN;
  9253. }
  9254. _createClass(Store, [{
  9255. key: 'extendStore',
  9256. value: function extendStore(nextStore) {
  9257. this.nextStore = nextStore;
  9258. }
  9259. }, {
  9260. key: 'applyStore',
  9261. value: function applyStore(id) {
  9262. if (!this.store[id]) {
  9263. if (this.nextStore !== null) {
  9264. return this.nextStore.applyStore(id);
  9265. } else {
  9266. throw new Error('Variable ' + id + ' not found.');
  9267. }
  9268. }
  9269. var val = this.store[id];
  9270. if (val.isRef) {
  9271. return val.getRefObj();
  9272. }
  9273. return this.store[id];
  9274. }
  9275. }, {
  9276. key: 'updateStore',
  9277. value: function updateStore(id, stoObj) {
  9278. if (!this.store[id]) {
  9279. if (this.nextStore !== null) {
  9280. this.nextStore.updateStore(id, stoObj);
  9281. return this;
  9282. } else {
  9283. // TODO: better error message
  9284. throw new Error('Variable ' + id + ' not found.');
  9285. }
  9286. } else {
  9287. var oldObj = this.store[id];
  9288. if (oldObj.readOnly) {
  9289. // TODO: better error message
  9290. throw new Error("Cannot change value of a read only variable: " + id);
  9291. }
  9292. if (oldObj.isRef) {
  9293. oldObj.updateRef(stoObj);
  9294. return this;
  9295. } else if (oldObj.isCompatible(stoObj)) {
  9296. stoObj.setID(id);
  9297. this.store[id] = Object.freeze(stoObj);
  9298. return this;
  9299. } else {
  9300. var oldType = oldObj.type;
  9301. var stoType = stoObj.type;
  9302. // TODO: better error message
  9303. throw new Error(oldType + ' is not compatible with type ' + stoType + ' given');
  9304. }
  9305. }
  9306. }
  9307. //In case of future use of ref, it needs to have a special function to update the storeRefObject
  9308. // and no the StoreObject refferenced by it
  9309. // updateStoreRef(id, stoObjAddress) {...}
  9310. }, {
  9311. key: 'insertStore',
  9312. value: function insertStore(id, stoObj) {
  9313. if (this.store[id]) {
  9314. // TODO: better error message
  9315. throw new Error(id + ' is already defined');
  9316. }
  9317. stoObj.setID(id);
  9318. this.store[id] = Object.freeze(stoObj);
  9319. return this;
  9320. }
  9321. }]);
  9322. return Store;
  9323. }();
  9324. /***/ }),
  9325. /***/ "./js/processor/store/storeObject.js":
  9326. /*!*******************************************!*\
  9327. !*** ./js/processor/store/storeObject.js ***!
  9328. \*******************************************/
  9329. /*! no static exports found */
  9330. /***/ (function(module, exports, __webpack_require__) {
  9331. "use strict";
  9332. Object.defineProperty(exports, "__esModule", {
  9333. value: true
  9334. });
  9335. exports.StoreObject = undefined;
  9336. 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; }; }();
  9337. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9338. var _decimal2 = _interopRequireDefault(_decimal);
  9339. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9340. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9341. var StoreObject = exports.StoreObject = function () {
  9342. function StoreObject(type, value) {
  9343. var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9344. _classCallCheck(this, StoreObject);
  9345. this._type = type;
  9346. this._value = value;
  9347. this._readOnly = readOnly;
  9348. this._id = null;
  9349. }
  9350. _createClass(StoreObject, [{
  9351. key: 'setID',
  9352. value: function setID(id) {
  9353. this._id = id;
  9354. }
  9355. }, {
  9356. key: 'isCompatible',
  9357. value: function isCompatible(another) {
  9358. if (another instanceof StoreObject) {
  9359. return this.type.isCompatible(another.type);
  9360. }
  9361. return false;
  9362. }
  9363. }, {
  9364. key: 'id',
  9365. get: function get() {
  9366. return this._id;
  9367. }
  9368. }, {
  9369. key: 'inStore',
  9370. get: function get() {
  9371. return this.id !== null;
  9372. }
  9373. }, {
  9374. key: 'type',
  9375. get: function get() {
  9376. return this._type;
  9377. }
  9378. }, {
  9379. key: 'value',
  9380. get: function get() {
  9381. return this._value;
  9382. }
  9383. }, {
  9384. key: 'number',
  9385. get: function get() {
  9386. if (this._value instanceof _decimal2.default) {
  9387. return this._value.toNumber();
  9388. } else {
  9389. return null;
  9390. }
  9391. }
  9392. }, {
  9393. key: 'readOnly',
  9394. get: function get() {
  9395. return this._readOnly;
  9396. },
  9397. set: function set(value) {
  9398. this._readOnly = value;
  9399. }
  9400. }]);
  9401. return StoreObject;
  9402. }();
  9403. /***/ }),
  9404. /***/ "./js/processor/store/storeObjectArray.js":
  9405. /*!************************************************!*\
  9406. !*** ./js/processor/store/storeObjectArray.js ***!
  9407. \************************************************/
  9408. /*! no static exports found */
  9409. /***/ (function(module, exports, __webpack_require__) {
  9410. "use strict";
  9411. Object.defineProperty(exports, "__esModule", {
  9412. value: true
  9413. });
  9414. exports.StoreObjectArray = undefined;
  9415. 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); } };
  9416. 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; }; }();
  9417. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9418. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9419. 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; }
  9420. 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; }
  9421. var StoreObjectArray = exports.StoreObjectArray = function (_StoreObject) {
  9422. _inherits(StoreObjectArray, _StoreObject);
  9423. _createClass(StoreObjectArray, null, [{
  9424. key: 'WRONG_LINE_NUMBER',
  9425. get: function get() {
  9426. return 1;
  9427. }
  9428. }, {
  9429. key: 'WRONG_TYPE',
  9430. get: function get() {
  9431. return 2;
  9432. }
  9433. }, {
  9434. key: 'WRONG_COLUMN_NUMBER',
  9435. get: function get() {
  9436. return 3;
  9437. }
  9438. }]);
  9439. function StoreObjectArray(type, lines, columns) {
  9440. var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  9441. var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  9442. _classCallCheck(this, StoreObjectArray);
  9443. var _this = _possibleConstructorReturn(this, (StoreObjectArray.__proto__ || Object.getPrototypeOf(StoreObjectArray)).call(this, type, value, readOnly));
  9444. _this._lines = lines;
  9445. _this._columns = columns;
  9446. return _this;
  9447. }
  9448. _createClass(StoreObjectArray, [{
  9449. key: 'isCompatible',
  9450. value: function isCompatible(another) {
  9451. if (another instanceof _storeObject.StoreObject) {
  9452. if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) {
  9453. if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) {
  9454. return _get(StoreObjectArray.prototype.__proto__ || Object.getPrototypeOf(StoreObjectArray.prototype), 'isCompatible', this).call(this, another);
  9455. }
  9456. }
  9457. }
  9458. return false;
  9459. }
  9460. }, {
  9461. key: 'lines',
  9462. get: function get() {
  9463. return this._lines;
  9464. }
  9465. }, {
  9466. key: 'columns',
  9467. get: function get() {
  9468. return this._columns;
  9469. }
  9470. }, {
  9471. key: 'isVector',
  9472. get: function get() {
  9473. return this.type.dimensions === 1;
  9474. }
  9475. }, {
  9476. key: 'isValid',
  9477. get: function get() {
  9478. var _this2 = this;
  9479. if (this.value !== null) {
  9480. if (this.isVector) {
  9481. if (this.value.length !== this.lines) {
  9482. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];;
  9483. }
  9484. var mustBeNull = this.value.find(function (v) {
  9485. return !_this2.type.canAccept(v.type);
  9486. });
  9487. if (!!mustBeNull) {
  9488. return [StoreObjectArray.WRONG_TYPE, this.value.indexOf(mustBeNull)];;
  9489. }
  9490. }
  9491. return [];
  9492. } else {
  9493. if (this.lines !== this.value.length) {
  9494. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9495. }
  9496. for (var i = 0; i < this.lines; i++) {
  9497. for (var j = 0; j < this.columns; j++) {
  9498. var arr = this.value[i];
  9499. if (arr.length !== this.columns) {
  9500. return [StoreObjectArray.WRONG_COLUMN_NUMBER, arr.length];
  9501. }
  9502. var _mustBeNull = arr.find(function (v) {
  9503. return !_this2.type.canAccept(v.type);
  9504. });
  9505. if (!!_mustBeNull) {
  9506. return [StoreObjectArray.WRONG_TYPE, i, arr.indexOf(_mustBeNull)];
  9507. }
  9508. }
  9509. }
  9510. return [];
  9511. }
  9512. }
  9513. }]);
  9514. return StoreObjectArray;
  9515. }(_storeObject.StoreObject);
  9516. /***/ }),
  9517. /***/ "./js/processor/store/storeObjectArrayAddress.js":
  9518. /*!*******************************************************!*\
  9519. !*** ./js/processor/store/storeObjectArrayAddress.js ***!
  9520. \*******************************************************/
  9521. /*! no static exports found */
  9522. /***/ (function(module, exports, __webpack_require__) {
  9523. "use strict";
  9524. Object.defineProperty(exports, "__esModule", {
  9525. value: true
  9526. });
  9527. exports.StoreObjectArrayAddress = undefined;
  9528. 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; }; }();
  9529. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9530. var _storeObjectArray = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  9531. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  9532. var _processorErrorFactory = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  9533. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9534. 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; }
  9535. 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; }
  9536. var StoreObjectArrayAddress = exports.StoreObjectArrayAddress = function (_StoreObject) {
  9537. _inherits(StoreObjectArrayAddress, _StoreObject);
  9538. function StoreObjectArrayAddress(refID, line, column, store) {
  9539. _classCallCheck(this, StoreObjectArrayAddress);
  9540. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddress.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddress)).call(this, null, null, false));
  9541. _this.refID = refID;
  9542. _this.store = store;
  9543. _this.line = line;
  9544. _this.column = column;
  9545. return _this;
  9546. }
  9547. _createClass(StoreObjectArrayAddress, [{
  9548. key: 'getArrayObject',
  9549. value: function getArrayObject() {
  9550. return this.store.applyStore(this.refID);
  9551. }
  9552. }, {
  9553. key: 'updateArrayObject',
  9554. value: function updateArrayObject(stoObj) {
  9555. var anArray = this.getArrayObject();
  9556. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), anArray);
  9557. if (!stoObj.type.isCompatible(this.type)) {
  9558. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9559. } else if (this.type instanceof _compoundType.CompoundType && this.type.canAccept(stoObj.type)) {
  9560. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9561. }
  9562. if (this.column !== null) {
  9563. newArray.value[this.line].value[this.column] = stoObj;
  9564. return newArray;
  9565. } else {
  9566. newArray.value[this.line] = stoObj;
  9567. return newArray;
  9568. }
  9569. }
  9570. }, {
  9571. key: 'isCompatible',
  9572. value: function isCompatible(another) {
  9573. if (this.type.isCompatible(another.type)) {
  9574. if (another.type instanceof _compoundType.CompoundType) {
  9575. return this.lines === another.lines && this.columns === another.columns;
  9576. } else {
  9577. this.refValue.isCompatible(another);
  9578. }
  9579. }
  9580. }
  9581. }, {
  9582. key: 'isRef',
  9583. get: function get() {
  9584. return false;
  9585. }
  9586. }, {
  9587. key: 'inStore',
  9588. get: function get() {
  9589. return true;
  9590. }
  9591. }, {
  9592. key: 'refValue',
  9593. get: function get() {
  9594. var refLine = this.store.applyStore(this.refID).value[this.line];
  9595. if (!refLine) {
  9596. if (this.getArrayObject().isVector) {
  9597. throw _processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9598. } else {
  9599. throw _processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9600. }
  9601. }
  9602. if (this.column !== null) {
  9603. var refColumn = refLine.value[this.column];
  9604. if (!refColumn) {
  9605. if (this.getArrayObject().isVector) {
  9606. throw _processorErrorFactory.ProcessorErrorFactory.vector_not_matrix(this.refID);
  9607. } else {
  9608. throw _processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds(this.refID, this.column, this.getArrayObject().columns);
  9609. }
  9610. }
  9611. return refColumn;
  9612. }
  9613. return refLine;
  9614. }
  9615. }, {
  9616. key: 'value',
  9617. get: function get() {
  9618. return this.refValue.value;
  9619. }
  9620. }, {
  9621. key: 'type',
  9622. get: function get() {
  9623. return this.refValue.type;
  9624. }
  9625. }, {
  9626. key: 'lines',
  9627. get: function get() {
  9628. if (!(this.type instanceof _compoundType.CompoundType)) {
  9629. return null;
  9630. }
  9631. return this.refValue.value.length;
  9632. }
  9633. }, {
  9634. key: 'columns',
  9635. get: function get() {
  9636. switch (this.type.dimensions) {
  9637. case 2:
  9638. return this.refValue.value[0].value.length;
  9639. default:
  9640. return null;
  9641. }
  9642. }
  9643. }]);
  9644. return StoreObjectArrayAddress;
  9645. }(_storeObject.StoreObject);
  9646. /***/ }),
  9647. /***/ "./js/processor/store/storeObjectArrayAddressRef.js":
  9648. /*!**********************************************************!*\
  9649. !*** ./js/processor/store/storeObjectArrayAddressRef.js ***!
  9650. \**********************************************************/
  9651. /*! no static exports found */
  9652. /***/ (function(module, exports, __webpack_require__) {
  9653. "use strict";
  9654. Object.defineProperty(exports, "__esModule", {
  9655. value: true
  9656. });
  9657. exports.StoreObjectArrayAddressRef = undefined;
  9658. 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; }; }();
  9659. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9660. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9661. var _decimal2 = _interopRequireDefault(_decimal);
  9662. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9663. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9664. 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; }
  9665. 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; }
  9666. var StoreObjectArrayAddressRef = exports.StoreObjectArrayAddressRef = function (_StoreObject) {
  9667. _inherits(StoreObjectArrayAddressRef, _StoreObject);
  9668. function StoreObjectArrayAddressRef(address) {
  9669. _classCallCheck(this, StoreObjectArrayAddressRef);
  9670. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddressRef.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddressRef)).call(this, null, null, false));
  9671. _this.address = address;
  9672. return _this;
  9673. }
  9674. _createClass(StoreObjectArrayAddressRef, [{
  9675. key: 'getRefObj',
  9676. value: function getRefObj() {
  9677. return this.address.refValue;
  9678. }
  9679. }, {
  9680. key: 'updateRef',
  9681. value: function updateRef(stoObj) {
  9682. var newArray = this.address.updateArrayObject(stoObj);
  9683. this.address.store.updateStore(this.address.refID, newArray);
  9684. }
  9685. }, {
  9686. key: 'isCompatible',
  9687. value: function isCompatible(another) {
  9688. return this.address.isCompatible(another);
  9689. }
  9690. }, {
  9691. key: 'isRef',
  9692. get: function get() {
  9693. return true;
  9694. }
  9695. }, {
  9696. key: 'type',
  9697. get: function get() {
  9698. return this.address.type;
  9699. }
  9700. }, {
  9701. key: 'value',
  9702. get: function get() {
  9703. return this.address.value;
  9704. }
  9705. }, {
  9706. key: 'number',
  9707. get: function get() {
  9708. if (this.value instanceof _decimal2.default) {
  9709. return this.value.toNumber();
  9710. } else {
  9711. return null;
  9712. }
  9713. }
  9714. }]);
  9715. return StoreObjectArrayAddressRef;
  9716. }(_storeObject.StoreObject);
  9717. /***/ }),
  9718. /***/ "./js/processor/store/storeObjectRef.js":
  9719. /*!**********************************************!*\
  9720. !*** ./js/processor/store/storeObjectRef.js ***!
  9721. \**********************************************/
  9722. /*! no static exports found */
  9723. /***/ (function(module, exports, __webpack_require__) {
  9724. "use strict";
  9725. Object.defineProperty(exports, "__esModule", {
  9726. value: true
  9727. });
  9728. exports.StoreObjectRef = undefined;
  9729. 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; }; }();
  9730. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9731. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9732. var _decimal2 = _interopRequireDefault(_decimal);
  9733. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9734. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9735. 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; }
  9736. 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; }
  9737. var StoreObjectRef = exports.StoreObjectRef = function (_StoreObject) {
  9738. _inherits(StoreObjectRef, _StoreObject);
  9739. function StoreObjectRef(refID, store) {
  9740. _classCallCheck(this, StoreObjectRef);
  9741. var _this = _possibleConstructorReturn(this, (StoreObjectRef.__proto__ || Object.getPrototypeOf(StoreObjectRef)).call(this, null, null, false));
  9742. _this.refID = refID;
  9743. _this.store = store;
  9744. return _this;
  9745. }
  9746. _createClass(StoreObjectRef, [{
  9747. key: 'getRefObj',
  9748. value: function getRefObj() {
  9749. return this.store.applyStore(this.refID);
  9750. }
  9751. }, {
  9752. key: 'updateRef',
  9753. value: function updateRef(stoObj) {
  9754. this.store.updateStore(this.refID, stoObj);
  9755. }
  9756. }, {
  9757. key: 'isCompatible',
  9758. value: function isCompatible(another) {
  9759. return this.store.applyStore(this.refID).isCompatible(another);
  9760. }
  9761. }, {
  9762. key: 'isRef',
  9763. get: function get() {
  9764. return true;
  9765. }
  9766. }, {
  9767. key: 'type',
  9768. get: function get() {
  9769. return this.store.applyStore(this.refID).type;
  9770. }
  9771. }, {
  9772. key: 'value',
  9773. get: function get() {
  9774. return this.store.applyStore(this.refID).value;
  9775. }
  9776. }, {
  9777. key: 'number',
  9778. get: function get() {
  9779. if (this.value instanceof _decimal2.default) {
  9780. return this.value.toNumber();
  9781. } else {
  9782. return null;
  9783. }
  9784. }
  9785. }]);
  9786. return StoreObjectRef;
  9787. }(_storeObject.StoreObject);
  9788. /***/ }),
  9789. /***/ "./js/runner.js":
  9790. /*!**********************!*\
  9791. !*** ./js/runner.js ***!
  9792. \**********************/
  9793. /*! no static exports found */
  9794. /***/ (function(module, exports, __webpack_require__) {
  9795. "use strict";
  9796. Object.defineProperty(exports, "__esModule", {
  9797. value: true
  9798. });
  9799. exports.runner = runner;
  9800. var _ivprogParser = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  9801. var _ivprogProcessor = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  9802. var _domConsole = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
  9803. var _languageService = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js");
  9804. var _semanticAnalyser = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  9805. function runner() {
  9806. var ivprogLexer = _languageService.LanguageService.getCurrentLexer();
  9807. // const lexer = new ivprogLexer(new InputStream(input));
  9808. // const stream = new CommonTokenStream(lexer);
  9809. // stream.fill();
  9810. // let i = 1;
  9811. // let token = null;
  9812. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  9813. // console.log(`${token.type}-${token.text}`);
  9814. // console.log('\n')
  9815. // i++;
  9816. // }
  9817. // const anaSin = new IVProgParser(input, ivprogLexer);
  9818. var editor = new JsonEditor('#json-renderer', {});
  9819. var domConsole = new _domConsole.DOMConsole("#console");
  9820. // proc.interpretAST().then( sto => {
  9821. // console.log(sto.applyStore('a'));
  9822. // }).catch(e => console.log(e));
  9823. try {
  9824. $('#btn').click(function () {
  9825. var input = $('#input').val();
  9826. var analiser = new _ivprogParser.IVProgParser(input, ivprogLexer);
  9827. try {
  9828. var data = analiser.parseTree();
  9829. var semAna = new _semanticAnalyser.SemanticAnalyser(data);
  9830. var proc = new _ivprogProcessor.IVProgProcessor(semAna.analyseTree());
  9831. proc.registerInput(domConsole);
  9832. domConsole.clear();
  9833. proc.registerOutput(domConsole);
  9834. proc.interpretAST().then(function (sto) {
  9835. return editor.load(sto.store);
  9836. }).catch(function (e) {
  9837. alert(e);console.log(e);
  9838. });
  9839. } catch (error) {
  9840. alert(error);
  9841. console.log(error);
  9842. }
  9843. });
  9844. } catch (a) {
  9845. console.log(a);
  9846. }
  9847. }
  9848. /***/ }),
  9849. /***/ "./js/semantic/semantic.min.js":
  9850. /*!*************************************!*\
  9851. !*** ./js/semantic/semantic.min.js ***!
  9852. \*************************************/
  9853. /*! no static exports found */
  9854. /***/ (function(module, exports, __webpack_require__) {
  9855. "use strict";
  9856. 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; };
  9857. /*
  9858. * # Semantic UI - 2.3.3
  9859. * https://github.com/Semantic-Org/Semantic-UI
  9860. * http://www.semantic-ui.com/
  9861. *
  9862. * Copyright 2014 Contributors
  9863. * Released under the MIT license
  9864. * http://opensource.org/licenses/MIT
  9865. *
  9866. */
  9867. !function (e, t, n, i) {
  9868. e.site = e.fn.site = function (o) {
  9869. var a,
  9870. r,
  9871. s = new Date().getTime(),
  9872. l = [],
  9873. c = arguments[0],
  9874. u = "string" == typeof c,
  9875. d = [].slice.call(arguments, 1),
  9876. f = e.isPlainObject(o) ? e.extend(!0, {}, e.site.settings, o) : e.extend({}, e.site.settings),
  9877. m = f.namespace,
  9878. g = f.error,
  9879. p = "module-" + m,
  9880. h = e(n),
  9881. v = this,
  9882. b = h.data(p);return a = { initialize: function initialize() {
  9883. a.instantiate();
  9884. }, instantiate: function instantiate() {
  9885. a.verbose("Storing instance of site", a), b = a, h.data(p, a);
  9886. }, normalize: function normalize() {
  9887. a.fix.console(), a.fix.requestAnimationFrame();
  9888. }, fix: { console: function (_console) {
  9889. function console() {
  9890. return _console.apply(this, arguments);
  9891. }
  9892. console.toString = function () {
  9893. return _console.toString();
  9894. };
  9895. return console;
  9896. }(function () {
  9897. 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 () {});
  9898. }), consoleClear: function consoleClear() {
  9899. a.debug("Disabling programmatic console clearing"), t.console.clear = function () {};
  9900. }, requestAnimationFrame: function requestAnimationFrame() {
  9901. 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) {
  9902. setTimeout(e, 0);
  9903. });
  9904. } }, moduleExists: function moduleExists(t) {
  9905. return e.fn[t] !== i && e.fn[t].settings !== i;
  9906. }, enabled: { modules: function modules(t) {
  9907. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9908. a.moduleExists(t) && n.push(t);
  9909. }), n;
  9910. } }, disabled: { modules: function modules(t) {
  9911. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9912. a.moduleExists(t) || n.push(t);
  9913. }), n;
  9914. } }, change: { setting: function setting(t, n, o, r) {
  9915. o = "string" == typeof o ? "all" === o ? f.modules : [o] : o || f.modules, r = r === i || r, e.each(o, function (i, o) {
  9916. var s,
  9917. 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)));
  9918. });
  9919. }, settings: function settings(t, n, o) {
  9920. n = "string" == typeof n ? [n] : n || f.modules, o = o === i || o, e.each(n, function (n, i) {
  9921. 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)));
  9922. });
  9923. } }, enable: { console: function console() {
  9924. a.console(!0);
  9925. }, debug: function debug(e, t) {
  9926. e = e || f.modules, a.debug("Enabling debug for modules", e), a.change.setting("debug", !0, e, t);
  9927. }, verbose: function verbose(e, t) {
  9928. e = e || f.modules, a.debug("Enabling verbose debug for modules", e), a.change.setting("verbose", !0, e, t);
  9929. } }, disable: { console: function console() {
  9930. a.console(!1);
  9931. }, debug: function debug(e, t) {
  9932. e = e || f.modules, a.debug("Disabling debug for modules", e), a.change.setting("debug", !1, e, t);
  9933. }, verbose: function verbose(e, t) {
  9934. e = e || f.modules, a.debug("Disabling verbose debug for modules", e), a.change.setting("verbose", !1, e, t);
  9935. } }, console: function console(e) {
  9936. if (e) {
  9937. if (b.cache.console === i) return void a.error(g.console);a.debug("Restoring console function"), t.console = b.cache.console;
  9938. } 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() {} };
  9939. }, destroy: function destroy() {
  9940. a.verbose("Destroying previous site for", h), h.removeData(p);
  9941. }, cache: {}, setting: function setting(t, n) {
  9942. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  9943. if (n === i) return f[t];f[t] = n;
  9944. }
  9945. }, internal: function internal(t, n) {
  9946. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  9947. if (n === i) return a[t];a[t] = n;
  9948. }
  9949. }, debug: function debug() {
  9950. f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  9951. }, verbose: function verbose() {
  9952. 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)));
  9953. }, error: function error() {
  9954. a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments);
  9955. }, performance: { log: function log(e) {
  9956. 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);
  9957. }, display: function display() {
  9958. var t = f.name + ":",
  9959. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  9960. n += t["Execution Time"];
  9961. }), 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) {
  9962. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9963. }), console.groupEnd()), l = [];
  9964. } }, invoke: function invoke(t, n, o) {
  9965. var s,
  9966. l,
  9967. c,
  9968. 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) {
  9969. 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 {
  9970. 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];
  9971. }
  9972. })), 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;
  9973. } }, u ? (b === i && a.initialize(), a.invoke(c)) : (b !== i && a.destroy(), a.initialize()), r !== i ? r : this;
  9974. }, 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) {
  9975. return function (n) {
  9976. return !!e.data(n, t);
  9977. };
  9978. }) : function (t, n, i) {
  9979. return !!e.data(t, i[3]);
  9980. } });
  9981. }(jQuery, window, document), function (e, t, n, i) {
  9982. "use strict";
  9983. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.form = function (t) {
  9984. var o,
  9985. a = e(this),
  9986. r = a.selector || "",
  9987. s = new Date().getTime(),
  9988. l = [],
  9989. c = arguments[0],
  9990. u = arguments[1],
  9991. d = "string" == typeof c,
  9992. f = [].slice.call(arguments, 1);return a.each(function () {
  9993. var m,
  9994. g,
  9995. p,
  9996. h,
  9997. v,
  9998. b,
  9999. y,
  10000. x,
  10001. C,
  10002. w,
  10003. S,
  10004. k,
  10005. T,
  10006. A,
  10007. R,
  10008. P,
  10009. E = e(this),
  10010. F = this,
  10011. O = [],
  10012. D = !1;(P = { initialize: function initialize() {
  10013. 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());
  10014. }, instantiate: function instantiate() {
  10015. P.verbose("Storing instance of module", P), R = P, E.data(T, P);
  10016. }, destroy: function destroy() {
  10017. P.verbose("Destroying previous module", R), P.removeEvents(), E.removeData(T);
  10018. }, refresh: function refresh() {
  10019. 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);
  10020. }, submit: function submit() {
  10021. P.verbose("Submitting form", E), E.submit();
  10022. }, attachEvents: function attachEvents(t, n) {
  10023. n = n || "submit", e(t).on("click" + A, function (e) {
  10024. P[n](), e.preventDefault();
  10025. });
  10026. }, bindEvents: function bindEvents() {
  10027. 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 () {
  10028. var t = e(this),
  10029. n = t.prop("type"),
  10030. i = P.get.changeEvent(n, t);e(this).on(i + A, P.event.field.change);
  10031. });
  10032. }, clear: function clear() {
  10033. m.each(function () {
  10034. var t = e(this),
  10035. n = t.parent(),
  10036. i = t.closest(g),
  10037. o = i.find(x.prompt),
  10038. a = t.data(y.defaultValue) || "",
  10039. r = n.is(x.uiCheckbox),
  10040. 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(""));
  10041. });
  10042. }, reset: function reset() {
  10043. m.each(function () {
  10044. var t = e(this),
  10045. n = t.parent(),
  10046. o = t.closest(g),
  10047. a = o.find(x.prompt),
  10048. r = t.data(y.defaultValue),
  10049. s = n.is(x.uiCheckbox),
  10050. l = n.is(x.uiDropdown),
  10051. 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)));
  10052. });
  10053. }, determine: { isValid: function isValid() {
  10054. var t = !0;return e.each(b, function (e, n) {
  10055. P.validate.field(n, e, !0) || (t = !1);
  10056. }), t;
  10057. } }, is: { bracketedRule: function bracketedRule(e) {
  10058. return e.type && e.type.match(v.regExp.bracket);
  10059. }, shorthandFields: function shorthandFields(e) {
  10060. var t = e[Object.keys(e)[0]];return P.is.shorthandRules(t);
  10061. }, shorthandRules: function shorthandRules(t) {
  10062. return "string" == typeof t || e.isArray(t);
  10063. }, empty: function empty(e) {
  10064. return !e || 0 === e.length || (e.is('input[type="checkbox"]') ? !e.is(":checked") : P.is.blank(e));
  10065. }, blank: function blank(t) {
  10066. return "" === e.trim(t.val());
  10067. }, valid: function valid(t) {
  10068. 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) {
  10069. P.is.valid(e) || (n = !1);
  10070. }), n);
  10071. } }, removeEvents: function removeEvents() {
  10072. E.off(A), m.off(A), h.off(A), m.off(A);
  10073. }, event: { field: { keydown: function keydown(t) {
  10074. var n = e(this),
  10075. i = t.which,
  10076. o = n.is(x.input),
  10077. a = n.is(x.checkbox),
  10078. r = n.closest(x.uiDropdown).length > 0,
  10079. 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);
  10080. }, keyup: function keyup() {
  10081. D = !1;
  10082. }, blur: function blur(t) {
  10083. var n = e(this),
  10084. i = n.closest(g),
  10085. 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);
  10086. }, change: function change(t) {
  10087. var n = e(this),
  10088. i = n.closest(g),
  10089. o = P.get.validation(n);o && ("change" == v.on || i.hasClass(C.error) && v.revalidate) && (clearTimeout(P.timer), P.timer = setTimeout(function () {
  10090. P.debug("Revalidating field", n, P.get.validation(n)), P.validate.field(o);
  10091. }, v.delay));
  10092. } } }, get: { ancillaryValue: function ancillaryValue(e) {
  10093. return !(!e.type || !e.value && !P.is.bracketedRule(e)) && (e.value !== i ? e.value : e.type.match(v.regExp.bracket)[1] + "");
  10094. }, ruleName: function ruleName(e) {
  10095. return P.is.bracketedRule(e) ? e.type.replace(e.type.match(v.regExp.bracket)[0], "") : e.type;
  10096. }, changeEvent: function changeEvent(e, t) {
  10097. return "checkbox" == e || "radio" == e || "hidden" == e || t.is("select") ? "change" : P.get.inputEvent();
  10098. }, inputEvent: function inputEvent() {
  10099. return n.createElement("input").oninput !== i ? "input" : n.createElement("input").onpropertychange !== i ? "propertychange" : "keyup";
  10100. }, fieldsFromShorthand: function fieldsFromShorthand(t) {
  10101. var n = {};return e.each(t, function (t, i) {
  10102. "string" == typeof i && (i = [i]), n[t] = { rules: [] }, e.each(i, function (e, i) {
  10103. n[t].rules.push({ type: i });
  10104. });
  10105. }), n;
  10106. }, prompt: function prompt(t, n) {
  10107. var i,
  10108. o,
  10109. a = P.get.ruleName(t),
  10110. r = P.get.ancillaryValue(t),
  10111. s = P.get.field(n.identifier),
  10112. l = s.val(),
  10113. c = e.isFunction(t.prompt) ? t.prompt(l) : t.prompt || v.prompt[a] || v.text.unspecifiedRule,
  10114. u = -1 !== c.search("{value}"),
  10115. 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;
  10116. }, settings: function settings() {
  10117. if (e.isPlainObject(t)) {
  10118. 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));
  10119. } 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();
  10120. }, field: function field(t) {
  10121. 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/>");
  10122. }, fields: function fields(t) {
  10123. var n = e();return e.each(t, function (e, t) {
  10124. n = n.add(P.get.field(t));
  10125. }), n;
  10126. }, validation: function validation(t) {
  10127. var n, i;return !!b && (e.each(b, function (e, o) {
  10128. i = o.identifier || e, P.get.field(i)[0] == t[0] && (o.identifier = i, n = o);
  10129. }), n || !1);
  10130. }, value: function value(e) {
  10131. var t = [];return t.push(e), P.get.values.call(F, t)[e];
  10132. }, values: function values(t) {
  10133. var n = {};return (e.isArray(t) ? P.get.fields(t) : m).each(function (t, o) {
  10134. var a = e(o),
  10135. r = (a.prop("type"), a.prop("name")),
  10136. s = a.val(),
  10137. l = a.is(x.checkbox),
  10138. c = a.is(x.radio),
  10139. u = -1 !== r.indexOf("[]"),
  10140. 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);
  10141. }), n;
  10142. } }, has: { field: function field(e) {
  10143. 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;
  10144. } }, escape: { string: function string(e) {
  10145. return (e = String(e)).replace(w.escape, "\\$&");
  10146. } }, add: { rule: function rule(e, t) {
  10147. P.add.field(e, t);
  10148. }, field: function field(t, n) {
  10149. var i = {};P.is.shorthandRules(n) ? (n = e.isArray(n) ? n : [n], i[t] = { rules: [] }, e.each(n, function (e, n) {
  10150. i[t].rules.push({ type: n });
  10151. })) : i[t] = n, b = e.extend({}, b, i), P.debug("Adding rules", i, b);
  10152. }, fields: function fields(t) {
  10153. var n;n = t && P.is.shorthandFields(t) ? P.get.fieldsFromShorthand(t) : t, b = e.extend({}, b, n);
  10154. }, prompt: function prompt(t, n) {
  10155. var o = P.get.field(t).closest(g),
  10156. a = o.children(x.prompt),
  10157. 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)));
  10158. }, errors: function errors(e) {
  10159. P.debug("Adding form error messages", e), P.set.error(), p.html(v.templates.error(e));
  10160. } }, remove: { rule: function rule(t, n) {
  10161. 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) {
  10162. -1 !== o.indexOf(n.type) && (P.debug("Removed rule", n.type), b[t].rules.splice(e, 1));
  10163. });
  10164. }, field: function field(t) {
  10165. var n = e.isArray(t) ? t : [t];e.each(n, function (e, t) {
  10166. P.remove.rule(t);
  10167. });
  10168. }, rules: function rules(t, n) {
  10169. e.isArray(t) ? e.each(fields, function (e, t) {
  10170. P.remove.rule(t, n);
  10171. }) : P.remove.rule(t, n);
  10172. }, fields: function fields(e) {
  10173. P.remove.field(e);
  10174. }, prompt: function prompt(t) {
  10175. var n = P.get.field(t).closest(g),
  10176. 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 () {
  10177. o.remove();
  10178. }) : o.fadeOut(v.duration, function () {
  10179. o.remove();
  10180. }));
  10181. } }, set: { success: function success() {
  10182. E.removeClass(C.error).addClass(C.success);
  10183. }, defaults: function defaults() {
  10184. m.each(function () {
  10185. var t = e(this),
  10186. n = t.filter(x.checkbox).length > 0 ? t.is(":checked") : t.val();t.data(y.defaultValue, n);
  10187. });
  10188. }, error: function error() {
  10189. E.removeClass(C.success).addClass(C.error);
  10190. }, value: function value(e, t) {
  10191. var n = {};return n[e] = t, P.set.values.call(F, n);
  10192. }, values: function values(t) {
  10193. e.isEmptyObject(t) || e.each(t, function (t, n) {
  10194. var i,
  10195. o = P.get.field(t),
  10196. a = o.parent(),
  10197. r = e.isArray(n),
  10198. s = a.is(x.uiCheckbox),
  10199. l = a.is(x.uiDropdown),
  10200. 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) {
  10201. i = o.filter('[value="' + t + '"]'), a = i.parent(), i.length > 0 && a.checkbox("check");
  10202. })) : 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)));
  10203. });
  10204. } }, validate: { form: function form(e, t) {
  10205. var n = P.get.values();if (D) return !1;if (O = [], P.determine.isValid()) {
  10206. if (P.debug("Form has no validation errors, submitting"), P.set.success(), !0 !== t) return v.onSuccess.call(F, e, n);
  10207. } 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);
  10208. }, field: function field(t, n, o) {
  10209. o = o === i || o, "string" == typeof t && (P.verbose("Validating field", t), n = t, t = b[t]);var a = t.identifier || n,
  10210. r = P.get.field(a),
  10211. s = !!t.depends && P.get.field(t.depends),
  10212. l = !0,
  10213. 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) {
  10214. 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);
  10215. }), 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);
  10216. }, rule: function rule(t, n) {
  10217. var o = P.get.field(t.identifier),
  10218. a = (n.type, o.val()),
  10219. r = P.get.ancillaryValue(n),
  10220. s = P.get.ruleName(n),
  10221. 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);
  10222. } }, setting: function setting(t, n) {
  10223. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  10224. if (n === i) return v[t];v[t] = n;
  10225. }
  10226. }, internal: function internal(t, n) {
  10227. if (e.isPlainObject(t)) e.extend(!0, P, t);else {
  10228. if (n === i) return P[t];P[t] = n;
  10229. }
  10230. }, debug: function debug() {
  10231. !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)));
  10232. }, verbose: function verbose() {
  10233. !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)));
  10234. }, error: function error() {
  10235. v.silent || (P.error = Function.prototype.bind.call(console.error, console, v.name + ":"), P.error.apply(console, arguments));
  10236. }, performance: { log: function log(e) {
  10237. 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);
  10238. }, display: function display() {
  10239. var t = v.name + ":",
  10240. n = 0;s = !1, clearTimeout(P.performance.timer), e.each(l, function (e, t) {
  10241. n += t["Execution Time"];
  10242. }), 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) {
  10243. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10244. }), console.groupEnd()), l = [];
  10245. } }, invoke: function invoke(t, n, a) {
  10246. var r,
  10247. s,
  10248. l,
  10249. 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) {
  10250. 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 {
  10251. 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];
  10252. }
  10253. })), 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;
  10254. } }).initialize();
  10255. }), o !== i ? o : this;
  10256. }, 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() {
  10257. return !0;
  10258. }, onFailure: function onFailure() {
  10259. return !1;
  10260. }, 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) {
  10261. var n = '<ul class="list">';return e.each(t, function (e, t) {
  10262. n += "<li>" + t + "</li>";
  10263. }), e(n += "</ul>");
  10264. }, prompt: function prompt(t) {
  10265. return e("<div/>").addClass("ui basic red pointing prompt label").html(t[0]);
  10266. } }, rules: { empty: function empty(t) {
  10267. return !(t === i || "" === t || e.isArray(t) && 0 === t.length);
  10268. }, checked: function checked() {
  10269. return e(this).filter(":checked").length > 0;
  10270. }, email: function email(t) {
  10271. return e.fn.form.settings.regExp.email.test(t);
  10272. }, url: function url(t) {
  10273. return e.fn.form.settings.regExp.url.test(t);
  10274. }, regExp: function regExp(t, n) {
  10275. if (n instanceof RegExp) return t.match(n);var i,
  10276. 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));
  10277. }, integer: function integer(t, n) {
  10278. var o,
  10279. a,
  10280. r,
  10281. 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);
  10282. }, decimal: function decimal(t) {
  10283. return e.fn.form.settings.regExp.decimal.test(t);
  10284. }, number: function number(t) {
  10285. return e.fn.form.settings.regExp.number.test(t);
  10286. }, is: function is(e, t) {
  10287. return t = "string" == typeof t ? t.toLowerCase() : t, (e = "string" == typeof e ? e.toLowerCase() : e) == t;
  10288. }, isExactly: function isExactly(e, t) {
  10289. return e == t;
  10290. }, not: function not(e, t) {
  10291. return (e = "string" == typeof e ? e.toLowerCase() : e) != (t = "string" == typeof t ? t.toLowerCase() : t);
  10292. }, notExactly: function notExactly(e, t) {
  10293. return e != t;
  10294. }, contains: function contains(t, n) {
  10295. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n, "i"));
  10296. }, containsExactly: function containsExactly(t, n) {
  10297. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n));
  10298. }, doesntContain: function doesntContain(t, n) {
  10299. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n, "i"));
  10300. }, doesntContainExactly: function doesntContainExactly(t, n) {
  10301. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n));
  10302. }, minLength: function minLength(e, t) {
  10303. return e !== i && e.length >= t;
  10304. }, length: function length(e, t) {
  10305. return e !== i && e.length >= t;
  10306. }, exactLength: function exactLength(e, t) {
  10307. return e !== i && e.length == t;
  10308. }, maxLength: function maxLength(e, t) {
  10309. return e !== i && e.length <= t;
  10310. }, match: function match(t, n) {
  10311. 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();
  10312. }, different: function different(t, n) {
  10313. 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();
  10314. }, creditCard: function creditCard(t, n) {
  10315. var i,
  10316. o,
  10317. 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] } },
  10318. r = {},
  10319. s = !1,
  10320. l = "string" == typeof n && n.split(",");if ("string" == typeof t && 0 !== t.length) {
  10321. if (t = t.replace(/[\-]/g, ""), l && (e.each(l, function (n, i) {
  10322. (o = a[i]) && (r = { length: -1 !== e.inArray(t.length, o.length), pattern: -1 !== t.search(o.pattern) }).length && r.pattern && (s = !0);
  10323. }), !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--;) {
  10324. f += d[u][parseInt(t.charAt(c), 10)], u ^= 1;
  10325. }return f % 10 == 0 && f > 0;
  10326. }
  10327. }, minCount: function minCount(e, t) {
  10328. return 0 == t || (1 == t ? "" !== e : e.split(",").length >= t);
  10329. }, exactCount: function exactCount(e, t) {
  10330. return 0 == t ? "" === e : 1 == t ? "" !== e && -1 === e.search(",") : e.split(",").length == t;
  10331. }, maxCount: function maxCount(e, t) {
  10332. return 0 != t && (1 == t ? -1 === e.search(",") : e.split(",").length <= t);
  10333. } } };
  10334. }(jQuery, window, document), function (e, t, n, i) {
  10335. "use strict";
  10336. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.accordion = function (n) {
  10337. var o,
  10338. a = e(this),
  10339. r = new Date().getTime(),
  10340. s = [],
  10341. l = arguments[0],
  10342. c = "string" == typeof l,
  10343. u = [].slice.call(arguments, 1);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function () {
  10344. var d,
  10345. f,
  10346. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.accordion.settings, n) : e.extend({}, e.fn.accordion.settings),
  10347. g = m.className,
  10348. p = m.namespace,
  10349. h = m.selector,
  10350. v = m.error,
  10351. b = "." + p,
  10352. y = "module-" + p,
  10353. x = a.selector || "",
  10354. C = e(this),
  10355. w = C.find(h.title),
  10356. S = C.find(h.content),
  10357. k = this,
  10358. T = C.data(y);f = { initialize: function initialize() {
  10359. f.debug("Initializing", C), f.bind.events(), m.observeChanges && f.observeChanges(), f.instantiate();
  10360. }, instantiate: function instantiate() {
  10361. T = f, C.data(y, f);
  10362. }, destroy: function destroy() {
  10363. f.debug("Destroying previous instance", C), C.off(b).removeData(y);
  10364. }, refresh: function refresh() {
  10365. w = C.find(h.title), S = C.find(h.content);
  10366. }, observeChanges: function observeChanges() {
  10367. "MutationObserver" in t && ((d = new MutationObserver(function (e) {
  10368. f.debug("DOM tree modified, updating selector cache"), f.refresh();
  10369. })).observe(k, { childList: !0, subtree: !0 }), f.debug("Setting up mutation observer", d));
  10370. }, bind: { events: function events() {
  10371. f.debug("Binding delegated events"), C.on(m.on + b, h.trigger, f.event.click);
  10372. } }, event: { click: function click() {
  10373. f.toggle.call(this);
  10374. } }, toggle: function toggle(t) {
  10375. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10376. o = n.next(S),
  10377. a = o.hasClass(g.animating),
  10378. r = o.hasClass(g.active),
  10379. s = r && !a,
  10380. 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);
  10381. }, open: function open(t) {
  10382. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10383. o = n.next(S),
  10384. 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 () {
  10385. o.removeClass(g.animating).addClass(g.active), f.reset.display.call(this), m.onOpen.call(this), m.onChange.call(this);
  10386. }));
  10387. }, close: function close(t) {
  10388. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10389. o = n.next(S),
  10390. a = o.hasClass(g.animating),
  10391. 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 () {
  10392. o.removeClass(g.animating).removeClass(g.active), f.reset.display.call(this), m.onClose.call(this), m.onChange.call(this);
  10393. }));
  10394. }, closeOthers: function closeOthers(t) {
  10395. var n,
  10396. o,
  10397. a,
  10398. r = t !== i ? w.eq(t) : e(this).closest(h.title),
  10399. s = r.parents(h.content).prev(h.title),
  10400. l = r.closest(h.accordion),
  10401. c = h.title + "." + g.active + ":visible",
  10402. 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 () {
  10403. e(this).removeClass(g.active), f.reset.display.call(this);
  10404. }));
  10405. }, reset: { display: function display() {
  10406. f.verbose("Removing inline display from element", this), e(this).css("display", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10407. }, opacity: function opacity() {
  10408. f.verbose("Removing inline opacity from element", this), e(this).css("opacity", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10409. } }, setting: function setting(t, n) {
  10410. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  10411. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  10412. }
  10413. }, internal: function internal(t, n) {
  10414. if (f.debug("Changing internal", t, n), n === i) return f[t];e.isPlainObject(t) ? e.extend(!0, f, t) : f[t] = n;
  10415. }, debug: function debug() {
  10416. !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)));
  10417. }, verbose: function verbose() {
  10418. !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)));
  10419. }, error: function error() {
  10420. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  10421. }, performance: { log: function log(e) {
  10422. 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);
  10423. }, display: function display() {
  10424. var t = m.name + ":",
  10425. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  10426. n += t["Execution Time"];
  10427. }), 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) {
  10428. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10429. }), console.groupEnd()), s = [];
  10430. } }, invoke: function invoke(t, n, a) {
  10431. var r,
  10432. s,
  10433. l,
  10434. 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) {
  10435. 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 {
  10436. 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];
  10437. }
  10438. })), 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;
  10439. } }, c ? (T === i && f.initialize(), f.invoke(l)) : (T !== i && T.invoke("destroy"), f.initialize());
  10440. }), o !== i ? o : this;
  10441. }, 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) {
  10442. return -i * (t /= o) * (t - 2) + n;
  10443. } });
  10444. }(jQuery, window, document), function (e, t, n, i) {
  10445. "use strict";
  10446. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.checkbox = function (o) {
  10447. var a,
  10448. r = e(this),
  10449. s = r.selector || "",
  10450. l = new Date().getTime(),
  10451. c = [],
  10452. u = arguments[0],
  10453. d = "string" == typeof u,
  10454. f = [].slice.call(arguments, 1);return r.each(function () {
  10455. var r,
  10456. m,
  10457. g = e.extend(!0, {}, e.fn.checkbox.settings, o),
  10458. p = g.className,
  10459. h = g.namespace,
  10460. v = g.selector,
  10461. b = g.error,
  10462. y = "." + h,
  10463. x = "module-" + h,
  10464. C = e(this),
  10465. w = e(this).children(v.label),
  10466. S = e(this).children(v.input),
  10467. k = S[0],
  10468. T = !1,
  10469. A = !1,
  10470. R = C.data(x),
  10471. P = this;m = { initialize: function initialize() {
  10472. m.verbose("Initializing checkbox", g), m.create.label(), m.bind.events(), m.set.tabbable(), m.hide.input(), m.observeChanges(), m.instantiate(), m.setup();
  10473. }, instantiate: function instantiate() {
  10474. m.verbose("Storing instance of module", m), R = m, C.data(x, m);
  10475. }, destroy: function destroy() {
  10476. m.verbose("Destroying module"), m.unbind.events(), m.show.input(), C.removeData(x);
  10477. }, fix: { reference: function reference() {
  10478. C.is(v.input) && (m.debug("Behavior called on <input> adjusting invoked element"), C = C.closest(v.checkbox), m.refresh());
  10479. } }, setup: function setup() {
  10480. 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();
  10481. }, refresh: function refresh() {
  10482. w = C.children(v.label), S = C.children(v.input), k = S[0];
  10483. }, hide: { input: function input() {
  10484. m.verbose("Modifying <input> z-index to be unselectable"), S.addClass(p.hidden);
  10485. } }, show: { input: function input() {
  10486. m.verbose("Modifying <input> z-index to be selectable"), S.removeClass(p.hidden);
  10487. } }, observeChanges: function observeChanges() {
  10488. "MutationObserver" in t && ((r = new MutationObserver(function (e) {
  10489. m.debug("DOM tree modified, updating selector cache"), m.refresh();
  10490. })).observe(P, { childList: !0, subtree: !0 }), m.debug("Setting up mutation observer", r));
  10491. }, attachEvents: function attachEvents(t, n) {
  10492. 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);
  10493. }, event: { click: function click(t) {
  10494. 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());
  10495. }, keydown: function keydown(e) {
  10496. var t = e.which,
  10497. n = 13,
  10498. 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);
  10499. }, keyup: function keyup(e) {
  10500. A && e.preventDefault();
  10501. } }, check: function check() {
  10502. m.should.allowCheck() && (m.debug("Checking checkbox", S), m.set.checked(), m.should.ignoreCallbacks() || (g.onChecked.call(k), g.onChange.call(k)));
  10503. }, uncheck: function uncheck() {
  10504. m.should.allowUncheck() && (m.debug("Unchecking checkbox"), m.set.unchecked(), m.should.ignoreCallbacks() || (g.onUnchecked.call(k), g.onChange.call(k)));
  10505. }, indeterminate: function indeterminate() {
  10506. 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)));
  10507. }, determinate: function determinate() {
  10508. 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)));
  10509. }, enable: function enable() {
  10510. m.is.enabled() ? m.debug("Checkbox is already enabled") : (m.debug("Enabling checkbox"), m.set.enabled(), g.onEnable.call(k), g.onEnabled.call(k));
  10511. }, disable: function disable() {
  10512. m.is.disabled() ? m.debug("Checkbox is already disabled") : (m.debug("Disabling checkbox"), m.set.disabled(), g.onDisable.call(k), g.onDisabled.call(k));
  10513. }, get: { radios: function radios() {
  10514. var t = m.get.name();return e('input[name="' + t + '"]').closest(v.checkbox);
  10515. }, otherRadios: function otherRadios() {
  10516. return m.get.radios().not(C);
  10517. }, name: function name() {
  10518. return S.attr("name");
  10519. } }, is: { initialLoad: function initialLoad() {
  10520. return T;
  10521. }, radio: function radio() {
  10522. return S.hasClass(p.radio) || "radio" == S.attr("type");
  10523. }, indeterminate: function indeterminate() {
  10524. return S.prop("indeterminate") !== i && S.prop("indeterminate");
  10525. }, checked: function checked() {
  10526. return S.prop("checked") !== i && S.prop("checked");
  10527. }, disabled: function disabled() {
  10528. return S.prop("disabled") !== i && S.prop("disabled");
  10529. }, enabled: function enabled() {
  10530. return !m.is.disabled();
  10531. }, determinate: function determinate() {
  10532. return !m.is.indeterminate();
  10533. }, unchecked: function unchecked() {
  10534. return !m.is.checked();
  10535. } }, should: { allowCheck: function allowCheck() {
  10536. 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);
  10537. }, allowUncheck: function allowUncheck() {
  10538. 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);
  10539. }, allowIndeterminate: function allowIndeterminate() {
  10540. 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);
  10541. }, allowDeterminate: function allowDeterminate() {
  10542. 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);
  10543. }, forceCallbacks: function forceCallbacks() {
  10544. return m.is.initialLoad() && g.fireOnInit;
  10545. }, ignoreCallbacks: function ignoreCallbacks() {
  10546. return T && !g.fireOnInit;
  10547. } }, can: { change: function change() {
  10548. return !(C.hasClass(p.disabled) || C.hasClass(p.readOnly) || S.prop("disabled") || S.prop("readonly"));
  10549. }, uncheck: function uncheck() {
  10550. return "boolean" == typeof g.uncheckable ? g.uncheckable : !m.is.radio();
  10551. } }, set: { initialLoad: function initialLoad() {
  10552. T = !0;
  10553. }, checked: function checked() {
  10554. 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");
  10555. }, unchecked: function unchecked() {
  10556. 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");
  10557. }, indeterminate: function indeterminate() {
  10558. 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());
  10559. }, determinate: function determinate() {
  10560. 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));
  10561. }, disabled: function disabled() {
  10562. 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());
  10563. }, enabled: function enabled() {
  10564. 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());
  10565. }, tabbable: function tabbable() {
  10566. m.verbose("Adding tabindex to checkbox"), S.attr("tabindex") === i && S.attr("tabindex", 0);
  10567. } }, remove: { initialLoad: function initialLoad() {
  10568. T = !1;
  10569. } }, trigger: { change: function change() {
  10570. var e = n.createEvent("HTMLEvents"),
  10571. t = S[0];t && (m.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  10572. } }, create: { label: function label() {
  10573. 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));
  10574. } }, has: { label: function label() {
  10575. return w.length > 0;
  10576. } }, bind: { events: function events() {
  10577. 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);
  10578. } }, unbind: { events: function events() {
  10579. m.debug("Removing events"), C.off(y);
  10580. } }, uncheckOthers: function uncheckOthers() {
  10581. var e = m.get.otherRadios();m.debug("Unchecking other radios", e), e.removeClass(p.checked);
  10582. }, toggle: function toggle() {
  10583. 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");
  10584. }, setting: function setting(t, n) {
  10585. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10586. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10587. }
  10588. }, internal: function internal(t, n) {
  10589. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10590. if (n === i) return m[t];m[t] = n;
  10591. }
  10592. }, debug: function debug() {
  10593. !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)));
  10594. }, verbose: function verbose() {
  10595. !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)));
  10596. }, error: function error() {
  10597. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10598. }, performance: { log: function log(e) {
  10599. 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);
  10600. }, display: function display() {
  10601. var t = g.name + ":",
  10602. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  10603. n += t["Execution Time"];
  10604. }), 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) {
  10605. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10606. }), console.groupEnd()), c = [];
  10607. } }, invoke: function invoke(t, n, o) {
  10608. var r,
  10609. s,
  10610. l,
  10611. 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) {
  10612. 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 {
  10613. 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];
  10614. }
  10615. })), 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;
  10616. } }, d ? (R === i && m.initialize(), m.invoke(u)) : (R !== i && R.invoke("destroy"), m.initialize());
  10617. }), a !== i ? a : this;
  10618. }, 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]" } };
  10619. }(jQuery, window, document), function (e, t, n, i) {
  10620. "use strict";
  10621. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dimmer = function (t) {
  10622. var o,
  10623. a = e(this),
  10624. r = new Date().getTime(),
  10625. s = [],
  10626. l = arguments[0],
  10627. c = "string" == typeof l,
  10628. u = [].slice.call(arguments, 1);return a.each(function () {
  10629. var d,
  10630. f,
  10631. m,
  10632. g = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.dimmer.settings, t) : e.extend({}, e.fn.dimmer.settings),
  10633. p = g.selector,
  10634. h = g.namespace,
  10635. v = g.className,
  10636. b = g.error,
  10637. y = "." + h,
  10638. x = "module-" + h,
  10639. C = a.selector || "",
  10640. w = "ontouchstart" in n.documentElement ? "touchstart" : "click",
  10641. S = e(this),
  10642. k = this,
  10643. T = S.data(x);(m = { preinitialize: function preinitialize() {
  10644. 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());
  10645. }, initialize: function initialize() {
  10646. m.debug("Initializing dimmer", g), m.bind.events(), m.set.dimmable(), m.instantiate();
  10647. }, instantiate: function instantiate() {
  10648. m.verbose("Storing instance of module", m), T = m, S.data(x, T);
  10649. }, destroy: function destroy() {
  10650. m.verbose("Destroying previous module", d), m.unbind.events(), m.remove.variation(), f.off(y);
  10651. }, bind: { events: function events() {
  10652. 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));
  10653. } }, unbind: { events: function events() {
  10654. m.is.page() && f.get(0).removeEventListener("touchmove", m.event.preventScroll, { passive: !1 }), S.removeData(x), f.off(y);
  10655. } }, event: { click: function click(t) {
  10656. 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());
  10657. }, preventScroll: function preventScroll(e) {
  10658. e.preventDefault();
  10659. } }, addContent: function addContent(t) {
  10660. var n = e(t);m.debug("Add content to dimmer", n), n.parent()[0] !== d[0] && n.detach().appendTo(d);
  10661. }, create: function create() {
  10662. var t = e(g.template.dimmer());return g.dimmerName && (m.debug("Creating named dimmer", g.dimmerName), t.addClass(g.dimmerName)), t.appendTo(f), t;
  10663. }, show: function show(t) {
  10664. 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));
  10665. }, hide: function hide(t) {
  10666. 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");
  10667. }, toggle: function toggle() {
  10668. m.verbose("Toggling dimmer visibility", d), m.is.dimmed() ? m.hide() : m.show();
  10669. }, animate: { show: function show(t) {
  10670. 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() {
  10671. m.set.dimmed();
  10672. }, onComplete: function onComplete() {
  10673. m.set.active(), t();
  10674. } })) : (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 () {
  10675. d.removeAttr("style"), m.set.active(), t();
  10676. }));
  10677. }, hide: function hide(t) {
  10678. 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() {
  10679. m.remove.dimmed();
  10680. }, onComplete: function onComplete() {
  10681. m.remove.active(), t();
  10682. } })) : (m.verbose("Hiding dimmer with javascript"), m.remove.dimmed(), d.stop().fadeOut(m.get.duration(), function () {
  10683. m.remove.active(), d.removeAttr("style"), t();
  10684. }));
  10685. } }, get: { dimmer: function dimmer() {
  10686. return d;
  10687. }, duration: function duration() {
  10688. return "object" == _typeof(g.duration) ? m.is.active() ? g.duration.hide : g.duration.show : g.duration;
  10689. } }, has: { dimmer: function dimmer() {
  10690. return g.dimmerName ? S.find(p.dimmer).filter("." + g.dimmerName).length > 0 : S.find(p.dimmer).length > 0;
  10691. } }, is: { active: function active() {
  10692. return d.hasClass(v.active);
  10693. }, animating: function animating() {
  10694. return d.is(":animated") || d.hasClass(v.animating);
  10695. }, closable: function closable() {
  10696. return "auto" == g.closable ? "hover" != g.on : g.closable;
  10697. }, dimmer: function dimmer() {
  10698. return S.hasClass(v.dimmer);
  10699. }, dimmable: function dimmable() {
  10700. return S.hasClass(v.dimmable);
  10701. }, dimmed: function dimmed() {
  10702. return f.hasClass(v.dimmed);
  10703. }, disabled: function disabled() {
  10704. return f.hasClass(v.disabled);
  10705. }, enabled: function enabled() {
  10706. return !m.is.disabled();
  10707. }, page: function page() {
  10708. return f.is("body");
  10709. }, pageDimmer: function pageDimmer() {
  10710. return d.hasClass(v.pageDimmer);
  10711. } }, can: { show: function show() {
  10712. return !d.hasClass(v.disabled);
  10713. } }, set: { opacity: function opacity(e) {
  10714. var t = d.css("background-color"),
  10715. n = t.split(","),
  10716. i = n && 3 == n.length,
  10717. 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);
  10718. }, active: function active() {
  10719. d.addClass(v.active);
  10720. }, dimmable: function dimmable() {
  10721. f.addClass(v.dimmable);
  10722. }, dimmed: function dimmed() {
  10723. f.addClass(v.dimmed);
  10724. }, pageDimmer: function pageDimmer() {
  10725. d.addClass(v.pageDimmer);
  10726. }, disabled: function disabled() {
  10727. d.addClass(v.disabled);
  10728. }, variation: function variation(e) {
  10729. (e = e || g.variation) && d.addClass(e);
  10730. } }, remove: { active: function active() {
  10731. d.removeClass(v.active);
  10732. }, dimmed: function dimmed() {
  10733. f.removeClass(v.dimmed);
  10734. }, disabled: function disabled() {
  10735. d.removeClass(v.disabled);
  10736. }, variation: function variation(e) {
  10737. (e = e || g.variation) && d.removeClass(e);
  10738. } }, setting: function setting(t, n) {
  10739. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10740. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10741. }
  10742. }, internal: function internal(t, n) {
  10743. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10744. if (n === i) return m[t];m[t] = n;
  10745. }
  10746. }, debug: function debug() {
  10747. !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)));
  10748. }, verbose: function verbose() {
  10749. !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)));
  10750. }, error: function error() {
  10751. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10752. }, performance: { log: function log(e) {
  10753. 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);
  10754. }, display: function display() {
  10755. var t = g.name + ":",
  10756. n = 0;r = !1, clearTimeout(m.performance.timer), e.each(s, function (e, t) {
  10757. n += t["Execution Time"];
  10758. }), 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) {
  10759. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10760. }), console.groupEnd()), s = [];
  10761. } }, invoke: function invoke(t, n, a) {
  10762. var r,
  10763. s,
  10764. l,
  10765. 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) {
  10766. 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 {
  10767. 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];
  10768. }
  10769. })), 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;
  10770. } }).preinitialize(), c ? (T === i && m.initialize(), m.invoke(l)) : (T !== i && T.invoke("destroy"), m.initialize());
  10771. }), o !== i ? o : this;
  10772. }, 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() {
  10773. return e("<div />").attr("class", "ui dimmer");
  10774. } } };
  10775. }(jQuery, window, document), function (e, t, n, i) {
  10776. "use strict";
  10777. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dropdown = function (o) {
  10778. var a,
  10779. r = e(this),
  10780. s = e(n),
  10781. l = r.selector || "",
  10782. c = "ontouchstart" in n.documentElement,
  10783. u = new Date().getTime(),
  10784. d = [],
  10785. f = arguments[0],
  10786. m = "string" == typeof f,
  10787. g = [].slice.call(arguments, 1);return r.each(function (p) {
  10788. var h,
  10789. v,
  10790. b,
  10791. y,
  10792. x,
  10793. C,
  10794. w,
  10795. S,
  10796. k = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.dropdown.settings, o) : e.extend({}, e.fn.dropdown.settings),
  10797. T = k.className,
  10798. A = k.message,
  10799. R = k.fields,
  10800. P = k.keys,
  10801. E = k.metadata,
  10802. F = k.namespace,
  10803. O = k.regExp,
  10804. D = k.selector,
  10805. q = k.error,
  10806. j = k.templates,
  10807. z = "." + F,
  10808. I = "module-" + F,
  10809. M = e(this),
  10810. L = e(k.context),
  10811. V = M.find(D.text),
  10812. N = M.find(D.search),
  10813. H = M.find(D.sizer),
  10814. U = M.find(D.input),
  10815. W = M.find(D.icon),
  10816. B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(),
  10817. Q = M.children(D.menu),
  10818. X = Q.find(D.item),
  10819. $ = !1,
  10820. Y = !1,
  10821. Z = !1,
  10822. K = this,
  10823. J = M.data(I);S = { initialize: function initialize() {
  10824. 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());
  10825. }, instantiate: function instantiate() {
  10826. S.verbose("Storing instance of dropdown", S), J = S, M.data(I, S);
  10827. }, destroy: function destroy() {
  10828. 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();
  10829. }, observeChanges: function observeChanges() {
  10830. "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());
  10831. }, disconnect: { menuObserver: function menuObserver() {
  10832. w && w.disconnect();
  10833. }, selectObserver: function selectObserver() {
  10834. C && C.disconnect();
  10835. } }, observe: { select: function select() {
  10836. S.has.input() && C.observe(M[0], { childList: !0, subtree: !0 });
  10837. }, menu: function menu() {
  10838. S.has.menu() && w.observe(Q[0], { childList: !0, subtree: !0 });
  10839. } }, create: { id: function id() {
  10840. x = (Math.random().toString(16) + "000000000").substr(2, 8), y = "." + x, S.verbose("Creating unique id for element", x);
  10841. }, userChoice: function userChoice(t) {
  10842. var n, o, a;return !!(t = t || S.get.userValues()) && (t = e.isArray(t) ? t : [t], e.each(t, function (t, r) {
  10843. !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));
  10844. }), n);
  10845. }, userLabels: function userLabels(t) {
  10846. var n = S.get.userValues();n && (S.debug("Adding user labels", n), e.each(n, function (e, t) {
  10847. S.verbose("Adding custom user value"), S.add.label(t, t);
  10848. }));
  10849. }, menu: function menu() {
  10850. Q = e("<div />").addClass(T.menu).appendTo(M);
  10851. }, sizer: function sizer() {
  10852. H = e("<span />").addClass(T.sizer).insertAfter(N);
  10853. } }, search: function search(e) {
  10854. e = e !== i ? e : S.get.query(), S.verbose("Searching for query", e), S.has.minCharacters(e) ? S.filter(e) : S.hide();
  10855. }, select: { firstUnfiltered: function firstUnfiltered() {
  10856. S.verbose("Selecting first non-filtered element"), S.remove.selectedItem(), X.not(D.unselectable).not(D.addition + D.hidden).eq(0).addClass(T.selected);
  10857. }, nextAvailable: function nextAvailable(e) {
  10858. var t = (e = e.eq(0)).nextAll(D.item).not(D.unselectable).eq(0),
  10859. 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));
  10860. } }, setup: { api: function api() {
  10861. 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);
  10862. }, layout: function layout() {
  10863. 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();
  10864. }, select: function select() {
  10865. 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();
  10866. }, menu: function menu(e) {
  10867. Q.html(j.menu(e, R)), X = Q.find(D.item);
  10868. }, reference: function reference() {
  10869. 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();
  10870. }, returnedObject: function returnedObject() {
  10871. var e = r.slice(0, p),
  10872. t = r.slice(p + 1);r = e.add(M).add(t);
  10873. } }, refresh: function refresh() {
  10874. S.refreshSelectors(), S.refreshData();
  10875. }, refreshItems: function refreshItems() {
  10876. X = Q.find(D.item);
  10877. }, refreshSelectors: function refreshSelectors() {
  10878. 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);
  10879. }, refreshData: function refreshData() {
  10880. S.verbose("Refreshing cached metadata"), X.removeData(E.text).removeData(E.value);
  10881. }, clearData: function clearData() {
  10882. S.verbose("Clearing metadata"), X.removeData(E.text).removeData(E.value), M.removeData(E.defaultText).removeData(E.defaultValue).removeData(E.placeholderText);
  10883. }, toggle: function toggle() {
  10884. S.verbose("Toggling menu visibility"), S.is.active() ? S.hide() : S.show();
  10885. }, show: function show(t) {
  10886. 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()) {
  10887. 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 () {
  10888. S.can.click() && S.bind.intent(), S.has.menuSearch() && S.focusSearch(), S.set.visible(), t.call(K);
  10889. });
  10890. }
  10891. }, hide: function hide(t) {
  10892. 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 () {
  10893. S.remove.visible(), t.call(K);
  10894. }));
  10895. }, hideOthers: function hideOthers() {
  10896. S.verbose("Finding other dropdowns to hide"), r.not(M).has(D.menu + "." + T.visible).dropdown("hide");
  10897. }, hideMenu: function hideMenu() {
  10898. S.verbose("Hiding menu instantaneously"), S.remove.active(), S.remove.visible(), Q.transition("hide");
  10899. }, hideSubMenus: function hideSubMenus() {
  10900. var e = Q.children(D.item).find(D.menu);S.verbose("Hiding sub menus", e), e.transition("hide");
  10901. }, bind: { events: function events() {
  10902. c && S.bind.touchEvents(), S.bind.keyboardEvents(), S.bind.inputEvents(), S.bind.mouseEvents();
  10903. }, touchEvents: function touchEvents() {
  10904. 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);
  10905. }, keyboardEvents: function keyboardEvents() {
  10906. 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);
  10907. }, inputEvents: function inputEvents() {
  10908. S.verbose("Binding input change events"), M.on("change" + z, D.input, S.event.change);
  10909. }, mouseEvents: function mouseEvents() {
  10910. 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);
  10911. }, intent: function intent() {
  10912. 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);
  10913. } }, unbind: { intent: function intent() {
  10914. S.verbose("Removing hide intent event from document"), c && s.off("touchstart" + y).off("touchmove" + y), s.off("click" + y);
  10915. } }, filter: function filter(e) {
  10916. var t = e !== i ? e : S.get.query(),
  10917. n = function n() {
  10918. 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();
  10919. };k.useLabels && S.has.maxSelections() || (k.apiSettings ? S.can.useAPI() ? S.queryRemote(t, function () {
  10920. k.filterRemoteData && S.filterItems(t), n();
  10921. }) : S.error(q.noAPI) : (S.filterItems(t), n()));
  10922. }, queryRemote: function queryRemote(t, n) {
  10923. var i = { errorDuration: !1, cache: "local", throttle: k.throttle, urlData: { query: t }, onError: function onError() {
  10924. S.add.message(A.serverError), n();
  10925. }, onFailure: function onFailure() {
  10926. S.add.message(A.serverError), n();
  10927. }, onSuccess: function onSuccess(t) {
  10928. 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();
  10929. } };M.api("get request") || S.setup.api(), i = e.extend(!0, {}, i, k.apiSettings), M.api("setting", i).api("query");
  10930. }, filterItems: function filterItems(t) {
  10931. var n = t !== i ? t : S.get.query(),
  10932. o = null,
  10933. a = S.escape.string(n),
  10934. r = new RegExp("^" + a, "igm");S.has.query() && (o = [], S.verbose("Searching for matching values", n), X.each(function () {
  10935. var t,
  10936. i,
  10937. a = e(this);if ("both" == k.match || "text" == k.match) {
  10938. 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;
  10939. }if ("both" == k.match || "value" == k.match) {
  10940. 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;
  10941. }
  10942. })), S.debug("Showing only matched items", n), S.remove.filteredItem(), o && X.not(o).addClass(T.filtered);
  10943. }, fuzzySearch: function fuzzySearch(e, t) {
  10944. var n = t.length,
  10945. 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++) {
  10946. for (var r = e.charCodeAt(o); a < n;) {
  10947. if (t.charCodeAt(a++) === r) continue e;
  10948. }return !1;
  10949. }return !0;
  10950. }, exactSearch: function exactSearch(e, t) {
  10951. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  10952. }, filterActive: function filterActive() {
  10953. k.useLabels && X.filter("." + T.active).addClass(T.filtered);
  10954. }, focusSearch: function focusSearch(e) {
  10955. 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());
  10956. }, forceSelection: function forceSelection() {
  10957. var e = X.not(T.filtered).filter("." + T.selected).eq(0),
  10958. t = X.not(T.filtered).filter("." + T.active).eq(0),
  10959. 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();
  10960. }, change: { values: function values(t) {
  10961. k.allowAdditions || S.clear(), S.debug("Creating dropdown with specified values", t), S.setup.menu({ values: t }), e.each(t, function (e, t) {
  10962. if (1 == t.selected) return S.debug("Setting initial selection to", t.value), S.set.selected(t.value), !0;
  10963. });
  10964. } }, event: { change: function change() {
  10965. Z || (S.debug("Input changed, updating selection"), S.set.selected());
  10966. }, focus: function focus() {
  10967. k.showOnFocus && !$ && S.is.hidden() && !v && S.show();
  10968. }, blur: function blur(e) {
  10969. v = n.activeElement === this, $ || v || (S.remove.activeLabel(), S.hide());
  10970. }, mousedown: function mousedown() {
  10971. S.is.searchSelection() ? b = !0 : $ = !0;
  10972. }, mouseup: function mouseup() {
  10973. S.is.searchSelection() ? b = !1 : $ = !1;
  10974. }, click: function click(t) {
  10975. e(t.target).is(M) && (S.is.focusedOnSearch() ? S.show() : S.focusSearch());
  10976. }, search: { focus: function focus() {
  10977. $ = !0, S.is.multiple() && S.remove.activeLabel(), k.showOnFocus && S.search();
  10978. }, blur: function blur(e) {
  10979. v = n.activeElement === this, S.is.searchSelection() && !b && (Y || v || (k.forceSelection && S.forceSelection(), S.hide())), b = !1;
  10980. } }, icon: { click: function click(e) {
  10981. S.toggle();
  10982. } }, text: { focus: function focus(e) {
  10983. $ = !0, S.focusSearch();
  10984. } }, input: function input(e) {
  10985. (S.is.multiple() || S.is.searchSelection()) && S.set.filtered(), clearTimeout(S.timer), S.timer = setTimeout(S.search, k.delay.search);
  10986. }, label: { click: function click(t) {
  10987. var n = e(this),
  10988. i = M.find(D.label),
  10989. o = i.filter("." + T.active),
  10990. a = n.nextAll("." + T.active),
  10991. r = n.prevAll("." + T.active),
  10992. 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));
  10993. } }, remove: { click: function click() {
  10994. var t = e(this).parent();t.hasClass(T.active) ? S.remove.activeLabels() : S.remove.activeLabels(t);
  10995. } }, test: { toggle: function toggle(e) {
  10996. var t = S.is.multiple() ? S.show : S.toggle;S.is.bubbledLabelClick(e) || S.is.bubbledIconClick(e) || S.determine.eventOnElement(e, t) && e.preventDefault();
  10997. }, touch: function touch(e) {
  10998. S.determine.eventOnElement(e, function () {
  10999. "touchstart" == e.type ? S.timer = setTimeout(function () {
  11000. S.hide();
  11001. }, k.delay.touch) : "touchmove" == e.type && clearTimeout(S.timer);
  11002. }), e.stopPropagation();
  11003. }, hide: function hide(e) {
  11004. S.determine.eventInModule(e, S.hide);
  11005. } }, select: { mutation: function mutation(t) {
  11006. S.debug("<select> modified, recreating menu");var n = !1;e.each(t, function (t, i) {
  11007. if (e(i.target).is("select") || e(i.addedNodes).is("select")) return n = !0, !0;
  11008. }), n && (S.disconnect.selectObserver(), S.refresh(), S.setup.select(), S.set.selected(), S.observe.select());
  11009. } }, menu: { mutation: function mutation(t) {
  11010. var n = t[0],
  11011. i = n.addedNodes ? e(n.addedNodes[0]) : e(!1),
  11012. o = n.removedNodes ? e(n.removedNodes[0]) : e(!1),
  11013. a = i.add(o),
  11014. r = a.is(D.addition) || a.closest(D.addition).length > 0,
  11015. 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());
  11016. }, mousedown: function mousedown() {
  11017. Y = !0;
  11018. }, mouseup: function mouseup() {
  11019. Y = !1;
  11020. } }, item: { mouseenter: function mouseenter(t) {
  11021. var n = e(t.target),
  11022. i = e(this),
  11023. o = i.children(D.menu),
  11024. a = i.siblings(D.item).children(D.menu),
  11025. r = o.length > 0;!(o.find(n).length > 0) && r && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  11026. S.verbose("Showing sub-menu", o), e.each(a, function () {
  11027. S.animate.hide(!1, e(this));
  11028. }), S.animate.show(!1, o);
  11029. }, k.delay.show), t.preventDefault());
  11030. }, mouseleave: function mouseleave(t) {
  11031. var n = e(this).children(D.menu);n.length > 0 && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  11032. S.verbose("Hiding sub-menu", n), S.animate.hide(!1, n);
  11033. }, k.delay.hide));
  11034. }, click: function click(t, i) {
  11035. var o = e(this),
  11036. a = e(t ? t.target : ""),
  11037. r = o.find(D.menu),
  11038. s = S.get.choiceText(o),
  11039. l = S.get.choiceValue(o, s),
  11040. c = r.length > 0,
  11041. 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));
  11042. } }, document: { keydown: function keydown(e) {
  11043. var t = e.which;if (S.is.inObject(t, P)) {
  11044. var n = M.find(D.label),
  11045. i = n.filter("." + T.active),
  11046. o = (i.data(E.value), n.index(i)),
  11047. a = n.length,
  11048. r = i.length > 0,
  11049. s = i.length > 1,
  11050. l = 0 === o,
  11051. c = o + 1 == a,
  11052. u = S.is.searchSelection(),
  11053. d = S.is.focusedOnSearch(),
  11054. f = S.is.focused(),
  11055. 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);
  11056. }
  11057. } }, keydown: function keydown(e) {
  11058. var t = e.which;if (S.is.inObject(t, P)) {
  11059. var n,
  11060. i = X.not(D.unselectable).filter("." + T.selected).eq(0),
  11061. o = Q.children("." + T.active).eq(0),
  11062. a = i.length > 0 ? i : o,
  11063. r = a.length > 0 ? a.siblings(":not(." + T.filtered + ")").addBack() : Q.children(":not(." + T.filtered + ")"),
  11064. s = a.children(D.menu),
  11065. l = a.closest(D.menu),
  11066. c = l.hasClass(T.visible) || l.hasClass(T.animating) || l.parent(D.menu).length > 0,
  11067. u = s.length > 0,
  11068. d = a.length > 0,
  11069. f = a.not(D.unselectable).length > 0,
  11070. 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()) {
  11071. 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) {
  11072. 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();
  11073. }if (t == P.downArrow) {
  11074. 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();
  11075. }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());
  11076. } else m && e.preventDefault(), t != P.downArrow || S.is.visible() || (S.verbose("Down key pressed, showing dropdown"), S.show(), e.preventDefault());
  11077. } else S.has.search() || S.set.selectedLetter(String.fromCharCode(t));
  11078. } }, trigger: { change: function change() {
  11079. var e = n.createEvent("HTMLEvents"),
  11080. t = U[0];t && (S.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  11081. } }, determine: { selectAction: function selectAction(t, n) {
  11082. 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);
  11083. }, eventInModule: function eventInModule(t, i) {
  11084. var o = e(t.target),
  11085. a = o.closest(n.documentElement).length > 0,
  11086. 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);
  11087. }, eventOnElement: function eventOnElement(t, i) {
  11088. var o = e(t.target),
  11089. a = o.closest(D.siblingLabel),
  11090. r = n.body.contains(t.target),
  11091. s = 0 === M.find(a).length,
  11092. 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);
  11093. } }, action: { nothing: function nothing() {}, activate: function activate(t, n, o) {
  11094. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  11095. if (S.set.selected(n, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  11096. }
  11097. }, select: function select(t, n, o) {
  11098. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  11099. if (S.set.value(n, t, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  11100. }
  11101. }, combo: function combo(t, n, o) {
  11102. n = n !== i ? n : t, S.set.selected(n, e(o)), S.hideAndClear();
  11103. }, hide: function hide(e, t, n) {
  11104. S.set.value(t, e), S.hideAndClear();
  11105. } }, get: { id: function id() {
  11106. return x;
  11107. }, defaultText: function defaultText() {
  11108. return M.data(E.defaultText);
  11109. }, defaultValue: function defaultValue() {
  11110. return M.data(E.defaultValue);
  11111. }, placeholderText: function placeholderText() {
  11112. return "auto" != k.placeholder && "string" == typeof k.placeholder ? k.placeholder : M.data(E.placeholderText) || "";
  11113. }, text: function text() {
  11114. return V.text();
  11115. }, query: function query() {
  11116. return e.trim(N.val());
  11117. }, searchWidth: function searchWidth(e) {
  11118. return e = e !== i ? e : N.val(), H.text(e), Math.ceil(H.width() + 1);
  11119. }, selectionCount: function selectionCount() {
  11120. var t = S.get.values();return S.is.multiple() ? e.isArray(t) ? t.length : 0 : "" !== S.get.value() ? 1 : 0;
  11121. }, transition: function transition(e) {
  11122. return "auto" == k.transition ? S.is.upward(e) ? "slide up" : "slide down" : k.transition;
  11123. }, userValues: function userValues() {
  11124. var t = S.get.values();return !!t && (t = e.isArray(t) ? t : [t], e.grep(t, function (e) {
  11125. return !1 === S.get.item(e);
  11126. }));
  11127. }, uniqueArray: function uniqueArray(t) {
  11128. return e.grep(t, function (n, i) {
  11129. return e.inArray(n, t) === i;
  11130. });
  11131. }, caretPosition: function caretPosition() {
  11132. var e,
  11133. t,
  11134. 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;
  11135. }, value: function value() {
  11136. var t = U.length > 0 ? U.val() : M.data(E.value),
  11137. n = e.isArray(t) && 1 === t.length && "" === t[0];return t === i || n ? "" : t;
  11138. }, values: function values() {
  11139. var e = S.get.value();return "" === e ? "" : !S.has.selectInput() && S.is.multiple() ? "string" == typeof e ? e.split(k.delimiter) : "" : e;
  11140. }, remoteValues: function remoteValues() {
  11141. var t = S.get.values(),
  11142. n = !1;return t && ("string" == typeof t && (t = [t]), e.each(t, function (e, t) {
  11143. var i = S.read.remoteData(t);S.verbose("Restoring value from session data", i, t), i && (n || (n = {}), n[t] = i);
  11144. })), n;
  11145. }, choiceText: function choiceText(t, n) {
  11146. 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());
  11147. }, choiceValue: function choiceValue(t, n) {
  11148. 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));
  11149. }, inputEvent: function inputEvent() {
  11150. var e = N[0];return !!e && (e.oninput !== i ? "input" : e.onpropertychange !== i ? "propertychange" : "keyup");
  11151. }, selectValues: function selectValues() {
  11152. var t = { values: [] };return M.find("option").each(function () {
  11153. var n = e(this),
  11154. o = n.html(),
  11155. a = n.attr("disabled"),
  11156. 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 });
  11157. }), 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) {
  11158. return e.name > t.name ? 1 : -1;
  11159. }), S.debug("Retrieved and sorted values from select", t)) : S.debug("Retrieved values from select", t), t;
  11160. }, activeItem: function activeItem() {
  11161. return X.filter("." + T.active);
  11162. }, selectedItem: function selectedItem() {
  11163. var e = X.not(D.unselectable).filter("." + T.selected);return e.length > 0 ? e : X.eq(0);
  11164. }, itemWithAdditions: function itemWithAdditions(e) {
  11165. var t = S.get.item(e),
  11166. n = S.create.userChoice(e);return n && n.length > 0 && (t = t.length > 0 ? t.add(n) : n), t;
  11167. }, item: function item(t, n) {
  11168. var o,
  11169. a,
  11170. 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 () {
  11171. var o = e(this),
  11172. s = S.get.choiceText(o),
  11173. 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) {
  11174. if (S.verbose("Ambiguous dropdown value using strict type check", o, t), l === t || s === t) return r = o, !0;
  11175. } else if (String(l) == String(t) || s == t) return S.verbose("Found select item by value", l, t), r = o, !0;
  11176. }), r;
  11177. } }, check: { maxSelections: function maxSelections(e) {
  11178. 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));
  11179. } }, restore: { defaults: function defaults() {
  11180. S.clear(), S.restore.defaultText(), S.restore.defaultValue();
  11181. }, defaultText: function defaultText() {
  11182. 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));
  11183. }, placeholderText: function placeholderText() {
  11184. S.set.placeholderText();
  11185. }, defaultValue: function defaultValue() {
  11186. 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()));
  11187. }, labels: function labels() {
  11188. k.allowAdditions && (k.useLabels || (S.error(q.labels), k.useLabels = !0), S.debug("Restoring selected values"), S.create.userLabels()), S.check.maxSelections();
  11189. }, selected: function selected() {
  11190. S.restore.values(), S.is.multiple() ? (S.debug("Restoring previously selected values and labels"), S.restore.labels()) : S.debug("Restoring previously selected values");
  11191. }, values: function values() {
  11192. S.set.initialLoad(), k.apiSettings && k.saveRemoteData && S.get.remoteValues() ? S.restore.remoteValues() : S.set.selected(), S.remove.initialLoad();
  11193. }, remoteValues: function remoteValues() {
  11194. var t = S.get.remoteValues();S.debug("Recreating selected from session data", t), t && (S.is.single() ? e.each(t, function (e, t) {
  11195. S.set.text(t);
  11196. }) : e.each(t, function (e, t) {
  11197. S.add.label(e, t);
  11198. }));
  11199. } }, read: { remoteData: function remoteData(e) {
  11200. var n;if (t.Storage !== i) return (n = sessionStorage.getItem(e)) !== i && n;S.error(q.noStorage);
  11201. } }, save: { defaults: function defaults() {
  11202. S.save.defaultText(), S.save.placeholderText(), S.save.defaultValue();
  11203. }, defaultValue: function defaultValue() {
  11204. var e = S.get.value();S.verbose("Saving default value as", e), M.data(E.defaultValue, e);
  11205. }, defaultText: function defaultText() {
  11206. var e = S.get.text();S.verbose("Saving default text as", e), M.data(E.defaultText, e);
  11207. }, placeholderText: function placeholderText() {
  11208. 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));
  11209. }, remoteData: function remoteData(e, n) {
  11210. t.Storage !== i ? (S.verbose("Saving remote data to session storage", n, e), sessionStorage.setItem(n, e)) : S.error(q.noStorage);
  11211. } }, clear: function clear() {
  11212. S.is.multiple() && k.useLabels ? S.remove.labels() : (S.remove.activeItem(), S.remove.selectedItem()), S.set.placeholderText(), S.clearValue();
  11213. }, clearValue: function clearValue() {
  11214. S.set.value("");
  11215. }, scrollPage: function scrollPage(e, t) {
  11216. var n,
  11217. i,
  11218. o = t || S.get.selectedItem(),
  11219. a = o.closest(D.menu),
  11220. r = a.outerHeight(),
  11221. s = a.scrollTop(),
  11222. l = X.eq(0).outerHeight(),
  11223. c = Math.floor(r / l),
  11224. u = (a.prop("scrollHeight"), "up" == e ? s - l * c : s + l * c),
  11225. 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));
  11226. }, set: { filtered: function filtered() {
  11227. var e = S.is.multiple(),
  11228. t = S.is.searchSelection(),
  11229. n = e && t,
  11230. i = t ? S.get.query() : "",
  11231. o = "string" == typeof i && i.length > 0,
  11232. a = S.get.searchWidth(),
  11233. 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));
  11234. }, empty: function empty() {
  11235. M.addClass(T.empty);
  11236. }, loading: function loading() {
  11237. M.addClass(T.loading);
  11238. }, placeholderText: function placeholderText(e) {
  11239. e = e || S.get.placeholderText(), S.debug("Setting placeholder text", e), S.set.text(e), V.addClass(T.placeholder);
  11240. }, tabbable: function tabbable() {
  11241. 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)));
  11242. }, initialLoad: function initialLoad() {
  11243. S.verbose("Setting initial load"), h = !0;
  11244. }, activeItem: function activeItem(e) {
  11245. k.allowAdditions && e.filter(D.addition).length > 0 ? e.addClass(T.filtered) : e.addClass(T.active);
  11246. }, partialSearch: function partialSearch(e) {
  11247. var t = S.get.query().length;N.val(e.substr(0, t));
  11248. }, scrollPosition: function scrollPosition(e, t) {
  11249. 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));
  11250. }, text: function text(e) {
  11251. "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)));
  11252. }, selectedItem: function selectedItem(e) {
  11253. var t = S.get.choiceValue(e),
  11254. n = S.get.choiceText(e, !1),
  11255. 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);
  11256. }, selectedLetter: function selectedLetter(t) {
  11257. var n,
  11258. i = X.filter("." + T.selected),
  11259. 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 () {
  11260. if (S.has.firstLetter(e(this), t)) return o = e(this), !1;
  11261. }), 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));
  11262. }, direction: function direction(e) {
  11263. "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);
  11264. }, upward: function upward(e) {
  11265. (e || M).addClass(T.upward);
  11266. }, leftward: function leftward(e) {
  11267. (e || Q).addClass(T.leftward);
  11268. }, value: function value(e, t, n) {
  11269. var o = S.escape.value(e),
  11270. a = U.length > 0,
  11271. r = S.get.values(),
  11272. s = e !== i ? String(e) : e;if (a) {
  11273. 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;
  11274. } 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);
  11275. }, active: function active() {
  11276. M.addClass(T.active);
  11277. }, multiple: function multiple() {
  11278. M.addClass(T.multiple);
  11279. }, visible: function visible() {
  11280. M.addClass(T.visible);
  11281. }, exactly: function exactly(e, t) {
  11282. S.debug("Setting selected to exact values"), S.clear(), S.set.selected(e, t);
  11283. }, selected: function selected(t, n) {
  11284. 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 () {
  11285. var t = e(this),
  11286. o = S.get.choiceText(t),
  11287. a = S.get.choiceValue(t, o),
  11288. r = t.hasClass(T.filtered),
  11289. s = t.hasClass(T.active),
  11290. l = t.hasClass(T.addition),
  11291. 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));
  11292. }));
  11293. } }, add: { label: function label(t, n, i) {
  11294. var o,
  11295. a = S.is.searchSelection() ? N : V,
  11296. 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)));
  11297. }, message: function message(t) {
  11298. var n = Q.children(D.message),
  11299. i = k.templates.message(S.add.variables(t));n.length > 0 ? n.html(i) : n = e("<div/>").html(i).addClass(T.message).appendTo(Q);
  11300. }, optionValue: function optionValue(t) {
  11301. 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());
  11302. }, userSuggestion: function userSuggestion(e) {
  11303. var t,
  11304. n = Q.children(D.addition),
  11305. i = S.get.item(e),
  11306. o = i && i.not(D.addition).length,
  11307. 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()));
  11308. }, variables: function variables(e, t) {
  11309. var n,
  11310. i,
  11311. o = -1 !== e.search("{count}"),
  11312. a = -1 !== e.search("{maxCount}"),
  11313. 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;
  11314. }, value: function value(t, n, i) {
  11315. var o,
  11316. 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");
  11317. } }, remove: { active: function active() {
  11318. M.removeClass(T.active);
  11319. }, activeLabel: function activeLabel() {
  11320. M.find(D.label).removeClass(T.active);
  11321. }, empty: function empty() {
  11322. M.removeClass(T.empty);
  11323. }, loading: function loading() {
  11324. M.removeClass(T.loading);
  11325. }, initialLoad: function initialLoad() {
  11326. h = !1;
  11327. }, upward: function upward(e) {
  11328. (e || M).removeClass(T.upward);
  11329. }, leftward: function leftward(e) {
  11330. (e || Q).removeClass(T.leftward);
  11331. }, visible: function visible() {
  11332. M.removeClass(T.visible);
  11333. }, activeItem: function activeItem() {
  11334. X.removeClass(T.active);
  11335. }, filteredItem: function filteredItem() {
  11336. k.useLabels && S.has.maxSelections() || (k.useLabels && S.is.multiple() ? X.not("." + T.active).removeClass(T.filtered) : X.removeClass(T.filtered), S.remove.empty());
  11337. }, optionValue: function optionValue(e) {
  11338. var t = S.escape.value(e),
  11339. 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 }));
  11340. }, message: function message() {
  11341. Q.children(D.message).remove();
  11342. }, searchWidth: function searchWidth() {
  11343. N.css("width", "");
  11344. }, searchTerm: function searchTerm() {
  11345. S.verbose("Cleared search term"), N.val(""), S.set.filtered();
  11346. }, userAddition: function userAddition() {
  11347. X.filter(D.addition).remove();
  11348. }, selected: function selected(t, n) {
  11349. if (!(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t))) return !1;n.each(function () {
  11350. var t = e(this),
  11351. n = S.get.choiceText(t),
  11352. 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);
  11353. });
  11354. }, selectedItem: function selectedItem() {
  11355. X.removeClass(T.selected);
  11356. }, value: function value(e, t, n) {
  11357. var i,
  11358. 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();
  11359. }, arrayValue: function arrayValue(t, n) {
  11360. return e.isArray(n) || (n = [n]), n = e.grep(n, function (e) {
  11361. return t != e;
  11362. }), S.verbose("Removed value from delimited string", t, n), n;
  11363. }, label: function label(e, t) {
  11364. var n = M.find(D.label).filter("[data-" + E.value + '="' + S.escape.string(e) + '"]');S.verbose("Removing label", n), n.remove();
  11365. }, activeLabels: function activeLabels(e) {
  11366. e = e || M.find(D.label).filter("." + T.active), S.verbose("Removing active label selections", e), S.remove.labels(e);
  11367. }, labels: function labels(t) {
  11368. t = t || M.find(D.label), S.verbose("Removing labels", t), t.each(function () {
  11369. var t = e(this),
  11370. n = t.data(E.value),
  11371. o = n !== i ? String(n) : n,
  11372. 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");
  11373. });
  11374. }, tabbable: function tabbable() {
  11375. 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"));
  11376. } }, has: { menuSearch: function menuSearch() {
  11377. return S.has.search() && N.closest(Q).length > 0;
  11378. }, search: function search() {
  11379. return N.length > 0;
  11380. }, sizer: function sizer() {
  11381. return H.length > 0;
  11382. }, selectInput: function selectInput() {
  11383. return U.is("select");
  11384. }, minCharacters: function minCharacters(e) {
  11385. return !k.minCharacters || (e = e !== i ? String(e) : String(S.get.query())).length >= k.minCharacters;
  11386. }, firstLetter: function firstLetter(e, t) {
  11387. var n;return !(!e || 0 === e.length || "string" != typeof t) && (n = S.get.choiceText(e, !1), (t = t.toLowerCase()) == String(n).charAt(0).toLowerCase());
  11388. }, input: function input() {
  11389. return U.length > 0;
  11390. }, items: function items() {
  11391. return X.length > 0;
  11392. }, menu: function menu() {
  11393. return Q.length > 0;
  11394. }, message: function message() {
  11395. return 0 !== Q.children(D.message).length;
  11396. }, label: function label(e) {
  11397. var t = S.escape.value(e),
  11398. n = M.find(D.label);return k.ignoreCase && (t = t.toLowerCase()), n.filter("[data-" + E.value + '="' + S.escape.string(t) + '"]').length > 0;
  11399. }, maxSelections: function maxSelections() {
  11400. return k.maxSelections && S.get.selectionCount() >= k.maxSelections;
  11401. }, allResultsFiltered: function allResultsFiltered() {
  11402. var e = X.not(D.addition);return e.filter(D.unselectable).length === e.length;
  11403. }, userSuggestion: function userSuggestion() {
  11404. return Q.children(D.addition).length > 0;
  11405. }, query: function query() {
  11406. return "" !== S.get.query();
  11407. }, value: function value(e) {
  11408. return k.ignoreCase ? S.has.valueIgnoringCase(e) : S.has.valueMatchingCase(e);
  11409. }, valueMatchingCase: function valueMatchingCase(t) {
  11410. var n = S.get.values();return !!(e.isArray(n) ? n && -1 !== e.inArray(t, n) : n == t);
  11411. }, valueIgnoringCase: function valueIgnoringCase(t) {
  11412. var n = S.get.values(),
  11413. i = !1;return e.isArray(n) || (n = [n]), e.each(n, function (e, n) {
  11414. if (String(t).toLowerCase() == String(n).toLowerCase()) return i = !0, !1;
  11415. }), i;
  11416. } }, is: { active: function active() {
  11417. return M.hasClass(T.active);
  11418. }, animatingInward: function animatingInward() {
  11419. return Q.transition("is inward");
  11420. }, animatingOutward: function animatingOutward() {
  11421. return Q.transition("is outward");
  11422. }, bubbledLabelClick: function bubbledLabelClick(t) {
  11423. return e(t.target).is("select, input") && M.closest("label").length > 0;
  11424. }, bubbledIconClick: function bubbledIconClick(t) {
  11425. return e(t.target).closest(W).length > 0;
  11426. }, alreadySetup: function alreadySetup() {
  11427. return M.is("select") && M.parent(D.dropdown).data(I) !== i && 0 === M.prev().length;
  11428. }, animating: function animating(e) {
  11429. return e ? e.transition && e.transition("is animating") : Q.transition && Q.transition("is animating");
  11430. }, leftward: function leftward(e) {
  11431. return (e || Q).hasClass(T.leftward);
  11432. }, disabled: function disabled() {
  11433. return M.hasClass(T.disabled);
  11434. }, focused: function focused() {
  11435. return n.activeElement === M[0];
  11436. }, focusedOnSearch: function focusedOnSearch() {
  11437. return n.activeElement === N[0];
  11438. }, allFiltered: function allFiltered() {
  11439. return (S.is.multiple() || S.has.search()) && !(0 == k.hideAdditions && S.has.userSuggestion()) && !S.has.message() && S.has.allResultsFiltered();
  11440. }, hidden: function hidden(e) {
  11441. return !S.is.visible(e);
  11442. }, initialLoad: function initialLoad() {
  11443. return h;
  11444. }, inObject: function inObject(t, n) {
  11445. var i = !1;return e.each(n, function (e, n) {
  11446. if (n == t) return i = !0, !0;
  11447. }), i;
  11448. }, multiple: function multiple() {
  11449. return M.hasClass(T.multiple);
  11450. }, remote: function remote() {
  11451. return k.apiSettings && S.can.useAPI();
  11452. }, single: function single() {
  11453. return !S.is.multiple();
  11454. }, selectMutation: function selectMutation(t) {
  11455. var n = !1;return e.each(t, function (t, i) {
  11456. if (i.target && e(i.target).is("select")) return n = !0, !0;
  11457. }), n;
  11458. }, search: function search() {
  11459. return M.hasClass(T.search);
  11460. }, searchSelection: function searchSelection() {
  11461. return S.has.search() && 1 === N.parent(D.dropdown).length;
  11462. }, selection: function selection() {
  11463. return M.hasClass(T.selection);
  11464. }, userValue: function userValue(t) {
  11465. return -1 !== e.inArray(t, S.get.userValues());
  11466. }, upward: function upward(e) {
  11467. return (e || M).hasClass(T.upward);
  11468. }, visible: function visible(e) {
  11469. return e ? e.hasClass(T.visible) : Q.hasClass(T.visible);
  11470. }, verticallyScrollableContext: function verticallyScrollableContext() {
  11471. var e = L.get(0) !== t && L.css("overflow-y");return "auto" == e || "scroll" == e;
  11472. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  11473. var e = L.get(0) !== t && L.css("overflow-X");return "auto" == e || "scroll" == e;
  11474. } }, can: { activate: function activate(e) {
  11475. return !!k.useLabels || !S.has.maxSelections() || !(!S.has.maxSelections() || !e.hasClass(T.active));
  11476. }, openDownward: function openDownward(e) {
  11477. var n,
  11478. i,
  11479. o = e || Q,
  11480. 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;
  11481. }, openRightward: function openRightward(e) {
  11482. var n,
  11483. i,
  11484. o = e || Q,
  11485. 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;
  11486. }, click: function click() {
  11487. return c || "click" == k.on;
  11488. }, extendSelect: function extendSelect() {
  11489. return k.allowAdditions || k.apiSettings;
  11490. }, show: function show() {
  11491. return !S.is.disabled() && (S.has.items() || S.has.message());
  11492. }, useAPI: function useAPI() {
  11493. return e.fn.api !== i;
  11494. } }, animate: { show: function show(t, n) {
  11495. var o,
  11496. a = n || Q,
  11497. r = n ? function () {} : function () {
  11498. S.hideSubMenus(), S.hideOthers(), S.set.active();
  11499. };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() {
  11500. t.call(K);
  11501. } }) : S.error(q.noTransition, o));
  11502. }, hide: function hide(t, n) {
  11503. var o = n || Q,
  11504. a = (n ? k.duration : k.duration, n ? function () {} : function () {
  11505. S.can.click() && S.unbind.intent(), S.remove.active();
  11506. }),
  11507. 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() {
  11508. t.call(K);
  11509. } }) : S.error(q.transition));
  11510. } }, hideAndClear: function hideAndClear() {
  11511. S.remove.searchTerm(), S.has.maxSelections() || (S.has.search() ? S.hide(function () {
  11512. S.remove.filteredItem();
  11513. }) : S.hide());
  11514. }, delay: { show: function show() {
  11515. S.verbose("Delaying show event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.show, k.delay.show);
  11516. }, hide: function hide() {
  11517. S.verbose("Delaying hide event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.hide, k.delay.hide);
  11518. } }, escape: { value: function value(t) {
  11519. var n = e.isArray(t),
  11520. i = "string" == typeof t,
  11521. o = !i && !n,
  11522. a = i && -1 !== t.search(O.quote),
  11523. r = [];return o || !a ? t : (S.debug("Encoding quote values for use in select", t), n ? (e.each(t, function (e, t) {
  11524. r.push(t.replace(O.quote, "&quot;"));
  11525. }), r) : t.replace(O.quote, "&quot;"));
  11526. }, string: function string(e) {
  11527. return (e = String(e)).replace(O.escape, "\\$&");
  11528. } }, setting: function setting(t, n) {
  11529. if (S.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, k, t);else {
  11530. if (n === i) return k[t];e.isPlainObject(k[t]) ? e.extend(!0, k[t], n) : k[t] = n;
  11531. }
  11532. }, internal: function internal(t, n) {
  11533. if (e.isPlainObject(t)) e.extend(!0, S, t);else {
  11534. if (n === i) return S[t];S[t] = n;
  11535. }
  11536. }, debug: function debug() {
  11537. !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)));
  11538. }, verbose: function verbose() {
  11539. !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)));
  11540. }, error: function error() {
  11541. k.silent || (S.error = Function.prototype.bind.call(console.error, console, k.name + ":"), S.error.apply(console, arguments));
  11542. }, performance: { log: function log(e) {
  11543. 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);
  11544. }, display: function display() {
  11545. var t = k.name + ":",
  11546. n = 0;u = !1, clearTimeout(S.performance.timer), e.each(d, function (e, t) {
  11547. n += t["Execution Time"];
  11548. }), 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) {
  11549. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11550. }), console.groupEnd()), d = [];
  11551. } }, invoke: function invoke(t, n, o) {
  11552. var r,
  11553. s,
  11554. l,
  11555. 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) {
  11556. 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 {
  11557. 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];
  11558. }
  11559. })), 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;
  11560. } }, m ? (J === i && S.initialize(), S.invoke(f)) : (J !== i && J.invoke("destroy"), S.initialize());
  11561. }), a !== i ? a : r;
  11562. }, 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) {
  11563. return e(this);
  11564. }, onLabelRemove: function onLabelRemove(e) {
  11565. return !0;
  11566. }, onNoResults: function onNoResults(e) {
  11567. return !0;
  11568. }, 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) {
  11569. var n = t.placeholder || !1,
  11570. 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) {
  11571. i += t.disabled ? '<div class="disabled item" data-value="' + t.value + '">' + t.name + "</div>" : '<div class="item" data-value="' + t.value + '">' + t.name + "</div>";
  11572. }), i += "</div>";
  11573. }, menu: function menu(t, n) {
  11574. var i = t[n.values] || {},
  11575. o = "";return e.each(i, function (e, t) {
  11576. var i = t[n.text] ? 'data-text="' + t[n.text] + '"' : "",
  11577. a = t[n.disabled] ? "disabled " : "";o += '<div class="' + a + 'item" data-value="' + t[n.value] + '"' + i + ">", o += t[n.name], o += "</div>";
  11578. }), o;
  11579. }, label: function label(e, t) {
  11580. return t + '<i class="delete icon"></i>';
  11581. }, message: function message(e) {
  11582. return e;
  11583. }, addition: function addition(e) {
  11584. return e;
  11585. } };
  11586. }(jQuery, window, document), function (e, t, n, i) {
  11587. "use strict";
  11588. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.embed = function (n) {
  11589. var o,
  11590. a = e(this),
  11591. r = a.selector || "",
  11592. s = new Date().getTime(),
  11593. l = [],
  11594. c = arguments[0],
  11595. u = "string" == typeof c,
  11596. d = [].slice.call(arguments, 1);return a.each(function () {
  11597. var f,
  11598. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.embed.settings, n) : e.extend({}, e.fn.embed.settings),
  11599. g = m.selector,
  11600. p = m.className,
  11601. h = m.sources,
  11602. v = m.error,
  11603. b = m.metadata,
  11604. y = m.namespace,
  11605. x = m.templates,
  11606. C = "." + y,
  11607. w = "module-" + y,
  11608. S = (e(t), e(this)),
  11609. k = (S.find(g.placeholder), S.find(g.icon), S.find(g.embed)),
  11610. T = this,
  11611. A = S.data(w);f = { initialize: function initialize() {
  11612. f.debug("Initializing embed"), f.determine.autoplay(), f.create(), f.bind.events(), f.instantiate();
  11613. }, instantiate: function instantiate() {
  11614. f.verbose("Storing instance of module", f), A = f, S.data(w, f);
  11615. }, destroy: function destroy() {
  11616. f.verbose("Destroying previous instance of embed"), f.reset(), S.removeData(w).off(C);
  11617. }, refresh: function refresh() {
  11618. f.verbose("Refreshing selector cache"), S.find(g.placeholder), S.find(g.icon), k = S.find(g.embed);
  11619. }, bind: { events: function events() {
  11620. f.has.placeholder() && (f.debug("Adding placeholder events"), S.on("click" + C, g.placeholder, f.createAndShow).on("click" + C, g.icon, f.createAndShow));
  11621. } }, create: function create() {
  11622. f.get.placeholder() ? f.createPlaceholder() : f.createAndShow();
  11623. }, createPlaceholder: function createPlaceholder(e) {
  11624. var t = f.get.icon(),
  11625. 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);
  11626. }, createEmbed: function createEmbed(t) {
  11627. 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);
  11628. }, changeEmbed: function changeEmbed(e) {
  11629. k.html(f.generate.embed(e));
  11630. }, createAndShow: function createAndShow() {
  11631. f.createEmbed(), f.show();
  11632. }, change: function change(e, t, n) {
  11633. 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();
  11634. }, reset: function reset() {
  11635. f.debug("Clearing embed and showing placeholder"), f.remove.active(), f.remove.embed(), f.showPlaceholder(), m.onReset.call(T);
  11636. }, show: function show() {
  11637. f.debug("Showing embed"), f.set.active(), m.onDisplay.call(T);
  11638. }, hide: function hide() {
  11639. f.debug("Hiding embed"), f.showPlaceholder();
  11640. }, showPlaceholder: function showPlaceholder() {
  11641. f.debug("Showing placeholder image"), f.remove.active(), m.onPlaceholderDisplay.call(T);
  11642. }, get: { id: function id() {
  11643. return m.id || S.data(b.id);
  11644. }, placeholder: function placeholder() {
  11645. return m.placeholder || S.data(b.placeholder);
  11646. }, icon: function icon() {
  11647. return m.icon ? m.icon : S.data(b.icon) !== i ? S.data(b.icon) : f.determine.icon();
  11648. }, source: function source(e) {
  11649. return m.source ? m.source : S.data(b.source) !== i ? S.data(b.source) : f.determine.source();
  11650. }, type: function type() {
  11651. var e = f.get.source();return h[e] !== i && h[e].type;
  11652. }, url: function url() {
  11653. return m.url ? m.url : S.data(b.url) !== i ? S.data(b.url) : f.determine.url();
  11654. } }, determine: { autoplay: function autoplay() {
  11655. f.should.autoplay() && (m.autoplay = !0);
  11656. }, source: function source(t) {
  11657. var n = !1;return (t = t || f.get.url()) && e.each(h, function (e, i) {
  11658. if (-1 !== t.search(i.domain)) return n = e, !1;
  11659. }), n;
  11660. }, icon: function icon() {
  11661. var e = f.get.source();return h[e] !== i && h[e].icon;
  11662. }, url: function url() {
  11663. var e,
  11664. t = m.id || S.data(b.id),
  11665. n = m.source || S.data(b.source);return (e = h[n] !== i && h[n].url.replace("{id}", t)) && S.data(b.url, e), e;
  11666. } }, set: { active: function active() {
  11667. S.addClass(p.active);
  11668. } }, remove: { active: function active() {
  11669. S.removeClass(p.active);
  11670. }, embed: function embed() {
  11671. k.empty();
  11672. } }, encode: { parameters: function parameters(e) {
  11673. var t,
  11674. n = [];for (t in e) {
  11675. n.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t]));
  11676. }return n.join("&amp;");
  11677. } }, generate: { embed: function embed(e) {
  11678. f.debug("Generating embed html");var t,
  11679. n,
  11680. 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;
  11681. }, parameters: function parameters(t, n) {
  11682. 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);
  11683. } }, has: { embed: function embed() {
  11684. return k.length > 0;
  11685. }, placeholder: function placeholder() {
  11686. return m.placeholder || S.data(b.placeholder);
  11687. } }, should: { autoplay: function autoplay() {
  11688. return "auto" === m.autoplay ? m.placeholder || S.data(b.placeholder) !== i : m.autoplay;
  11689. } }, is: { video: function video() {
  11690. return "video" == f.get.type();
  11691. } }, setting: function setting(t, n) {
  11692. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  11693. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  11694. }
  11695. }, internal: function internal(t, n) {
  11696. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  11697. if (n === i) return f[t];f[t] = n;
  11698. }
  11699. }, debug: function debug() {
  11700. !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)));
  11701. }, verbose: function verbose() {
  11702. !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)));
  11703. }, error: function error() {
  11704. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  11705. }, performance: { log: function log(e) {
  11706. 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);
  11707. }, display: function display() {
  11708. var t = m.name + ":",
  11709. n = 0;s = !1, clearTimeout(f.performance.timer), e.each(l, function (e, t) {
  11710. n += t["Execution Time"];
  11711. }), 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) {
  11712. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11713. }), console.groupEnd()), l = [];
  11714. } }, invoke: function invoke(t, n, a) {
  11715. var r,
  11716. s,
  11717. l,
  11718. 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) {
  11719. 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 {
  11720. 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];
  11721. }
  11722. })), 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;
  11723. } }, u ? (A === i && f.initialize(), f.invoke(c)) : (A !== i && A.invoke("destroy"), f.initialize());
  11724. }), o !== i ? o : this;
  11725. }, 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) {
  11726. return e;
  11727. }, 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) {
  11728. return { autohide: !e.brandedUI, autoplay: e.autoplay, color: e.color || i, hq: e.hd, jsapi: e.api, modestbranding: !e.brandedUI };
  11729. } }, vimeo: { name: "vimeo", type: "video", icon: "video play", domain: "vimeo.com", url: "//player.vimeo.com/video/{id}", parameters: function parameters(e) {
  11730. return { api: e.api, autoplay: e.autoplay, byline: e.brandedUI, color: e.color || i, portrait: e.brandedUI, title: e.brandedUI };
  11731. } } }, templates: { iframe: function iframe(e, t) {
  11732. var n = e;return t && (n += "?" + t), '<iframe src="' + n + '" width="100%" height="100%" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  11733. }, placeholder: function placeholder(e, t) {
  11734. var n = "";return t && (n += '<i class="' + t + ' icon"></i>'), e && (n += '<img class="placeholder" src="' + e + '">'), n;
  11735. } }, api: !1, onPause: function onPause() {}, onPlay: function onPlay() {}, onStop: function onStop() {} };
  11736. }(jQuery, window, document), function (e, t, n, i) {
  11737. "use strict";
  11738. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.modal = function (o) {
  11739. var a,
  11740. r = e(this),
  11741. s = e(t),
  11742. l = e(n),
  11743. c = e("body"),
  11744. u = r.selector || "",
  11745. d = new Date().getTime(),
  11746. f = [],
  11747. m = arguments[0],
  11748. g = "string" == typeof m,
  11749. p = [].slice.call(arguments, 1),
  11750. h = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  11751. setTimeout(e, 0);
  11752. };return r.each(function () {
  11753. var r,
  11754. v,
  11755. b,
  11756. y,
  11757. x,
  11758. C,
  11759. w,
  11760. S,
  11761. k,
  11762. T = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.modal.settings, o) : e.extend({}, e.fn.modal.settings),
  11763. A = T.selector,
  11764. R = T.className,
  11765. P = T.namespace,
  11766. E = T.error,
  11767. F = "." + P,
  11768. O = "module-" + P,
  11769. D = e(this),
  11770. q = e(T.context),
  11771. j = D.find(A.close),
  11772. z = this,
  11773. I = D.data(O),
  11774. M = !1;k = { initialize: function initialize() {
  11775. k.verbose("Initializing dimmer", q), k.create.id(), k.create.dimmer(), k.refreshModals(), k.bind.events(), T.observeChanges && k.observeChanges(), k.instantiate();
  11776. }, instantiate: function instantiate() {
  11777. k.verbose("Storing instance of modal"), I = k, D.data(O, I);
  11778. }, create: { dimmer: function dimmer() {
  11779. var t = { debug: T.debug, variation: !T.centered && "top aligned", dimmerName: "modals" },
  11780. 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);
  11781. }, id: function id() {
  11782. w = (Math.random().toString(16) + "000000000").substr(2, 8), C = "." + w, k.verbose("Creating unique id for element", w);
  11783. } }, destroy: function destroy() {
  11784. k.verbose("Destroying previous modal"), D.removeData(O).off(F), s.off(C), x.off(C), j.off(F), q.dimmer("destroy");
  11785. }, observeChanges: function observeChanges() {
  11786. "MutationObserver" in t && ((S = new MutationObserver(function (e) {
  11787. k.debug("DOM tree modified, refreshing"), k.refresh();
  11788. })).observe(z, { childList: !0, subtree: !0 }), k.debug("Setting up mutation observer", S));
  11789. }, refresh: function refresh() {
  11790. k.remove.scrolling(), k.cacheSizes(), k.set.screenHeight(), k.set.type();
  11791. }, refreshModals: function refreshModals() {
  11792. v = D.siblings(A.modal), r = v.add(D);
  11793. }, attachEvents: function attachEvents(t, n) {
  11794. 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);
  11795. }, bind: { events: function events() {
  11796. 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);
  11797. } }, get: { id: function id() {
  11798. return (Math.random().toString(16) + "000000000").substr(2, 8);
  11799. } }, event: { approve: function approve() {
  11800. M || !1 === T.onApprove.call(z, e(this)) ? k.verbose("Approve callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11801. M = !1;
  11802. }));
  11803. }, deny: function deny() {
  11804. M || !1 === T.onDeny.call(z, e(this)) ? k.verbose("Deny callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11805. M = !1;
  11806. }));
  11807. }, close: function close() {
  11808. k.hide();
  11809. }, click: function click(t) {
  11810. if (T.closable) {
  11811. var i = e(t.target).closest(A.modal).length > 0,
  11812. 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());
  11813. } else k.verbose("Dimmer clicked but closable setting is disabled");
  11814. }, debounce: function debounce(e, t) {
  11815. clearTimeout(k.timer), k.timer = setTimeout(e, t);
  11816. }, keyboard: function keyboard(e) {
  11817. 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());
  11818. }, resize: function resize() {
  11819. y.dimmer("is active") && (k.is.animating() || k.is.active()) && h(k.refresh);
  11820. } }, toggle: function toggle() {
  11821. k.is.active() || k.is.animating() ? k.hide() : k.show();
  11822. }, show: function show(t) {
  11823. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.set.dimmerSettings(), k.showModal(t);
  11824. }, hide: function hide(t) {
  11825. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.hideModal(t);
  11826. }, showModal: function showModal(t) {
  11827. 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() {
  11828. T.onVisible.apply(z), T.keyboardShortcuts && k.add.keyboardShortcuts(), k.save.focus(), k.set.active(), T.autofocus && k.set.autofocus(), t();
  11829. } })) : k.error(E.noTransition))) : k.debug("Modal is already visible");
  11830. }, hideModal: function hideModal(t, n) {
  11831. 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() {
  11832. k.others.active() || n || k.hideDimmer(), T.keyboardShortcuts && k.remove.keyboardShortcuts();
  11833. }, onComplete: function onComplete() {
  11834. T.onHidden.call(z), k.restore.focus(), t();
  11835. } })) : k.error(E.noTransition)) : k.verbose("Hide callback returned false cancelling hide");
  11836. }, showDimmer: function showDimmer() {
  11837. y.dimmer("is animating") || !y.dimmer("is active") ? (k.debug("Showing dimmer"), y.dimmer("show")) : k.debug("Dimmer already visible");
  11838. }, hideDimmer: function hideDimmer() {
  11839. y.dimmer("is animating") || y.dimmer("is active") ? y.dimmer("hide", function () {
  11840. k.remove.clickaway(), k.remove.screenHeight();
  11841. }) : k.debug("Dimmer is not visible cannot hide");
  11842. }, hideAll: function hideAll(t) {
  11843. 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));
  11844. }, hideOthers: function hideOthers(t) {
  11845. 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));
  11846. }, others: { active: function active() {
  11847. return v.filter("." + R.active).length > 0;
  11848. }, animating: function animating() {
  11849. return v.filter("." + R.animating).length > 0;
  11850. } }, add: { keyboardShortcuts: function keyboardShortcuts() {
  11851. k.verbose("Adding keyboard shortcuts"), l.on("keyup" + F, k.event.keyboard);
  11852. } }, save: { focus: function focus() {
  11853. e(n.activeElement).closest(D).length > 0 || (b = e(n.activeElement).blur());
  11854. } }, restore: { focus: function focus() {
  11855. b && b.length > 0 && b.focus();
  11856. } }, remove: { active: function active() {
  11857. D.removeClass(R.active);
  11858. }, clickaway: function clickaway() {
  11859. x.off("click" + C);
  11860. }, bodyStyle: function bodyStyle() {
  11861. "" === c.attr("style") && (k.verbose("Removing style attribute"), c.removeAttr("style"));
  11862. }, screenHeight: function screenHeight() {
  11863. k.debug("Removing page height"), c.css("height", "");
  11864. }, keyboardShortcuts: function keyboardShortcuts() {
  11865. k.verbose("Removing keyboard shortcuts"), l.off("keyup" + F);
  11866. }, scrolling: function scrolling() {
  11867. y.removeClass(R.scrolling), D.removeClass(R.scrolling);
  11868. } }, cacheSizes: function cacheSizes() {
  11869. D.addClass(R.loading);var o = D.prop("scrollHeight"),
  11870. 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);
  11871. }, can: { fit: function fit() {
  11872. var e = k.cache.contextHeight,
  11873. t = k.cache.contextHeight / 2,
  11874. n = k.cache.topOffset,
  11875. i = k.cache.scrollHeight,
  11876. o = k.cache.height,
  11877. a = T.padding;return i > o ? t + n + i + a < e : o + 2 * a < e;
  11878. } }, is: { active: function active() {
  11879. return D.hasClass(R.active);
  11880. }, animating: function animating() {
  11881. return D.transition("is supported") ? D.transition("is animating") : D.is(":visible");
  11882. }, scrolling: function scrolling() {
  11883. return y.hasClass(R.scrolling);
  11884. }, modernBrowser: function modernBrowser() {
  11885. return !(t.ActiveXObject || "ActiveXObject" in t);
  11886. } }, set: { autofocus: function autofocus() {
  11887. var e = D.find("[tabindex], :input").filter(":visible"),
  11888. t = e.filter("[autofocus]"),
  11889. n = t.length > 0 ? t.first() : e.first();n.length > 0 && n.focus();
  11890. }, clickaway: function clickaway() {
  11891. x.on("click" + C, k.event.click);
  11892. }, dimmerSettings: function dimmerSettings() {
  11893. if (e.fn.dimmer !== i) {
  11894. var t = { debug: T.debug, dimmerName: "modals", closable: "auto", variation: !T.centered && "top aligned", duration: { show: T.duration, hide: T.duration } },
  11895. 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);
  11896. } else k.error(E.dimmer);
  11897. }, screenHeight: function screenHeight() {
  11898. 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));
  11899. }, active: function active() {
  11900. D.addClass(R.active);
  11901. }, scrolling: function scrolling() {
  11902. y.addClass(R.scrolling), D.addClass(R.scrolling);
  11903. }, type: function type() {
  11904. 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());
  11905. }, undetached: function undetached() {
  11906. y.addClass(R.undetached);
  11907. } }, setting: function setting(t, n) {
  11908. if (k.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, T, t);else {
  11909. if (n === i) return T[t];e.isPlainObject(T[t]) ? e.extend(!0, T[t], n) : T[t] = n;
  11910. }
  11911. }, internal: function internal(t, n) {
  11912. if (e.isPlainObject(t)) e.extend(!0, k, t);else {
  11913. if (n === i) return k[t];k[t] = n;
  11914. }
  11915. }, debug: function debug() {
  11916. !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)));
  11917. }, verbose: function verbose() {
  11918. !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)));
  11919. }, error: function error() {
  11920. T.silent || (k.error = Function.prototype.bind.call(console.error, console, T.name + ":"), k.error.apply(console, arguments));
  11921. }, performance: { log: function log(e) {
  11922. 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);
  11923. }, display: function display() {
  11924. var t = T.name + ":",
  11925. n = 0;d = !1, clearTimeout(k.performance.timer), e.each(f, function (e, t) {
  11926. n += t["Execution Time"];
  11927. }), 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) {
  11928. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11929. }), console.groupEnd()), f = [];
  11930. } }, invoke: function invoke(t, n, o) {
  11931. var r,
  11932. s,
  11933. l,
  11934. 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) {
  11935. 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 {
  11936. 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];
  11937. }
  11938. })), 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;
  11939. } }, g ? (I === i && k.initialize(), k.invoke(m)) : (I !== i && I.invoke("destroy"), k.initialize());
  11940. }), a !== i ? a : this;
  11941. }, 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() {
  11942. return !0;
  11943. }, onHidden: function onHidden() {}, onApprove: function onApprove() {
  11944. return !0;
  11945. }, onDeny: function onDeny() {
  11946. return !0;
  11947. }, 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" } };
  11948. }(jQuery, window, document), function (e, t, n, i) {
  11949. "use strict";
  11950. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.nag = function (n) {
  11951. var o,
  11952. a = e(this),
  11953. r = a.selector || "",
  11954. s = new Date().getTime(),
  11955. l = [],
  11956. c = arguments[0],
  11957. u = "string" == typeof c,
  11958. d = [].slice.call(arguments, 1);return a.each(function () {
  11959. var a,
  11960. f = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.nag.settings, n) : e.extend({}, e.fn.nag.settings),
  11961. m = (f.className, f.selector),
  11962. g = f.error,
  11963. p = f.namespace,
  11964. h = "." + p,
  11965. v = p + "-module",
  11966. b = e(this),
  11967. y = (b.find(m.close), f.context ? e(f.context) : e("body")),
  11968. x = this,
  11969. C = b.data(v);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;a = { initialize: function initialize() {
  11970. 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();
  11971. }, destroy: function destroy() {
  11972. a.verbose("Destroying instance"), b.removeData(v).off(h);
  11973. }, show: function show() {
  11974. 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));
  11975. }, hide: function hide() {
  11976. a.debug("Showing nag", f.animation.hide), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideUp(f.duration, f.easing);
  11977. }, onHide: function onHide() {
  11978. a.debug("Removing nag", f.animation.hide), b.remove(), f.onHide && f.onHide();
  11979. }, dismiss: function dismiss(e) {
  11980. f.storageMethod && a.storage.set(f.key, f.value), a.hide(), e.stopImmediatePropagation(), e.preventDefault();
  11981. }, should: { show: function show() {
  11982. 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);
  11983. } }, get: { storageOptions: function storageOptions() {
  11984. var e = {};return f.expires && (e.expires = f.expires), f.domain && (e.domain = f.domain), f.path && (e.path = f.path), e;
  11985. } }, clear: function clear() {
  11986. a.storage.remove(f.key);
  11987. }, storage: { set: function set(n, o) {
  11988. 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 {
  11989. if (e.cookie === i) return void a.error(g.noCookieStorage);e.cookie(n, o, r), a.debug("Value stored using cookie", n, o, r);
  11990. }
  11991. }, get: function get(n, o) {
  11992. 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;
  11993. }, remove: function remove(n) {
  11994. 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);
  11995. } }, setting: function setting(t, n) {
  11996. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  11997. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  11998. }
  11999. }, internal: function internal(t, n) {
  12000. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  12001. if (n === i) return a[t];a[t] = n;
  12002. }
  12003. }, debug: function debug() {
  12004. !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)));
  12005. }, verbose: function verbose() {
  12006. !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)));
  12007. }, error: function error() {
  12008. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  12009. }, performance: { log: function log(e) {
  12010. 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);
  12011. }, display: function display() {
  12012. var t = f.name + ":",
  12013. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  12014. n += t["Execution Time"];
  12015. }), 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) {
  12016. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12017. }), console.groupEnd()), l = [];
  12018. } }, invoke: function invoke(t, n, r) {
  12019. var s,
  12020. l,
  12021. c,
  12022. 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) {
  12023. 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 {
  12024. 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];
  12025. }
  12026. })), 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;
  12027. } }, u ? (C === i && a.initialize(), a.invoke(c)) : (C !== i && C.invoke("destroy"), a.initialize());
  12028. }), o !== i ? o : this;
  12029. }, 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) {
  12030. return -i * (t /= o) * (t - 2) + n;
  12031. } });
  12032. }(jQuery, window, document), function (e, t, n, i) {
  12033. "use strict";
  12034. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.popup = function (o) {
  12035. var a,
  12036. r = e(this),
  12037. s = e(n),
  12038. l = e(t),
  12039. c = e("body"),
  12040. u = r.selector || "",
  12041. d = new Date().getTime(),
  12042. f = [],
  12043. m = arguments[0],
  12044. g = "string" == typeof m,
  12045. p = [].slice.call(arguments, 1);return r.each(function () {
  12046. var r,
  12047. h,
  12048. v,
  12049. b,
  12050. y,
  12051. x,
  12052. C = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.popup.settings, o) : e.extend({}, e.fn.popup.settings),
  12053. w = C.selector,
  12054. S = C.className,
  12055. k = C.error,
  12056. T = C.metadata,
  12057. A = C.namespace,
  12058. R = "." + C.namespace,
  12059. P = "module-" + A,
  12060. E = e(this),
  12061. F = e(C.context),
  12062. O = e(C.scrollContext),
  12063. D = e(C.boundary),
  12064. q = C.target ? e(C.target) : E,
  12065. j = 0,
  12066. z = !1,
  12067. I = !1,
  12068. M = this,
  12069. L = E.data(P);x = { initialize: function initialize() {
  12070. x.debug("Initializing", E), x.createID(), x.bind.events(), !x.exists() && C.preserve && x.create(), C.observeChanges && x.observeChanges(), x.instantiate();
  12071. }, instantiate: function instantiate() {
  12072. x.verbose("Storing instance", x), L = x, E.data(P, L);
  12073. }, observeChanges: function observeChanges() {
  12074. "MutationObserver" in t && ((v = new MutationObserver(x.event.documentChanged)).observe(n, { childList: !0, subtree: !0 }), x.debug("Setting up mutation observer", v));
  12075. }, refresh: function refresh() {
  12076. 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();
  12077. }, reposition: function reposition() {
  12078. x.refresh(), x.set.position();
  12079. }, destroy: function destroy() {
  12080. 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);
  12081. }, event: { start: function start(t) {
  12082. var n = e.isPlainObject(C.delay) ? C.delay.show : C.delay;clearTimeout(x.hideTimer), I || (x.showTimer = setTimeout(x.show, n));
  12083. }, end: function end() {
  12084. var t = e.isPlainObject(C.delay) ? C.delay.hide : C.delay;clearTimeout(x.showTimer), x.hideTimer = setTimeout(x.hide, t);
  12085. }, touchstart: function touchstart(e) {
  12086. I = !0, x.show();
  12087. }, resize: function resize() {
  12088. x.is.visible() && x.set.position();
  12089. }, documentChanged: function documentChanged(t) {
  12090. [].forEach.call(t, function (t) {
  12091. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  12092. (t == M || e(t).find(M).length > 0) && (x.debug("Element removed from DOM, tearing down events"), x.destroy());
  12093. });
  12094. });
  12095. }, hideGracefully: function hideGracefully(t) {
  12096. var i = e(t.target),
  12097. o = e.contains(n.documentElement, t.target),
  12098. 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");
  12099. } }, create: function create() {
  12100. var t = x.get.html(),
  12101. n = x.get.title(),
  12102. 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);
  12103. }, createID: function createID() {
  12104. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, x.verbose("Creating unique id for element", y);
  12105. }, toggle: function toggle() {
  12106. 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());
  12107. }, show: function show(e) {
  12108. if (e = e || function () {}, x.debug("Showing pop-up", C.transition), x.is.hidden() && (!x.is.active() || !x.is.dropdown())) {
  12109. 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));
  12110. }
  12111. }, hide: function hide(e) {
  12112. if (e = e || function () {}, x.is.visible() || x.is.animating()) {
  12113. 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);
  12114. }
  12115. }, hideAll: function hideAll() {
  12116. e(w.popup).filter("." + S.popupVisible).each(function () {
  12117. e(this).data(T.activator).popup("hide");
  12118. });
  12119. }, exists: function exists() {
  12120. return !!r && (C.inline || C.popup ? x.has.popup() : r.closest(F).length >= 1);
  12121. }, removePopup: function removePopup() {
  12122. x.has.popup() && !C.popup && (x.debug("Removing popup", r), r.remove(), r = i, C.onRemove.call(r, M));
  12123. }, save: { conditions: function conditions() {
  12124. x.cache = { title: E.attr("title") }, x.cache.title && E.removeAttr("title"), x.verbose("Saving original attributes", x.cache.title);
  12125. } }, restore: { conditions: function conditions() {
  12126. return x.cache && x.cache.title && (E.attr("title", x.cache.title), x.verbose("Restoring original attributes", x.cache.title)), !0;
  12127. } }, supports: { svg: function svg() {
  12128. return "undefined" == typeof SVGGraphicsElement;
  12129. } }, animate: { show: function show(t) {
  12130. 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() {
  12131. x.bind.close(), t.call(r, M), C.onVisible.call(r, M);
  12132. } })) : x.error(k.noTransition);
  12133. }, hide: function hide(t) {
  12134. 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() {
  12135. x.reset(), t.call(r, M), C.onHidden.call(r, M);
  12136. } }) : x.error(k.noTransition) : x.debug("onHide callback returned false, cancelling popup animation");
  12137. } }, change: { content: function content(e) {
  12138. r.html(e);
  12139. } }, get: { html: function html() {
  12140. return E.removeData(T.html), E.data(T.html) || C.html;
  12141. }, title: function title() {
  12142. return E.removeData(T.title), E.data(T.title) || C.title;
  12143. }, content: function content() {
  12144. return E.removeData(T.content), E.data(T.content) || C.content || E.attr("title");
  12145. }, variation: function variation() {
  12146. return E.removeData(T.variation), E.data(T.variation) || C.variation;
  12147. }, popup: function popup() {
  12148. return r;
  12149. }, popupOffset: function popupOffset() {
  12150. return r.offset();
  12151. }, calculations: function calculations() {
  12152. var e,
  12153. n = x.get.offsetParent(r),
  12154. i = q[0],
  12155. o = D[0] == t,
  12156. a = C.inline || C.popup && C.movePopup ? q.position() : q.offset(),
  12157. s = o ? { top: 0, left: 0 } : D.offset(),
  12158. c = {},
  12159. 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)) {
  12160. var d = n.offset();c.target.top -= d.top, c.target.left -= d.left, c.parent.width = n.outerWidth(), c.parent.height = n.outerHeight();
  12161. }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;
  12162. }, id: function id() {
  12163. return y;
  12164. }, startEvent: function startEvent() {
  12165. return "hover" == C.on ? "mouseenter" : "focus" == C.on && "focus";
  12166. }, scrollEvent: function scrollEvent() {
  12167. return "scroll";
  12168. }, endEvent: function endEvent() {
  12169. return "hover" == C.on ? "mouseleave" : "focus" == C.on && "blur";
  12170. }, distanceFromBoundary: function distanceFromBoundary(e, t) {
  12171. var n,
  12172. i,
  12173. 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;
  12174. }, offsetParent: function offsetParent(t) {
  12175. var n = (t !== i ? t[0] : q[0]).parentNode,
  12176. 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;) {
  12177. n = n.parentNode, a = "none" === (o = e(n)).css("transform"), r = "static" === o.css("position"), s = o.is("body");
  12178. }return o && o.length > 0 ? o : e();
  12179. }, positions: function positions() {
  12180. 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 };
  12181. }, nextPosition: function nextPosition(e) {
  12182. var t = e.split(" "),
  12183. n = t[0],
  12184. i = t[1],
  12185. o = "top" == n || "bottom" == n,
  12186. a = !1,
  12187. r = !1,
  12188. 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;
  12189. } }, set: { position: function position(e, t) {
  12190. if (0 !== q.length && 0 !== r.length) {
  12191. 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) {
  12192. return "left" == e ? "right" : "left";
  12193. }), x.debug("RTL: Popup position updated", e)), j == C.maxSearchDepth && "string" == typeof C.lastResort && (e = C.lastResort), e) {case "top left":
  12194. c = { top: "auto", bottom: l.height - a.top + o, left: a.left + n, right: "auto" };break;case "top center":
  12195. 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":
  12196. c = { bottom: l.height - a.top + o, right: l.width - a.left - a.width - n, top: "auto", left: "auto" };break;case "left center":
  12197. 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":
  12198. 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":
  12199. c = { top: a.top + a.height + o, left: a.left + n, bottom: "auto", right: "auto" };break;case "bottom center":
  12200. 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":
  12201. 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)) {
  12202. 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");
  12203. }return x.debug("Position is on stage", e), x.remove.attempts(), x.remove.loading(), C.setFluidWidth && x.is.fluid() && x.set.fluidWidth(t), !0;
  12204. }x.error(k.notFound);
  12205. }, fluidWidth: function fluidWidth(e) {
  12206. e = e || x.get.calculations(), x.debug("Automatically setting element width to parent width", e.parent.width), r.css("width", e.container.width);
  12207. }, variation: function variation(e) {
  12208. (e = e || x.get.variation()) && x.has.popup() && (x.verbose("Adding variation to popup", e), r.addClass(e));
  12209. }, visible: function visible() {
  12210. E.addClass(S.visible);
  12211. } }, remove: { loading: function loading() {
  12212. r.removeClass(S.loading);
  12213. }, variation: function variation(e) {
  12214. (e = e || x.get.variation()) && (x.verbose("Removing variation", e), r.removeClass(e));
  12215. }, visible: function visible() {
  12216. E.removeClass(S.visible);
  12217. }, attempts: function attempts() {
  12218. x.verbose("Resetting all searched positions"), j = 0, z = !1;
  12219. } }, bind: { events: function events() {
  12220. 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);
  12221. }, popup: function popup() {
  12222. 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);
  12223. }, close: function close() {
  12224. (!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();
  12225. }, closeOnScroll: function closeOnScroll() {
  12226. x.verbose("Binding scroll close event to document"), O.one(x.get.scrollEvent() + b, x.event.hideGracefully);
  12227. }, touchClose: function touchClose() {
  12228. x.verbose("Binding popup touchclose event to document"), s.on("touchstart" + b, function (e) {
  12229. x.verbose("Touched away from popup"), x.event.hideGracefully.call(M, e);
  12230. });
  12231. }, clickaway: function clickaway() {
  12232. x.verbose("Binding popup close event to document"), s.on("click" + b, function (e) {
  12233. x.verbose("Clicked away from popup"), x.event.hideGracefully.call(M, e);
  12234. });
  12235. } }, unbind: { events: function events() {
  12236. l.off(b), E.off(R);
  12237. }, close: function close() {
  12238. s.off(b), O.off(b);
  12239. } }, has: { popup: function popup() {
  12240. return r && r.length > 0;
  12241. } }, should: { centerArrow: function centerArrow(e) {
  12242. return !x.is.basic() && e.target.width <= 2 * C.arrowPixelsFromEdge;
  12243. } }, is: { offstage: function offstage(t, n) {
  12244. var i = [];return e.each(t, function (e, t) {
  12245. t < -C.jitter && (x.debug("Position exceeds allowable distance from edge", e, t, n), i.push(e));
  12246. }), i.length > 0;
  12247. }, svg: function svg(e) {
  12248. return x.supports.svg() && e instanceof SVGGraphicsElement;
  12249. }, basic: function basic() {
  12250. return E.hasClass(S.basic);
  12251. }, active: function active() {
  12252. return E.hasClass(S.active);
  12253. }, animating: function animating() {
  12254. return r !== i && r.hasClass(S.animating);
  12255. }, fluid: function fluid() {
  12256. return r !== i && r.hasClass(S.fluid);
  12257. }, visible: function visible() {
  12258. return r !== i && r.hasClass(S.popupVisible);
  12259. }, dropdown: function dropdown() {
  12260. return E.hasClass(S.dropdown);
  12261. }, hidden: function hidden() {
  12262. return !x.is.visible();
  12263. }, rtl: function rtl() {
  12264. return "rtl" == E.css("direction");
  12265. } }, reset: function reset() {
  12266. x.remove.visible(), C.preserve ? e.fn.transition !== i && r.transition("remove transition") : x.removePopup();
  12267. }, setting: function setting(t, n) {
  12268. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  12269. if (n === i) return C[t];C[t] = n;
  12270. }
  12271. }, internal: function internal(t, n) {
  12272. if (e.isPlainObject(t)) e.extend(!0, x, t);else {
  12273. if (n === i) return x[t];x[t] = n;
  12274. }
  12275. }, debug: function debug() {
  12276. !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)));
  12277. }, verbose: function verbose() {
  12278. !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)));
  12279. }, error: function error() {
  12280. C.silent || (x.error = Function.prototype.bind.call(console.error, console, C.name + ":"), x.error.apply(console, arguments));
  12281. }, performance: { log: function log(e) {
  12282. 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);
  12283. }, display: function display() {
  12284. var t = C.name + ":",
  12285. n = 0;d = !1, clearTimeout(x.performance.timer), e.each(f, function (e, t) {
  12286. n += t["Execution Time"];
  12287. }), 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) {
  12288. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12289. }), console.groupEnd()), f = [];
  12290. } }, invoke: function invoke(t, n, o) {
  12291. var r,
  12292. s,
  12293. l,
  12294. 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) {
  12295. 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 {
  12296. 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];
  12297. }
  12298. })), 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;
  12299. } }, g ? (L === i && x.initialize(), x.invoke(m)) : (L !== i && L.invoke("destroy"), x.initialize());
  12300. }), a !== i ? a : this;
  12301. }, 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) {
  12302. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12303. return t[e];
  12304. }) : e
  12305. );
  12306. }, popup: function popup(t) {
  12307. var n = "",
  12308. 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;
  12309. } } };
  12310. }(jQuery, window, document), function (e, t, n, i) {
  12311. "use strict";
  12312. 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) {
  12313. var o,
  12314. a = e(this),
  12315. r = a.selector || "",
  12316. s = new Date().getTime(),
  12317. l = [],
  12318. c = arguments[0],
  12319. u = "string" == typeof c,
  12320. d = [].slice.call(arguments, 1);return a.each(function () {
  12321. var a,
  12322. f = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.progress.settings, t) : e.extend({}, e.fn.progress.settings),
  12323. m = f.className,
  12324. g = f.metadata,
  12325. p = f.namespace,
  12326. h = f.selector,
  12327. v = f.error,
  12328. b = "." + p,
  12329. y = "module-" + p,
  12330. x = e(this),
  12331. C = e(this).find(h.bar),
  12332. w = e(this).find(h.progress),
  12333. S = e(this).find(h.label),
  12334. k = this,
  12335. T = x.data(y),
  12336. A = !1;a = { initialize: function initialize() {
  12337. a.debug("Initializing progress bar", f), a.set.duration(), a.set.transitionEvent(), a.read.metadata(), a.read.settings(), a.instantiate();
  12338. }, instantiate: function instantiate() {
  12339. a.verbose("Storing instance of progress", a), T = a, x.data(y, a);
  12340. }, destroy: function destroy() {
  12341. a.verbose("Destroying previous progress for", x), clearInterval(T.interval), a.remove.state(), x.removeData(y), T = i;
  12342. }, reset: function reset() {
  12343. a.remove.nextValue(), a.update.progress(0);
  12344. }, complete: function complete() {
  12345. (a.percent === i || a.percent < 100) && (a.remove.progressPoll(), a.set.percent(100));
  12346. }, read: { metadata: function metadata() {
  12347. 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));
  12348. }, settings: function settings() {
  12349. !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));
  12350. } }, bind: { transitionEnd: function transitionEnd(e) {
  12351. var t = a.get.transitionEnd();C.one(t + b, function (t) {
  12352. clearTimeout(a.failSafeTimer), e.call(this, t);
  12353. }), a.failSafeTimer = setTimeout(function () {
  12354. C.triggerHandler(t);
  12355. }, f.duration + f.failSafeDelay), a.verbose("Adding fail safe timer", a.timer);
  12356. } }, increment: function increment(e) {
  12357. 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);
  12358. }, decrement: function decrement(e) {
  12359. 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);
  12360. }, has: { progressPoll: function progressPoll() {
  12361. return a.progressPoll;
  12362. }, total: function total() {
  12363. return !1 !== a.get.total();
  12364. } }, get: { text: function text(e) {
  12365. var t = a.value || 0,
  12366. n = a.total || 0,
  12367. i = A ? a.get.displayPercent() : a.percent || 0,
  12368. 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;
  12369. }, normalizedValue: function normalizedValue(e) {
  12370. if (e < 0) return a.debug("Value cannot decrement below 0"), 0;if (a.has.total()) {
  12371. if (e > a.total) return a.debug("Value cannot increment above total", a.total), a.total;
  12372. } else if (e > 100) return a.debug("Value cannot increment above 100 percent"), 100;return e;
  12373. }, updateInterval: function updateInterval() {
  12374. return "auto" == f.updateInterval ? f.duration : f.updateInterval;
  12375. }, randomValue: function randomValue() {
  12376. return a.debug("Generating random increment percentage"), Math.floor(Math.random() * f.random.max + f.random.min);
  12377. }, numericValue: function numericValue(e) {
  12378. return "string" == typeof e ? "" !== e.replace(/[^\d.]/g, "") && +e.replace(/[^\d.]/g, "") : e;
  12379. }, transitionEnd: function transitionEnd() {
  12380. var e,
  12381. t = n.createElement("element"),
  12382. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  12383. if (t.style[e] !== i) return o[e];
  12384. }
  12385. }, displayPercent: function displayPercent() {
  12386. var e = C.width(),
  12387. t = x.width(),
  12388. 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);
  12389. }, percent: function percent() {
  12390. return a.percent || 0;
  12391. }, value: function value() {
  12392. return a.nextValue || a.value || 0;
  12393. }, total: function total() {
  12394. return a.total || !1;
  12395. } }, create: { progressPoll: function progressPoll() {
  12396. a.progressPoll = setTimeout(function () {
  12397. a.update.toNextValue(), a.remove.progressPoll();
  12398. }, a.get.updateInterval());
  12399. } }, is: { complete: function complete() {
  12400. return a.is.success() || a.is.warning() || a.is.error();
  12401. }, success: function success() {
  12402. return x.hasClass(m.success);
  12403. }, warning: function warning() {
  12404. return x.hasClass(m.warning);
  12405. }, error: function error() {
  12406. return x.hasClass(m.error);
  12407. }, active: function active() {
  12408. return x.hasClass(m.active);
  12409. }, visible: function visible() {
  12410. return x.is(":visible");
  12411. } }, remove: { progressPoll: function progressPoll() {
  12412. a.verbose("Removing progress poll timer"), a.progressPoll && (clearTimeout(a.progressPoll), delete a.progressPoll);
  12413. }, nextValue: function nextValue() {
  12414. a.verbose("Removing progress value stored for next update"), delete a.nextValue;
  12415. }, state: function state() {
  12416. a.verbose("Removing stored state"), delete a.total, delete a.percent, delete a.value;
  12417. }, active: function active() {
  12418. a.verbose("Removing active state"), x.removeClass(m.active);
  12419. }, success: function success() {
  12420. a.verbose("Removing success state"), x.removeClass(m.success);
  12421. }, warning: function warning() {
  12422. a.verbose("Removing warning state"), x.removeClass(m.warning);
  12423. }, error: function error() {
  12424. a.verbose("Removing error state"), x.removeClass(m.error);
  12425. } }, set: { barWidth: function barWidth(e) {
  12426. 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)));
  12427. }, duration: function duration(e) {
  12428. e = "number" == typeof (e = e || f.duration) ? e + "ms" : e, a.verbose("Setting progress bar transition duration", e), C.css({ "transition-duration": e });
  12429. }, percent: function percent(e) {
  12430. 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);
  12431. }, labelInterval: function labelInterval() {
  12432. clearInterval(a.interval), a.bind.transitionEnd(function () {
  12433. a.verbose("Bar finished animating, removing continuous label updates"), clearInterval(a.interval), A = !1, a.set.labels();
  12434. }), A = !0, a.interval = setInterval(function () {
  12435. e.contains(n.documentElement, k) || (clearInterval(a.interval), A = !1), a.set.labels();
  12436. }, f.framerate);
  12437. }, labels: function labels() {
  12438. a.verbose("Setting both bar progress and outer label text"), a.set.barLabel(), a.set.state();
  12439. }, label: function label(e) {
  12440. (e = e || "") && (e = a.get.text(e), a.verbose("Setting label to text", e), S.text(e));
  12441. }, state: function state(e) {
  12442. 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));
  12443. }, barLabel: function barLabel(e) {
  12444. 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)));
  12445. }, active: function active(e) {
  12446. 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 () {
  12447. f.onActive.call(k, a.value, a.total);
  12448. });
  12449. }, success: function success(e) {
  12450. 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 () {
  12451. f.onSuccess.call(k, a.total);
  12452. });
  12453. }, warning: function warning(e) {
  12454. 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 () {
  12455. f.onWarning.call(k, a.value, a.total);
  12456. });
  12457. }, error: function error(e) {
  12458. 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 () {
  12459. f.onError.call(k, a.value, a.total);
  12460. });
  12461. }, transitionEvent: function transitionEvent() {
  12462. a.get.transitionEnd();
  12463. }, total: function total(e) {
  12464. a.total = e;
  12465. }, value: function value(e) {
  12466. a.value = e;
  12467. }, progress: function progress(e) {
  12468. 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());
  12469. }, nextValue: function nextValue(e) {
  12470. a.nextValue = e;
  12471. } }, update: { toNextValue: function toNextValue() {
  12472. var e = a.nextValue;e && (a.debug("Update interval complete using last updated value", e), a.update.progress(e), a.remove.nextValue());
  12473. }, progress: function progress(e) {
  12474. 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));
  12475. } }, setting: function setting(t, n) {
  12476. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  12477. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  12478. }
  12479. }, internal: function internal(t, n) {
  12480. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  12481. if (n === i) return a[t];a[t] = n;
  12482. }
  12483. }, debug: function debug() {
  12484. !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)));
  12485. }, verbose: function verbose() {
  12486. !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)));
  12487. }, error: function error() {
  12488. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  12489. }, performance: { log: function log(e) {
  12490. 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);
  12491. }, display: function display() {
  12492. var t = f.name + ":",
  12493. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  12494. n += t["Execution Time"];
  12495. }), 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) {
  12496. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12497. }), console.groupEnd()), l = [];
  12498. } }, invoke: function invoke(t, n, r) {
  12499. var s,
  12500. l,
  12501. c,
  12502. 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) {
  12503. 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 {
  12504. 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];
  12505. }
  12506. })), 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;
  12507. } }, u ? (T === i && a.initialize(), a.invoke(c)) : (T !== i && T.invoke("destroy"), a.initialize());
  12508. }), o !== i ? o : this;
  12509. }, 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) {
  12510. return t;
  12511. }, 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" } };
  12512. }(jQuery, window, document), function (e, t, n, i) {
  12513. "use strict";
  12514. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.rating = function (t) {
  12515. var n,
  12516. o = e(this),
  12517. a = o.selector || "",
  12518. r = new Date().getTime(),
  12519. s = [],
  12520. l = arguments[0],
  12521. c = "string" == typeof l,
  12522. u = [].slice.call(arguments, 1);return o.each(function () {
  12523. var d,
  12524. f,
  12525. m = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.rating.settings, t) : e.extend({}, e.fn.rating.settings),
  12526. g = m.namespace,
  12527. p = m.className,
  12528. h = m.metadata,
  12529. v = m.selector,
  12530. b = (m.error, "." + g),
  12531. y = "module-" + g,
  12532. x = this,
  12533. C = e(this).data(y),
  12534. w = e(this),
  12535. S = w.find(v.icon);f = { initialize: function initialize() {
  12536. 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();
  12537. }, instantiate: function instantiate() {
  12538. f.verbose("Instantiating module", m), C = f, w.data(y, f);
  12539. }, destroy: function destroy() {
  12540. f.verbose("Destroying previous instance", C), f.remove.events(), w.removeData(y);
  12541. }, refresh: function refresh() {
  12542. S = w.find(v.icon);
  12543. }, setup: { layout: function layout() {
  12544. var t = f.get.maxRating(),
  12545. n = e.fn.rating.settings.templates.icon(t);f.debug("Generating icon html dynamically"), w.html(n), f.refresh();
  12546. } }, event: { mouseenter: function mouseenter() {
  12547. var t = e(this);t.nextAll().removeClass(p.selected), w.addClass(p.selected), t.addClass(p.selected).prevAll().addClass(p.selected);
  12548. }, mouseleave: function mouseleave() {
  12549. w.removeClass(p.selected), S.removeClass(p.selected);
  12550. }, click: function click() {
  12551. var t = e(this),
  12552. n = f.get.rating(),
  12553. i = S.index(t) + 1;("auto" == m.clearable ? 1 === S.length : m.clearable) && n == i ? f.clearRating() : f.set.rating(i);
  12554. } }, clearRating: function clearRating() {
  12555. f.debug("Clearing current rating"), f.set.rating(0);
  12556. }, bind: { events: function events() {
  12557. 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);
  12558. } }, remove: { events: function events() {
  12559. f.verbose("Removing events"), w.off(b);
  12560. }, initialLoad: function initialLoad() {
  12561. d = !1;
  12562. } }, enable: function enable() {
  12563. f.debug("Setting rating to interactive mode"), f.bind.events(), w.removeClass(p.disabled);
  12564. }, disable: function disable() {
  12565. f.debug("Setting rating to read-only mode"), f.remove.events(), w.addClass(p.disabled);
  12566. }, is: { initialLoad: function initialLoad() {
  12567. return d;
  12568. } }, get: { initialRating: function initialRating() {
  12569. return w.data(h.rating) !== i ? (w.removeData(h.rating), w.data(h.rating)) : m.initialRating;
  12570. }, maxRating: function maxRating() {
  12571. return w.data(h.maxRating) !== i ? (w.removeData(h.maxRating), w.data(h.maxRating)) : m.maxRating;
  12572. }, rating: function rating() {
  12573. var e = S.filter("." + p.active).length;return f.verbose("Current rating retrieved", e), e;
  12574. } }, set: { rating: function rating(e) {
  12575. var t = e - 1 >= 0 ? e - 1 : 0,
  12576. 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);
  12577. }, initialLoad: function initialLoad() {
  12578. d = !0;
  12579. } }, setting: function setting(t, n) {
  12580. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  12581. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  12582. }
  12583. }, internal: function internal(t, n) {
  12584. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  12585. if (n === i) return f[t];f[t] = n;
  12586. }
  12587. }, debug: function debug() {
  12588. !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)));
  12589. }, verbose: function verbose() {
  12590. !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)));
  12591. }, error: function error() {
  12592. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  12593. }, performance: { log: function log(e) {
  12594. 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);
  12595. }, display: function display() {
  12596. var t = m.name + ":",
  12597. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  12598. n += t["Execution Time"];
  12599. }), 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) {
  12600. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12601. }), console.groupEnd()), s = [];
  12602. } }, invoke: function invoke(t, o, a) {
  12603. var r,
  12604. s,
  12605. l,
  12606. 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) {
  12607. 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 {
  12608. 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];
  12609. }
  12610. })), 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;
  12611. } }, c ? (C === i && f.initialize(), f.invoke(l)) : (C !== i && C.invoke("destroy"), f.initialize());
  12612. }), n !== i ? n : this;
  12613. }, 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) {
  12614. for (var t = 1, n = ""; t <= e;) {
  12615. n += '<i class="icon"></i>', t++;
  12616. }return n;
  12617. } } };
  12618. }(jQuery, window, document), function (e, t, n, i) {
  12619. "use strict";
  12620. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.search = function (o) {
  12621. var a,
  12622. r = e(this),
  12623. s = r.selector || "",
  12624. l = new Date().getTime(),
  12625. c = [],
  12626. u = arguments[0],
  12627. d = "string" == typeof u,
  12628. f = [].slice.call(arguments, 1);return e(this).each(function () {
  12629. var m,
  12630. g = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.search.settings, o) : e.extend({}, e.fn.search.settings),
  12631. p = g.className,
  12632. h = g.metadata,
  12633. v = g.regExp,
  12634. b = g.fields,
  12635. y = g.selector,
  12636. x = g.error,
  12637. C = g.namespace,
  12638. w = "." + C,
  12639. S = C + "-module",
  12640. k = e(this),
  12641. T = k.find(y.prompt),
  12642. A = k.find(y.searchButton),
  12643. R = k.find(y.results),
  12644. P = k.find(y.result),
  12645. E = (k.find(y.category), this),
  12646. F = k.data(S),
  12647. O = !1,
  12648. D = !1;m = { initialize: function initialize() {
  12649. m.verbose("Initializing module"), m.get.settings(), m.determine.searchFields(), m.bind.events(), m.set.type(), m.create.results(), m.instantiate();
  12650. }, instantiate: function instantiate() {
  12651. m.verbose("Storing instance of module", m), F = m, k.data(S, m);
  12652. }, destroy: function destroy() {
  12653. m.verbose("Destroying instance"), k.off(w).removeData(S);
  12654. }, refresh: function refresh() {
  12655. 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);
  12656. }, refreshResults: function refreshResults() {
  12657. R = k.find(y.results), P = k.find(y.result);
  12658. }, bind: { events: function events() {
  12659. 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);
  12660. } }, determine: { searchFields: function searchFields() {
  12661. o && o.searchFields !== i && (g.searchFields = o.searchFields);
  12662. } }, event: { input: function input() {
  12663. g.searchDelay ? (clearTimeout(m.timer), m.timer = setTimeout(function () {
  12664. m.is.focused() && m.query();
  12665. }, g.searchDelay)) : m.query();
  12666. }, focus: function focus() {
  12667. m.set.focus(), g.searchOnFocus && m.has.minimumCharacters() && m.query(function () {
  12668. m.can.show() && m.showResults();
  12669. });
  12670. }, blur: function blur(e) {
  12671. var t = function t() {
  12672. m.cancel.query(), m.remove.focus(), m.timer = setTimeout(m.hideResults, g.hideDelay);
  12673. };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) {
  12674. m.is.inMessage(e) || O ? T.focus() : (O = !1, m.is.animating() || m.is.hidden() || t());
  12675. })) : (m.debug("Input blurred without user action, closing results"), t()));
  12676. }, result: { mousedown: function mousedown() {
  12677. m.resultsClicked = !0;
  12678. }, mouseup: function mouseup() {
  12679. m.resultsClicked = !1;
  12680. }, click: function click(n) {
  12681. m.debug("Search result selected");var i = e(this),
  12682. o = i.find(y.title).eq(0),
  12683. a = i.is("a[href]") ? i : i.find("a[href]").eq(0),
  12684. r = a.attr("href") || !1,
  12685. s = a.attr("target") || !1,
  12686. l = (o.html(), o.length > 0 && o.text()),
  12687. c = m.get.results(),
  12688. 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);
  12689. } } }, handleKeyboard: function handleKeyboard(e) {
  12690. var t,
  12691. n = k.find(y.result),
  12692. i = k.find(y.category),
  12693. o = n.filter("." + p.active),
  12694. a = n.index(o),
  12695. r = n.length,
  12696. s = o.length > 0,
  12697. l = e.which,
  12698. c = 13,
  12699. u = 38,
  12700. d = 40;if (l == 27 && (m.verbose("Escape key pressed, blurring search field"), m.hideResults(), D = !0), m.is.visible()) {
  12701. if (l == c) {
  12702. 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;
  12703. } 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());
  12704. } else l == c && (m.verbose("Enter key pressed, executing query"), m.query(), m.set.buttonPressed(), T.one("keyup", m.remove.buttonFocus));
  12705. }, setup: { api: function api(t, n) {
  12706. var i = { debug: g.debug, on: !1, cache: g.cache, action: "search", urlData: { query: t }, onSuccess: function onSuccess(e) {
  12707. m.parse.response.call(E, e, t), n();
  12708. }, onFailure: function onFailure() {
  12709. m.displayMessage(x.serverError), n();
  12710. }, onAbort: function onAbort(e) {}, onError: m.error };e.extend(!0, i, g.apiSettings), m.verbose("Setting up API request", i), k.api(i);
  12711. } }, can: { useAPI: function useAPI() {
  12712. return e.fn.api !== i;
  12713. }, show: function show() {
  12714. return m.is.focused() && !m.is.visible() && !m.is.empty();
  12715. }, transition: function transition() {
  12716. return g.transition && e.fn.transition !== i && k.transition("is supported");
  12717. } }, is: { animating: function animating() {
  12718. return R.hasClass(p.animating);
  12719. }, hidden: function hidden() {
  12720. return R.hasClass(p.hidden);
  12721. }, inMessage: function inMessage(t) {
  12722. if (t.target) {
  12723. var i = e(t.target);return e.contains(n.documentElement, t.target) && i.closest(y.message).length > 0;
  12724. }
  12725. }, empty: function empty() {
  12726. return "" === R.html();
  12727. }, visible: function visible() {
  12728. return R.filter(":visible").length > 0;
  12729. }, focused: function focused() {
  12730. return T.filter(":focus").length > 0;
  12731. } }, get: { settings: function settings() {
  12732. e.isPlainObject(o) && o.searchFullText && (g.fullTextSearch = o.searchFullText, m.error(g.error.oldSearchSyntax, E));
  12733. }, inputEvent: function inputEvent() {
  12734. var e = T[0];return e !== i && e.oninput !== i ? "input" : e !== i && e.onpropertychange !== i ? "propertychange" : "keyup";
  12735. }, value: function value() {
  12736. return T.val();
  12737. }, results: function results() {
  12738. return k.data(h.results);
  12739. }, result: function result(t, n) {
  12740. var o = ["title", "id"],
  12741. 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) {
  12742. if (e.isArray(i.results) && (a = m.search.object(t, i.results, o)[0])) return !1;
  12743. })) : (m.debug("Finding result in results object", t), a = m.search.object(t, n, o)[0]), a || !1;
  12744. } }, select: { firstResult: function firstResult() {
  12745. m.verbose("Selecting first result"), P.first().addClass(p.active);
  12746. } }, set: { focus: function focus() {
  12747. k.addClass(p.focus);
  12748. }, loading: function loading() {
  12749. k.addClass(p.loading);
  12750. }, value: function value(e) {
  12751. m.verbose("Setting search input value", e), T.val(e);
  12752. }, type: function type(e) {
  12753. e = e || g.type, "category" == g.type && k.addClass(g.type);
  12754. }, buttonPressed: function buttonPressed() {
  12755. A.addClass(p.pressed);
  12756. } }, remove: { loading: function loading() {
  12757. k.removeClass(p.loading);
  12758. }, focus: function focus() {
  12759. k.removeClass(p.focus);
  12760. }, buttonPressed: function buttonPressed() {
  12761. A.removeClass(p.pressed);
  12762. } }, query: function query(t) {
  12763. t = e.isFunction(t) ? t : function () {};var n = m.get.value(),
  12764. 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();
  12765. }, search: { local: function local(e) {
  12766. var t,
  12767. 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 });
  12768. }, remote: function remote(t, n) {
  12769. n = e.isFunction(n) ? n : function () {}, k.api("is loading") && k.api("abort"), m.setup.api(t, n), k.api("query");
  12770. }, object: function object(t, n, o) {
  12771. var a = [],
  12772. r = [],
  12773. s = [],
  12774. l = t.toString().replace(v.escape, "\\$&"),
  12775. c = new RegExp(v.beginsWith + l, "i"),
  12776. u = function u(t, n) {
  12777. var i = -1 == e.inArray(n, a),
  12778. o = -1 == e.inArray(n, s),
  12779. l = -1 == e.inArray(n, r);i && o && l && t.push(n);
  12780. };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) {
  12781. e.each(n, function (e, n) {
  12782. "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));
  12783. });
  12784. }), e.merge(r, s), e.merge(a, r), a);
  12785. } }, exactSearch: function exactSearch(e, t) {
  12786. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  12787. }, fuzzySearch: function fuzzySearch(e, t) {
  12788. var n = t.length,
  12789. 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++) {
  12790. for (var r = e.charCodeAt(o); a < n;) {
  12791. if (t.charCodeAt(a++) === r) continue e;
  12792. }return !1;
  12793. }return !0;
  12794. }, parse: { response: function response(e, t) {
  12795. 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]));
  12796. } }, cancel: { query: function query() {
  12797. m.can.useAPI() && k.api("abort");
  12798. } }, has: { minimumCharacters: function minimumCharacters() {
  12799. return m.get.value().length >= g.minCharacters;
  12800. }, results: function results() {
  12801. return 0 !== R.length && "" != R.html();
  12802. } }, clear: { cache: function cache(e) {
  12803. 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));
  12804. } }, read: { cache: function cache(e) {
  12805. 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]);
  12806. } }, create: { categoryResults: function categoryResults(t) {
  12807. var n = {};return e.each(t, function (e, t) {
  12808. 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));
  12809. }), n;
  12810. }, id: function id(e, t) {
  12811. var n,
  12812. 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;
  12813. }, results: function results() {
  12814. 0 === R.length && (R = e("<div />").addClass(p.results).appendTo(k));
  12815. } }, inject: { result: function result(e, t, n) {
  12816. 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);
  12817. }, id: function id(t) {
  12818. m.debug("Injecting unique ids into results");var n = 0,
  12819. o = 0;return "category" === g.type ? e.each(t, function (t, a) {
  12820. o = 0, e.each(a.results, function (e, t) {
  12821. var r = a.results[e];r.id === i && (r.id = m.create.id(o, n)), m.inject.result(r, o, n), o++;
  12822. }), n++;
  12823. }) : e.each(t, function (e, n) {
  12824. var a = t[e];a.id === i && (a.id = m.create.id(o)), m.inject.result(a, o), o++;
  12825. }), t;
  12826. } }, save: { results: function results(e) {
  12827. m.verbose("Saving current search results to metadata", e), k.data(h.results, e);
  12828. } }, write: { cache: function cache(e, t) {
  12829. 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));
  12830. } }, addResults: function addResults(t) {
  12831. 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 () {
  12832. R.empty();
  12833. });
  12834. }, showResults: function showResults(t) {
  12835. 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() {
  12836. t();
  12837. }, queue: !0 })) : (m.debug("Showing results with javascript"), R.stop().fadeIn(g.duration, g.easing)), g.onResultsOpen.call(R));
  12838. }, hideResults: function hideResults(t) {
  12839. 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() {
  12840. t();
  12841. }, queue: !0 })) : (m.debug("Hiding results with javascript"), R.stop().fadeOut(g.duration, g.easing)), g.onResultsClose.call(R));
  12842. }, generateResults: function generateResults(t) {
  12843. m.debug("Generating html from response", t);var n = g.templates[g.type],
  12844. i = e.isPlainObject(t[b.results]) && !e.isEmptyObject(t[b.results]),
  12845. o = e.isArray(t[b.results]) && t[b.results].length > 0,
  12846. 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;
  12847. }, displayMessage: function displayMessage(e, t) {
  12848. return t = t || "standard", m.debug("Displaying message", e, t), m.addResults(g.templates.message(e, t)), g.templates.message(e, t);
  12849. }, setting: function setting(t, n) {
  12850. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  12851. if (n === i) return g[t];g[t] = n;
  12852. }
  12853. }, internal: function internal(t, n) {
  12854. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  12855. if (n === i) return m[t];m[t] = n;
  12856. }
  12857. }, debug: function debug() {
  12858. !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)));
  12859. }, verbose: function verbose() {
  12860. !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)));
  12861. }, error: function error() {
  12862. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  12863. }, performance: { log: function log(e) {
  12864. 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);
  12865. }, display: function display() {
  12866. var t = g.name + ":",
  12867. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  12868. n += t["Execution Time"];
  12869. }), 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) {
  12870. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12871. }), console.groupEnd()), c = [];
  12872. } }, invoke: function invoke(t, n, o) {
  12873. var r,
  12874. s,
  12875. l,
  12876. 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) {
  12877. 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 {
  12878. 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];
  12879. }
  12880. })), 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;
  12881. } }, d ? (F === i && m.initialize(), m.invoke(u)) : (F !== i && F.invoke("destroy"), m.initialize());
  12882. }), a !== i ? a : this;
  12883. }, 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) {
  12884. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12885. return t[e];
  12886. }) : e
  12887. );
  12888. }, message: function message(e, t) {
  12889. 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;
  12890. }, category: function category(t, n) {
  12891. var o = "";e.fn.search.settings.templates.escape;return t[n.categoryResults] !== i && (e.each(t[n.categoryResults], function (t, a) {
  12892. 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) {
  12893. 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>";
  12894. }), o += "</div>", o += "</div>");
  12895. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12896. }, standard: function standard(t, n) {
  12897. var o = "";return t[n.results] !== i && (e.each(t[n.results], function (e, t) {
  12898. 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>";
  12899. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12900. } } };
  12901. }(jQuery, window, document), function (e, t, n, i) {
  12902. "use strict";
  12903. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.shape = function (o) {
  12904. var a,
  12905. r = e(this),
  12906. s = (e("body"), new Date().getTime()),
  12907. l = [],
  12908. c = arguments[0],
  12909. u = "string" == typeof c,
  12910. d = [].slice.call(arguments, 1),
  12911. f = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  12912. setTimeout(e, 0);
  12913. };return r.each(function () {
  12914. var t,
  12915. m,
  12916. g,
  12917. p = r.selector || "",
  12918. h = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.shape.settings, o) : e.extend({}, e.fn.shape.settings),
  12919. v = h.namespace,
  12920. b = h.selector,
  12921. y = h.error,
  12922. x = h.className,
  12923. C = "." + v,
  12924. w = "module-" + v,
  12925. S = e(this),
  12926. k = S.find(b.sides),
  12927. T = S.find(b.side),
  12928. A = !1,
  12929. R = this,
  12930. P = S.data(w);g = { initialize: function initialize() {
  12931. g.verbose("Initializing module for", R), g.set.defaultSide(), g.instantiate();
  12932. }, instantiate: function instantiate() {
  12933. g.verbose("Storing instance of module", g), P = g, S.data(w, P);
  12934. }, destroy: function destroy() {
  12935. g.verbose("Destroying previous module for", R), S.removeData(w).off(C);
  12936. }, refresh: function refresh() {
  12937. g.verbose("Refreshing selector cache for", R), S = e(R), k = e(this).find(b.shape), T = e(this).find(b.side);
  12938. }, repaint: function repaint() {
  12939. g.verbose("Forcing repaint event");(k[0] || n.createElement("div")).offsetWidth;
  12940. }, animate: function animate(e, n) {
  12941. g.verbose("Animating box with properties", e), n = n || function (e) {
  12942. g.verbose("Executing animation callback"), e !== i && e.stopPropagation(), g.reset(), g.set.active();
  12943. }, 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 () {
  12944. S.addClass(x.animating), t.addClass(x.hidden);
  12945. })) : n();
  12946. }, queue: function queue(e) {
  12947. g.debug("Queueing animation of", e), k.one(g.get.transitionEvent(), function () {
  12948. g.debug("Executing queued animation"), setTimeout(function () {
  12949. S.shape(e);
  12950. }, 0);
  12951. });
  12952. }, reset: function reset() {
  12953. 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");
  12954. }, is: { complete: function complete() {
  12955. return T.filter("." + x.active)[0] == m[0];
  12956. }, animating: function animating() {
  12957. return S.hasClass(x.animating);
  12958. } }, set: { defaultSide: function defaultSide() {
  12959. 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);
  12960. }, duration: function duration(e) {
  12961. 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 });
  12962. }, currentStageSize: function currentStageSize() {
  12963. var e = S.find("." + h.className.active),
  12964. t = e.outerWidth(!0),
  12965. n = e.outerHeight(!0);S.css({ width: t, height: n });
  12966. }, stageSize: function stageSize() {
  12967. var e = S.clone().addClass(x.loading),
  12968. t = e.find("." + h.className.active),
  12969. n = A ? e.find(b.side).eq(A) : t.next(b.side).length > 0 ? t.next(b.side) : e.find(b.side).first(),
  12970. i = "next" == h.width ? n.outerWidth(!0) : "initial" == h.width ? S.width() : h.width,
  12971. 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));
  12972. }, nextSide: function nextSide(e) {
  12973. 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);
  12974. }, active: function active() {
  12975. g.verbose("Setting new side to active", m), T.removeClass(x.active), m.addClass(x.active), h.onChange.call(m[0]), g.set.defaultSide();
  12976. } }, flip: { up: function up() {
  12977. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12978. if (g.is.animating()) g.queue("flip up");else {
  12979. g.debug("Flipping up", m);var e = g.get.transform.up();g.set.stageSize(), g.stage.above(), g.animate(e);
  12980. }
  12981. } else g.debug("Side already visible", m);
  12982. }, down: function down() {
  12983. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12984. if (g.is.animating()) g.queue("flip down");else {
  12985. g.debug("Flipping down", m);var e = g.get.transform.down();g.set.stageSize(), g.stage.below(), g.animate(e);
  12986. }
  12987. } else g.debug("Side already visible", m);
  12988. }, left: function left() {
  12989. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12990. if (g.is.animating()) g.queue("flip left");else {
  12991. g.debug("Flipping left", m);var e = g.get.transform.left();g.set.stageSize(), g.stage.left(), g.animate(e);
  12992. }
  12993. } else g.debug("Side already visible", m);
  12994. }, right: function right() {
  12995. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12996. if (g.is.animating()) g.queue("flip right");else {
  12997. g.debug("Flipping right", m);var e = g.get.transform.right();g.set.stageSize(), g.stage.right(), g.animate(e);
  12998. }
  12999. } else g.debug("Side already visible", m);
  13000. }, over: function over() {
  13001. !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);
  13002. }, back: function back() {
  13003. !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);
  13004. } }, get: { transform: { up: function up() {
  13005. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(-90deg)" };
  13006. }, down: function down() {
  13007. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(90deg)" };
  13008. }, left: function left() {
  13009. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(90deg)" };
  13010. }, right: function right() {
  13011. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(-90deg)" };
  13012. }, over: function over() {
  13013. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(180deg)" };
  13014. }, back: function back() {
  13015. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(-180deg)" };
  13016. } }, transitionEvent: function transitionEvent() {
  13017. var e,
  13018. t = n.createElement("element"),
  13019. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  13020. if (t.style[e] !== i) return o[e];
  13021. }
  13022. }, nextSide: function nextSide() {
  13023. return t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first();
  13024. } }, stage: { above: function above() {
  13025. 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)" });
  13026. }, below: function below() {
  13027. 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)" });
  13028. }, left: function left() {
  13029. var e = t.outerWidth(!0),
  13030. n = m.outerWidth(!0),
  13031. 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)" });
  13032. }, right: function right() {
  13033. var e = t.outerWidth(!0),
  13034. n = m.outerWidth(!0),
  13035. 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)" });
  13036. }, behind: function behind() {
  13037. var e = t.outerWidth(!0),
  13038. n = m.outerWidth(!0),
  13039. 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)" });
  13040. } }, setting: function setting(t, n) {
  13041. if (g.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, h, t);else {
  13042. if (n === i) return h[t];e.isPlainObject(h[t]) ? e.extend(!0, h[t], n) : h[t] = n;
  13043. }
  13044. }, internal: function internal(t, n) {
  13045. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  13046. if (n === i) return g[t];g[t] = n;
  13047. }
  13048. }, debug: function debug() {
  13049. !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)));
  13050. }, verbose: function verbose() {
  13051. !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)));
  13052. }, error: function error() {
  13053. h.silent || (g.error = Function.prototype.bind.call(console.error, console, h.name + ":"), g.error.apply(console, arguments));
  13054. }, performance: { log: function log(e) {
  13055. 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);
  13056. }, display: function display() {
  13057. var t = h.name + ":",
  13058. n = 0;s = !1, clearTimeout(g.performance.timer), e.each(l, function (e, t) {
  13059. n += t["Execution Time"];
  13060. }), 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) {
  13061. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13062. }), console.groupEnd()), l = [];
  13063. } }, invoke: function invoke(t, n, o) {
  13064. var r,
  13065. s,
  13066. l,
  13067. 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) {
  13068. 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 {
  13069. 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];
  13070. }
  13071. })), 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;
  13072. } }, u ? (P === i && g.initialize(), g.invoke(c)) : (P !== i && P.invoke("destroy"), g.initialize());
  13073. }), a !== i ? a : this;
  13074. }, 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" } };
  13075. }(jQuery, window, document), function (e, t, n, i) {
  13076. "use strict";
  13077. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sidebar = function (o) {
  13078. var a,
  13079. r = e(this),
  13080. s = e(t),
  13081. l = e(n),
  13082. c = e("html"),
  13083. u = e("head"),
  13084. d = r.selector || "",
  13085. f = new Date().getTime(),
  13086. m = [],
  13087. g = arguments[0],
  13088. p = "string" == typeof g,
  13089. h = [].slice.call(arguments, 1),
  13090. v = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13091. setTimeout(e, 0);
  13092. };return r.each(function () {
  13093. var r,
  13094. b,
  13095. y,
  13096. x,
  13097. C,
  13098. w,
  13099. S = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sidebar.settings, o) : e.extend({}, e.fn.sidebar.settings),
  13100. k = S.selector,
  13101. T = S.className,
  13102. A = S.namespace,
  13103. R = S.regExp,
  13104. P = S.error,
  13105. E = "." + A,
  13106. F = "module-" + A,
  13107. O = e(this),
  13108. D = e(S.context),
  13109. q = O.children(k.sidebar),
  13110. j = (D.children(k.fixed), D.children(k.pusher)),
  13111. z = this,
  13112. I = O.data(F);w = { initialize: function initialize() {
  13113. w.debug("Initializing sidebar", o), w.create.id(), C = w.get.transitionEvent(), S.delaySetup ? v(w.setup.layout) : w.setup.layout(), v(function () {
  13114. w.setup.cache();
  13115. }), w.instantiate();
  13116. }, instantiate: function instantiate() {
  13117. w.verbose("Storing instance of module", w), I = w, O.data(F, w);
  13118. }, create: { id: function id() {
  13119. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, w.verbose("Creating unique id for element", y);
  13120. } }, destroy: function destroy() {
  13121. 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);
  13122. }, event: { clickaway: function clickaway(e) {
  13123. var t = j.find(e.target).length > 0 || j.is(e.target),
  13124. 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());
  13125. }, touch: function touch(e) {}, containScroll: function containScroll(e) {
  13126. z.scrollTop <= 0 && (z.scrollTop = 1), z.scrollTop + z.offsetHeight >= z.scrollHeight && (z.scrollTop = z.scrollHeight - z.offsetHeight - 1);
  13127. }, scroll: function scroll(t) {
  13128. 0 === e(t.target).closest(k.sidebar).length && t.preventDefault();
  13129. } }, bind: { clickaway: function clickaway() {
  13130. w.verbose("Adding clickaway events to context", D), S.closable && D.on("click" + b, w.event.clickaway).on("touchend" + b, w.event.clickaway);
  13131. }, scrollLock: function scrollLock() {
  13132. 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);
  13133. } }, unbind: { clickaway: function clickaway() {
  13134. w.verbose("Removing clickaway events from context", D), D.off(b);
  13135. }, scrollLock: function scrollLock() {
  13136. w.verbose("Removing scroll lock from page"), l.off(b), s.off(b), O.off("scroll" + E);
  13137. } }, add: { inlineCSS: function inlineCSS() {
  13138. var t,
  13139. n = w.cache.width || O.outerWidth(),
  13140. i = w.cache.height || O.outerHeight(),
  13141. o = w.is.rtl(),
  13142. a = w.get.direction(),
  13143. 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);
  13144. } }, refresh: function refresh() {
  13145. 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();
  13146. }, refreshSidebars: function refreshSidebars() {
  13147. w.verbose("Refreshing other sidebars"), q = D.children(k.sidebar);
  13148. }, repaint: function repaint() {
  13149. w.verbose("Forcing repaint event"), z.style.display = "none";z.offsetHeight;z.scrollTop = z.scrollTop, z.style.display = "";
  13150. }, setup: { cache: function cache() {
  13151. w.cache = { width: O.outerWidth(), height: O.outerHeight(), rtl: "rtl" == O.css("direction") };
  13152. }, layout: function layout() {
  13153. 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();
  13154. } }, attachEvents: function attachEvents(t, n) {
  13155. 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);
  13156. }, show: function show(t) {
  13157. if (t = e.isFunction(t) ? t : function () {}, w.is.hidden()) {
  13158. 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) {
  13159. if ("overlay" != S.transition) return void w.hideOthers(w.show);w.hideOthers();
  13160. } else S.transition = "overlay";w.pushPage(function () {
  13161. t.call(z), S.onShow.call(z);
  13162. }), S.onChange.call(z), S.onVisible.call(z);
  13163. } else w.debug("Sidebar is already visible");
  13164. }, hide: function hide(t) {
  13165. t = e.isFunction(t) ? t : function () {}, (w.is.visible() || w.is.animating()) && (w.debug("Hiding sidebar", t), w.refreshSidebars(), w.pullPage(function () {
  13166. t.call(z), S.onHidden.call(z);
  13167. }), S.onChange.call(z), S.onHide.call(z));
  13168. }, othersAnimating: function othersAnimating() {
  13169. return q.not(O).filter("." + T.animating).length > 0;
  13170. }, othersVisible: function othersVisible() {
  13171. return q.not(O).filter("." + T.visible).length > 0;
  13172. }, othersActive: function othersActive() {
  13173. return w.othersVisible() || w.othersAnimating();
  13174. }, hideOthers: function hideOthers(e) {
  13175. var t = q.not(O).filter("." + T.visible),
  13176. n = t.length,
  13177. i = 0;e = e || function () {}, t.sidebar("hide", function () {
  13178. ++i == n && e();
  13179. });
  13180. }, toggle: function toggle() {
  13181. w.verbose("Determining toggled direction"), w.is.hidden() ? w.show() : w.hide();
  13182. }, pushPage: function pushPage(t) {
  13183. var n,
  13184. i,
  13185. _o,
  13186. a = w.get.transition(),
  13187. 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() {
  13188. w.bind.clickaway(), w.add.inlineCSS(), w.set.animating(), w.set.visible();
  13189. }, i = function i() {
  13190. w.set.dimmed();
  13191. }, _o = function o(e) {
  13192. e.target == r[0] && (r.off(C + b, _o), w.remove.animating(), w.bind.scrollLock(), t.call(z));
  13193. }, r.off(C + b), r.on(C + b, _o), v(n), S.dimPage && !w.othersVisible() && v(i);
  13194. }, pullPage: function pullPage(t) {
  13195. var n,
  13196. _i,
  13197. o = w.get.transition(),
  13198. 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() {
  13199. w.set.transition(o), w.set.animating(), w.remove.visible(), S.dimPage && !w.othersVisible() && j.removeClass(T.dimmed);
  13200. }, _i = function i(e) {
  13201. 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));
  13202. }, a.off(C + b), a.on(C + b, _i), v(n);
  13203. }, scrollToTop: function scrollToTop() {
  13204. w.verbose("Scrolling to top of page to avoid animation issues"), x = e(t).scrollTop(), O.scrollTop(0), t.scrollTo(0, 0);
  13205. }, scrollBack: function scrollBack() {
  13206. w.verbose("Scrolling back to original page position"), t.scrollTo(0, x);
  13207. }, clear: { cache: function cache() {
  13208. w.verbose("Clearing cached dimensions"), w.cache = {};
  13209. } }, set: { ios: function ios() {
  13210. c.addClass(T.ios);
  13211. }, pushed: function pushed() {
  13212. D.addClass(T.pushed);
  13213. }, pushable: function pushable() {
  13214. D.addClass(T.pushable);
  13215. }, dimmed: function dimmed() {
  13216. j.addClass(T.dimmed);
  13217. }, active: function active() {
  13218. O.addClass(T.active);
  13219. }, animating: function animating() {
  13220. O.addClass(T.animating);
  13221. }, transition: function transition(e) {
  13222. e = e || w.get.transition(), O.addClass(e);
  13223. }, direction: function direction(e) {
  13224. e = e || w.get.direction(), O.addClass(T[e]);
  13225. }, visible: function visible() {
  13226. O.addClass(T.visible);
  13227. }, overlay: function overlay() {
  13228. O.addClass(T.overlay);
  13229. } }, remove: { inlineCSS: function inlineCSS() {
  13230. w.debug("Removing inline css styles", r), r && r.length > 0 && r.remove();
  13231. }, ios: function ios() {
  13232. c.removeClass(T.ios);
  13233. }, pushed: function pushed() {
  13234. D.removeClass(T.pushed);
  13235. }, pushable: function pushable() {
  13236. D.removeClass(T.pushable);
  13237. }, active: function active() {
  13238. O.removeClass(T.active);
  13239. }, animating: function animating() {
  13240. O.removeClass(T.animating);
  13241. }, transition: function transition(e) {
  13242. e = e || w.get.transition(), O.removeClass(e);
  13243. }, direction: function direction(e) {
  13244. e = e || w.get.direction(), O.removeClass(T[e]);
  13245. }, visible: function visible() {
  13246. O.removeClass(T.visible);
  13247. }, overlay: function overlay() {
  13248. O.removeClass(T.overlay);
  13249. } }, get: { direction: function direction() {
  13250. return O.hasClass(T.top) ? T.top : O.hasClass(T.right) ? T.right : O.hasClass(T.bottom) ? T.bottom : T.left;
  13251. }, transition: function transition() {
  13252. var e,
  13253. 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;
  13254. }, transitionEvent: function transitionEvent() {
  13255. var e,
  13256. t = n.createElement("element"),
  13257. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  13258. if (t.style[e] !== i) return o[e];
  13259. }
  13260. } }, is: { ie: function ie() {
  13261. return !t.ActiveXObject && "ActiveXObject" in t || "ActiveXObject" in t;
  13262. }, ios: function ios() {
  13263. var e = navigator.userAgent,
  13264. t = e.match(R.ios),
  13265. n = e.match(R.mobileChrome);return !(!t || n) && (w.verbose("Browser was found to be iOS", e), !0);
  13266. }, mobile: function mobile() {
  13267. 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);
  13268. }, hidden: function hidden() {
  13269. return !w.is.visible();
  13270. }, visible: function visible() {
  13271. return O.hasClass(T.visible);
  13272. }, open: function open() {
  13273. return w.is.visible();
  13274. }, closed: function closed() {
  13275. return w.is.hidden();
  13276. }, vertical: function vertical() {
  13277. return O.hasClass(T.top);
  13278. }, animating: function animating() {
  13279. return D.hasClass(T.animating);
  13280. }, rtl: function rtl() {
  13281. return w.cache.rtl === i && (w.cache.rtl = "rtl" == O.css("direction")), w.cache.rtl;
  13282. } }, setting: function setting(t, n) {
  13283. if (w.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, S, t);else {
  13284. if (n === i) return S[t];e.isPlainObject(S[t]) ? e.extend(!0, S[t], n) : S[t] = n;
  13285. }
  13286. }, internal: function internal(t, n) {
  13287. if (e.isPlainObject(t)) e.extend(!0, w, t);else {
  13288. if (n === i) return w[t];w[t] = n;
  13289. }
  13290. }, debug: function debug() {
  13291. !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)));
  13292. }, verbose: function verbose() {
  13293. !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)));
  13294. }, error: function error() {
  13295. S.silent || (w.error = Function.prototype.bind.call(console.error, console, S.name + ":"), w.error.apply(console, arguments));
  13296. }, performance: { log: function log(e) {
  13297. 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);
  13298. }, display: function display() {
  13299. var t = S.name + ":",
  13300. n = 0;f = !1, clearTimeout(w.performance.timer), e.each(m, function (e, t) {
  13301. n += t["Execution Time"];
  13302. }), 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) {
  13303. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13304. }), console.groupEnd()), m = [];
  13305. } }, invoke: function invoke(t, n, o) {
  13306. var r,
  13307. s,
  13308. l,
  13309. 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) {
  13310. 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 {
  13311. 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];
  13312. }
  13313. })), 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;
  13314. } }, p ? (I === i && w.initialize(), w.invoke(g)) : (I !== i && w.invoke("destroy"), w.initialize());
  13315. }), a !== i ? a : this;
  13316. }, 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" } };
  13317. }(jQuery, window, document), function (e, t, n, i) {
  13318. "use strict";
  13319. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sticky = function (o) {
  13320. var a,
  13321. r = e(this),
  13322. s = r.selector || "",
  13323. l = new Date().getTime(),
  13324. c = [],
  13325. u = arguments[0],
  13326. d = "string" == typeof u,
  13327. f = [].slice.call(arguments, 1);return r.each(function () {
  13328. var r,
  13329. m,
  13330. g,
  13331. p,
  13332. h,
  13333. v = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sticky.settings, o) : e.extend({}, e.fn.sticky.settings),
  13334. b = v.className,
  13335. y = v.namespace,
  13336. x = v.error,
  13337. C = "." + y,
  13338. w = "module-" + y,
  13339. S = e(this),
  13340. k = e(t),
  13341. T = e(v.scrollContext),
  13342. A = (S.selector, S.data(w)),
  13343. R = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13344. setTimeout(e, 0);
  13345. },
  13346. P = this;h = { initialize: function initialize() {
  13347. h.determineContainer(), h.determineContext(), h.verbose("Initializing sticky", v, r), h.save.positions(), h.checkErrors(), h.bind.events(), v.observeChanges && h.observeChanges(), h.instantiate();
  13348. }, instantiate: function instantiate() {
  13349. h.verbose("Storing instance of module", h), A = h, S.data(w, h);
  13350. }, destroy: function destroy() {
  13351. 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);
  13352. }, observeChanges: function observeChanges() {
  13353. "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));
  13354. }, determineContainer: function determineContainer() {
  13355. r = v.container ? e(v.container) : S.offsetParent();
  13356. }, determineContext: function determineContext() {
  13357. 0 !== (m = v.context ? e(v.context) : r).length || h.error(x.invalidContext, v.context, S);
  13358. }, checkErrors: function checkErrors() {
  13359. 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);
  13360. }, bind: { events: function events() {
  13361. 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);
  13362. } }, event: { changed: function changed(e) {
  13363. clearTimeout(h.timer), h.timer = setTimeout(function () {
  13364. h.verbose("DOM tree modified, updating sticky menu", e), h.refresh();
  13365. }, 100);
  13366. }, documentChanged: function documentChanged(t) {
  13367. [].forEach.call(t, function (t) {
  13368. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  13369. (t == P || e(t).find(P).length > 0) && (h.debug("Element removed from DOM, tearing down events"), h.destroy());
  13370. });
  13371. });
  13372. }, load: function load() {
  13373. h.verbose("Page contents finished loading"), R(h.refresh);
  13374. }, resize: function resize() {
  13375. h.verbose("Window resized"), R(h.refresh);
  13376. }, scroll: function scroll() {
  13377. R(function () {
  13378. T.triggerHandler("scrollchange" + C, T.scrollTop());
  13379. });
  13380. }, scrollchange: function scrollchange(e, t) {
  13381. h.stick(t), v.onScroll.call(P);
  13382. } }, refresh: function refresh(e) {
  13383. h.reset(), v.context || h.determineContext(), e && h.determineContainer(), h.save.positions(), h.stick(), v.onReposition.call(P);
  13384. }, supports: { sticky: function sticky() {
  13385. var t = e("<div/>");t[0];return t.addClass(b.supported), t.css("position").match("sticky");
  13386. } }, save: { lastScroll: function lastScroll(e) {
  13387. h.lastScroll = e;
  13388. }, elementScroll: function elementScroll(e) {
  13389. h.elementScroll = e;
  13390. }, positions: function positions() {
  13391. var e = { height: T.height() },
  13392. 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() },
  13393. 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);
  13394. } }, get: { direction: function direction(e) {
  13395. var t = "down";return e = e || T.scrollTop(), h.lastScroll !== i && (h.lastScroll < e ? t = "down" : h.lastScroll > e && (t = "up")), t;
  13396. }, scrollChange: function scrollChange(e) {
  13397. return e = e || T.scrollTop(), h.lastScroll ? e - h.lastScroll : 0;
  13398. }, currentElementScroll: function currentElementScroll() {
  13399. return h.elementScroll ? h.elementScroll : h.is.top() ? Math.abs(parseInt(S.css("top"), 10)) || 0 : Math.abs(parseInt(S.css("bottom"), 10)) || 0;
  13400. }, elementScroll: function elementScroll(e) {
  13401. e = e || T.scrollTop();var t = h.cache.element,
  13402. n = h.cache.scrollContext,
  13403. i = h.get.scrollChange(e),
  13404. o = t.height - n.height + v.offset,
  13405. a = h.get.currentElementScroll(),
  13406. r = a + i;return a = h.cache.fits || r < 0 ? 0 : r > o ? o : r;
  13407. } }, remove: { lastScroll: function lastScroll() {
  13408. delete h.lastScroll;
  13409. }, elementScroll: function elementScroll(e) {
  13410. delete h.elementScroll;
  13411. }, minimumSize: function minimumSize() {
  13412. r.css("min-height", "");
  13413. }, offset: function offset() {
  13414. S.css("margin-top", "");
  13415. } }, set: { offset: function offset() {
  13416. h.verbose("Setting offset on element", v.offset), S.css("margin-top", v.offset);
  13417. }, containerSize: function containerSize() {
  13418. 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 }));
  13419. }, minimumSize: function minimumSize() {
  13420. var e = h.cache.element;r.css("min-height", e.height);
  13421. }, scroll: function scroll(e) {
  13422. 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));
  13423. }, size: function size() {
  13424. 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"));
  13425. } }, is: { standardScroll: function standardScroll() {
  13426. return T[0] == t;
  13427. }, top: function top() {
  13428. return S.hasClass(b.top);
  13429. }, bottom: function bottom() {
  13430. return S.hasClass(b.bottom);
  13431. }, initialPosition: function initialPosition() {
  13432. return !h.is.fixed() && !h.is.bound();
  13433. }, hidden: function hidden() {
  13434. return !S.is(":visible");
  13435. }, bound: function bound() {
  13436. return S.hasClass(b.bound);
  13437. }, fixed: function fixed() {
  13438. return S.hasClass(b.fixed);
  13439. } }, stick: function stick(e) {
  13440. var t = e || T.scrollTop(),
  13441. n = h.cache,
  13442. i = n.fits,
  13443. o = n.sameHeight,
  13444. a = n.element,
  13445. r = n.scrollContext,
  13446. s = n.context,
  13447. l = h.is.bottom() && v.pushing ? v.bottomOffset : v.offset,
  13448. c = (e = { top: t + l, bottom: t + l + r.height }, h.get.direction(e.top), i ? 0 : h.get.elementScroll(e.top)),
  13449. 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())));
  13450. }, bindTop: function bindTop() {
  13451. 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);
  13452. }, bindBottom: function bindBottom() {
  13453. 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);
  13454. }, setInitialPosition: function setInitialPosition() {
  13455. h.debug("Returning to initial position"), h.unfix(), h.unbind();
  13456. }, fixTop: function fixTop() {
  13457. 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);
  13458. }, fixBottom: function fixBottom() {
  13459. 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);
  13460. }, unbind: function unbind() {
  13461. h.is.bound() && (h.debug("Removing container bound position on element"), h.remove.offset(), S.removeClass(b.bound).removeClass(b.top).removeClass(b.bottom));
  13462. }, unfix: function unfix() {
  13463. 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));
  13464. }, reset: function reset() {
  13465. h.debug("Resetting elements position"), h.unbind(), h.unfix(), h.resetCSS(), h.remove.offset(), h.remove.lastScroll();
  13466. }, resetCSS: function resetCSS() {
  13467. S.css({ width: "", height: "" }), r.css({ height: "" });
  13468. }, setting: function setting(t, n) {
  13469. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  13470. if (n === i) return v[t];v[t] = n;
  13471. }
  13472. }, internal: function internal(t, n) {
  13473. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  13474. if (n === i) return h[t];h[t] = n;
  13475. }
  13476. }, debug: function debug() {
  13477. !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)));
  13478. }, verbose: function verbose() {
  13479. !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)));
  13480. }, error: function error() {
  13481. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  13482. }, performance: { log: function log(e) {
  13483. 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);
  13484. }, display: function display() {
  13485. var t = v.name + ":",
  13486. n = 0;l = !1, clearTimeout(h.performance.timer), e.each(c, function (e, t) {
  13487. n += t["Execution Time"];
  13488. }), 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) {
  13489. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13490. }), console.groupEnd()), c = [];
  13491. } }, invoke: function invoke(t, n, o) {
  13492. var r,
  13493. s,
  13494. l,
  13495. 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) {
  13496. 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 {
  13497. 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];
  13498. }
  13499. })), 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;
  13500. } }, d ? (A === i && h.initialize(), h.invoke(u)) : (A !== i && A.invoke("destroy"), h.initialize());
  13501. }), a !== i ? a : this;
  13502. }, 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" } };
  13503. }(jQuery, window, document), function (e, t, n, i) {
  13504. "use strict";
  13505. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.tab = function (o) {
  13506. var a,
  13507. r = e.isFunction(this) ? e(t) : e(this),
  13508. s = r.selector || "",
  13509. l = new Date().getTime(),
  13510. c = [],
  13511. u = arguments[0],
  13512. d = "string" == typeof u,
  13513. f = [].slice.call(arguments, 1),
  13514. m = !1;return r.each(function () {
  13515. var g,
  13516. p,
  13517. h,
  13518. v,
  13519. b,
  13520. y,
  13521. x = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.tab.settings, o) : e.extend({}, e.fn.tab.settings),
  13522. C = x.className,
  13523. w = x.metadata,
  13524. S = x.selector,
  13525. k = x.error,
  13526. T = "." + x.namespace,
  13527. A = "module-" + x.namespace,
  13528. R = e(this),
  13529. P = {},
  13530. E = !0,
  13531. F = 0,
  13532. O = this,
  13533. D = R.data(A);b = { initialize: function initialize() {
  13534. 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();
  13535. }, instantiate: function instantiate() {
  13536. b.verbose("Storing instance of module", b), D = b, R.data(A, b);
  13537. }, destroy: function destroy() {
  13538. b.debug("Destroying tabs", R), R.removeData(A).off(T);
  13539. }, bind: { events: function events() {
  13540. e.isWindow(O) || (b.debug("Attaching tab activation events to element", R), R.on("click" + T, b.event.click));
  13541. } }, determineTabs: function determineTabs() {
  13542. 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));
  13543. }, fix: { callbacks: function callbacks() {
  13544. 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));
  13545. } }, initializeHistory: function initializeHistory() {
  13546. if (b.debug("Initializing page state"), e.address === i) return b.error(k.state), !1;if ("state" == x.historyType) {
  13547. if (b.debug("Using HTML5 to manage state"), !1 === x.path) return b.error(k.path), !1;e.address.history(!0).state(x.path);
  13548. }e.address.bind("change", b.event.history.change);
  13549. }, event: { click: function click(t) {
  13550. 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");
  13551. }, history: { change: function change(t) {
  13552. var n = t.pathNames.join("/") || b.get.initialPath(),
  13553. 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);
  13554. } } }, refresh: function refresh() {
  13555. h && (b.debug("Refreshing tab", h), b.changeTab(h));
  13556. }, cache: { read: function read(e) {
  13557. return e !== i && P[e];
  13558. }, add: function add(e, t) {
  13559. e = e || h, b.debug("Adding cached content for", e), P[e] = t;
  13560. }, remove: function remove(e) {
  13561. e = e || h, b.debug("Removing cached content for", e), delete P[e];
  13562. } }, set: { auto: function auto() {
  13563. 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 };
  13564. }, loading: function loading(e) {
  13565. 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));
  13566. }, state: function state(t) {
  13567. e.address.value(t);
  13568. } }, changeTab: function changeTab(n) {
  13569. var i = t.history && t.history.pushState && x.ignoreFirstLoad && E,
  13570. o = x.auto || e.isPlainObject(x.apiSettings),
  13571. a = o && !i ? b.utilities.pathToArray(n) : b.get.defaultPathArray(n);n = b.utilities.arrayToPath(a), e.each(a, function (t, r) {
  13572. var s,
  13573. l,
  13574. c,
  13575. u,
  13576. d = a.slice(0, t + 1),
  13577. f = b.utilities.arrayToPath(d),
  13578. m = b.is.tab(f),
  13579. p = t + 1 == a.length,
  13580. S = b.get.tabElement(f);if (b.verbose("Looking for tab", r), m) {
  13581. 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);
  13582. } else {
  13583. 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 () {
  13584. b.scrollTo(s);
  13585. }, 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;
  13586. }
  13587. });
  13588. }, scrollTo: function scrollTo(t) {
  13589. 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));
  13590. }, update: { content: function content(t, n, o) {
  13591. var a = b.get.tabElement(t),
  13592. 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);
  13593. } }, fetch: { content: function content(t, n) {
  13594. var o,
  13595. a,
  13596. r = b.get.tabElement(t),
  13597. s = { dataType: "html", encodeParameters: !1, on: "now", cache: x.alwaysRefresh, headers: { "X-Remote": !0 }, onSuccess: function onSuccess(e) {
  13598. "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 () {
  13599. var e = r.children().clone(!0);e = e.not("script"), b.cache.add(n, e);
  13600. }, 0) : b.cache.add(n, r.html());
  13601. }, urlData: { tab: n } },
  13602. l = r.api("get request") || !1,
  13603. 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);
  13604. } }, activate: { all: function all(e) {
  13605. b.activate.tab(e), b.activate.navigation(e);
  13606. }, tab: function tab(e) {
  13607. var t = b.get.tabElement(e),
  13608. n = "siblings" == x.deactivate ? t.siblings(p) : p.not(t),
  13609. 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));
  13610. }, navigation: function navigation(e) {
  13611. var t = b.get.navElement(e),
  13612. n = "siblings" == x.deactivate ? t.siblings(r) : r.not(t),
  13613. i = t.hasClass(C.active);b.verbose("Activating tab navigation for", t, e), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading));
  13614. } }, deactivate: { all: function all() {
  13615. b.deactivate.navigation(), b.deactivate.tabs();
  13616. }, navigation: function navigation() {
  13617. r.removeClass(C.active);
  13618. }, tabs: function tabs() {
  13619. p.removeClass(C.active + " " + C.loading);
  13620. } }, is: { tab: function tab(e) {
  13621. return e !== i && b.get.tabElement(e).length > 0;
  13622. } }, get: { initialPath: function initialPath() {
  13623. return r.eq(0).data(w.tab) || p.eq(0).data(w.tab);
  13624. }, path: function path() {
  13625. return e.address.value();
  13626. }, defaultPathArray: function defaultPathArray(e) {
  13627. return b.utilities.pathToArray(b.get.defaultPath(e));
  13628. }, defaultPath: function defaultPath(e) {
  13629. var t = r.filter("[data-" + w.tab + '^="' + e + '/"]').eq(0).data(w.tab) || !1;if (t) {
  13630. if (b.debug("Found default tab", t), F < x.maxDepth) return F++, b.get.defaultPath(t);b.error(k.recursion);
  13631. } else b.debug("No default tabs found for", e, p);return F = 0, e;
  13632. }, navElement: function navElement(e) {
  13633. return e = e || h, r.filter("[data-" + w.tab + '="' + e + '"]');
  13634. }, tabElement: function tabElement(e) {
  13635. 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;
  13636. }, tab: function tab() {
  13637. return h;
  13638. } }, utilities: { filterArray: function filterArray(t, n) {
  13639. return e.grep(t, function (t) {
  13640. return -1 == e.inArray(t, n);
  13641. });
  13642. }, last: function last(t) {
  13643. return !!e.isArray(t) && t[t.length - 1];
  13644. }, pathToArray: function pathToArray(e) {
  13645. return e === i && (e = h), "string" == typeof e ? e.split("/") : [e];
  13646. }, arrayToPath: function arrayToPath(t) {
  13647. return !!e.isArray(t) && t.join("/");
  13648. } }, setting: function setting(t, n) {
  13649. if (b.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, x, t);else {
  13650. if (n === i) return x[t];e.isPlainObject(x[t]) ? e.extend(!0, x[t], n) : x[t] = n;
  13651. }
  13652. }, internal: function internal(t, n) {
  13653. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  13654. if (n === i) return b[t];b[t] = n;
  13655. }
  13656. }, debug: function debug() {
  13657. !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)));
  13658. }, verbose: function verbose() {
  13659. !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)));
  13660. }, error: function error() {
  13661. x.silent || (b.error = Function.prototype.bind.call(console.error, console, x.name + ":"), b.error.apply(console, arguments));
  13662. }, performance: { log: function log(e) {
  13663. 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);
  13664. }, display: function display() {
  13665. var t = x.name + ":",
  13666. n = 0;l = !1, clearTimeout(b.performance.timer), e.each(c, function (e, t) {
  13667. n += t["Execution Time"];
  13668. }), 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) {
  13669. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13670. }), console.groupEnd()), c = [];
  13671. } }, invoke: function invoke(t, n, o) {
  13672. var r,
  13673. s,
  13674. l,
  13675. 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) {
  13676. 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 {
  13677. 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];
  13678. }
  13679. })), 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;
  13680. } }, d ? (D === i && b.initialize(), b.invoke(u)) : (D !== i && D.invoke("destroy"), b.initialize());
  13681. }), a !== i ? a : this;
  13682. }, e.tab = function () {
  13683. e(t).tab.apply(this, arguments);
  13684. }, 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" } };
  13685. }(jQuery, window, document), function (e, t, n, i) {
  13686. "use strict";
  13687. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.transition = function () {
  13688. var o,
  13689. a = e(this),
  13690. r = a.selector || "",
  13691. s = new Date().getTime(),
  13692. l = [],
  13693. c = arguments,
  13694. u = c[0],
  13695. d = [].slice.call(arguments, 1),
  13696. f = "string" == typeof u;t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function (t) {
  13697. var m,
  13698. g,
  13699. p,
  13700. h,
  13701. v,
  13702. b,
  13703. y,
  13704. x,
  13705. C,
  13706. w = e(this),
  13707. S = this;(C = { initialize: function initialize() {
  13708. 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());
  13709. }, instantiate: function instantiate() {
  13710. C.verbose("Storing instance of module", C), g = C, w.data(y, g);
  13711. }, destroy: function destroy() {
  13712. C.verbose("Destroying previous module for", S), w.removeData(y);
  13713. }, refresh: function refresh() {
  13714. C.verbose("Refreshing display type on next animation"), delete C.displayType;
  13715. }, forceRepaint: function forceRepaint() {
  13716. C.verbose("Forcing element repaint");var e = w.parent(),
  13717. t = w.next();0 === t.length ? w.detach().appendTo(e) : w.detach().insertBefore(t);
  13718. }, repaint: function repaint() {
  13719. C.verbose("Repainting element");S.offsetWidth;
  13720. }, delay: function delay(e) {
  13721. var n,
  13722. 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);
  13723. }, animate: function animate(e) {
  13724. if (m = e || m, !C.is.supported()) return C.error(p.support), !1;if (C.debug("Preparing animation", m.animation), C.is.animating()) {
  13725. 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();
  13726. }C.can.animate() ? C.set.animating(m.animation) : C.error(p.noAnimation, m.animation, S);
  13727. }, reset: function reset() {
  13728. C.debug("Resetting animation to beginning conditions"), C.remove.animationCallbacks(), C.restore.conditions(), C.remove.animating();
  13729. }, queue: function queue(e) {
  13730. C.debug("Queueing animation of", e), C.queuing = !0, w.one(b + ".queue" + x, function () {
  13731. C.queuing = !1, C.repaint(), C.animate.apply(this, m);
  13732. });
  13733. }, complete: function complete(e) {
  13734. 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)));
  13735. }, force: { visible: function visible() {
  13736. var e = w.attr("style"),
  13737. t = C.get.userStyle(),
  13738. n = C.get.displayType(),
  13739. o = t + "display: " + n + " !important;",
  13740. a = w.css("display"),
  13741. r = e === i || "" === e;a !== n ? (C.verbose("Overriding default display to show element", n), w.attr("style", o)) : r && w.removeAttr("style");
  13742. }, hidden: function hidden() {
  13743. var e = w.attr("style"),
  13744. t = w.css("display"),
  13745. 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"));
  13746. } }, has: { direction: function direction(t) {
  13747. var n = !1;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13748. t !== h.inward && t !== h.outward || (n = !0);
  13749. })), n;
  13750. }, inlineDisplay: function inlineDisplay() {
  13751. var t = w.attr("style") || "";return e.isArray(t.match(/display.*?;/, ""));
  13752. } }, set: { animating: function animating(e) {
  13753. 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);
  13754. }, duration: function duration(e, t) {
  13755. ((t = "number" == typeof (t = t || m.duration) ? t + "ms" : t) || 0 === t) && (C.verbose("Setting animation duration", t), w.css({ "animation-duration": t }));
  13756. }, direction: function direction(e) {
  13757. (e = e || C.get.direction()) == h.inward ? C.set.inward() : C.set.outward();
  13758. }, looping: function looping() {
  13759. C.debug("Transition set to loop"), w.addClass(h.looping);
  13760. }, hidden: function hidden() {
  13761. w.addClass(h.transition).addClass(h.hidden);
  13762. }, inward: function inward() {
  13763. C.debug("Setting direction to inward"), w.removeClass(h.outward).addClass(h.inward);
  13764. }, outward: function outward() {
  13765. C.debug("Setting direction to outward"), w.removeClass(h.inward).addClass(h.outward);
  13766. }, visible: function visible() {
  13767. w.addClass(h.transition).addClass(h.visible);
  13768. } }, start: { animation: function animation(e) {
  13769. 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);
  13770. } }, save: { animation: function animation(e) {
  13771. C.cache || (C.cache = {}), C.cache.animation = e;
  13772. }, displayType: function displayType(e) {
  13773. "none" !== e && w.data(v.displayType, e);
  13774. }, transitionExists: function transitionExists(t, n) {
  13775. e.fn.transition.exists[t] = n, C.verbose("Saving existence of transition", t, n);
  13776. } }, restore: { conditions: function conditions() {
  13777. var e = C.get.currentAnimation();e && (w.removeClass(e), C.verbose("Removing animation class", C.cache)), C.remove.duration();
  13778. } }, add: { failSafe: function failSafe() {
  13779. var e = C.get.duration();C.timer = setTimeout(function () {
  13780. w.triggerHandler(b);
  13781. }, e + m.failSafeDelay), C.verbose("Adding fail safe timer", C.timer);
  13782. } }, remove: { animating: function animating() {
  13783. w.removeClass(h.animating);
  13784. }, animationCallbacks: function animationCallbacks() {
  13785. C.remove.queueCallback(), C.remove.completeCallback();
  13786. }, queueCallback: function queueCallback() {
  13787. w.off(".queue" + x);
  13788. }, completeCallback: function completeCallback() {
  13789. w.off(".complete" + x);
  13790. }, display: function display() {
  13791. w.css("display", "");
  13792. }, direction: function direction() {
  13793. w.removeClass(h.inward).removeClass(h.outward);
  13794. }, duration: function duration() {
  13795. w.css("animation-duration", "");
  13796. }, failSafe: function failSafe() {
  13797. C.verbose("Removing fail safe timer", C.timer), C.timer && clearTimeout(C.timer);
  13798. }, hidden: function hidden() {
  13799. w.removeClass(h.hidden);
  13800. }, visible: function visible() {
  13801. w.removeClass(h.visible);
  13802. }, looping: function looping() {
  13803. C.debug("Transitions are no longer looping"), C.is.looping() && (C.reset(), w.removeClass(h.looping));
  13804. }, transition: function transition() {
  13805. w.removeClass(h.visible).removeClass(h.hidden);
  13806. } }, get: { settings: function settings(t, n, i) {
  13807. 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 });
  13808. }, animationClass: function animationClass(e) {
  13809. var t = e || m.animation,
  13810. n = C.can.transition() && !C.has.direction() ? C.get.direction() + " " : "";return h.animating + " " + h.transition + " " + n + t;
  13811. }, currentAnimation: function currentAnimation() {
  13812. return !(!C.cache || C.cache.animation === i) && C.cache.animation;
  13813. }, currentDirection: function currentDirection() {
  13814. return C.is.inward() ? h.inward : h.outward;
  13815. }, direction: function direction() {
  13816. return C.is.hidden() || !C.is.visible() ? h.inward : h.outward;
  13817. }, animationDirection: function animationDirection(t) {
  13818. var n;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13819. t === h.inward ? n = h.inward : t === h.outward && (n = h.outward);
  13820. })), n || !1;
  13821. }, duration: function duration(e) {
  13822. 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;
  13823. }, displayType: function displayType(e) {
  13824. return e = e === i || e, m.displayType ? m.displayType : (e && w.data(v.displayType) === i && C.can.transition(!0), w.data(v.displayType));
  13825. }, userStyle: function userStyle(e) {
  13826. return (e = e || w.attr("style") || "").replace(/display.*?;/, "");
  13827. }, transitionExists: function transitionExists(t) {
  13828. return e.fn.transition.exists[t];
  13829. }, animationStartEvent: function animationStartEvent() {
  13830. var e,
  13831. t = n.createElement("div"),
  13832. o = { animation: "animationstart", OAnimation: "oAnimationStart", MozAnimation: "mozAnimationStart", WebkitAnimation: "webkitAnimationStart" };for (e in o) {
  13833. if (t.style[e] !== i) return o[e];
  13834. }return !1;
  13835. }, animationEndEvent: function animationEndEvent() {
  13836. var e,
  13837. t = n.createElement("div"),
  13838. o = { animation: "animationend", OAnimation: "oAnimationEnd", MozAnimation: "mozAnimationEnd", WebkitAnimation: "webkitAnimationEnd" };for (e in o) {
  13839. if (t.style[e] !== i) return o[e];
  13840. }return !1;
  13841. } }, can: { transition: function transition(t) {
  13842. var n,
  13843. o,
  13844. a,
  13845. r,
  13846. s,
  13847. l,
  13848. c = m.animation,
  13849. u = C.get.transitionExists(c),
  13850. d = C.get.displayType(!1);if (u === i || t) {
  13851. 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 {
  13852. if ("none" == r || !r) return void C.debug("No animation defined in css", c);C.debug("Static animation found", c, d), l = !1;
  13853. }C.save.transitionExists(c, l);
  13854. }return u !== i ? u : l;
  13855. }, animate: function animate() {
  13856. return C.can.transition() !== i;
  13857. } }, is: { animating: function animating() {
  13858. return w.hasClass(h.animating);
  13859. }, inward: function inward() {
  13860. return w.hasClass(h.inward);
  13861. }, outward: function outward() {
  13862. return w.hasClass(h.outward);
  13863. }, looping: function looping() {
  13864. return w.hasClass(h.looping);
  13865. }, occurring: function occurring(e) {
  13866. return e = "." + (e = e || m.animation).replace(" ", "."), w.filter(e).length > 0;
  13867. }, visible: function visible() {
  13868. return w.is(":visible");
  13869. }, hidden: function hidden() {
  13870. return "hidden" === w.css("visibility");
  13871. }, supported: function supported() {
  13872. return !1 !== b;
  13873. } }, hide: function hide() {
  13874. 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);
  13875. }, show: function show(e) {
  13876. C.verbose("Showing element", e), C.remove.hidden(), C.set.visible(), C.force.visible(), m.onShow.call(S), m.onComplete.call(S);
  13877. }, toggle: function toggle() {
  13878. C.is.visible() ? C.hide() : C.show();
  13879. }, stop: function stop() {
  13880. C.debug("Stopping current animation"), w.triggerHandler(b);
  13881. }, stopAll: function stopAll() {
  13882. C.debug("Stopping all animation"), C.remove.queueCallback(), w.triggerHandler(b);
  13883. }, clear: { queue: function queue() {
  13884. C.debug("Clearing animation queue"), C.remove.queueCallback();
  13885. } }, enable: function enable() {
  13886. C.verbose("Starting animation"), w.removeClass(h.disabled);
  13887. }, disable: function disable() {
  13888. C.debug("Stopping animation"), w.addClass(h.disabled);
  13889. }, setting: function setting(t, n) {
  13890. if (C.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  13891. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  13892. }
  13893. }, internal: function internal(t, n) {
  13894. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  13895. if (n === i) return C[t];C[t] = n;
  13896. }
  13897. }, debug: function debug() {
  13898. !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)));
  13899. }, verbose: function verbose() {
  13900. !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)));
  13901. }, error: function error() {
  13902. m.silent || (C.error = Function.prototype.bind.call(console.error, console, m.name + ":"), C.error.apply(console, arguments));
  13903. }, performance: { log: function log(e) {
  13904. 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);
  13905. }, display: function display() {
  13906. var t = m.name + ":",
  13907. n = 0;s = !1, clearTimeout(C.performance.timer), e.each(l, function (e, t) {
  13908. n += t["Execution Time"];
  13909. }), 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) {
  13910. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13911. }), console.groupEnd()), l = [];
  13912. } }, invoke: function invoke(t, n, a) {
  13913. var r,
  13914. s,
  13915. l,
  13916. 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) {
  13917. 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 {
  13918. 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];
  13919. }
  13920. })), 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;
  13921. } }).initialize();
  13922. }), o !== i ? o : this;
  13923. }, 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" } };
  13924. }(jQuery, window, document), function (e, t, n, i) {
  13925. "use strict";
  13926. 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) {
  13927. var o,
  13928. a = e.isFunction(this) ? e(t) : e(this),
  13929. r = a.selector || "",
  13930. s = new Date().getTime(),
  13931. l = [],
  13932. c = arguments[0],
  13933. u = "string" == typeof c,
  13934. d = [].slice.call(arguments, 1);return a.each(function () {
  13935. var a,
  13936. f,
  13937. m,
  13938. g,
  13939. p,
  13940. h,
  13941. v = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.api.settings, n) : e.extend({}, e.fn.api.settings),
  13942. b = v.namespace,
  13943. y = v.metadata,
  13944. x = v.selector,
  13945. C = v.error,
  13946. w = v.className,
  13947. S = "." + b,
  13948. k = "module-" + b,
  13949. T = e(this),
  13950. A = T.closest(x.form),
  13951. R = v.stateContext ? e(v.stateContext) : T,
  13952. P = this,
  13953. E = R[0],
  13954. F = T.data(k);h = { initialize: function initialize() {
  13955. u || h.bind.events(), h.instantiate();
  13956. }, instantiate: function instantiate() {
  13957. h.verbose("Storing instance of module", h), F = h, T.data(k, F);
  13958. }, destroy: function destroy() {
  13959. h.verbose("Destroying previous module for", P), T.removeData(k).off(S);
  13960. }, bind: { events: function events() {
  13961. 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());
  13962. } }, decode: { json: function json(e) {
  13963. if (e !== i && "string" == typeof e) try {
  13964. e = JSON.parse(e);
  13965. } catch (e) {}return e;
  13966. } }, read: { cachedResponse: function cachedResponse(e) {
  13967. 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);
  13968. } }, write: { cachedResponse: function cachedResponse(n, o) {
  13969. 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);
  13970. } }, query: function query() {
  13971. if (h.is.disabled()) h.debug("Element is disabled API request aborted");else {
  13972. if (h.is.loading()) {
  13973. if (!v.interruptRequests) return void h.debug("Cancelling request, previous request is still pending");h.debug("Interrupting previous request"), h.abort();
  13974. }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()) {
  13975. if ((m = h.add.urlData(m)) || h.is.mocked()) {
  13976. 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 () {
  13977. h.timer && delete h.timer, h.debug("Sending throttled request", g, a.method), h.send.request();
  13978. }, 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());
  13979. }
  13980. } else h.error(C.missingURL);
  13981. }
  13982. }, should: { removeError: function removeError() {
  13983. return !0 === v.hideError || "auto" === v.hideError && !h.is.form();
  13984. } }, is: { disabled: function disabled() {
  13985. return T.filter(x.disabled).length > 0;
  13986. }, expectingJSON: function expectingJSON() {
  13987. return "json" === v.dataType || "jsonp" === v.dataType;
  13988. }, form: function form() {
  13989. return T.is("form") || R.is("form");
  13990. }, mocked: function mocked() {
  13991. return v.mockResponse || v.mockResponseAsync || v.response || v.responseAsync;
  13992. }, input: function input() {
  13993. return T.is("input");
  13994. }, loading: function loading() {
  13995. return !!h.request && "pending" == h.request.state();
  13996. }, abortedRequest: function abortedRequest(e) {
  13997. 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);
  13998. }, validResponse: function validResponse(t) {
  13999. 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);
  14000. } }, was: { cancelled: function cancelled() {
  14001. return h.cancelled || !1;
  14002. }, succesful: function succesful() {
  14003. return h.request && "resolved" == h.request.state();
  14004. }, failure: function failure() {
  14005. return h.request && "rejected" == h.request.state();
  14006. }, complete: function complete() {
  14007. return h.request && ("resolved" == h.request.state() || "rejected" == h.request.state());
  14008. } }, add: { urlData: function urlData(t, n) {
  14009. 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) {
  14010. var r = -1 !== a.indexOf("$") ? a.substr(2, a.length - 3) : a.substr(1, a.length - 2),
  14011. 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);
  14012. })), a && (h.debug("Looking for optional URL variables", o), e.each(a, function (o, a) {
  14013. var r = -1 !== a.indexOf("$") ? a.substr(3, a.length - 4) : a.substr(2, a.length - 3),
  14014. 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, ""));
  14015. }))), t;
  14016. }, formData: function formData(t) {
  14017. var n = e.fn.serializeObject !== i,
  14018. 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;
  14019. } }, send: { request: function request() {
  14020. 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);
  14021. } }, event: { trigger: function trigger(e) {
  14022. h.query(), "submit" != e.type && "click" != e.type || e.preventDefault();
  14023. }, xhr: { always: function always() {}, done: function done(t, n, i) {
  14024. var o = this,
  14025. a = new Date().getTime() - p,
  14026. r = v.loadingDuration - a,
  14027. 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 () {
  14028. h.is.validResponse(t) ? h.request.resolveWith(o, [t, i]) : h.request.rejectWith(o, [i, "invalid"]);
  14029. }, r);
  14030. }, fail: function fail(e, t, n) {
  14031. var i = this,
  14032. o = new Date().getTime() - p,
  14033. a = v.loadingDuration - o;(a = a > 0 ? a : 0) > 0 && h.debug("Response completed early delaying state change by", a), setTimeout(function () {
  14034. h.is.abortedRequest(e) ? h.request.rejectWith(i, [e, "aborted", n]) : h.request.rejectWith(i, [e, "error", t, n]);
  14035. }, a);
  14036. } }, request: { done: function done(e, t) {
  14037. 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);
  14038. }, complete: function complete(e, t) {
  14039. 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);
  14040. }, fail: function fail(e, t, n) {
  14041. var o = h.get.responseFromXHR(e),
  14042. 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);
  14043. } } }, create: { request: function request() {
  14044. return e.Deferred().always(h.event.request.complete).done(h.event.request.done).fail(h.event.request.fail);
  14045. }, mockedXHR: function mockedXHR() {
  14046. var t,
  14047. n,
  14048. i,
  14049. o = v.mockResponse || v.response,
  14050. 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) {
  14051. h.debug("Async callback returned response", e), e ? i.resolveWith(E, [e, !1, { responseText: e }]) : i.rejectWith(E, [{ responseText: e }, !1, !1]);
  14052. }, h.debug("Using specified async response callback", a), a.call(E, f, t)), i;
  14053. }, xhr: function xhr() {
  14054. 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;
  14055. } }, set: { error: function error() {
  14056. h.verbose("Adding error state to element", R), R.addClass(w.error);
  14057. }, loading: function loading() {
  14058. h.verbose("Adding loading state to element", R), R.addClass(w.loading), p = new Date().getTime();
  14059. } }, remove: { error: function error() {
  14060. h.verbose("Removing error state from element", R), R.removeClass(w.error);
  14061. }, loading: function loading() {
  14062. h.verbose("Removing loading state from element", R), R.removeClass(w.loading);
  14063. } }, get: { responseFromXHR: function responseFromXHR(t) {
  14064. return !!e.isPlainObject(t) && (h.is.expectingJSON() ? h.decode.json(t.responseText) : t.responseText);
  14065. }, errorFromRequest: function errorFromRequest(t, n, o) {
  14066. return e.isPlainObject(t) && t.error !== i ? t.error : v.error[n] !== i ? v.error[n] : o;
  14067. }, request: function request() {
  14068. return h.request || !1;
  14069. }, xhr: function xhr() {
  14070. return h.xhr || !1;
  14071. }, settings: function settings() {
  14072. 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);
  14073. }, urlEncodedValue: function urlEncodedValue(e) {
  14074. var n = t.decodeURIComponent(e),
  14075. 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);
  14076. }, defaultData: function defaultData() {
  14077. var t = {};return e.isWindow(P) || (h.is.input() ? t.value = T.val() : h.is.form() || (t.text = T.text())), t;
  14078. }, event: function event() {
  14079. 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;
  14080. }, templatedURL: function templatedURL(e) {
  14081. 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) {
  14082. 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];
  14083. } 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;
  14084. } }, abort: function abort() {
  14085. var e = h.get.xhr();e && "resolved" !== e.state() && (h.debug("Cancelling API request"), e.abort());
  14086. }, reset: function reset() {
  14087. h.remove.error(), h.remove.loading();
  14088. }, setting: function setting(t, n) {
  14089. if (h.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, v, t);else {
  14090. if (n === i) return v[t];e.isPlainObject(v[t]) ? e.extend(!0, v[t], n) : v[t] = n;
  14091. }
  14092. }, internal: function internal(t, n) {
  14093. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  14094. if (n === i) return h[t];h[t] = n;
  14095. }
  14096. }, debug: function debug() {
  14097. !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)));
  14098. }, verbose: function verbose() {
  14099. !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)));
  14100. }, error: function error() {
  14101. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  14102. }, performance: { log: function log(e) {
  14103. 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);
  14104. }, display: function display() {
  14105. var t = v.name + ":",
  14106. n = 0;s = !1, clearTimeout(h.performance.timer), e.each(l, function (e, t) {
  14107. n += t["Execution Time"];
  14108. }), 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) {
  14109. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14110. }), console.groupEnd()), l = [];
  14111. } }, invoke: function invoke(t, n, a) {
  14112. var r,
  14113. s,
  14114. l,
  14115. 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) {
  14116. 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 {
  14117. 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];
  14118. }
  14119. })), 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;
  14120. } }, u ? (F === i && h.initialize(), h.invoke(c)) : (F !== i && F.invoke("destroy"), h.initialize());
  14121. }), o !== i ? o : this;
  14122. }, 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) {
  14123. return e;
  14124. }, 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" } };
  14125. }(jQuery, window, document), function (e, t, n, i) {
  14126. "use strict";
  14127. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.visibility = function (o) {
  14128. var a,
  14129. r = e(this),
  14130. s = r.selector || "",
  14131. l = new Date().getTime(),
  14132. c = [],
  14133. u = arguments[0],
  14134. d = "string" == typeof u,
  14135. f = [].slice.call(arguments, 1),
  14136. m = r.length,
  14137. g = 0;return r.each(function () {
  14138. var r,
  14139. p,
  14140. h,
  14141. v,
  14142. b = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.visibility.settings, o) : e.extend({}, e.fn.visibility.settings),
  14143. y = b.className,
  14144. x = b.namespace,
  14145. C = b.error,
  14146. w = b.metadata,
  14147. S = "." + x,
  14148. k = "module-" + x,
  14149. T = e(t),
  14150. A = e(this),
  14151. R = e(b.context),
  14152. P = (A.selector, A.data(k)),
  14153. E = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  14154. setTimeout(e, 0);
  14155. },
  14156. F = this,
  14157. O = !1;v = { initialize: function initialize() {
  14158. 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();
  14159. }, instantiate: function instantiate() {
  14160. v.debug("Storing instance", v), A.data(k, v), P = v;
  14161. }, destroy: function destroy() {
  14162. 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);
  14163. }, observeChanges: function observeChanges() {
  14164. "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));
  14165. }, bind: { events: function events() {
  14166. 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);
  14167. } }, event: { changed: function changed(e) {
  14168. v.verbose("DOM tree modified, updating visibility calculations"), v.timer = setTimeout(function () {
  14169. v.verbose("DOM tree modified, updating sticky menu"), v.refresh();
  14170. }, 100);
  14171. }, contextChanged: function contextChanged(t) {
  14172. [].forEach.call(t, function (t) {
  14173. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  14174. (t == F || e(t).find(F).length > 0) && (v.debug("Element removed from DOM, tearing down events"), v.destroy());
  14175. });
  14176. });
  14177. }, resize: function resize() {
  14178. v.debug("Window resized"), b.refreshOnResize && E(v.refresh);
  14179. }, load: function load() {
  14180. v.debug("Page finished loading"), E(v.refresh);
  14181. }, scroll: function scroll() {
  14182. b.throttle ? (clearTimeout(v.timer), v.timer = setTimeout(function () {
  14183. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14184. }, b.throttle)) : E(function () {
  14185. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14186. });
  14187. }, scrollchange: function scrollchange(e, t) {
  14188. v.checkVisibility(t);
  14189. } }, precache: function precache(t, i) {
  14190. t instanceof Array || (t = [t]);for (var o = t.length, a = 0, r = [], s = n.createElement("img"), l = function l() {
  14191. ++a >= t.length && e.isFunction(i) && i();
  14192. }; o--;) {
  14193. (s = n.createElement("img")).onload = l, s.onerror = l, s.src = t[o], r.push(s);
  14194. }
  14195. }, enableCallbacks: function enableCallbacks() {
  14196. v.debug("Allowing callbacks to occur"), O = !1;
  14197. }, disableCallbacks: function disableCallbacks() {
  14198. v.debug("Disabling all callbacks temporarily"), O = !0;
  14199. }, should: { trackChanges: function trackChanges() {
  14200. return d ? (v.debug("One time query, no need to bind events"), !1) : (v.debug("Callbacks being attached"), !0);
  14201. } }, setup: { cache: function cache() {
  14202. v.cache = { occurred: {}, screen: {}, element: {} };
  14203. }, image: function image() {
  14204. var e = A.data(w.src);e && (v.verbose("Lazy loading image", e), b.once = !0, b.observeChanges = !1, b.onOnScreen = function () {
  14205. v.debug("Image on screen", F), v.precache(e, function () {
  14206. v.set.image(e, function () {
  14207. ++g == m && b.onAllLoaded.call(this), b.onLoad.call(this);
  14208. });
  14209. });
  14210. });
  14211. }, fixed: function fixed() {
  14212. 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 () {
  14213. 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);
  14214. }, b.onTopPassedReverse = function () {
  14215. v.debug("Element returned to position, removing fixed", A), v.hide.placeholder(), v.remove.fixed();
  14216. };
  14217. } }, create: { placeholder: function placeholder() {
  14218. v.verbose("Creating fixed position placeholder"), r = A.clone(!1).css("display", "none").addClass(y.placeholder).insertAfter(A);
  14219. } }, show: { placeholder: function placeholder() {
  14220. v.verbose("Showing placeholder"), r.css("display", "block").css("visibility", "hidden");
  14221. } }, hide: { placeholder: function placeholder() {
  14222. v.verbose("Hiding placeholder"), r.css("display", "none").css("visibility", "");
  14223. } }, set: { fixed: function fixed() {
  14224. 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);
  14225. }, image: function image(t, n) {
  14226. if (A.attr("src", t), b.transition) {
  14227. if (e.fn.transition !== i) {
  14228. if (A.hasClass(y.visible)) return void v.debug("Transition already occurred on this image, skipping animation");A.transition(b.transition, b.duration, n);
  14229. } else A.fadeIn(b.duration, n);
  14230. } else A.show();
  14231. } }, is: { onScreen: function onScreen() {
  14232. return v.get.elementCalculations().onScreen;
  14233. }, offScreen: function offScreen() {
  14234. return v.get.elementCalculations().offScreen;
  14235. }, visible: function visible() {
  14236. return !(!v.cache || !v.cache.element) && !(0 === v.cache.element.width && 0 === v.cache.element.offset.top);
  14237. }, verticallyScrollableContext: function verticallyScrollableContext() {
  14238. var e = R.get(0) !== t && R.css("overflow-y");return "auto" == e || "scroll" == e;
  14239. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  14240. var e = R.get(0) !== t && R.css("overflow-x");return "auto" == e || "scroll" == e;
  14241. } }, refresh: function refresh() {
  14242. v.debug("Refreshing constants (width/height)"), "fixed" == b.type && v.resetFixed(), v.reset(), v.save.position(), b.checkOnRefresh && v.checkVisibility(), b.onRefresh.call(F);
  14243. }, resetFixed: function resetFixed() {
  14244. v.remove.fixed(), v.remove.occurred();
  14245. }, reset: function reset() {
  14246. v.verbose("Resetting all cached values"), e.isPlainObject(v.cache) && (v.cache.screen = {}, v.cache.element = {});
  14247. }, checkVisibility: function checkVisibility(e) {
  14248. 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()));
  14249. }, passed: function passed(t, n) {
  14250. var o = v.get.elementCalculations();if (t && n) b.onPassed[t] = n;else {
  14251. if (t !== i) return v.get.pixelsPassed(t) > o.pixelsPassed;o.passing && e.each(b.onPassed, function (e, t) {
  14252. o.bottomVisible || o.pixelsPassed > v.get.pixelsPassed(e) ? v.execute(t, e) : b.once || v.remove.occurred(t);
  14253. });
  14254. }
  14255. }, onScreen: function onScreen(e) {
  14256. var t = v.get.elementCalculations(),
  14257. n = e || b.onOnScreen,
  14258. 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;
  14259. }, offScreen: function offScreen(e) {
  14260. var t = v.get.elementCalculations(),
  14261. n = e || b.onOffScreen,
  14262. 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;
  14263. }, passing: function passing(e) {
  14264. var t = v.get.elementCalculations(),
  14265. n = e || b.onPassing,
  14266. 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;
  14267. }, topVisible: function topVisible(e) {
  14268. var t = v.get.elementCalculations(),
  14269. n = e || b.onTopVisible,
  14270. 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;
  14271. }, bottomVisible: function bottomVisible(e) {
  14272. var t = v.get.elementCalculations(),
  14273. n = e || b.onBottomVisible,
  14274. 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;
  14275. }, topPassed: function topPassed(e) {
  14276. var t = v.get.elementCalculations(),
  14277. n = e || b.onTopPassed,
  14278. 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;
  14279. }, bottomPassed: function bottomPassed(e) {
  14280. var t = v.get.elementCalculations(),
  14281. n = e || b.onBottomPassed,
  14282. 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;
  14283. }, passingReverse: function passingReverse(e) {
  14284. var t = v.get.elementCalculations(),
  14285. n = e || b.onPassingReverse,
  14286. 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;
  14287. }, topVisibleReverse: function topVisibleReverse(e) {
  14288. var t = v.get.elementCalculations(),
  14289. n = e || b.onTopVisibleReverse,
  14290. 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;
  14291. }, bottomVisibleReverse: function bottomVisibleReverse(e) {
  14292. var t = v.get.elementCalculations(),
  14293. n = e || b.onBottomVisibleReverse,
  14294. 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;
  14295. }, topPassedReverse: function topPassedReverse(e) {
  14296. var t = v.get.elementCalculations(),
  14297. n = e || b.onTopPassedReverse,
  14298. 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;
  14299. }, bottomPassedReverse: function bottomPassedReverse(e) {
  14300. var t = v.get.elementCalculations(),
  14301. n = e || b.onBottomPassedReverse,
  14302. 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;
  14303. }, execute: function execute(e, t) {
  14304. var n = v.get.elementCalculations(),
  14305. 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);
  14306. }, remove: { fixed: function fixed() {
  14307. v.debug("Removing fixed position"), A.removeClass(y.fixed).css({ position: "", top: "", left: "", zIndex: "" }), b.onUnfixed.call(F);
  14308. }, placeholder: function placeholder() {
  14309. v.debug("Removing placeholder content"), r && r.remove();
  14310. }, occurred: function occurred(e) {
  14311. if (e) {
  14312. 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);
  14313. } else v.cache.occurred = {};
  14314. } }, save: { calculations: function calculations() {
  14315. v.verbose("Saving all calculations necessary to determine positioning"), v.save.direction(), v.save.screenCalculations(), v.save.elementCalculations();
  14316. }, occurred: function occurred(e) {
  14317. e && (v.cache.occurred[e] !== i && !0 === v.cache.occurred[e] || (v.verbose("Saving callback occurred", e), v.cache.occurred[e] = !0));
  14318. }, scroll: function scroll(e) {
  14319. e = e + b.offset || R.scrollTop() + b.offset, v.cache.scroll = e;
  14320. }, direction: function direction() {
  14321. var e,
  14322. t = v.get.scroll(),
  14323. n = v.get.lastScroll();return e = t > n && n ? "down" : t < n && n ? "up" : "static", v.cache.direction = e, v.cache.direction;
  14324. }, elementPosition: function elementPosition() {
  14325. var e = v.cache.element,
  14326. 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;
  14327. }, elementCalculations: function elementCalculations() {
  14328. var e = v.get.screenCalculations(),
  14329. 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;
  14330. }, screenCalculations: function screenCalculations() {
  14331. 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;
  14332. }, screenSize: function screenSize() {
  14333. v.verbose("Saving window position"), v.cache.screen = { height: R.height() };
  14334. }, position: function position() {
  14335. v.save.screenSize(), v.save.elementPosition();
  14336. } }, get: { pixelsPassed: function pixelsPassed(e) {
  14337. var t = v.get.elementCalculations();return e.search("%") > -1 ? t.height * (parseInt(e, 10) / 100) : parseInt(e, 10);
  14338. }, occurred: function occurred(e) {
  14339. return v.cache.occurred !== i && v.cache.occurred[e] || !1;
  14340. }, direction: function direction() {
  14341. return v.cache.direction === i && v.save.direction(), v.cache.direction;
  14342. }, elementPosition: function elementPosition() {
  14343. return v.cache.element === i && v.save.elementPosition(), v.cache.element;
  14344. }, elementCalculations: function elementCalculations() {
  14345. return v.cache.element === i && v.save.elementCalculations(), v.cache.element;
  14346. }, screenCalculations: function screenCalculations() {
  14347. return v.cache.screen === i && v.save.screenCalculations(), v.cache.screen;
  14348. }, screenSize: function screenSize() {
  14349. return v.cache.screen === i && v.save.screenSize(), v.cache.screen;
  14350. }, scroll: function scroll() {
  14351. return v.cache.scroll === i && v.save.scroll(), v.cache.scroll;
  14352. }, lastScroll: function lastScroll() {
  14353. return v.cache.screen === i ? (v.debug("First scroll event, no last scroll could be found"), !1) : v.cache.screen.top;
  14354. } }, setting: function setting(t, n) {
  14355. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  14356. if (n === i) return b[t];b[t] = n;
  14357. }
  14358. }, internal: function internal(t, n) {
  14359. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  14360. if (n === i) return v[t];v[t] = n;
  14361. }
  14362. }, debug: function debug() {
  14363. !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)));
  14364. }, verbose: function verbose() {
  14365. !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)));
  14366. }, error: function error() {
  14367. b.silent || (v.error = Function.prototype.bind.call(console.error, console, b.name + ":"), v.error.apply(console, arguments));
  14368. }, performance: { log: function log(e) {
  14369. 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);
  14370. }, display: function display() {
  14371. var t = b.name + ":",
  14372. n = 0;l = !1, clearTimeout(v.performance.timer), e.each(c, function (e, t) {
  14373. n += t["Execution Time"];
  14374. }), 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) {
  14375. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14376. }), console.groupEnd()), c = [];
  14377. } }, invoke: function invoke(t, n, o) {
  14378. var r,
  14379. s,
  14380. l,
  14381. 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) {
  14382. 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 {
  14383. 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];
  14384. }
  14385. })), 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;
  14386. } }, d ? (P === i && v.initialize(), P.save.scroll(), P.save.calculations(), v.invoke(u)) : (P !== i && P.invoke("destroy"), v.initialize());
  14387. }), a !== i ? a : this;
  14388. }, 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" } };
  14389. }(jQuery, window, document);
  14390. /***/ }),
  14391. /***/ "./js/services/i18nHelper.js":
  14392. /*!***********************************!*\
  14393. !*** ./js/services/i18nHelper.js ***!
  14394. \***********************************/
  14395. /*! no static exports found */
  14396. /***/ (function(module, exports, __webpack_require__) {
  14397. "use strict";
  14398. Object.defineProperty(exports, "__esModule", {
  14399. value: true
  14400. });
  14401. exports.i18nHelper = undefined;
  14402. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14403. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14404. var _localizedStringsService = __webpack_require__(/*! ./localizedStringsService */ "./js/services/localizedStringsService.js");
  14405. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14406. var StringTypes = _lineI18n2.default.StringTypes;
  14407. var i18nHelper = exports.i18nHelper = Object.freeze({
  14408. i18n: function i18n(identifier) {
  14409. var opts = identifier.split(':');
  14410. var type = opts[0].toLowerCase();
  14411. var id = opts[1];
  14412. if (StringTypes.ERROR === type) {
  14413. return _localizedStringsService.LocalizedStrings.getError(id);
  14414. } else if (StringTypes.MESSAGE === type) {
  14415. return _localizedStringsService.LocalizedStrings.getMessage(id);
  14416. } else if (StringTypes.UI === type) {
  14417. return _localizedStringsService.LocalizedStrings.getUI(id);
  14418. } else {
  14419. console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> " + identifier);
  14420. return _localizedStringsService.LocalizedStrings.getString(identifier, type);
  14421. }
  14422. }
  14423. });
  14424. /***/ }),
  14425. /***/ "./js/services/languageService.js":
  14426. /*!****************************************!*\
  14427. !*** ./js/services/languageService.js ***!
  14428. \****************************************/
  14429. /*! no static exports found */
  14430. /***/ (function(module, exports, __webpack_require__) {
  14431. "use strict";
  14432. Object.defineProperty(exports, "__esModule", {
  14433. value: true
  14434. });
  14435. exports.LanguageService = undefined;
  14436. 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; }; }();
  14437. var _grammar = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.js");
  14438. var _grammar2 = _interopRequireDefault(_grammar);
  14439. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14440. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14441. var _config = __webpack_require__(/*! ./../util/config */ "./js/util/config.js");
  14442. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14443. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14444. 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; }
  14445. 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; }
  14446. var LanguageServiceExtended = function (_line_i18n$LanguageSe) {
  14447. _inherits(LanguageServiceExtended, _line_i18n$LanguageSe);
  14448. function LanguageServiceExtended() {
  14449. _classCallCheck(this, LanguageServiceExtended);
  14450. return _possibleConstructorReturn(this, (LanguageServiceExtended.__proto__ || Object.getPrototypeOf(LanguageServiceExtended)).call(this, typeof iLMparameters === 'undefined' ? _config.Config.default_lang : iLMparameters.lang));
  14451. }
  14452. _createClass(LanguageServiceExtended, [{
  14453. key: 'getCurrentLexer',
  14454. value: function getCurrentLexer() {
  14455. var langInfo = _grammar2.default[this.getLang()];
  14456. if (langInfo === null || langInfo === undefined) {
  14457. return _grammar2.default[this.getDefaultLang()].lexer;
  14458. } else {
  14459. return langInfo.lexer;
  14460. }
  14461. }
  14462. }, {
  14463. key: 'getCurrentLangFuncs',
  14464. value: function getCurrentLangFuncs() {
  14465. var langInfo = _grammar2.default[this.getLang()];
  14466. if (langInfo === null || langInfo === undefined) {
  14467. return _grammar2.default[this.getDefaultLang()].langFuncs;
  14468. } else {
  14469. return langInfo.langFuncs;
  14470. }
  14471. }
  14472. }, {
  14473. key: 'getCurrentLangLibs',
  14474. value: function getCurrentLangLibs() {
  14475. var langInfo = _grammar2.default[this.getLang()];
  14476. if (langInfo === null || langInfo === undefined) {
  14477. return _grammar2.default[this.getDefaultLang()].langLibs;
  14478. }
  14479. return langInfo.langLibs;
  14480. }
  14481. }]);
  14482. return LanguageServiceExtended;
  14483. }(_lineI18n2.default.LanguageServiceNoLS);
  14484. var LanguageService = exports.LanguageService = new LanguageServiceExtended();
  14485. /***/ }),
  14486. /***/ "./js/services/localizedStringsService.js":
  14487. /*!************************************************!*\
  14488. !*** ./js/services/localizedStringsService.js ***!
  14489. \************************************************/
  14490. /*! no static exports found */
  14491. /***/ (function(module, exports, __webpack_require__) {
  14492. "use strict";
  14493. Object.defineProperty(exports, "__esModule", {
  14494. value: true
  14495. });
  14496. exports.LocalizedStrings = undefined;
  14497. var _languageService = __webpack_require__(/*! ./languageService */ "./js/services/languageService.js");
  14498. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14499. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14500. var _i18n = __webpack_require__(/*! ./../../i18n */ "./i18n/index.js");
  14501. var _i18n2 = _interopRequireDefault(_i18n);
  14502. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14503. var LocalizedStrings = exports.LocalizedStrings = Object.freeze(new _lineI18n2.default.LocalizedStrings(_languageService.LanguageService, _i18n2.default, true));
  14504. /***/ }),
  14505. /***/ "./js/typeSystem/baseTypes.js":
  14506. /*!************************************!*\
  14507. !*** ./js/typeSystem/baseTypes.js ***!
  14508. \************************************/
  14509. /*! no static exports found */
  14510. /***/ (function(module, exports, __webpack_require__) {
  14511. "use strict";
  14512. Object.defineProperty(exports, "__esModule", {
  14513. value: true
  14514. });
  14515. 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; }; }();
  14516. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14517. var BaseType = function () {
  14518. function BaseType(name, ord) {
  14519. _classCallCheck(this, BaseType);
  14520. this.name = name;
  14521. this.ord = ord;
  14522. }
  14523. _createClass(BaseType, [{
  14524. key: "isCompatible",
  14525. value: function isCompatible(another) {
  14526. if (another instanceof BaseType) {
  14527. return this.name === another.name && this.ord === another.ord;
  14528. }
  14529. return false;
  14530. }
  14531. }, {
  14532. key: "value",
  14533. get: function get() {
  14534. return this.name;
  14535. }
  14536. }]);
  14537. return BaseType;
  14538. }();
  14539. // Base types names are the same as i18n ui type keys
  14540. var BaseTypes = exports.BaseTypes = Object.freeze({
  14541. INTEGER: new BaseType("integer", 0),
  14542. REAL: new BaseType("real", 1),
  14543. STRING: new BaseType("text", 2),
  14544. BOOLEAN: new BaseType("boolean", 3),
  14545. VOID: new BaseType("void", 4),
  14546. UNDEFINED: new BaseType("undefined", 5)
  14547. });
  14548. /***/ }),
  14549. /***/ "./js/typeSystem/compoundType.js":
  14550. /*!***************************************!*\
  14551. !*** ./js/typeSystem/compoundType.js ***!
  14552. \***************************************/
  14553. /*! no static exports found */
  14554. /***/ (function(module, exports, __webpack_require__) {
  14555. "use strict";
  14556. Object.defineProperty(exports, "__esModule", {
  14557. value: true
  14558. });
  14559. exports.CompoundType = undefined;
  14560. 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; }; }();
  14561. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14562. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14563. 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; }
  14564. 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; }
  14565. var CompoundType = exports.CompoundType = function (_Type) {
  14566. _inherits(CompoundType, _Type);
  14567. function CompoundType(type, dimensions) {
  14568. _classCallCheck(this, CompoundType);
  14569. var _this = _possibleConstructorReturn(this, (CompoundType.__proto__ || Object.getPrototypeOf(CompoundType)).call(this, null));
  14570. _this.innerType = type;
  14571. _this.dimensions = dimensions;
  14572. return _this;
  14573. }
  14574. _createClass(CompoundType, [{
  14575. key: "isCompatible",
  14576. value: function isCompatible(another) {
  14577. if (another instanceof CompoundType) {
  14578. if (this.dimensions !== another.dimensions) {
  14579. return false;
  14580. }
  14581. return this.innerType.isCompatible(another.innerType);
  14582. }
  14583. return false;
  14584. }
  14585. }, {
  14586. key: "stringInfo",
  14587. value: function stringInfo() {
  14588. var _this2 = this;
  14589. var list = this.innerType.stringInfo();
  14590. list.forEach(function (v) {
  14591. v.dim = _this2.dimensions;
  14592. });
  14593. return list;
  14594. }
  14595. }, {
  14596. key: "canAccept",
  14597. value: function canAccept(another) {
  14598. if (another instanceof CompoundType) {
  14599. return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
  14600. } else {
  14601. return this.innerType.isCompatible(another);
  14602. }
  14603. }
  14604. }]);
  14605. return CompoundType;
  14606. }(_type.Type);
  14607. /***/ }),
  14608. /***/ "./js/typeSystem/multiType.js":
  14609. /*!************************************!*\
  14610. !*** ./js/typeSystem/multiType.js ***!
  14611. \************************************/
  14612. /*! no static exports found */
  14613. /***/ (function(module, exports, __webpack_require__) {
  14614. "use strict";
  14615. Object.defineProperty(exports, "__esModule", {
  14616. value: true
  14617. });
  14618. exports.MultiType = undefined;
  14619. 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; }; }();
  14620. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14621. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14622. 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; }
  14623. 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; }
  14624. var MultiType = exports.MultiType = function (_Type) {
  14625. _inherits(MultiType, _Type);
  14626. function MultiType(types) {
  14627. _classCallCheck(this, MultiType);
  14628. var _this = _possibleConstructorReturn(this, (MultiType.__proto__ || Object.getPrototypeOf(MultiType)).call(this, null));
  14629. _this.types = types;
  14630. return _this;
  14631. }
  14632. _createClass(MultiType, [{
  14633. key: "stringInfo",
  14634. value: function stringInfo() {
  14635. var list = [];
  14636. for (var i = 0; i < this.types.length; i++) {
  14637. var t = this.types[i];
  14638. list = list.concat(t.stringInfo());
  14639. }
  14640. return list;
  14641. }
  14642. }, {
  14643. key: "isCompatible",
  14644. value: function isCompatible(another) {
  14645. if (another instanceof _type.Type) {
  14646. for (var i = 0; i < this.types.length; i++) {
  14647. var t = this.types[i];
  14648. if (another.isCompatible(t)) {
  14649. return true;
  14650. }
  14651. }
  14652. }
  14653. return false;
  14654. }
  14655. }, {
  14656. key: "value",
  14657. get: function get() {
  14658. return null;
  14659. }
  14660. }, {
  14661. key: "ord",
  14662. get: function get() {
  14663. return null;
  14664. }
  14665. }]);
  14666. return MultiType;
  14667. }(_type.Type);
  14668. /***/ }),
  14669. /***/ "./js/typeSystem/parsers.js":
  14670. /*!**********************************!*\
  14671. !*** ./js/typeSystem/parsers.js ***!
  14672. \**********************************/
  14673. /*! no static exports found */
  14674. /***/ (function(module, exports, __webpack_require__) {
  14675. "use strict";
  14676. Object.defineProperty(exports, "__esModule", {
  14677. value: true
  14678. });
  14679. exports.toInt = toInt;
  14680. exports.toString = toString;
  14681. exports.toReal = toReal;
  14682. exports.toBool = toBool;
  14683. exports.convertToString = convertToString;
  14684. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14685. var _types = __webpack_require__(/*! ./types */ "./js/typeSystem/types.js");
  14686. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  14687. var _decimal2 = _interopRequireDefault(_decimal);
  14688. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14689. function toInt(str) {
  14690. return new _decimal2.default(str);
  14691. }
  14692. function toString(str) {
  14693. var value = str.replace(/^"/, '');
  14694. value = value.replace(/"$/, '');
  14695. value = value.replace(/\\b/g, "\b");
  14696. value = value.replace(/\\t/g, "\t");
  14697. value = value.replace(/\\n/g, "\n");
  14698. value = value.replace(/\\r/g, "\r");
  14699. value = value.replace(/\\\"/g, "\"");
  14700. value = value.replace(/\\\'/g, "\'");
  14701. value = value.replace(/\\\\/g, "\\");
  14702. return value;
  14703. }
  14704. function toReal(value) {
  14705. return new _decimal2.default(value);
  14706. }
  14707. function toBool(str) {
  14708. var val = "'" + str + "'";
  14709. var lexer = _languageService.LanguageService.getCurrentLexer();
  14710. var instance = new lexer(null);
  14711. if (instance.literalNames[lexer.RK_TRUE] === val) {
  14712. return true;
  14713. } else if (instance.literalNames[lexer.RK_FALSE] === val) {
  14714. return false;
  14715. } else {
  14716. // TODO: better error message
  14717. throw new Error(str + "not a valid boolean");
  14718. }
  14719. }
  14720. function convertBoolToString(bool) {
  14721. var lexer = _languageService.LanguageService.getCurrentLexer();
  14722. var instance = new lexer(null);
  14723. if (bool) {
  14724. return instance.literalNames[lexer.RK_TRUE];
  14725. } else {
  14726. return instance.literalNames[lexer.RK_FALSE];
  14727. }
  14728. }
  14729. function convertToString(value, type) {
  14730. switch (type.ord) {
  14731. case _types.Types.INTEGER.ord:
  14732. return value.toString();
  14733. case _types.Types.REAL.ord:
  14734. {
  14735. if (value.dp() <= 0) {
  14736. return value.toFixed(1);
  14737. } else {
  14738. return value.toNumber();
  14739. }
  14740. }
  14741. case _types.Types.BOOLEAN.ord:
  14742. return convertBoolToString(value);
  14743. default:
  14744. return value;
  14745. }
  14746. }
  14747. /***/ }),
  14748. /***/ "./js/typeSystem/type.js":
  14749. /*!*******************************!*\
  14750. !*** ./js/typeSystem/type.js ***!
  14751. \*******************************/
  14752. /*! no static exports found */
  14753. /***/ (function(module, exports, __webpack_require__) {
  14754. "use strict";
  14755. Object.defineProperty(exports, "__esModule", {
  14756. value: true
  14757. });
  14758. exports.Type = undefined;
  14759. 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; }; }();
  14760. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  14761. var _baseTypes = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  14762. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14763. var Type = exports.Type = function () {
  14764. function Type(baseType) {
  14765. _classCallCheck(this, Type);
  14766. this.baseType = baseType;
  14767. }
  14768. _createClass(Type, [{
  14769. key: "stringInfo",
  14770. value: function stringInfo() {
  14771. return [{ type: this.baseType.name, dim: 0 }];
  14772. }
  14773. }, {
  14774. key: "isCompatible",
  14775. value: function isCompatible(another) {
  14776. if (another instanceof Type) {
  14777. return this.baseType.isCompatible(another.baseType);
  14778. }
  14779. return false;
  14780. }
  14781. }, {
  14782. key: "value",
  14783. get: function get() {
  14784. return this.baseType.value;
  14785. }
  14786. }, {
  14787. key: "ord",
  14788. get: function get() {
  14789. return this.baseType.ord;
  14790. }
  14791. }]);
  14792. return Type;
  14793. }();
  14794. /***/ }),
  14795. /***/ "./js/typeSystem/types.js":
  14796. /*!********************************!*\
  14797. !*** ./js/typeSystem/types.js ***!
  14798. \********************************/
  14799. /*! no static exports found */
  14800. /***/ (function(module, exports, __webpack_require__) {
  14801. "use strict";
  14802. Object.defineProperty(exports, "__esModule", {
  14803. value: true
  14804. });
  14805. exports.Types = undefined;
  14806. var _baseTypes = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  14807. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14808. var _multiType = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.js");
  14809. var INTEGER = new _type.Type(_baseTypes.BaseTypes.INTEGER);
  14810. var REAL = new _type.Type(_baseTypes.BaseTypes.REAL);
  14811. var STRING = new _type.Type(_baseTypes.BaseTypes.STRING);
  14812. var BOOLEAN = new _type.Type(_baseTypes.BaseTypes.BOOLEAN);
  14813. var VOID = new _type.Type(_baseTypes.BaseTypes.VOID);
  14814. var UNDEFINED = new _type.Type(_baseTypes.BaseTypes.UNDEFINED);
  14815. var ALL = new _multiType.MultiType([INTEGER, REAL, STRING, BOOLEAN]);
  14816. var Types = exports.Types = Object.freeze({
  14817. INTEGER: INTEGER,
  14818. REAL: REAL,
  14819. STRING: STRING,
  14820. BOOLEAN: BOOLEAN,
  14821. VOID: VOID,
  14822. UNDEFINED: UNDEFINED,
  14823. ALL: ALL
  14824. });
  14825. /***/ }),
  14826. /***/ "./js/util/config.js":
  14827. /*!***************************!*\
  14828. !*** ./js/util/config.js ***!
  14829. \***************************/
  14830. /*! no static exports found */
  14831. /***/ (function(module, exports, __webpack_require__) {
  14832. "use strict";
  14833. Object.defineProperty(exports, "__esModule", {
  14834. value: true
  14835. });
  14836. 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; }; }();
  14837. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14838. var ConfigObject = function () {
  14839. function ConfigObject() {
  14840. _classCallCheck(this, ConfigObject);
  14841. this.loopTimeout = 5000;
  14842. this.decimalPlaces = 5;
  14843. this.intConvertRoundMode = 2;
  14844. this.default_lang = 'pt';
  14845. this.enable_type_casting = true;
  14846. }
  14847. _createClass(ConfigObject, [{
  14848. key: 'setConfig',
  14849. value: function setConfig(opts) {
  14850. for (var key in opts) {
  14851. if (this.hasOwnProperty(key)) {
  14852. this[key] = opts[key];
  14853. }
  14854. }
  14855. }
  14856. }]);
  14857. return ConfigObject;
  14858. }();
  14859. var config = new ConfigObject();
  14860. var Config = exports.Config = config;
  14861. /***/ }),
  14862. /***/ "./js/util/inputTest.js":
  14863. /*!******************************!*\
  14864. !*** ./js/util/inputTest.js ***!
  14865. \******************************/
  14866. /*! no static exports found */
  14867. /***/ (function(module, exports, __webpack_require__) {
  14868. "use strict";
  14869. Object.defineProperty(exports, "__esModule", {
  14870. value: true
  14871. });
  14872. exports.InputTest = undefined;
  14873. 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; }; }();
  14874. var _input = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  14875. var _localizedStringsService = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14876. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14877. 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; }
  14878. 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; }
  14879. var InputTest = exports.InputTest = function (_Input) {
  14880. _inherits(InputTest, _Input);
  14881. function InputTest(inputList) {
  14882. _classCallCheck(this, InputTest);
  14883. var _this = _possibleConstructorReturn(this, (InputTest.__proto__ || Object.getPrototypeOf(InputTest)).call(this));
  14884. _this.index = 0;
  14885. _this.inputList = inputList;
  14886. return _this;
  14887. }
  14888. _createClass(InputTest, [{
  14889. key: 'requestInput',
  14890. value: function requestInput(callback) {
  14891. if (this.index < this.inputList.length) {
  14892. callback(this.inputList[this.index]);
  14893. this.index++;
  14894. } else {
  14895. throw new Error(_localizedStringsService.LocalizedStrings.getError("exceeded_input_request"));
  14896. }
  14897. }
  14898. }]);
  14899. return InputTest;
  14900. }(_input.Input);
  14901. /***/ }),
  14902. /***/ "./js/util/outputTest.js":
  14903. /*!*******************************!*\
  14904. !*** ./js/util/outputTest.js ***!
  14905. \*******************************/
  14906. /*! no static exports found */
  14907. /***/ (function(module, exports, __webpack_require__) {
  14908. "use strict";
  14909. Object.defineProperty(exports, "__esModule", {
  14910. value: true
  14911. });
  14912. exports.OutputTest = undefined;
  14913. 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; }; }();
  14914. var _output = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  14915. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14916. 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; }
  14917. 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; }
  14918. var OutputTest = exports.OutputTest = function (_Output) {
  14919. _inherits(OutputTest, _Output);
  14920. function OutputTest() {
  14921. _classCallCheck(this, OutputTest);
  14922. var _this = _possibleConstructorReturn(this, (OutputTest.__proto__ || Object.getPrototypeOf(OutputTest)).call(this));
  14923. _this.list = [];
  14924. return _this;
  14925. }
  14926. _createClass(OutputTest, [{
  14927. key: 'sendOutput',
  14928. value: function sendOutput(text) {
  14929. this.list.push(text);
  14930. }
  14931. }]);
  14932. return OutputTest;
  14933. }(_output.Output);
  14934. /***/ }),
  14935. /***/ "./js/visualUI/algorithm.js":
  14936. /*!**********************************!*\
  14937. !*** ./js/visualUI/algorithm.js ***!
  14938. \**********************************/
  14939. /*! no static exports found */
  14940. /***/ (function(module, exports, __webpack_require__) {
  14941. "use strict";
  14942. Object.defineProperty(exports, "__esModule", {
  14943. value: true
  14944. });
  14945. exports.renderAlgorithm = renderAlgorithm;
  14946. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14947. var _jquery2 = _interopRequireDefault(_jquery);
  14948. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  14949. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14950. var Models = _interopRequireWildcard(_ivprog_elements);
  14951. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14952. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  14953. var GlobalsManagement = _interopRequireWildcard(_globals);
  14954. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  14955. var VariablesManagement = _interopRequireWildcard(_variables);
  14956. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  14957. var CommandsManagement = _interopRequireWildcard(_commands);
  14958. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  14959. var CodeManagement = _interopRequireWildcard(_code_generator);
  14960. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14961. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  14962. var _functions = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
  14963. var FunctionsManagement = _interopRequireWildcard(_functions);
  14964. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  14965. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  14966. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  14967. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14968. 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; } }
  14969. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14970. window.block_render = false;
  14971. function renderAlgorithm() {
  14972. if (window.block_render) {
  14973. return;
  14974. }
  14975. if (window.draging) {
  14976. return;
  14977. }
  14978. window.block_render = true;
  14979. console.log('rendering algorithm');
  14980. (0, _jquery2.default)('.all_functions').children().off();
  14981. (0, _jquery2.default)('.all_functions').empty();
  14982. (0, _jquery2.default)('.list_globals').children().off();
  14983. (0, _jquery2.default)('.list_globals').empty();
  14984. for (var i = 0; i < window.program_obj.functions.length; i++) {
  14985. FunctionsManagement.renderFunction(window.program_obj.functions[i]);
  14986. }
  14987. for (var i = 0; i < window.program_obj.globals.length; i++) {
  14988. GlobalsManagement.renderGlobal(window.program_obj.globals[i]);
  14989. }
  14990. setTimeout(function () {
  14991. window.block_render = false;
  14992. }, 500);
  14993. }
  14994. /***/ }),
  14995. /***/ "./js/visualUI/code_generator.js":
  14996. /*!***************************************!*\
  14997. !*** ./js/visualUI/code_generator.js ***!
  14998. \***************************************/
  14999. /*! no static exports found */
  15000. /***/ (function(module, exports, __webpack_require__) {
  15001. "use strict";
  15002. Object.defineProperty(exports, "__esModule", {
  15003. value: true
  15004. });
  15005. exports.generate = generate;
  15006. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15007. var _jquery2 = _interopRequireDefault(_jquery);
  15008. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  15009. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15010. var Models = _interopRequireWildcard(_ivprog_elements);
  15011. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15012. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  15013. var GlobalsManagement = _interopRequireWildcard(_globals);
  15014. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  15015. var VariablesManagement = _interopRequireWildcard(_variables);
  15016. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  15017. var CommandsManagement = _interopRequireWildcard(_commands);
  15018. var _utils = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  15019. var Utils = _interopRequireWildcard(_utils);
  15020. 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; } }
  15021. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15022. function generate() {
  15023. (0, _jquery2.default)('.ivprog_visual_panel').find('.error_icon').remove();
  15024. var code = _localizedStringsService.LocalizedStrings.getUI('program') + ' { ';
  15025. code += globalsCode();
  15026. code += '\n';
  15027. var has_error = false;
  15028. for (var i = 0; i < window.program_obj.functions.length; i++) {
  15029. var n_code = functionsCode(window.program_obj.functions[i]);
  15030. if (n_code == null) {
  15031. has_error = true;
  15032. }
  15033. code += n_code;
  15034. code += '\n';
  15035. }
  15036. code += '\n}';
  15037. if (has_error) {
  15038. return null;
  15039. } else {
  15040. return code;
  15041. }
  15042. }
  15043. function functionsCode(function_obj) {
  15044. var ret = '\n\t' + _localizedStringsService.LocalizedStrings.getUI('function') + ' ';
  15045. var has_error = false;
  15046. switch (function_obj.return_type) {
  15047. case _types.Types.INTEGER:
  15048. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  15049. break;
  15050. case _types.Types.REAL:
  15051. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  15052. break;
  15053. case _types.Types.TEXT:
  15054. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  15055. break;
  15056. case _types.Types.BOOLEAN:
  15057. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  15058. break;
  15059. case _types.Types.VOID:
  15060. ret += _localizedStringsService.LocalizedStrings.getUI('void');
  15061. break;
  15062. }
  15063. ret += ' ';
  15064. if (function_obj.return_dimensions == 1) {
  15065. ret += '[] ';
  15066. } else if (function_obj.return_dimensions == 2) {
  15067. ret += '[][] ';
  15068. }
  15069. ret += function_obj.name + ' ( ';
  15070. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  15071. ret += parametersCode(function_obj.parameters_list[j]);
  15072. if (j + 1 < function_obj.parameters_list.length) {
  15073. ret += ',';
  15074. }
  15075. }
  15076. ret += ' ) {';
  15077. for (var j = 0; j < function_obj.variables_list.length; j++) {
  15078. ret += variablesCode(function_obj.variables_list[j]);
  15079. }
  15080. for (var j = 0; j < function_obj.commands.length; j++) {
  15081. try {
  15082. ret += commandsCode(function_obj.commands[j]);
  15083. } catch (err) {
  15084. has_error = true;
  15085. console.error(err.message);
  15086. var todos = (0, _jquery2.default)('body').find('.command_container');
  15087. for (var i = 0; i < todos.length; i++) {
  15088. if ((0, _jquery2.default)(todos[i]).data('command') == function_obj.commands[j]) {
  15089. (0, _jquery2.default)(todos[i]).prepend(' <i class="ui icon red exclamation triangle error_icon"></i> ');
  15090. break;
  15091. }
  15092. }
  15093. }
  15094. }
  15095. ret += '\n\t}';
  15096. if (has_error) {
  15097. return null;
  15098. } else {
  15099. return ret;
  15100. }
  15101. }
  15102. function commandsCode(command_obj) {
  15103. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  15104. switch (command_obj.type) {
  15105. case Models.COMMAND_TYPES.break:
  15106. return breaksCode(command_obj, indentation);
  15107. case Models.COMMAND_TYPES.comment:
  15108. return commentsCode(command_obj, indentation);
  15109. case Models.COMMAND_TYPES.reader:
  15110. return readersCode(command_obj, indentation);
  15111. case Models.COMMAND_TYPES.writer:
  15112. return writersCode(command_obj, indentation);
  15113. case Models.COMMAND_TYPES.functioncall:
  15114. return functioncallsCode(command_obj, indentation);
  15115. case Models.COMMAND_TYPES.attribution:
  15116. return attributionsCode(command_obj, indentation);
  15117. case Models.COMMAND_TYPES.whiletrue:
  15118. return whiletruesCode(command_obj, indentation);
  15119. case Models.COMMAND_TYPES.dowhiletrue:
  15120. return doWhilesCode(command_obj, indentation);
  15121. case Models.COMMAND_TYPES.iftrue:
  15122. return iftruesCode(command_obj, indentation);
  15123. case Models.COMMAND_TYPES.repeatNtimes:
  15124. return repeatNtimesCode(command_obj, indentation);
  15125. case Models.COMMAND_TYPES.switch:
  15126. return switchsCode(command_obj, indentation);
  15127. case Models.COMMAND_TYPES.return:
  15128. return returnsCode(command_obj, indentation);
  15129. }
  15130. }
  15131. function returnsCode(command_obj, indentation) {
  15132. var ret = '\n';
  15133. for (var i = 0; i < indentation; i++) {
  15134. ret += '\t';
  15135. }
  15136. ret += _localizedStringsService.LocalizedStrings.getUI('text_return');
  15137. if (command_obj.variable_value_menu) {
  15138. try {
  15139. ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu, true);
  15140. } catch (err) {}
  15141. }
  15142. return ret;
  15143. }
  15144. function breaksCode(command_obj, indentation) {
  15145. var ret = '\n';
  15146. for (var i = 0; i < indentation; i++) {
  15147. ret += '\t';
  15148. }
  15149. ret += _localizedStringsService.LocalizedStrings.getUI('text_break');
  15150. return ret;
  15151. }
  15152. function switchsCode(command_obj, indentation) {
  15153. var ret = '\n';
  15154. for (var i = 0; i < indentation; i++) {
  15155. ret += '\t';
  15156. }
  15157. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( ';
  15158. ret += variableValueMenuCode(command_obj.variable);
  15159. ret += ' ) { ';
  15160. if (command_obj.cases) {
  15161. for (var i = 0; i < command_obj.cases.length; i++) {
  15162. ret += switchcasesCode(command_obj.cases[i], indentation + 1);
  15163. }
  15164. }
  15165. ret += '\n';
  15166. for (var i = 0; i < indentation; i++) {
  15167. ret += '\t';
  15168. }
  15169. ret += '} ';
  15170. return ret;
  15171. }
  15172. function switchcasesCode(switchcase, indentation) {
  15173. var ret = '\n';
  15174. for (var i = 0; i < indentation; i++) {
  15175. ret += '\t';
  15176. }
  15177. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' ';
  15178. ret += variableValueMenuCode(switchcase.variable_value_menu);
  15179. ret += ' :';
  15180. if (switchcase.commands_block) {
  15181. for (var i = 0; i < switchcase.commands_block.length; i++) {
  15182. ret += commandsCode(switchcase.commands_block[i], indentation + 1);
  15183. }
  15184. }
  15185. return ret;
  15186. }
  15187. function repeatNtimesCode(command_obj, indentation) {
  15188. var ret = '\n';
  15189. for (var i = 0; i < indentation; i++) {
  15190. ret += '\t';
  15191. }
  15192. ret += _localizedStringsService.LocalizedStrings.getUI('text_for') + ' ( ';
  15193. if (command_obj.var_attribution) {
  15194. ret += variableValueMenuCode(command_obj.var_attribution);
  15195. ret += ' = ';
  15196. ret += variableValueMenuCode(command_obj.expression1);
  15197. }
  15198. ret += ' ; ';
  15199. if (command_obj.expression2) {
  15200. switch (command_obj.expression2.expression.type) {
  15201. case Models.EXPRESSION_TYPES.exp_logic:
  15202. ret += logicExpressionCode(command_obj.expression2.expression);
  15203. break;
  15204. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15205. ret += arithmeticExpressionCode(command_obj.expression2.expression);
  15206. break;
  15207. }
  15208. }
  15209. ret += ' ; ';
  15210. if (command_obj.var_incrementation) {
  15211. ret += variableValueMenuCode(command_obj.var_incrementation);
  15212. ret += ' = ';
  15213. ret += variableValueMenuCode(command_obj.expression3.itens[0]);
  15214. switch (command_obj.expression3.itens[1]) {
  15215. case Models.ARITHMETIC_TYPES.plus:
  15216. ret += ' + ';
  15217. break;
  15218. case Models.ARITHMETIC_TYPES.minus:
  15219. ret += ' - ';
  15220. break;
  15221. case Models.ARITHMETIC_TYPES.multiplication:
  15222. ret += ' * ';
  15223. break;
  15224. case Models.ARITHMETIC_TYPES.division:
  15225. ret += ' / ';
  15226. break;
  15227. case Models.ARITHMETIC_TYPES.module:
  15228. ret += ' % ';
  15229. break;
  15230. }
  15231. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  15232. }
  15233. ret += ' ) { ';
  15234. if (command_obj.commands_block) {
  15235. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15236. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15237. }
  15238. }
  15239. ret += '\n';
  15240. for (var i = 0; i < indentation; i++) {
  15241. ret += '\t';
  15242. }
  15243. ret += '}';
  15244. return ret;
  15245. }
  15246. function iftruesCode(command_obj, indentation) {
  15247. var ret = '\n';
  15248. for (var i = 0; i < indentation; i++) {
  15249. ret += '\t';
  15250. }
  15251. ret += _localizedStringsService.LocalizedStrings.getUI('text_if');
  15252. if (!command_obj.expression.expression) {
  15253. Utils.renderErrorMessage(command_obj.expression.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_expression'));
  15254. }
  15255. switch (command_obj.expression.expression.type) {
  15256. case Models.EXPRESSION_TYPES.exp_logic:
  15257. ret += logicExpressionCode(command_obj.expression.expression);
  15258. break;
  15259. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15260. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15261. break;
  15262. }
  15263. ret += ' { ';
  15264. if (command_obj.commands_block) {
  15265. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15266. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15267. }
  15268. }
  15269. ret += '\n';
  15270. for (var i = 0; i < indentation; i++) {
  15271. ret += '\t';
  15272. }
  15273. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' {';
  15274. if (command_obj.commands_else) {
  15275. for (var i = 0; i < command_obj.commands_else.length; i++) {
  15276. ret += commandsCode(command_obj.commands_else[i], indentation + 1);
  15277. }
  15278. }
  15279. ret += '\n';
  15280. for (var i = 0; i < indentation; i++) {
  15281. ret += '\t';
  15282. }
  15283. ret += '}';
  15284. return ret;
  15285. }
  15286. function doWhilesCode(command_obj, indentation) {
  15287. var ret = '\n';
  15288. for (var i = 0; i < indentation; i++) {
  15289. ret += '\t';
  15290. }
  15291. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_do') + ' { ';
  15292. if (command_obj.commands_block) {
  15293. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15294. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15295. }
  15296. }
  15297. ret += '\n';
  15298. for (var i = 0; i < indentation; i++) {
  15299. ret += '\t';
  15300. }
  15301. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15302. if (!command_obj.expression.expression) {
  15303. Utils.renderErrorMessage(command_obj.expression.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_expression'));
  15304. }
  15305. switch (command_obj.expression.expression.type) {
  15306. case Models.EXPRESSION_TYPES.exp_logic:
  15307. ret += logicExpressionCode(command_obj.expression.expression);
  15308. break;
  15309. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15310. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15311. break;
  15312. }
  15313. return ret;
  15314. }
  15315. function whiletruesCode(command_obj, indentation) {
  15316. var ret = '\n';
  15317. for (var i = 0; i < indentation; i++) {
  15318. ret += '\t';
  15319. }
  15320. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15321. if (!command_obj.expression.expression) {
  15322. Utils.renderErrorMessage(command_obj.expression.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_expression'));
  15323. }
  15324. switch (command_obj.expression.expression.type) {
  15325. case Models.EXPRESSION_TYPES.exp_logic:
  15326. ret += logicExpressionCode(command_obj.expression.expression);
  15327. break;
  15328. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15329. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15330. break;
  15331. }
  15332. ret += ' { ';
  15333. if (command_obj.commands_block) {
  15334. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15335. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15336. }
  15337. }
  15338. ret += '\n';
  15339. for (var i = 0; i < indentation; i++) {
  15340. ret += '\t';
  15341. }
  15342. ret += '}';
  15343. return ret;
  15344. }
  15345. function logicExpressionCode(expression) {
  15346. var ret = ' ( ';
  15347. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15348. ret += logicExpressionCode(expression.first_operand);
  15349. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15350. ret += arithmeticExpressionCode(expression.first_operand);
  15351. } else {
  15352. ret += variableValueMenuCode(expression.first_operand);
  15353. }
  15354. if (expression.operator) {
  15355. switch (expression.operator) {
  15356. case Models.LOGIC_COMPARISON.equals_to:
  15357. ret += ' == ';
  15358. break;
  15359. case Models.LOGIC_COMPARISON.not_equals_to:
  15360. ret += ' != ';
  15361. break;
  15362. case Models.LOGIC_COMPARISON.and:
  15363. ret += ' && ';
  15364. break;
  15365. case Models.LOGIC_COMPARISON.or:
  15366. ret += ' || ';
  15367. break;
  15368. }
  15369. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15370. ret += logicExpressionCode(expression.second_operand);
  15371. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15372. ret += arithmeticExpressionCode(expression.second_operand);
  15373. } else {
  15374. ret += variableValueMenuCode(expression.second_operand);
  15375. }
  15376. }
  15377. ret += ' ) ';
  15378. return ret;
  15379. }
  15380. function arithmeticExpressionCode(expression) {
  15381. var ret = ' ( ';
  15382. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15383. ret += logicExpressionCode(expression.first_operand);
  15384. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15385. ret += arithmeticExpressionCode(expression.first_operand);
  15386. } else {
  15387. ret += variableValueMenuCode(expression.first_operand);
  15388. }
  15389. switch (expression.operator) {
  15390. case Models.ARITHMETIC_COMPARISON.greater_than:
  15391. ret += ' > ';
  15392. break;
  15393. case Models.ARITHMETIC_COMPARISON.less_than:
  15394. ret += ' < ';
  15395. break;
  15396. case Models.ARITHMETIC_COMPARISON.equals_to:
  15397. ret += ' == ';
  15398. break;
  15399. case Models.ARITHMETIC_COMPARISON.not_equals_to:
  15400. ret += ' != ';
  15401. break;
  15402. case Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
  15403. ret += ' >= ';
  15404. break;
  15405. case Models.ARITHMETIC_COMPARISON.less_than_or_equals_to:
  15406. ret += ' <= ';
  15407. break;
  15408. }
  15409. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15410. ret += logicExpressionCode(expression.second_operand);
  15411. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15412. ret += arithmeticExpressionCode(expression.second_operand);
  15413. } else {
  15414. ret += variableValueMenuCode(expression.second_operand);
  15415. }
  15416. ret += ' ) ';
  15417. return ret;
  15418. }
  15419. function attributionsCode(command_obj, indentation) {
  15420. var ret = '\n';
  15421. for (var i = 0; i < indentation; i++) {
  15422. ret += '\t';
  15423. }
  15424. ret += variableValueMenuCode(command_obj.variable) + ' = ';
  15425. for (var i = 0; i < command_obj.expression.length; i++) {
  15426. ret += elementExpressionCode(command_obj.expression[i]);
  15427. }
  15428. return ret;
  15429. }
  15430. function elementExpressionCode(expression_obj) {
  15431. var ret = '';
  15432. for (var i = 0; i < expression_obj.itens.length; i++) {
  15433. if (expression_obj.itens[i].type) {
  15434. ret += variableValueMenuCode(expression_obj.itens[i]);
  15435. } else if (expression_obj.itens[i].type_exp) {
  15436. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15437. ret += ' ( ';
  15438. }
  15439. ret += elementExpressionCode(expression_obj.itens[i]);
  15440. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15441. ret += ' ) ';
  15442. }
  15443. } else {
  15444. switch (expression_obj.itens[i]) {
  15445. case Models.ARITHMETIC_TYPES.plus:
  15446. ret += ' + ';
  15447. break;
  15448. case Models.ARITHMETIC_TYPES.minus:
  15449. ret += ' - ';
  15450. break;
  15451. case Models.ARITHMETIC_TYPES.multiplication:
  15452. ret += ' * ';
  15453. break;
  15454. case Models.ARITHMETIC_TYPES.division:
  15455. ret += ' / ';
  15456. break;
  15457. case Models.ARITHMETIC_TYPES.module:
  15458. ret += ' % ';
  15459. break;
  15460. }
  15461. }
  15462. }
  15463. return ret;
  15464. }
  15465. function functioncallsCode(command_obj, indentation) {
  15466. var ret = '\n';
  15467. for (var i = 0; i < indentation; i++) {
  15468. ret += '\t';
  15469. }
  15470. ret += variableValueMenuCode(command_obj.function_called);
  15471. return ret;
  15472. }
  15473. function readersCode(command_obj, indentation) {
  15474. var ret = '\n';
  15475. for (var i = 0; i < indentation; i++) {
  15476. ret += '\t';
  15477. }
  15478. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( ';
  15479. ret += variableValueMenuCode(command_obj.variable_value_menu);
  15480. ret += ' ) ';
  15481. return ret;
  15482. }
  15483. function variableValueMenuCode(variable_obj) {
  15484. var is_return = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  15485. var ret = '';
  15486. try {
  15487. if (variable_obj.function_called) {
  15488. if (variable_obj.function_called.name) {
  15489. ret += variable_obj.function_called.name + ' ( ';
  15490. } else {
  15491. ret += _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + ' ( ';
  15492. }
  15493. if (variable_obj.parameters_list) {
  15494. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  15495. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  15496. if (i + 1 < variable_obj.parameters_list.length) {
  15497. ret += ', ';
  15498. }
  15499. }
  15500. }
  15501. ret += ' )';
  15502. } else if (variable_obj.content.type) {
  15503. ret += variable_obj.content.name;
  15504. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  15505. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15506. }
  15507. if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  15508. ret += ' [ ' + variableValueMenuCode(variable_obj.row) + ' ] ';
  15509. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15510. }
  15511. } else {
  15512. if (isNaN(variable_obj.content)) {
  15513. ret += '"' + variable_obj.content + '"';
  15514. } else {
  15515. ret += variable_obj.content;
  15516. }
  15517. }
  15518. } catch (err) {
  15519. if (!is_return) {
  15520. Utils.renderErrorMessage(variable_obj.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_content'));
  15521. throw err;
  15522. }
  15523. }
  15524. return ret;
  15525. }
  15526. function writersCode(command_obj, indentation) {
  15527. var ret = '\n';
  15528. for (var i = 0; i < indentation; i++) {
  15529. ret += '\t';
  15530. }
  15531. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( ';
  15532. for (var i = 0; i < command_obj.content.length; i++) {
  15533. ret += variableValueMenuCode(command_obj.content[i]);
  15534. if (i + 1 < command_obj.content.length) {
  15535. ret += ' + ';
  15536. }
  15537. }
  15538. ret += ' ) ';
  15539. return ret;
  15540. }
  15541. function commentsCode(command_obj, indentation) {
  15542. var ret = '\n';
  15543. for (var i = 0; i < indentation; i++) {
  15544. ret += '\t';
  15545. }
  15546. ret += '// ';
  15547. ret += command_obj.comment_text.content;
  15548. return ret;
  15549. }
  15550. function parametersCode(parameter_obj) {
  15551. var ret = '';
  15552. switch (parameter_obj.type) {
  15553. case _types.Types.INTEGER:
  15554. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15555. break;
  15556. case _types.Types.REAL:
  15557. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15558. break;
  15559. case _types.Types.TEXT:
  15560. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15561. break;
  15562. case _types.Types.BOOLEAN:
  15563. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15564. break;
  15565. }
  15566. ret += parameter_obj.name + '';
  15567. if (parameter_obj.dimensions == 1) {
  15568. ret += ' []';
  15569. } else if (parameter_obj.dimensions == 2) {
  15570. ret += ' [][]';
  15571. }
  15572. return ret;
  15573. }
  15574. function variablesCode(variable_obj) {
  15575. var ret = '';
  15576. var temp = variable_obj;
  15577. ret += '\n\t\t';
  15578. if (temp.is_constant) {
  15579. ret += 'const ';
  15580. }
  15581. switch (temp.type) {
  15582. case _types.Types.INTEGER:
  15583. ret += _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15584. break;
  15585. case _types.Types.REAL:
  15586. ret += _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15587. break;
  15588. case _types.Types.TEXT:
  15589. ret += _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15590. break;
  15591. case _types.Types.BOOLEAN:
  15592. ret += _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15593. break;
  15594. }
  15595. ret += temp.name + ' ';
  15596. if (temp.dimensions == 1) {
  15597. ret += '[' + temp.columns + '] ';
  15598. switch (temp.type) {
  15599. case _types.Types.INTEGER:
  15600. ret += '= {' + temp.value + '}';
  15601. break;
  15602. case _types.Types.REAL:
  15603. ret += '= {' + temp.value.toFixed(2) + '}';
  15604. break;
  15605. case _types.Types.TEXT:
  15606. ret += '= {';
  15607. for (var j = 0; j < temp.value.length; j++) {
  15608. ret += '"' + temp.value[j] + '"';
  15609. if (j + 1 < temp.value.length) {
  15610. ret += ',';
  15611. }
  15612. }
  15613. ret += '}';
  15614. break;
  15615. case _types.Types.BOOLEAN:
  15616. ret += '= {';
  15617. for (var j = 0; j < temp.value.length; j++) {
  15618. if (temp.value[j]) {
  15619. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15620. } else {
  15621. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15622. }
  15623. if (j + 1 < temp.value.length) {
  15624. ret += ',';
  15625. }
  15626. }
  15627. ret += '}';
  15628. break;
  15629. }
  15630. } else if (temp.dimensions == 2) {
  15631. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15632. switch (temp.type) {
  15633. case _types.Types.INTEGER:
  15634. ret += '= {';
  15635. for (var j = 0; j < temp.rows; j++) {
  15636. ret += '{' + temp.value[j] + '}';
  15637. if (j + 1 < temp.rows) {
  15638. ret += ',';
  15639. }
  15640. }
  15641. ret += '}';
  15642. break;
  15643. case _types.Types.REAL:
  15644. ret += '= {';
  15645. for (var j = 0; j < temp.rows; j++) {
  15646. ret += '{' + temp.value[j].toFixed(2) + '}';
  15647. if (j + 1 < temp.rows) {
  15648. ret += ',';
  15649. }
  15650. }
  15651. ret += '}';
  15652. break;
  15653. case _types.Types.TEXT:
  15654. ret += '= {';
  15655. for (var j = 0; j < temp.rows; j++) {
  15656. ret += '{';
  15657. for (var k = 0; k < temp.columns; k++) {
  15658. ret += '"' + temp.value[j][k] + '"';
  15659. if (k + 1 < temp.columns) {
  15660. ret += ',';
  15661. }
  15662. }
  15663. ret += '}';
  15664. if (j + 1 < temp.rows) {
  15665. ret += ',';
  15666. }
  15667. }
  15668. ret += '}';
  15669. break;
  15670. case _types.Types.BOOLEAN:
  15671. ret += '= {';
  15672. for (var j = 0; j < temp.rows; j++) {
  15673. ret += '{';
  15674. for (var k = 0; k < temp.columns; k++) {
  15675. if (temp.value[j][k]) {
  15676. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15677. } else {
  15678. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15679. }
  15680. if (k + 1 < temp.columns) {
  15681. ret += ',';
  15682. }
  15683. }
  15684. ret += '}';
  15685. if (j + 1 < temp.rows) {
  15686. ret += ',';
  15687. }
  15688. }
  15689. ret += '}';
  15690. break;
  15691. }
  15692. } else {
  15693. switch (temp.type) {
  15694. case _types.Types.INTEGER:
  15695. ret += '= ' + temp.value;
  15696. break;
  15697. case _types.Types.REAL:
  15698. ret += '= ' + temp.value.toFixed(2);
  15699. break;
  15700. case _types.Types.TEXT:
  15701. ret += '= "' + temp.value + '"';
  15702. break;
  15703. case _types.Types.BOOLEAN:
  15704. ret += '= ';
  15705. if (temp.value) {
  15706. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15707. } else {
  15708. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15709. }
  15710. break;
  15711. }
  15712. }
  15713. return ret;
  15714. }
  15715. function globalsCode() {
  15716. var ret = '';
  15717. if (window.program_obj.globals) {
  15718. for (var i = 0; i < window.program_obj.globals.length; i++) {
  15719. var temp = window.program_obj.globals[i];
  15720. ret += '\n\t';
  15721. if (temp.is_constant) {
  15722. ret += 'const ';
  15723. }
  15724. switch (temp.type) {
  15725. case _types.Types.INTEGER:
  15726. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  15727. break;
  15728. case _types.Types.REAL:
  15729. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  15730. break;
  15731. case _types.Types.TEXT:
  15732. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  15733. break;
  15734. case _types.Types.BOOLEAN:
  15735. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  15736. break;
  15737. }
  15738. ret += ' ' + temp.name + ' ';
  15739. if (temp.dimensions == 1) {
  15740. ret += '[' + temp.columns + '] ';
  15741. switch (temp.type) {
  15742. case _types.Types.INTEGER:
  15743. ret += '= {' + temp.value + '}';
  15744. break;
  15745. case _types.Types.REAL:
  15746. ret += '= {';
  15747. for (var j = 0; j < temp.value.length; j++) {
  15748. ret += temp.value[j].toFixed(2);
  15749. if (j + 1 < temp.value.length) {
  15750. ret += ',';
  15751. }
  15752. }
  15753. ret += '}';
  15754. break;
  15755. case _types.Types.TEXT:
  15756. ret += '= {';
  15757. for (var j = 0; j < temp.value.length; j++) {
  15758. ret += '"' + temp.value[j] + '"';
  15759. if (j + 1 < temp.value.length) {
  15760. ret += ',';
  15761. }
  15762. }
  15763. ret += '}';
  15764. break;
  15765. case _types.Types.BOOLEAN:
  15766. ret += '= {';
  15767. for (var j = 0; j < temp.value.length; j++) {
  15768. if (temp.value[j]) {
  15769. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15770. } else {
  15771. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15772. }
  15773. if (j + 1 < temp.value.length) {
  15774. ret += ',';
  15775. }
  15776. }
  15777. ret += '}';
  15778. break;
  15779. }
  15780. } else if (temp.dimensions == 2) {
  15781. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15782. switch (temp.type) {
  15783. case _types.Types.INTEGER:
  15784. ret += '= {';
  15785. for (var j = 0; j < temp.rows; j++) {
  15786. ret += '{' + temp.value[j] + '}';
  15787. if (j + 1 < temp.rows) {
  15788. ret += ',';
  15789. }
  15790. }
  15791. ret += '}';
  15792. break;
  15793. case _types.Types.REAL:
  15794. ret += '= {';
  15795. for (var j = 0; j < temp.rows; j++) {
  15796. ret += '{';
  15797. for (var k = 0; k < temp.columns; k++) {
  15798. ret += temp.value[j][k].toFixed(2);
  15799. if (k + 1 < temp.columns) {
  15800. ret += ',';
  15801. }
  15802. }
  15803. ret += '}';
  15804. if (j + 1 < temp.rows) {
  15805. ret += ',';
  15806. }
  15807. }
  15808. ret += '}';
  15809. break;
  15810. case _types.Types.TEXT:
  15811. ret += '= {';
  15812. for (var j = 0; j < temp.rows; j++) {
  15813. ret += '{';
  15814. for (var k = 0; k < temp.columns; k++) {
  15815. ret += '"' + temp.value[j][k] + '"';
  15816. if (k + 1 < temp.columns) {
  15817. ret += ',';
  15818. }
  15819. }
  15820. ret += '}';
  15821. if (j + 1 < temp.rows) {
  15822. ret += ',';
  15823. }
  15824. }
  15825. ret += '}';
  15826. break;
  15827. case _types.Types.BOOLEAN:
  15828. ret += '= {';
  15829. for (var j = 0; j < temp.rows; j++) {
  15830. ret += '{';
  15831. for (var k = 0; k < temp.columns; k++) {
  15832. if (temp.value[j][k]) {
  15833. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15834. } else {
  15835. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15836. }
  15837. if (k + 1 < temp.columns) {
  15838. ret += ',';
  15839. }
  15840. }
  15841. ret += '}';
  15842. if (j + 1 < temp.rows) {
  15843. ret += ',';
  15844. }
  15845. }
  15846. ret += '}';
  15847. break;
  15848. }
  15849. } else {
  15850. switch (temp.type) {
  15851. case _types.Types.INTEGER:
  15852. ret += '= ' + temp.value;
  15853. break;
  15854. case _types.Types.REAL:
  15855. ret += '= ' + temp.value.toFixed(2);
  15856. break;
  15857. case _types.Types.TEXT:
  15858. ret += '= "' + temp.value + '"';
  15859. break;
  15860. case _types.Types.BOOLEAN:
  15861. ret += '= ';
  15862. if (temp.value) {
  15863. ret += _localizedStringsService.LocalizedStrings.getUI("true");;
  15864. } else {
  15865. ret += _localizedStringsService.LocalizedStrings.getUI("false");;
  15866. }
  15867. break;
  15868. }
  15869. }
  15870. }
  15871. }
  15872. return ret;
  15873. }
  15874. /***/ }),
  15875. /***/ "./js/visualUI/commands.js":
  15876. /*!*********************************!*\
  15877. !*** ./js/visualUI/commands.js ***!
  15878. \*********************************/
  15879. /*! no static exports found */
  15880. /***/ (function(module, exports, __webpack_require__) {
  15881. "use strict";
  15882. Object.defineProperty(exports, "__esModule", {
  15883. value: true
  15884. });
  15885. exports.removeCommand = removeCommand;
  15886. exports.createFloatingCommand = createFloatingCommand;
  15887. exports.renderCommand = renderCommand;
  15888. exports.genericCreateCommand = genericCreateCommand;
  15889. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15890. var _jquery2 = _interopRequireDefault(_jquery);
  15891. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  15892. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15893. var Models = _interopRequireWildcard(_ivprog_elements);
  15894. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15895. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  15896. var GlobalsManagement = _interopRequireWildcard(_globals);
  15897. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  15898. var VariablesManagement = _interopRequireWildcard(_variables);
  15899. var _comment = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  15900. var CommentsManagement = _interopRequireWildcard(_comment);
  15901. var _reader = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  15902. var ReadersManagement = _interopRequireWildcard(_reader);
  15903. var _writer = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  15904. var WritersManagement = _interopRequireWildcard(_writer);
  15905. var _attribution = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  15906. var AttributionsManagement = _interopRequireWildcard(_attribution);
  15907. var _iftrue = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  15908. var IftruesManagement = _interopRequireWildcard(_iftrue);
  15909. var _repeatNtimes = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  15910. var RepeatNtimesManagement = _interopRequireWildcard(_repeatNtimes);
  15911. var _whiletrue = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  15912. var WhiletruesManagement = _interopRequireWildcard(_whiletrue);
  15913. var _dowhiletrue = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  15914. var DowhiletruesManagement = _interopRequireWildcard(_dowhiletrue);
  15915. var _switch = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  15916. var SwitchesManagement = _interopRequireWildcard(_switch);
  15917. var _functioncall = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  15918. var FunctioncallsManagement = _interopRequireWildcard(_functioncall);
  15919. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15920. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  15921. var _break = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  15922. var BreaksManagement = _interopRequireWildcard(_break);
  15923. var _return = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  15924. var ReturnsManagement = _interopRequireWildcard(_return);
  15925. 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; } }
  15926. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15927. var has_element_created_draged = false;
  15928. var which_element_is_draged = null;
  15929. function removeCommand(command, function_obj, dom_obj) {
  15930. if (function_obj.commands.indexOf(command) > -1) {
  15931. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  15932. return true;
  15933. }
  15934. // Utilize dois parantNode, pois o primeiro é o div de comandos
  15935. try {
  15936. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  15937. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  15938. return true;
  15939. }
  15940. } catch (err) {}
  15941. try {
  15942. if (dom_obj.parent().parent().data('command').type == Models.COMMAND_TYPES.iftrue) {
  15943. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  15944. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  15945. return true;
  15946. }
  15947. }
  15948. } catch (err) {}
  15949. if (dom_obj.parent().data('switchcase')) {
  15950. console.log("o que encontrei: ");
  15951. console.log(dom_obj.parent().data('switchcase'));
  15952. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  15953. return true;
  15954. }
  15955. return false;
  15956. }
  15957. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  15958. var floatingObject;
  15959. switch (command_type) {
  15960. case Models.COMMAND_TYPES.break:
  15961. floatingObject = BreaksManagement.createFloatingCommand();
  15962. break;
  15963. case Models.COMMAND_TYPES.comment:
  15964. floatingObject = CommentsManagement.createFloatingCommand();
  15965. break;
  15966. case Models.COMMAND_TYPES.reader:
  15967. floatingObject = ReadersManagement.createFloatingCommand();
  15968. break;
  15969. case Models.COMMAND_TYPES.writer:
  15970. floatingObject = WritersManagement.createFloatingCommand();
  15971. break;
  15972. case Models.COMMAND_TYPES.attribution:
  15973. floatingObject = AttributionsManagement.createFloatingCommand();
  15974. break;
  15975. case Models.COMMAND_TYPES.iftrue:
  15976. floatingObject = IftruesManagement.createFloatingCommand();
  15977. break;
  15978. case Models.COMMAND_TYPES.repeatNtimes:
  15979. floatingObject = RepeatNtimesManagement.createFloatingCommand();
  15980. break;
  15981. case Models.COMMAND_TYPES.whiletrue:
  15982. floatingObject = WhiletruesManagement.createFloatingCommand();
  15983. break;
  15984. case Models.COMMAND_TYPES.dowhiletrue:
  15985. floatingObject = DowhiletruesManagement.createFloatingCommand();
  15986. break;
  15987. case Models.COMMAND_TYPES.switch:
  15988. floatingObject = SwitchesManagement.createFloatingCommand();
  15989. break;
  15990. case Models.COMMAND_TYPES.functioncall:
  15991. floatingObject = FunctioncallsManagement.createFloatingCommand();
  15992. break;
  15993. case Models.COMMAND_TYPES.return:
  15994. floatingObject = ReturnsManagement.createFloatingCommand();
  15995. break;
  15996. }
  15997. floatingObject.draggable({
  15998. drag: function drag(evt) {
  15999. borderMouseDragCommand(function_obj, function_container, evt);
  16000. },
  16001. stop: function stop(evt) {
  16002. function_container.find('.over_command_drag').each(function (index) {
  16003. (0, _jquery2.default)(this).removeClass('over_command_drag');
  16004. });
  16005. }
  16006. }).appendTo("body");
  16007. floatingObject.mouseup(function (evt) {
  16008. manageCommand(function_obj, function_container, evt, command_type);
  16009. });
  16010. floatingObject.css("position", "absolute");
  16011. mouse_event.type = "mousedown.draggable";
  16012. mouse_event.target = floatingObject[0];
  16013. floatingObject.css("left", mouse_event.pageX - 15);
  16014. floatingObject.css("top", mouse_event.pageY - 15);
  16015. floatingObject.trigger(mouse_event);
  16016. }
  16017. function borderMouseDragCommand(function_obj, function_container, evt) {
  16018. function_container.find('.over_command_drag').each(function (index) {
  16019. (0, _jquery2.default)(this).removeClass('over_command_drag');
  16020. });
  16021. var prev = null;
  16022. function_container.find('.commands_list_div').each(function (index) {
  16023. prev = (0, _jquery2.default)(this);
  16024. if (prev) {
  16025. var objLeft = prev.offset().left;
  16026. var objTop = prev.offset().top;
  16027. var objRight = objLeft + prev.width();
  16028. var objBottom = objTop + prev.height();
  16029. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  16030. prev.addClass("over_command_drag");
  16031. }
  16032. }
  16033. });
  16034. function_container.find('.command_container').each(function (index) {
  16035. var obj = (0, _jquery2.default)(this);
  16036. var objLeft = obj.offset().left;
  16037. var objTop = obj.offset().top;
  16038. var objRight = objLeft + obj.width();
  16039. var objBottom = objTop + obj.height();
  16040. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  16041. if (prev) {
  16042. prev.removeClass('over_command_drag');
  16043. }
  16044. obj.addClass("over_command_drag");
  16045. return;
  16046. }
  16047. });
  16048. }
  16049. // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  16050. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  16051. var createdElement;
  16052. switch (command.type) {
  16053. case Models.COMMAND_TYPES.comment:
  16054. createdElement = CommentsManagement.renderCommand(command, function_obj);
  16055. break;
  16056. case Models.COMMAND_TYPES.break:
  16057. createdElement = BreaksManagement.renderCommand(command, function_obj);
  16058. break;
  16059. case Models.COMMAND_TYPES.reader:
  16060. createdElement = ReadersManagement.renderCommand(command, function_obj);
  16061. break;
  16062. case Models.COMMAND_TYPES.writer:
  16063. createdElement = WritersManagement.renderCommand(command, function_obj);
  16064. break;
  16065. case Models.COMMAND_TYPES.attribution:
  16066. createdElement = AttributionsManagement.renderCommand(command, function_obj);
  16067. break;
  16068. case Models.COMMAND_TYPES.functioncall:
  16069. createdElement = FunctioncallsManagement.renderCommand(command, function_obj);
  16070. break;
  16071. case Models.COMMAND_TYPES.iftrue:
  16072. createdElement = IftruesManagement.renderCommand(command, function_obj);
  16073. break;
  16074. case Models.COMMAND_TYPES.repeatNtimes:
  16075. createdElement = RepeatNtimesManagement.renderCommand(command, function_obj);
  16076. break;
  16077. case Models.COMMAND_TYPES.whiletrue:
  16078. createdElement = WhiletruesManagement.renderCommand(command, function_obj);
  16079. break;
  16080. case Models.COMMAND_TYPES.dowhiletrue:
  16081. createdElement = DowhiletruesManagement.renderCommand(command, function_obj);
  16082. break;
  16083. case Models.COMMAND_TYPES.switch:
  16084. createdElement = SwitchesManagement.renderCommand(command, function_obj);
  16085. break;
  16086. case Models.COMMAND_TYPES.return:
  16087. createdElement = ReturnsManagement.renderCommand(command, function_obj);
  16088. break;
  16089. }
  16090. switch (before_after_inside) {
  16091. case 1:
  16092. createdElement.insertBefore(element_reference);
  16093. break;
  16094. case 2:
  16095. createdElement.insertAfter(element_reference);
  16096. break;
  16097. case 3:
  16098. element_reference.append(createdElement);
  16099. break;
  16100. }
  16101. }
  16102. function genericCreateCommand(command_type) {
  16103. switch (command_type) {
  16104. case Models.COMMAND_TYPES.break:
  16105. return new Models.Break();
  16106. case Models.COMMAND_TYPES.comment:
  16107. return new Models.Comment(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_value, _localizedStringsService.LocalizedStrings.getUI('text_comment'), null, null, false));
  16108. case Models.COMMAND_TYPES.reader:
  16109. return new Models.Reader(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false));
  16110. case Models.COMMAND_TYPES.writer:
  16111. return new Models.Writer([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16112. case Models.COMMAND_TYPES.attribution:
  16113. return new Models.Attribution(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), []);
  16114. case Models.COMMAND_TYPES.functioncall:
  16115. return new Models.FunctionCall(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_function, null, null, null, false), null);
  16116. case Models.COMMAND_TYPES.iftrue:
  16117. return new Models.IfTrue(new Models.ConditionalExpression(null), null, null);
  16118. case Models.COMMAND_TYPES.repeatNtimes:
  16119. 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);
  16120. case Models.COMMAND_TYPES.whiletrue:
  16121. return new Models.WhileTrue(new Models.ConditionalExpression(null), null);
  16122. case Models.COMMAND_TYPES.dowhiletrue:
  16123. return new Models.DoWhileTrue(new Models.ConditionalExpression(null), null);
  16124. case Models.COMMAND_TYPES.switch:
  16125. var sc = [new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true))];
  16126. return new Models.Switch(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true), sc);
  16127. case Models.COMMAND_TYPES.return:
  16128. return new Models.Return(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16129. }
  16130. }
  16131. function dragTrash(event) {
  16132. var trash = (0, _jquery2.default)('<i class="ui icon trash alternate outline"></i>');
  16133. (0, _jquery2.default)('body').append(trash);
  16134. trash.css('position', 'absolute');
  16135. trash.css('top', event.clientY);
  16136. trash.css('left', event.clientX - 20);
  16137. trash.css('font-size', '3em');
  16138. trash.css('display', 'none');
  16139. trash.fadeIn(200, function () {
  16140. trash.fadeOut(200, function () {
  16141. trash.remove();
  16142. });
  16143. });
  16144. }
  16145. function manageCommand(function_obj, function_container, event, command_type) {
  16146. (0, _jquery2.default)(".created_element").each(function (index) {
  16147. (0, _jquery2.default)(this).remove();
  16148. });
  16149. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  16150. console.log('soltou no: ');
  16151. console.log(el);
  16152. console.log(el.data('fun'));
  16153. // Primeiro verificar se ele soltou no espaço da função correta:
  16154. var hier = el.parentsUntil(".all_functions");
  16155. var esta_correto = false;
  16156. var esta_na_div_correta = false;
  16157. if (el.hasClass("commands_list_div")) {
  16158. esta_na_div_correta = true;
  16159. }
  16160. for (var i = 0; i < hier.length; i++) {
  16161. var temp = (0, _jquery2.default)(hier[i]);
  16162. if (temp.hasClass("commands_list_div")) {
  16163. esta_na_div_correta = true;
  16164. }
  16165. if (temp.data('fun') == function_obj) {
  16166. esta_correto = true;
  16167. break;
  16168. }
  16169. }
  16170. if (!esta_correto) {
  16171. has_element_created_draged = false;
  16172. which_element_is_draged = null;
  16173. dragTrash(event);
  16174. return;
  16175. } else {
  16176. if (!esta_na_div_correta) {
  16177. has_element_created_draged = false;
  16178. which_element_is_draged = null;
  16179. dragTrash(event);
  16180. return;
  16181. }
  16182. }
  16183. // Agora é descobrir qual o escopo para adicionar o comando:
  16184. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  16185. if (typeof el.data('fun') !== 'undefined') {
  16186. // Se a lista de comandos estiver vazia, então é o primeiro.
  16187. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  16188. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  16189. // pode adicionar
  16190. el.data('fun').commands = [];
  16191. var new_cmd = genericCreateCommand(command_type);
  16192. el.data('fun').commands.push(new_cmd);
  16193. renderCommand(new_cmd, (0, _jquery2.default)(function_container).find('.commands_list_div'), 3, function_obj);
  16194. } else {
  16195. // Entra nesse else, caso já existam outros comandos no bloco:
  16196. findNearbyCommandToAddInFunctionScope(el, event, (0, _jquery2.default)(function_container).find('.commands_list_div'), function_obj, command_type);
  16197. }
  16198. } else {
  16199. console.log("soltou em um comando");
  16200. // descobrir em qual comando ele soltou:
  16201. var hier_find = el.parentsUntil(".commands_list_div");
  16202. var hierarquia_bottom_up = [];
  16203. if (typeof el.data('command') !== 'undefined') {
  16204. hierarquia_bottom_up.push(el.data('command'));
  16205. }
  16206. for (var i = 0; i < hier_find.length; i++) {
  16207. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16208. hierarquia_bottom_up.push((0, _jquery2.default)(hier_find[i]).data('command'));
  16209. }
  16210. }
  16211. console.log("comando em que soltou: ");
  16212. console.log(hierarquia_bottom_up[0]);
  16213. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  16214. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  16215. console.log(hierarquia_bottom_up[i]);
  16216. }
  16217. // Se for do tipo break, verificar se está no contexto correto:
  16218. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  16219. var is_correct_context = false;
  16220. if (command_type == Models.COMMAND_TYPES.break) {
  16221. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  16222. 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) {
  16223. is_correct_context = true;
  16224. break;
  16225. }
  16226. }
  16227. if (!is_correct_context) {
  16228. console.error("Context not allowed to insert BREAK COMMAND!");
  16229. return;
  16230. }
  16231. }
  16232. // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  16233. if (hierarquia_bottom_up.length == 1) {
  16234. console.log('QQ1');
  16235. var sub_elemento = false;
  16236. for (var i = 0; i < hier_find.length; i++) {
  16237. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16238. console.log('QQ2');
  16239. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  16240. sub_elemento = true;
  16241. break;
  16242. }
  16243. }
  16244. if (!sub_elemento) {
  16245. console.log('QQ3');
  16246. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  16247. }
  16248. } else {
  16249. console.log('QQ4');
  16250. // caso exista mais de um elemento na hierarquia:
  16251. if (typeof (0, _jquery2.default)(el).data('command') !== 'undefined') {
  16252. console.log('QQ5');
  16253. console.log("PPP1");
  16254. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  16255. } else {
  16256. console.log('QQ6');
  16257. var sub_elemento = false;
  16258. for (var i = 0; i < hier_find.length; i++) {
  16259. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16260. console.log('QQ7');
  16261. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  16262. sub_elemento = true;
  16263. break;
  16264. }
  16265. }
  16266. }
  16267. }
  16268. }
  16269. has_element_created_draged = false;
  16270. which_element_is_draged = null;
  16271. renderAlgorithm();
  16272. }
  16273. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  16274. var el_jq = (0, _jquery2.default)(el);
  16275. var command_parent = el_jq.data('command');
  16276. 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) {
  16277. console.log('QQ17');
  16278. 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) {
  16279. console.log('QQ18');
  16280. // Se não tiver outro comando ainda no bloco, só adiciona:
  16281. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16282. command_parent.commands_block = [];
  16283. var recentComand = genericCreateCommand(command_type);
  16284. command_parent.commands_block.push(recentComand);
  16285. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16286. } else {
  16287. // Se já tem algum comando no bloco:
  16288. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  16289. }
  16290. } else {
  16291. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  16292. addCommandToSwitchCase(event, function_obj, command_type);
  16293. }
  16294. } else {
  16295. console.log('QQ19');
  16296. // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  16297. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  16298. }
  16299. }
  16300. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  16301. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16302. var menor_distancia = 999999999;
  16303. var elemento_menor_distancia = null;
  16304. var antes = true;
  16305. var t_bot;
  16306. var t_top;
  16307. // Descobrindo o elemento mais próximo:
  16308. for (var i = 0; i < all_sub.length; i++) {
  16309. t_top = all_sub[i].getBoundingClientRect().top;
  16310. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16311. if (t_top - event.clientY < menor_distancia) {
  16312. menor_distancia = event.clientY - t_top;
  16313. elemento_menor_distancia = all_sub[i];
  16314. }
  16315. }
  16316. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16317. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16318. if (borda_inferior - event.clientY < menor_distancia) {
  16319. var recentComand = genericCreateCommand(command_type);
  16320. command_parent.commands_block.push(recentComand);
  16321. //
  16322. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16323. } else {
  16324. var recentComand = genericCreateCommand(command_type);
  16325. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16326. if (index > -1) {
  16327. command_parent.commands_block.splice(index, 0, recentComand);
  16328. }
  16329. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16330. }
  16331. }
  16332. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  16333. var el_jq = (0, _jquery2.default)(el);
  16334. var command_parent = (0, _jquery2.default)(el.parentNode.parentNode).data('command');
  16335. var command_target = el_jq.data('command');
  16336. var temp_parent = (0, _jquery2.default)(el.parentNode.parentNode);
  16337. var is_in_else = false;
  16338. if (!command_parent) {
  16339. command_parent = el_jq.data('command');
  16340. temp_parent = el_jq;
  16341. var hier = el_jq.parentsUntil(".command_container");
  16342. for (var i = 0; i < hier.length; i++) {
  16343. var temp = (0, _jquery2.default)(hier[i]);
  16344. if (typeof temp.data('else') != 'undefined') {
  16345. is_in_else = true;
  16346. }
  16347. if (typeof temp.data('command') != 'undefined') {
  16348. command_parent = temp.data('command');
  16349. temp_parent = temp;
  16350. }
  16351. }
  16352. }
  16353. var hier = el_jq.parentsUntil(".command_container");
  16354. for (var i = 0; i < hier.length; i++) {
  16355. var temp = (0, _jquery2.default)(hier[i]);
  16356. if (typeof temp.data('else') != 'undefined') {
  16357. is_in_else = true;
  16358. }
  16359. }
  16360. if (command_parent == command_target) {
  16361. var hier = el_jq.parentsUntil(".command_container");
  16362. for (var i = 0; i < hier.length; i++) {
  16363. var temp = (0, _jquery2.default)(hier[i]);
  16364. if (typeof temp.data('else') !== 'undefined') {
  16365. is_in_else = true;
  16366. break;
  16367. }
  16368. }
  16369. }
  16370. if (command_parent.type != Models.COMMAND_TYPES.iftrue && command_parent.type != Models.COMMAND_TYPES.switch) {
  16371. var hier = temp_parent.parentsUntil(".all_cases_div");
  16372. console.log("vou procurar!!");
  16373. for (var i = 0; i < hier.length; i++) {
  16374. console.log("estou vasculhando...");
  16375. var temp = (0, _jquery2.default)(hier[i]);
  16376. if (typeof temp.data('switchcase') !== 'undefined') {
  16377. console.log("encontrei");
  16378. command_parent = temp.data('switchcase');
  16379. is_in_else = false;
  16380. break;
  16381. }
  16382. }
  16383. }
  16384. console.log('debugging:');
  16385. console.log('el_jq');
  16386. console.log(el_jq);
  16387. console.log('command_parent');
  16388. console.log(command_parent);
  16389. console.log('command_target');
  16390. console.log(command_target);
  16391. var menor_distancia = 999999999;
  16392. var antes = true;
  16393. var t_bot;
  16394. var t_top;
  16395. t_top = el.getBoundingClientRect().top;
  16396. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16397. var d_top = event.clientY - t_top; // distancia topo
  16398. var d_bot = t_bot - event.clientY; // distancia baixo
  16399. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16400. if (d_top < d_bot) {
  16401. var recentComand = genericCreateCommand(command_type);
  16402. console.log('MMM1');
  16403. if (is_in_else) {
  16404. console.log('MMM2');
  16405. if (command_parent == command_target) {
  16406. console.log('MMM3');
  16407. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16408. command_parent.commands_else = [];
  16409. var recentComand = genericCreateCommand(command_type);
  16410. command_parent.commands_else.push(recentComand);
  16411. renderCommand(recentComand, el_jq, 3, function_obj);
  16412. } else {
  16413. // Se já tem algum comando no bloco:
  16414. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16415. }
  16416. return;
  16417. }
  16418. console.log('MMM7');
  16419. var index = command_parent.commands_else.indexOf(command_target);
  16420. if (index > -1) {
  16421. command_parent.commands_else.splice(index, 0, recentComand);
  16422. }
  16423. renderCommand(recentComand, el, 1, function_obj);
  16424. } else {
  16425. console.log('MMM4');
  16426. if (command_parent == command_target) {
  16427. console.log('Nxxxx5');
  16428. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16429. command_parent.commands_block = [];
  16430. console.log('SSS4');
  16431. var recentComand = genericCreateCommand(command_type);
  16432. command_parent.commands_block.push(recentComand);
  16433. renderCommand(recentComand, el_jq, 3, function_obj);
  16434. } else {
  16435. console.log('SSS5');
  16436. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16437. }
  16438. return;
  16439. }
  16440. console.log('MMM6');
  16441. var index = command_parent.commands_block.indexOf(command_target);
  16442. if (index > -1) {
  16443. command_parent.commands_block.splice(index, 0, recentComand);
  16444. }
  16445. renderCommand(recentComand, el, 1, function_obj);
  16446. }
  16447. } else {
  16448. console.log('XXX1');
  16449. var recentComand = genericCreateCommand(command_type);
  16450. if (is_in_else) {
  16451. if (command_parent == command_target) {
  16452. console.log('MMM3');
  16453. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16454. command_parent.commands_else = [];
  16455. console.log('SSS1');
  16456. var recentComand = genericCreateCommand(command_type);
  16457. command_parent.commands_else.push(recentComand);
  16458. renderCommand(recentComand, el_jq, 3, function_obj);
  16459. } else {
  16460. // Se já tem algum comando no bloco:
  16461. console.log('SSS2');
  16462. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16463. }
  16464. return;
  16465. }
  16466. console.log('XXX2');
  16467. var index = command_parent.commands_else.indexOf(command_target);
  16468. if (index > -1) {
  16469. command_parent.commands_else.splice(index + 1, 0, recentComand);
  16470. }
  16471. renderCommand(recentComand, el, 2, function_obj);
  16472. } else {
  16473. if (command_parent == command_target) {
  16474. console.log('Nxxxx78');
  16475. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16476. command_parent.commands_block = [];
  16477. var recentComand = genericCreateCommand(command_type);
  16478. command_parent.commands_block.push(recentComand);
  16479. console.log('SSS6');
  16480. renderCommand(recentComand, el_jq, 3, function_obj);
  16481. } else {
  16482. console.log('SSS7');
  16483. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16484. }
  16485. return;
  16486. }
  16487. console.log('XXX3');
  16488. var index = command_parent.commands_block.indexOf(command_target);
  16489. if (index > -1) {
  16490. command_parent.commands_block.splice(index + 1, 0, recentComand);
  16491. }
  16492. renderCommand(recentComand, el, 2, function_obj);
  16493. }
  16494. }
  16495. }
  16496. function insertCommandInBlock(el, event, function_obj, command_type) {
  16497. var el_jq = (0, _jquery2.default)(el);
  16498. var command_parent = el_jq.data('command');
  16499. 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) {
  16500. // Se não tiver outro comando ainda no bloco, só adiciona:
  16501. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16502. command_parent.commands_block = [];
  16503. var recentComand = genericCreateCommand(command_type);
  16504. command_parent.commands_block.push(recentComand);
  16505. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16506. } else {
  16507. // Se já tem algum comando no bloco:
  16508. findInBlockCorrectPlace(el, event, function_obj, command_type);
  16509. }
  16510. } else if (el_jq.data('command').type == Models.COMMAND_TYPES.iftrue) {
  16511. console.log('QQ9');
  16512. // no if ou no else?
  16513. var correct_div = (0, _jquery2.default)(document.elementFromPoint(event.pageX, event.pageY));
  16514. var is_in_if = true;
  16515. if (correct_div.data('if')) {
  16516. is_in_if = true;
  16517. } else if (correct_div.data('else')) {
  16518. is_in_if = false;
  16519. } else {
  16520. var hier = correct_div.parentsUntil(".command_container");
  16521. for (var i = 0; i < hier.length; i++) {
  16522. var temp = (0, _jquery2.default)(hier[i]);
  16523. if (typeof temp.data('if') !== 'undefined') {
  16524. is_in_if = true;
  16525. break;
  16526. }
  16527. if (typeof temp.data('else') !== 'undefined') {
  16528. is_in_if = false;
  16529. break;
  16530. }
  16531. }
  16532. }
  16533. if (is_in_if) {
  16534. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16535. command_parent.commands_block = [];
  16536. var recentComand = genericCreateCommand(command_type);
  16537. command_parent.commands_block.push(recentComand);
  16538. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  16539. } else {
  16540. // Se já tem algum comando no bloco:
  16541. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  16542. }
  16543. } else {
  16544. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16545. command_parent.commands_else = [];
  16546. var recentComand = genericCreateCommand(command_type);
  16547. command_parent.commands_else.push(recentComand);
  16548. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  16549. } else {
  16550. // Se já tem algum comando no bloco:
  16551. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  16552. }
  16553. }
  16554. } else {
  16555. // é do tipo switch
  16556. console.log("está tentando inserir em um switch que está na raiz!");
  16557. addCommandToSwitchCase(event, function_obj, command_type);
  16558. }
  16559. }
  16560. function addCommandToSwitchCase(event, function_obj, command_type) {
  16561. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  16562. var which_case = el.data('switchcase');
  16563. var case_div = el;
  16564. if (!which_case) {
  16565. var hier_find = el.parentsUntil(".all_cases_div");
  16566. for (var i = 0; i < hier_find.length; i++) {
  16567. if (typeof (0, _jquery2.default)(hier_find[i]).data('switchcase') !== 'undefined') {
  16568. which_case = (0, _jquery2.default)(hier_find[i]).data('switchcase');
  16569. case_div = (0, _jquery2.default)(hier_find[i]);
  16570. break;
  16571. }
  16572. }
  16573. }
  16574. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  16575. which_case.commands_block = [];
  16576. var recentComand = genericCreateCommand(command_type);
  16577. which_case.commands_block.push(recentComand);
  16578. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  16579. } else {
  16580. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  16581. }
  16582. }
  16583. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  16584. var all_sub = case_div.find('div.command_container');
  16585. var menor_distancia = 999999999;
  16586. var elemento_menor_distancia = null;
  16587. var antes = true;
  16588. var t_bot;
  16589. var t_top;
  16590. // Descobrindo o elemento mais próximo:
  16591. for (var i = 0; i < all_sub.length; i++) {
  16592. t_top = all_sub[i].getBoundingClientRect().top;
  16593. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16594. if (t_top - event.clientY < menor_distancia) {
  16595. menor_distancia = event.clientY - t_top;
  16596. elemento_menor_distancia = all_sub[i];
  16597. }
  16598. }
  16599. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16600. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16601. if (borda_inferior - event.clientY < menor_distancia) {
  16602. var recentComand = genericCreateCommand(command_type);
  16603. which_case.commands_block.push(recentComand);
  16604. renderCommand(recentComand, (0, _jquery2.default)(case_div.find('.case_commands_block')[0]), 3, function_obj);
  16605. } else {
  16606. var recentComand = genericCreateCommand(command_type);
  16607. var index = which_case.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16608. if (index > -1) {
  16609. which_case.commands_block.splice(index, 0, recentComand);
  16610. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16611. }
  16612. }
  16613. }
  16614. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  16615. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  16616. var el_jq = (0, _jquery2.default)(el);
  16617. var all_sub = el_jq.find('div.command_container');
  16618. var menor_distancia = 999999999;
  16619. var elemento_menor_distancia = null;
  16620. var antes = true;
  16621. var t_bot;
  16622. var t_top;
  16623. // Descobrindo o elemento mais próximo:
  16624. for (var i = 0; i < all_sub.length; i++) {
  16625. t_top = all_sub[i].getBoundingClientRect().top;
  16626. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16627. if (t_top - event.clientY < menor_distancia) {
  16628. menor_distancia = event.clientY - t_top;
  16629. elemento_menor_distancia = all_sub[i];
  16630. }
  16631. }
  16632. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16633. console.log("menor_distancia: ");
  16634. console.log(elemento_menor_distancia);
  16635. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16636. if (borda_inferior - event.clientY < menor_distancia) {
  16637. console.log('QQ11');
  16638. var recentComand = genericCreateCommand(command_type);
  16639. var command_parent = el_jq.data('command');
  16640. if (is_in_else) {
  16641. console.log('QQ15');
  16642. command_parent.commands_else.push(recentComand);
  16643. console.log('el_jq');
  16644. console.log(el_jq);
  16645. console.log("$(el_jq.find('.commands_else')[0]):: ");
  16646. console.log((0, _jquery2.default)(el_jq.find('.commands_else')[0]));
  16647. renderCommand(recentComand, el_jq, 3, function_obj);
  16648. } else {
  16649. console.log('QQ16');
  16650. command_parent.commands_block.push(recentComand);
  16651. renderCommand(recentComand, (0, _jquery2.default)(el_jq.find('.block_commands')[0]), 3, function_obj);
  16652. }
  16653. } else {
  16654. console.log('QQ12');
  16655. var recentComand = genericCreateCommand(command_type);
  16656. var command_parent = el_jq.data('command');
  16657. if (is_in_else) {
  16658. var index = command_parent.commands_else.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16659. if (index > -1) {
  16660. command_parent.commands_else.splice(index, 0, recentComand);
  16661. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16662. }
  16663. } else {
  16664. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16665. if (index > -1) {
  16666. command_parent.commands_block.splice(index, 0, recentComand);
  16667. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16668. }
  16669. }
  16670. }
  16671. }
  16672. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  16673. switch ((0, _jquery2.default)(el).data('command').type) {
  16674. case Models.COMMAND_TYPES.iftrue:
  16675. case Models.COMMAND_TYPES.switch:
  16676. case Models.COMMAND_TYPES.repeatNtimes:
  16677. case Models.COMMAND_TYPES.whiletrue:
  16678. case Models.COMMAND_TYPES.dowhiletrue:
  16679. insertCommandInBlock(el, event, function_obj, command_type);
  16680. return;
  16681. }
  16682. var menor_distancia = 999999999;
  16683. var antes = true;
  16684. var t_bot;
  16685. var t_top;
  16686. t_top = el.getBoundingClientRect().top;
  16687. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16688. var d_top = event.clientY - t_top; // distancia topo
  16689. var d_bot = t_bot - event.clientY; // distancia baixo
  16690. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16691. if (d_top < d_bot) {
  16692. var recentComand = genericCreateCommand(command_type);
  16693. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16694. if (index > -1) {
  16695. function_obj.commands.splice(index, 0, recentComand);
  16696. }
  16697. renderCommand(recentComand, el, 1, function_obj);
  16698. } else {
  16699. var recentComand = genericCreateCommand(command_type);
  16700. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16701. if (index > -1) {
  16702. function_obj.commands.splice(index + 1, 0, recentComand);
  16703. }
  16704. renderCommand(recentComand, el, 2, function_obj);
  16705. }
  16706. }
  16707. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  16708. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16709. var menor_distancia = 999999999;
  16710. var elemento_menor_distancia = null;
  16711. var antes = true;
  16712. var t_bot;
  16713. var t_top;
  16714. // Descobrindo o elemento mais próximo:
  16715. for (var i = 0; i < all_sub.length; i++) {
  16716. t_top = all_sub[i].getBoundingClientRect().top;
  16717. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16718. if (t_top - event.clientY < menor_distancia) {
  16719. menor_distancia = event.clientY - t_top;
  16720. elemento_menor_distancia = all_sub[i];
  16721. }
  16722. }
  16723. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16724. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16725. if (borda_inferior - event.clientY < menor_distancia) {
  16726. var recentComand = genericCreateCommand(command_type);
  16727. function_obj.commands.push(recentComand);
  16728. //
  16729. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16730. } else {
  16731. var recentComand = genericCreateCommand(command_type);
  16732. var index = function_obj.commands.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16733. if (index > -1) {
  16734. function_obj.commands.splice(index, 0, recentComand);
  16735. }
  16736. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16737. }
  16738. }
  16739. /***/ }),
  16740. /***/ "./js/visualUI/commands/attribution.js":
  16741. /*!*********************************************!*\
  16742. !*** ./js/visualUI/commands/attribution.js ***!
  16743. \*********************************************/
  16744. /*! no static exports found */
  16745. /***/ (function(module, exports, __webpack_require__) {
  16746. "use strict";
  16747. Object.defineProperty(exports, "__esModule", {
  16748. value: true
  16749. });
  16750. exports.createFloatingCommand = createFloatingCommand;
  16751. exports.renderCommand = renderCommand;
  16752. exports.manageExpressionElements = manageExpressionElements;
  16753. exports.renderMenuOperations = renderMenuOperations;
  16754. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16755. var _jquery2 = _interopRequireDefault(_jquery);
  16756. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16757. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16758. var Models = _interopRequireWildcard(_ivprog_elements);
  16759. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16760. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16761. var GlobalsManagement = _interopRequireWildcard(_globals);
  16762. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16763. var VariablesManagement = _interopRequireWildcard(_variables);
  16764. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16765. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16766. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16767. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16768. var CommandsManagement = _interopRequireWildcard(_commands);
  16769. 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; } }
  16770. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16771. function createFloatingCommand() {
  16772. return (0, _jquery2.default)('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
  16773. }
  16774. function renderCommand(command, function_obj) {
  16775. 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> <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>');
  16776. el.data('command', command);
  16777. VariableValueMenu.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
  16778. if (!command.expression || command.expression.length < 1) {
  16779. 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)]);
  16780. command.expression.push(exp);
  16781. }
  16782. addHandlers(command, function_obj, el);
  16783. renderExpressionElements(command, function_obj, el);
  16784. return el;
  16785. }
  16786. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  16787. var index_to_move = expression_element.itens.indexOf(ref_object);
  16788. switch (selectedItem.data('exp')) {
  16789. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16790. 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)]);
  16791. expression_element.itens[index_to_move] = exp;
  16792. break;
  16793. case Models.EXPRESSION_ELEMENTS.op_exp:
  16794. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, expression_element.itens[index_to_move]]);
  16795. expression_element.itens[index_to_move] = exp;
  16796. break;
  16797. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16798. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [expression_element.itens[index_to_move]]);
  16799. expression_element.itens[index_to_move] = exp;
  16800. break;
  16801. }
  16802. renderExpressionElements(command, function_obj, dom_object);
  16803. }
  16804. function renderExpressionElements(command, function_obj, el) {
  16805. var expression_div = el.find('.expression_elements');
  16806. var command_container;
  16807. if (el.hasClass("command_container") == false) {
  16808. var hier = el.parentsUntil(".command_container");
  16809. for (var i = 0; i < hier.length; i++) {
  16810. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16811. command_container = (0, _jquery2.default)(hier[i]);
  16812. break;
  16813. }
  16814. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16815. expression_div = (0, _jquery2.default)(hier[i]);
  16816. break;
  16817. }
  16818. }
  16819. }
  16820. if (command_container) {
  16821. expression_div = command_container.find('.expression_elements');
  16822. }
  16823. expression_div.text('');
  16824. for (var i = 0; i < command.expression.length; i++) {
  16825. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16826. temp.data('ref_element', command.expression[i]);
  16827. temp.data('ref_index', i);
  16828. expression_div.append(temp);
  16829. renderElement(command, function_obj, temp, command.expression[i]);
  16830. }
  16831. }
  16832. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  16833. var context_menu = '<div class="ui dropdown"><div class="text">';
  16834. switch (expression_element.itens[index_op]) {
  16835. case Models.ARITHMETIC_TYPES.plus:
  16836. context_menu += '+';
  16837. break;
  16838. case Models.ARITHMETIC_TYPES.minus:
  16839. context_menu += '-';
  16840. break;
  16841. case Models.ARITHMETIC_TYPES.multiplication:
  16842. context_menu += '*';
  16843. break;
  16844. case Models.ARITHMETIC_TYPES.division:
  16845. context_menu += '/';
  16846. break;
  16847. case Models.ARITHMETIC_TYPES.module:
  16848. context_menu += '%';
  16849. break;
  16850. case Models.ARITHMETIC_TYPES.none:
  16851. context_menu += '...';
  16852. break;
  16853. }
  16854. context_menu += '</div><div class="menu">';
  16855. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.plus + '">+</div>';
  16856. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.minus + '">-</div>';
  16857. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.multiplication + '">*</div>';
  16858. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.division + '">/</div>';
  16859. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.module + '">%</div>';
  16860. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.none + '" data-text="...">Nenhum</div>';
  16861. context_menu += '</div></div>';
  16862. context_menu = (0, _jquery2.default)(context_menu);
  16863. temp_op.append(context_menu);
  16864. context_menu.dropdown({
  16865. onChange: function onChange(value, text, $selectedItem) {
  16866. expression_element.itens[index_op] = value;
  16867. }
  16868. });
  16869. }
  16870. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  16871. if (el.hasClass("command_container") == false) {
  16872. var hier = el.parentsUntil(".commands_list_div");
  16873. for (var i = 0; i < hier.length; i++) {
  16874. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16875. el = (0, _jquery2.default)(hier[i]);
  16876. break;
  16877. }
  16878. }
  16879. }
  16880. if (dom_append_menu.hasClass("expression_elements") == false) {
  16881. var hier = el.parentsUntil(".commands_list_div");
  16882. for (var i = 0; i < hier.length; i++) {
  16883. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16884. dom_append_menu = (0, _jquery2.default)(hier[i]);
  16885. break;
  16886. }
  16887. }
  16888. }
  16889. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  16890. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16891. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16892. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16893. context_menu += '</div></div>';
  16894. context_menu = (0, _jquery2.default)(context_menu);
  16895. dom_append_menu.append(context_menu);
  16896. context_menu.dropdown({
  16897. onChange: function onChange(value, text, $selectedItem) {
  16898. switch (value) {
  16899. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16900. 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)]);
  16901. expression_append_new_expression.push(exp);
  16902. break;
  16903. case Models.EXPRESSION_ELEMENTS.op_exp:
  16904. 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)]);
  16905. expression_append_new_expression.push(exp);
  16906. break;
  16907. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16908. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16909. expression_append_new_expression.push(exp);
  16910. break;
  16911. }
  16912. renderExpressionElements(command, function_obj, el);
  16913. }
  16914. });
  16915. }
  16916. function renderElement(command, function_obj, el, expression_element) {
  16917. switch (expression_element.type_exp) {
  16918. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16919. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16920. var temp_exp_1 = (0, _jquery2.default)('<div class="component_element"></div>');
  16921. var temp_exp_2 = (0, _jquery2.default)('<div class="component_element"></div>');
  16922. el.append(temp_exp_1);
  16923. el.append(temp_op);
  16924. el.append(temp_exp_2);
  16925. if (expression_element.itens[0].type) {
  16926. VariableValueMenu.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  16927. } else {
  16928. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  16929. }
  16930. renderOperator(command, function_obj, temp_op, expression_element, 1);
  16931. if (expression_element.itens[2].type) {
  16932. VariableValueMenu.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  16933. } else {
  16934. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  16935. }
  16936. break;
  16937. case Models.EXPRESSION_ELEMENTS.op_exp:
  16938. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16939. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16940. el.append(temp_op);
  16941. el.append(temp_exp);
  16942. renderOperator(command, function_obj, temp_op, expression_element, 0);
  16943. if (expression_element.itens[1].type) {
  16944. VariableValueMenu.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  16945. } else {
  16946. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  16947. }
  16948. break;
  16949. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16950. var temp_par_1 = (0, _jquery2.default)('<div class="component_element"> ( </div>');
  16951. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16952. var temp_par_2 = (0, _jquery2.default)('<div class="component_element"> ) </div>');
  16953. el.append(temp_par_1);
  16954. el.append(temp_exp);
  16955. for (var j = 0; j < expression_element.itens.length; j++) {
  16956. if (expression_element.itens[j].type) {
  16957. VariableValueMenu.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  16958. } else {
  16959. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  16960. }
  16961. }
  16962. //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  16963. el.append(temp_par_2);
  16964. break;
  16965. }
  16966. }
  16967. function renderExpression(command, function_obj, el) {
  16968. var expression_div = el.find('.expression_elements');
  16969. expression_div.text('');
  16970. var menu_add_item = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16971. menu_add_item.data('index_add', 0);
  16972. expression_div.append(menu_add_item);
  16973. for (var i = 0; i < command.expression.length; i++) {
  16974. if (command.expression[i].type) {
  16975. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16976. temp.data('ref_element', command.expression[i]);
  16977. temp.data('ref_index', i);
  16978. expression_div.append(temp);
  16979. VariableValueMenu.renderMenu(command, command.expression[i], temp, function_obj);
  16980. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  16981. var temp = (0, _jquery2.default)('<div class="expression_element">' + command.expression[i] + '</div>');
  16982. temp.data('ref_element', command.expression[i]);
  16983. temp.data('ref_index', i);
  16984. expression_div.append(temp);
  16985. } else {
  16986. var temp = '<div class="expression_element">';
  16987. switch (command.expression[i]) {
  16988. case Models.ARITHMETIC_TYPES.plus:
  16989. temp += '+';
  16990. break;
  16991. case Models.ARITHMETIC_TYPES.minus:
  16992. temp += '-';
  16993. break;
  16994. case Models.ARITHMETIC_TYPES.multiplication:
  16995. temp += '*';
  16996. break;
  16997. case Models.ARITHMETIC_TYPES.division:
  16998. temp += '/';
  16999. break;
  17000. case Models.ARITHMETIC_TYPES.module:
  17001. temp += '%';
  17002. break;
  17003. }
  17004. temp += '</div>';
  17005. temp = (0, _jquery2.default)(temp);
  17006. temp.data('ref_element', command.expression[i]);
  17007. temp.data('ref_index', i);
  17008. expression_div.append(temp);
  17009. }
  17010. var menu_add_item_seq = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  17011. var index_temp = i + 1;
  17012. menu_add_item_seq.data('index_add', index_temp);
  17013. expression_div.append(menu_add_item_seq);
  17014. }
  17015. addMenuItens(command, function_obj, el);
  17016. }
  17017. function addMenuItens(command, function_obj, expression_div) {
  17018. var divs_expression = expression_div.find('.menu_add_item');
  17019. for (var i = 0; i < divs_expression.length; i++) {
  17020. var temp = (0, _jquery2.default)(divs_expression[i]).data('index_add');
  17021. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  17022. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  17023. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_operator') + '</div>';
  17024. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_parentheses') + '</div>';
  17025. context_menu += '</div></div>';
  17026. context_menu = (0, _jquery2.default)(context_menu);
  17027. (0, _jquery2.default)(divs_expression[i]).append(context_menu);
  17028. context_menu.dropdown({
  17029. on: 'hover',
  17030. onChange: function onChange(value, text, $selectedItem) {
  17031. switch ($selectedItem.data('option')) {
  17032. case "value":
  17033. command.expression.splice($selectedItem.data('index'), 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17034. renderExpression(command, function_obj, expression_div);
  17035. break;
  17036. case "operator":
  17037. command.expression.splice($selectedItem.data('index'), 0, Models.ARITHMETIC_TYPES.plus);
  17038. renderExpression(command, function_obj, expression_div);
  17039. break;
  17040. case "parentheses":
  17041. command.expression.splice($selectedItem.data('index'), 0, "(");
  17042. command.expression.splice($selectedItem.data('index') + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17043. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  17044. renderExpression(command, function_obj, expression_div);
  17045. break;
  17046. }
  17047. }
  17048. });
  17049. }
  17050. }
  17051. function addHandlers(command, function_obj, attribution_dom) {
  17052. attribution_dom.find('.button_remove_command').on('click', function () {
  17053. if (CommandsManagement.removeCommand(command, function_obj, attribution_dom)) {
  17054. attribution_dom.fadeOut();
  17055. }
  17056. });
  17057. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  17058. renderExpressionElements(command, function_obj, attribution_dom);
  17059. });
  17060. }
  17061. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  17062. /*console.log("recebido o seguinte DOM: ");
  17063. console.log(dom_object);
  17064. if (dom_object.hasClass('var_attributed')) {
  17065. return;
  17066. } else {
  17067. var hier = dom_object.parentsUntil(".command_container");
  17068. for (var i = 0; i < hier.length; i++) {
  17069. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  17070. return;
  17071. }
  17072. }
  17073. }
  17074. dom_object.find('.context_menu_clear').remove();
  17075. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17076. for (var tm in Models.ARITHMETIC_TYPES) {
  17077. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  17078. }
  17079. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  17080. menu_operations += '</div></div>';
  17081. menu_operations = $(menu_operations);
  17082. dom_object.append(menu_operations);
  17083. menu_operations.dropdown({
  17084. onChange: function(value, text, $selectedItem) {
  17085. switch ($($selectedItem).data('option')) {
  17086. case "clear":
  17087. $(dom_object).text('');
  17088. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  17089. break;
  17090. default:
  17091. createExpressionAround(command, ref_object, dom_object, function_obj);
  17092. menu_operations.find('.text').text('');
  17093. }
  17094. }
  17095. });*/
  17096. }
  17097. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  17098. (0, _jquery2.default)('<span> ( </span>').insertBefore(dom_object);
  17099. (0, _jquery2.default)('<span> ) </span>').insertAfter(dom_object);
  17100. VariableValueMenu.renderMenu(command, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), dom_object, function_obj);
  17101. }
  17102. /***/ }),
  17103. /***/ "./js/visualUI/commands/break.js":
  17104. /*!***************************************!*\
  17105. !*** ./js/visualUI/commands/break.js ***!
  17106. \***************************************/
  17107. /*! no static exports found */
  17108. /***/ (function(module, exports, __webpack_require__) {
  17109. "use strict";
  17110. Object.defineProperty(exports, "__esModule", {
  17111. value: true
  17112. });
  17113. exports.createFloatingCommand = createFloatingCommand;
  17114. exports.renderCommand = renderCommand;
  17115. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17116. var _jquery2 = _interopRequireDefault(_jquery);
  17117. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17118. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17119. var Models = _interopRequireWildcard(_ivprog_elements);
  17120. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17121. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17122. var CommandsManagement = _interopRequireWildcard(_commands);
  17123. 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; } }
  17124. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17125. function createFloatingCommand() {
  17126. 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>');
  17127. }
  17128. function renderCommand(command, function_obj) {
  17129. 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>');
  17130. el.data('command', command);
  17131. addHandlers(command, function_obj, el);
  17132. return el;
  17133. }
  17134. function addHandlers(command, function_obj, break_dom) {
  17135. break_dom.find('.button_remove_command').on('click', function () {
  17136. if (CommandsManagement.removeCommand(command, function_obj, break_dom)) {
  17137. break_dom.fadeOut();
  17138. }
  17139. });
  17140. }
  17141. /***/ }),
  17142. /***/ "./js/visualUI/commands/comment.js":
  17143. /*!*****************************************!*\
  17144. !*** ./js/visualUI/commands/comment.js ***!
  17145. \*****************************************/
  17146. /*! no static exports found */
  17147. /***/ (function(module, exports, __webpack_require__) {
  17148. "use strict";
  17149. Object.defineProperty(exports, "__esModule", {
  17150. value: true
  17151. });
  17152. exports.createFloatingCommand = createFloatingCommand;
  17153. exports.renderCommand = renderCommand;
  17154. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17155. var _jquery2 = _interopRequireDefault(_jquery);
  17156. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17157. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17158. var Models = _interopRequireWildcard(_ivprog_elements);
  17159. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17160. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17161. var GlobalsManagement = _interopRequireWildcard(_globals);
  17162. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17163. var VariablesManagement = _interopRequireWildcard(_variables);
  17164. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17165. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17166. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17167. var CommandsManagement = _interopRequireWildcard(_commands);
  17168. 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; } }
  17169. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17170. function createFloatingCommand() {
  17171. 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>');
  17172. }
  17173. function renderCommand(command, function_obj) {
  17174. var el = (0, _jquery2.default)('<div class="ui comment command_container"> <i class="ui icon small quote left command_drag"></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>');
  17175. el.data('command', command);
  17176. addHandlers(command, function_obj, el);
  17177. renderTextComment(command, function_obj, el);
  17178. return el;
  17179. }
  17180. function renderTextComment(command, function_obj, el) {
  17181. VariableValueMenu.renderMenu(command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  17182. }
  17183. function addHandlers(command, function_obj, comment_dom) {
  17184. comment_dom.find('.button_remove_command').on('click', function () {
  17185. if (CommandsManagement.removeCommand(command, function_obj, comment_dom)) {
  17186. comment_dom.fadeOut();
  17187. }
  17188. });
  17189. }
  17190. /***/ }),
  17191. /***/ "./js/visualUI/commands/conditional_expression.js":
  17192. /*!********************************************************!*\
  17193. !*** ./js/visualUI/commands/conditional_expression.js ***!
  17194. \********************************************************/
  17195. /*! no static exports found */
  17196. /***/ (function(module, exports, __webpack_require__) {
  17197. "use strict";
  17198. Object.defineProperty(exports, "__esModule", {
  17199. value: true
  17200. });
  17201. exports.renderExpression = renderExpression;
  17202. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17203. var _jquery2 = _interopRequireDefault(_jquery);
  17204. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17205. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17206. var Models = _interopRequireWildcard(_ivprog_elements);
  17207. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17208. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17209. var GlobalsManagement = _interopRequireWildcard(_globals);
  17210. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17211. var VariablesManagement = _interopRequireWildcard(_variables);
  17212. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17213. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  17214. 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; } }
  17215. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17216. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  17217. expression.dom_object = initial_el_to_render;
  17218. if (expression.expression == null || expression.expression.length < 1) {
  17219. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  17220. } else {
  17221. var main_div = (0, _jquery2.default)('<div class="expression_elements"></div>');
  17222. switch (expression.expression.type) {
  17223. case Models.EXPRESSION_TYPES.exp_logic:
  17224. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  17225. break;
  17226. case Models.EXPRESSION_TYPES.exp_arithmetic:
  17227. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  17228. break;
  17229. }
  17230. initial_el_to_render.append(main_div);
  17231. var restartMenu = (0, _jquery2.default)('<div class="ui restart_expression"><i class="ui icon undo"></i></div>');
  17232. initial_el_to_render.append(restartMenu);
  17233. restartMenu.on('click', function (e) {
  17234. expression.expression = null;
  17235. initial_el_to_render.empty();
  17236. renderExpression(command, expression, function_obj, initial_el_to_render);
  17237. });
  17238. }
  17239. }
  17240. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  17241. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  17242. menu_operator.dropdown({
  17243. values: [{
  17244. name: '>',
  17245. value: Models.ARITHMETIC_COMPARISON.greater_than,
  17246. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than
  17247. }, {
  17248. name: '<',
  17249. value: Models.ARITHMETIC_COMPARISON.less_than,
  17250. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than
  17251. }, {
  17252. name: '==',
  17253. value: Models.ARITHMETIC_COMPARISON.equals_to,
  17254. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.equals_to
  17255. }, {
  17256. name: '!=',
  17257. value: Models.ARITHMETIC_COMPARISON.not_equals_to,
  17258. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.not_equals_to
  17259. }, {
  17260. name: '>=',
  17261. value: Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to,
  17262. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to
  17263. }, {
  17264. name: '<=',
  17265. value: Models.ARITHMETIC_COMPARISON.less_than_or_equals_to,
  17266. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than_or_equals_to
  17267. }],
  17268. onChange: function onChange(value, text, $selectedItem) {
  17269. expression_arithmetic.operator = value;
  17270. }
  17271. });
  17272. element_to_append.append(menu_operator);
  17273. }
  17274. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  17275. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  17276. menu_operator.dropdown({
  17277. values: [{
  17278. name: '==',
  17279. value: Models.LOGIC_COMPARISON.equals_to,
  17280. selected: logic_operator == Models.LOGIC_COMPARISON.equals_to
  17281. }, {
  17282. name: '!=',
  17283. value: Models.LOGIC_COMPARISON.not_equals_to,
  17284. selected: logic_operator == Models.LOGIC_COMPARISON.not_equals_to
  17285. }, {
  17286. name: '&&',
  17287. value: Models.LOGIC_COMPARISON.and,
  17288. selected: logic_operator == Models.LOGIC_COMPARISON.and
  17289. }, {
  17290. name: '||',
  17291. value: Models.LOGIC_COMPARISON.or,
  17292. selected: logic_operator == Models.LOGIC_COMPARISON.or
  17293. }],
  17294. onChange: function onChange(value, text, $selectedItem) {
  17295. if ($selectedItem) {
  17296. expression_logic.operator = value;
  17297. if (expression_logic.second_operand == null) {
  17298. expression_logic.second_operand = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  17299. initial_el_to_render.empty();
  17300. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  17301. }
  17302. }
  17303. }
  17304. });
  17305. element_to_append.append(menu_operator);
  17306. }
  17307. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  17308. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17309. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17310. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17311. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17312. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17313. if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17314. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17315. } else if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17316. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17317. } else {
  17318. VariableValueMenuManagement.renderMenu(command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  17319. }
  17320. element_to_append.append(exp_el_par_1);
  17321. element_to_append.append(exp_el_expr_el_1);
  17322. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  17323. element_to_append.append(exp_el_expr_operand);
  17324. if (expression_logic.second_operand) {
  17325. if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17326. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17327. } else if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17328. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17329. } else {
  17330. VariableValueMenuManagement.renderMenu(command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  17331. }
  17332. element_to_append.append(exp_el_expr_el_2);
  17333. }
  17334. element_to_append.append(exp_el_par_2);
  17335. }
  17336. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  17337. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17338. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17339. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17340. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17341. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17342. if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17343. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17344. } else if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17345. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17346. } else {
  17347. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  17348. }
  17349. if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17350. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17351. } else if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17352. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17353. } else {
  17354. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  17355. }
  17356. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  17357. element_to_append.append(exp_el_par_1);
  17358. element_to_append.append(exp_el_expr_el_1);
  17359. element_to_append.append(exp_el_expr_operand);
  17360. element_to_append.append(exp_el_expr_el_2);
  17361. element_to_append.append(exp_el_par_2);
  17362. }
  17363. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  17364. var start_menu = '';
  17365. start_menu += '<div class="ui dropdown menu_start_rendered"><div class="text"><i>' + _localizedStringsService.LocalizedStrings.getUI('expression_menu_select') + '</i></div><i class="dropdown icon"></i><div class="menu">';
  17366. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_logic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_logic_expression') + ' (EL == EL and EL)</div>';
  17367. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_arithmetic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_arithmetic_expression') + ' (EA < EA)</div>';
  17368. start_menu += '</div></div>';
  17369. start_menu = (0, _jquery2.default)(start_menu);
  17370. start_menu.dropdown({
  17371. onChange: function onChange(value, text, $selectedItem) {
  17372. switch ($selectedItem.data('exp')) {
  17373. case Models.EXPRESSION_TYPES.exp_logic:
  17374. expression.expression = new Models.LogicExpression(false, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17375. break;
  17376. case Models.EXPRESSION_TYPES.exp_arithmetic:
  17377. 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);
  17378. break;
  17379. }
  17380. initial_el_to_render.html('');
  17381. renderExpression(command, expression, function_obj, initial_el_to_render);
  17382. },
  17383. selectOnKeydown: false
  17384. });
  17385. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17386. initial_el_to_render.append(start_menu);
  17387. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17388. }
  17389. /***/ }),
  17390. /***/ "./js/visualUI/commands/contextualized_menu.js":
  17391. /*!*****************************************************!*\
  17392. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  17393. \*****************************************************/
  17394. /*! no static exports found */
  17395. /***/ (function(module, exports, __webpack_require__) {
  17396. "use strict";
  17397. Object.defineProperty(exports, "__esModule", {
  17398. value: true
  17399. });
  17400. exports.renderMenu = renderMenu;
  17401. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17402. var _jquery2 = _interopRequireDefault(_jquery);
  17403. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17404. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17405. var Models = _interopRequireWildcard(_ivprog_elements);
  17406. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17407. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17408. var CommandsManagement = _interopRequireWildcard(_commands);
  17409. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17410. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  17411. var _switch = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  17412. var SwitchManagement = _interopRequireWildcard(_switch);
  17413. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17414. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17415. 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; } }
  17416. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17417. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  17418. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  17419. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17420. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17421. } else {
  17422. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17423. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.switchcase + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_case') + ' </a>';
  17424. }
  17425. menu_div += '</div></div>';
  17426. menu_div = (0, _jquery2.default)(menu_div);
  17427. dom_where_render.append(menu_div);
  17428. addHandlers(command, dom_where_render, function_obj, dom_command);
  17429. }
  17430. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  17431. console.log('command, dom_where_render, function_obj, dom_command');
  17432. console.log(command, dom_where_render, function_obj, dom_command);
  17433. console.log(dom_where_render.parents());
  17434. dom_where_render.find('.menu_commands').dropdown({
  17435. on: 'hover'
  17436. });
  17437. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  17438. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17439. if (command.commands_block == null || command.commands_block.length == 0) {
  17440. command.commands_block = [];
  17441. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  17442. command.commands_block.push(new_cmd);
  17443. CommandsManagement.renderCommand(new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  17444. } else {
  17445. CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), (0, _jquery2.default)(this).data('command'), evt);
  17446. }
  17447. } else {
  17448. switch ((0, _jquery2.default)(this).data('command')) {
  17449. case Models.COMMAND_TYPES.break:
  17450. CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), (0, _jquery2.default)(this).data('command'), evt);
  17451. break;
  17452. case Models.COMMAND_TYPES.switchcase:
  17453. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  17454. break;
  17455. }
  17456. }
  17457. });
  17458. }
  17459. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  17460. if (command.cases == null) {
  17461. command.cases = [];
  17462. }
  17463. var sc = new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17464. command.cases.push(sc);
  17465. SwitchManagement.renderCase(sc, command, function_obj, dom_command.find('.all_cases_div'));
  17466. }
  17467. /***/ }),
  17468. /***/ "./js/visualUI/commands/dowhiletrue.js":
  17469. /*!*********************************************!*\
  17470. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  17471. \*********************************************/
  17472. /*! no static exports found */
  17473. /***/ (function(module, exports, __webpack_require__) {
  17474. "use strict";
  17475. Object.defineProperty(exports, "__esModule", {
  17476. value: true
  17477. });
  17478. exports.createFloatingCommand = createFloatingCommand;
  17479. exports.renderCommand = renderCommand;
  17480. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17481. var _jquery2 = _interopRequireDefault(_jquery);
  17482. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17483. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17484. var Models = _interopRequireWildcard(_ivprog_elements);
  17485. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17486. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17487. var GlobalsManagement = _interopRequireWildcard(_globals);
  17488. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17489. var VariablesManagement = _interopRequireWildcard(_variables);
  17490. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17491. var CommandsManagement = _interopRequireWildcard(_commands);
  17492. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17493. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17494. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17495. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17496. 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; } }
  17497. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17498. function createFloatingCommand() {
  17499. 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>');
  17500. }
  17501. function renderCommand(command, function_obj) {
  17502. var ret = '';
  17503. 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>';
  17504. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  17505. ret += '</div>';
  17506. ret += ' <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' </span> <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  17507. ret += '</div>';
  17508. var el = (0, _jquery2.default)(ret);
  17509. el.data('command', command);
  17510. el.find('.block_commands').data('command', command);
  17511. addHandlers(command, function_obj, el);
  17512. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17513. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17514. if (command.commands_block) {
  17515. for (var j = 0; j < command.commands_block.length; j++) {
  17516. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17517. }
  17518. }
  17519. return el;
  17520. }
  17521. function addHandlers(command, function_obj, dowhiletrue_dom) {
  17522. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  17523. if (CommandsManagement.removeCommand(command, function_obj, dowhiletrue_dom)) {
  17524. dowhiletrue_dom.fadeOut();
  17525. }
  17526. });
  17527. }
  17528. /***/ }),
  17529. /***/ "./js/visualUI/commands/functioncall.js":
  17530. /*!**********************************************!*\
  17531. !*** ./js/visualUI/commands/functioncall.js ***!
  17532. \**********************************************/
  17533. /*! no static exports found */
  17534. /***/ (function(module, exports, __webpack_require__) {
  17535. "use strict";
  17536. Object.defineProperty(exports, "__esModule", {
  17537. value: true
  17538. });
  17539. exports.createFloatingCommand = createFloatingCommand;
  17540. exports.renderCommand = renderCommand;
  17541. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17542. var _jquery2 = _interopRequireDefault(_jquery);
  17543. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17544. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17545. var Models = _interopRequireWildcard(_ivprog_elements);
  17546. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17547. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17548. var GlobalsManagement = _interopRequireWildcard(_globals);
  17549. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17550. var VariablesManagement = _interopRequireWildcard(_variables);
  17551. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17552. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17553. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17554. var CommandsManagement = _interopRequireWildcard(_commands);
  17555. 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; } }
  17556. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17557. function createFloatingCommand() {
  17558. return (0, _jquery2.default)('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  17559. }
  17560. function renderCommand(command, function_obj) {
  17561. 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>');
  17562. el.data('command', command);
  17563. VariableValueMenu.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  17564. addHandlers(command, function_obj, el);
  17565. return el;
  17566. }
  17567. function addHandlers(command, function_obj, functioncall_dom) {
  17568. functioncall_dom.find('.button_remove_command').on('click', function () {
  17569. if (CommandsManagement.removeCommand(command, function_obj, functioncall_dom)) {
  17570. functioncall_dom.fadeOut();
  17571. }
  17572. });
  17573. }
  17574. /***/ }),
  17575. /***/ "./js/visualUI/commands/iftrue.js":
  17576. /*!****************************************!*\
  17577. !*** ./js/visualUI/commands/iftrue.js ***!
  17578. \****************************************/
  17579. /*! no static exports found */
  17580. /***/ (function(module, exports, __webpack_require__) {
  17581. "use strict";
  17582. Object.defineProperty(exports, "__esModule", {
  17583. value: true
  17584. });
  17585. exports.createFloatingCommand = createFloatingCommand;
  17586. exports.renderCommand = renderCommand;
  17587. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17588. var _jquery2 = _interopRequireDefault(_jquery);
  17589. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17590. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17591. var Models = _interopRequireWildcard(_ivprog_elements);
  17592. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17593. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17594. var GlobalsManagement = _interopRequireWildcard(_globals);
  17595. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17596. var VariablesManagement = _interopRequireWildcard(_variables);
  17597. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17598. var CommandsManagement = _interopRequireWildcard(_commands);
  17599. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17600. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17601. 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; } }
  17602. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17603. function createFloatingCommand() {
  17604. return (0, _jquery2.default)('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  17605. }
  17606. function renderCommand(command, function_obj) {
  17607. var ret = '';
  17608. 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>';
  17609. ret += '<span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_if') + '</span>';
  17610. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  17611. ret += '<span> </span> ';
  17612. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  17613. ret += '</div></div>';
  17614. ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' </span>';
  17615. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  17616. ret += '</div>';
  17617. ret += '<span></span></div>';
  17618. ret += '</div>';
  17619. var el = (0, _jquery2.default)(ret);
  17620. el.data('command', command);
  17621. el.find('.block_commands').data('command', command);
  17622. el.find('.data_block_if').data('command', command);
  17623. el.find('.data_block_else').data('command', command);
  17624. el.find('.commands_if').data('command', command);
  17625. addHandlers(command, function_obj, el);
  17626. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17627. if (command.commands_block) {
  17628. for (var j = 0; j < command.commands_block.length; j++) {
  17629. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.commands_if')[0]), 3, function_obj);
  17630. }
  17631. }
  17632. if (command.commands_else) {
  17633. for (var j = 0; j < command.commands_else.length; j++) {
  17634. CommandsManagement.renderCommand(command.commands_else[j], (0, _jquery2.default)(el.find('.commands_else')[0]), 3, function_obj);
  17635. }
  17636. }
  17637. return el;
  17638. }
  17639. function addHandlers(command, function_obj, iftrue_dom) {
  17640. iftrue_dom.find('.button_remove_command').on('click', function () {
  17641. if (CommandsManagement.removeCommand(command, function_obj, iftrue_dom)) {
  17642. iftrue_dom.fadeOut();
  17643. }
  17644. });
  17645. }
  17646. /***/ }),
  17647. /***/ "./js/visualUI/commands/reader.js":
  17648. /*!****************************************!*\
  17649. !*** ./js/visualUI/commands/reader.js ***!
  17650. \****************************************/
  17651. /*! no static exports found */
  17652. /***/ (function(module, exports, __webpack_require__) {
  17653. "use strict";
  17654. Object.defineProperty(exports, "__esModule", {
  17655. value: true
  17656. });
  17657. exports.createFloatingCommand = createFloatingCommand;
  17658. exports.renderCommand = renderCommand;
  17659. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17660. var _jquery2 = _interopRequireDefault(_jquery);
  17661. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17662. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17663. var Models = _interopRequireWildcard(_ivprog_elements);
  17664. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17665. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17666. var GlobalsManagement = _interopRequireWildcard(_globals);
  17667. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17668. var VariablesManagement = _interopRequireWildcard(_variables);
  17669. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17670. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17671. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17672. var CommandsManagement = _interopRequireWildcard(_commands);
  17673. 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; } }
  17674. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17675. function createFloatingCommand() {
  17676. 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>');
  17677. }
  17678. function renderCommand(command, function_obj) {
  17679. 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>';
  17680. el = (0, _jquery2.default)(el);
  17681. el.data('command', command);
  17682. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17683. addHandlers(command, function_obj, el);
  17684. return el;
  17685. }
  17686. function addHandlers(command, function_obj, reader_dom) {
  17687. reader_dom.find('.button_remove_command').on('click', function () {
  17688. if (CommandsManagement.removeCommand(command, function_obj, reader_dom)) {
  17689. reader_dom.fadeOut();
  17690. }
  17691. });
  17692. }
  17693. /***/ }),
  17694. /***/ "./js/visualUI/commands/repeatNtimes.js":
  17695. /*!**********************************************!*\
  17696. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  17697. \**********************************************/
  17698. /*! no static exports found */
  17699. /***/ (function(module, exports, __webpack_require__) {
  17700. "use strict";
  17701. Object.defineProperty(exports, "__esModule", {
  17702. value: true
  17703. });
  17704. exports.createFloatingCommand = createFloatingCommand;
  17705. exports.renderCommand = renderCommand;
  17706. exports.manageExpressionElements = manageExpressionElements;
  17707. exports.manageClearExpressionElements = manageClearExpressionElements;
  17708. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17709. var _jquery2 = _interopRequireDefault(_jquery);
  17710. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17711. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17712. var Models = _interopRequireWildcard(_ivprog_elements);
  17713. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17714. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17715. var GlobalsManagement = _interopRequireWildcard(_globals);
  17716. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17717. var VariablesManagement = _interopRequireWildcard(_variables);
  17718. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17719. var CommandsManagement = _interopRequireWildcard(_commands);
  17720. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17721. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17722. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17723. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17724. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17725. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17726. 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; } }
  17727. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17728. function createFloatingCommand() {
  17729. 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>');
  17730. }
  17731. function renderCommand(command, function_obj) {
  17732. 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> <span class="span_command_spec separator_character">;</span> <div class="conditional_expression"></div> <span class="span_command_spec separator_character">;</span> <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>';
  17733. ret += '<div class="ui block_commands">';
  17734. ret += '</div>';
  17735. ret += '<span> </span>';
  17736. ret += '</div>';
  17737. var el = (0, _jquery2.default)(ret);
  17738. el.data('command', command);
  17739. el.find('.block_commands').data('command', command);
  17740. addHandlers(command, function_obj, el);
  17741. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17742. VariableValueMenu.renderMenu(command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  17743. ConditionalExpressionManagement.renderExpression(command, command.expression2, function_obj, el.find('.conditional_expression'));
  17744. VariableValueMenu.renderMenu(command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  17745. if (command.expression1) {
  17746. el.find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17747. VariableValueMenu.renderMenu(command, command.expression1, el.find('.var_value_expression'), function_obj);
  17748. }
  17749. if (command.expression3) {
  17750. el.find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17751. VariableValueMenu.renderMenu(command, command.expression3.itens[0], el.find('.first_operand'), function_obj);
  17752. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  17753. VariableValueMenu.renderMenu(command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  17754. }
  17755. if (command.commands_block) {
  17756. for (var j = 0; j < command.commands_block.length; j++) {
  17757. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17758. }
  17759. }
  17760. return el;
  17761. }
  17762. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17763. if (dom_object.hasClass('variable_attribution')) {
  17764. if (!command.expression3) {
  17765. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [command.var_attribution, Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "1", null, null, true)]);
  17766. command.expression3 = exp;
  17767. command.var_incrementation = command.var_attribution;
  17768. var cond_exp = new Models.ArithmeticExpression(command.var_attribution, new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_COMPARISON.less_than);
  17769. command.expression2.expression = cond_exp;
  17770. }
  17771. dom_object.parent().find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17772. command.expression1 = new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "0", null, null, true);
  17773. dom_object.parent().find('.var_value_expression').empty();
  17774. VariableValueMenu.renderMenu(command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  17775. renderAlgorithm();
  17776. }
  17777. if (dom_object.hasClass('incrementation_variable')) {
  17778. dom_object.parent().find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17779. 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)]);
  17780. command.expression3 = exp;
  17781. VariableValueMenu.renderMenu(command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  17782. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  17783. VariableValueMenu.renderMenu(command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  17784. }
  17785. }
  17786. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17787. if (dom_object.hasClass('variable_attribution')) {
  17788. (0, _jquery2.default)(dom_object).parent().find('.text_receives').text('');
  17789. command.expression1 = null;
  17790. (0, _jquery2.default)(dom_object).parent().find('.var_value_expression').empty();
  17791. }
  17792. if (dom_object.hasClass('incrementation_variable')) {
  17793. (0, _jquery2.default)(dom_object).parent().find('.text_inc_receives').text('');
  17794. command.expression3 = null;
  17795. (0, _jquery2.default)(dom_object).parent().find('.first_operand').empty();
  17796. (0, _jquery2.default)(dom_object).parent().find('.operator').empty();
  17797. (0, _jquery2.default)(dom_object).parent().find('.second_operand').empty();
  17798. }
  17799. }
  17800. function addHandlers(command, function_obj, repeatNtimes_dom) {
  17801. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  17802. if (CommandsManagement.removeCommand(command, function_obj, repeatNtimes_dom)) {
  17803. repeatNtimes_dom.fadeOut();
  17804. }
  17805. });
  17806. }
  17807. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  17808. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div></div>');
  17809. menu_operator.dropdown({
  17810. values: [{
  17811. name: '+',
  17812. value: Models.ARITHMETIC_TYPES.plus,
  17813. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.plus
  17814. }, {
  17815. name: '-',
  17816. value: Models.ARITHMETIC_TYPES.minus,
  17817. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.minus
  17818. }, {
  17819. name: '*',
  17820. value: Models.ARITHMETIC_TYPES.multiplication,
  17821. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.multiplication
  17822. }, {
  17823. name: '/',
  17824. value: Models.ARITHMETIC_TYPES.division,
  17825. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.division
  17826. }, {
  17827. name: '%',
  17828. value: Models.ARITHMETIC_TYPES.module,
  17829. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.module
  17830. }],
  17831. onChange: function onChange(value, text, $selectedItem) {
  17832. expression_element.itens[index_op] = value;
  17833. }
  17834. });
  17835. temp_op.append(menu_operator);
  17836. }
  17837. /***/ }),
  17838. /***/ "./js/visualUI/commands/return.js":
  17839. /*!****************************************!*\
  17840. !*** ./js/visualUI/commands/return.js ***!
  17841. \****************************************/
  17842. /*! no static exports found */
  17843. /***/ (function(module, exports, __webpack_require__) {
  17844. "use strict";
  17845. Object.defineProperty(exports, "__esModule", {
  17846. value: true
  17847. });
  17848. exports.createFloatingCommand = createFloatingCommand;
  17849. exports.renderCommand = renderCommand;
  17850. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17851. var _jquery2 = _interopRequireDefault(_jquery);
  17852. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17853. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17854. var Models = _interopRequireWildcard(_ivprog_elements);
  17855. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17856. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17857. var GlobalsManagement = _interopRequireWildcard(_globals);
  17858. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17859. var VariablesManagement = _interopRequireWildcard(_variables);
  17860. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17861. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17862. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17863. var CommandsManagement = _interopRequireWildcard(_commands);
  17864. 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; } }
  17865. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17866. function createFloatingCommand() {
  17867. 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>');
  17868. }
  17869. function renderCommand(command, function_obj) {
  17870. var el = (0, _jquery2.default)('<div class="ui return command_container"> <i class="ui icon small reply command_drag"></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>');
  17871. el.data('command', command);
  17872. addHandlers(command, function_obj, el);
  17873. if (function_obj.return_type != _types.Types.VOID) {
  17874. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17875. } else {
  17876. el.find('.var_value_menu_div').remove();
  17877. command.variable_value_menu = null;
  17878. }
  17879. return el;
  17880. }
  17881. function addHandlers(command, function_obj, return_dom) {
  17882. return_dom.find('.button_remove_command').on('click', function () {
  17883. if (CommandsManagement.removeCommand(command, function_obj, return_dom)) {
  17884. return_dom.fadeOut();
  17885. }
  17886. });
  17887. }
  17888. /***/ }),
  17889. /***/ "./js/visualUI/commands/switch.js":
  17890. /*!****************************************!*\
  17891. !*** ./js/visualUI/commands/switch.js ***!
  17892. \****************************************/
  17893. /*! no static exports found */
  17894. /***/ (function(module, exports, __webpack_require__) {
  17895. "use strict";
  17896. Object.defineProperty(exports, "__esModule", {
  17897. value: true
  17898. });
  17899. exports.createFloatingCommand = createFloatingCommand;
  17900. exports.renderCommand = renderCommand;
  17901. exports.renderCase = renderCase;
  17902. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17903. var _jquery2 = _interopRequireDefault(_jquery);
  17904. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17905. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17906. var Models = _interopRequireWildcard(_ivprog_elements);
  17907. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17908. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17909. var GlobalsManagement = _interopRequireWildcard(_globals);
  17910. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17911. var VariablesManagement = _interopRequireWildcard(_variables);
  17912. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17913. var CommandsManagement = _interopRequireWildcard(_commands);
  17914. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17915. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17916. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17917. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17918. 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; } }
  17919. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17920. function createFloatingCommand() {
  17921. 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>');
  17922. }
  17923. function renderCommand(command, function_obj) {
  17924. var ret = '';
  17925. 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>';
  17926. ret += '</div>';
  17927. var el = (0, _jquery2.default)(ret);
  17928. el.data('command', command);
  17929. addHandlers(command, function_obj, el);
  17930. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17931. VariableValueMenu.renderMenu(command, command.variable, el.find('.variable_to_switch'), function_obj);
  17932. if (command.cases) {
  17933. for (var i = 0; i < command.cases.length; i++) {
  17934. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  17935. }
  17936. }
  17937. return el;
  17938. }
  17939. function renderCase(switchcase, command, function_obj, el) {
  17940. 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>');
  17941. VariableValueMenu.renderMenu(command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  17942. casediv.data('switchcase', switchcase);
  17943. casediv.find('.case_commands_block').data('switchcase', switchcase);
  17944. el.append(casediv);
  17945. if (switchcase.commands_block) {
  17946. for (var j = 0; j < switchcase.commands_block.length; j++) {
  17947. CommandsManagement.renderCommand(switchcase.commands_block[j], (0, _jquery2.default)(casediv.find('.case_commands_block')[0]), 3, function_obj);
  17948. }
  17949. }
  17950. casediv.find('.button_remove_command').on('click', function () {
  17951. for (var i = 0; i < command.cases.length; i++) {
  17952. if (switchcase == command.cases[i]) {
  17953. delete command.cases[i];
  17954. command.cases.splice(i, 1);
  17955. casediv.remove();
  17956. break;
  17957. }
  17958. }
  17959. });
  17960. }
  17961. function addHandlers(command, function_obj, switch_dom) {
  17962. switch_dom.find('.button_remove_command').on('click', function () {
  17963. if (CommandsManagement.removeCommand(command, function_obj, switch_dom)) {
  17964. switch_dom.fadeOut();
  17965. }
  17966. });
  17967. }
  17968. /***/ }),
  17969. /***/ "./js/visualUI/commands/variable_value_menu.js":
  17970. /*!*****************************************************!*\
  17971. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  17972. \*****************************************************/
  17973. /*! no static exports found */
  17974. /***/ (function(module, exports, __webpack_require__) {
  17975. "use strict";
  17976. Object.defineProperty(exports, "__esModule", {
  17977. value: true
  17978. });
  17979. exports.VAR_OR_VALUE_TYPES = undefined;
  17980. exports.renderMenu = renderMenu;
  17981. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17982. var _jquery2 = _interopRequireDefault(_jquery);
  17983. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17984. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17985. var Models = _interopRequireWildcard(_ivprog_elements);
  17986. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17987. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17988. var GlobalsManagement = _interopRequireWildcard(_globals);
  17989. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17990. var VariablesManagement = _interopRequireWildcard(_variables);
  17991. var _attribution = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  17992. var AttribuitionsManagement = _interopRequireWildcard(_attribution);
  17993. var _writer = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  17994. var WritersManagement = _interopRequireWildcard(_writer);
  17995. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17996. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17997. 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; } }
  17998. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17999. 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,
  18000. value_and_function: 6, all: 7 });
  18001. function renderMenu(command, ref_object, dom_object, function_obj) {
  18002. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  18003. var expression_element = arguments[5];
  18004. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  18005. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  18006. if (ref_object.function_called) {
  18007. if (ref_object.function_called.parameters_list) {
  18008. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  18009. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  18010. ref_object.parameters_list.pop();
  18011. } else {
  18012. ref_object.parameters_list.push(new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true));
  18013. }
  18014. }
  18015. }
  18016. }
  18017. var menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18018. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  18019. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_vars">';
  18020. menu_var_or_value += '</div>';
  18021. }
  18022. 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) {
  18023. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('variable');
  18024. menu_var_or_value += '<div class="menu menu_only_vars">';
  18025. menu_var_or_value += '</div></div>';
  18026. }
  18027. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  18028. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  18029. }
  18030. 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) {
  18031. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  18032. }
  18033. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  18034. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_functions">';
  18035. menu_var_or_value += '</div>';
  18036. }
  18037. 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) {
  18038. 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');
  18039. menu_var_or_value += '<div class="menu menu_only_functions">';
  18040. menu_var_or_value += '</div></div>';
  18041. if (command.type == Models.COMMAND_TYPES.attribution) {
  18042. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18043. menu_var_or_value += '<div class="menu">';
  18044. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18045. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18046. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18047. menu_var_or_value += '</div></div>';
  18048. }
  18049. }
  18050. menu_var_or_value += '</div></div>';
  18051. menu_var_or_value = (0, _jquery2.default)(menu_var_or_value);
  18052. dom_object.append(menu_var_or_value);
  18053. ref_object.dom_object = menu_var_or_value;
  18054. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18055. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  18056. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  18057. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  18058. if (ref_object.content || ref_object.function_called) {
  18059. if (ref_object.content) {
  18060. // Verificar se a variável ainda existe:
  18061. var variable_fun = isVarInProgram(ref_object.content, function_obj);
  18062. if (variable_fun) {
  18063. ref_object.content = variable_fun;
  18064. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18065. } else {
  18066. if (ref_object.content && ref_object.content.type) {
  18067. ref_object.content = null;
  18068. appendSelectText(ref_object, menu_var_or_value);
  18069. } else {
  18070. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18071. }
  18072. }
  18073. } else if (ref_object.function_called) {
  18074. // Verificar se a função ainda existe:
  18075. var ret_function = isFunctionInProgram(ref_object.function_called);
  18076. if (ret_function) {
  18077. ref_object.function_called = ret_function;
  18078. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18079. } else {
  18080. ref_object.content = null;
  18081. ref_object.row = null;
  18082. ref_object.column = null;
  18083. delete ref_object.function_called;
  18084. delete ref_object.parameters_list;
  18085. appendSelectText(ref_object, menu_var_or_value);
  18086. }
  18087. }
  18088. } else {
  18089. appendSelectText(ref_object, menu_var_or_value);
  18090. }
  18091. }
  18092. function appendSelectText(ref_object, menu_var_or_value) {
  18093. switch (ref_object.variable_and_value) {
  18094. case VAR_OR_VALUE_TYPES.only_variable:
  18095. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_var') + '</i>');
  18096. break;
  18097. case VAR_OR_VALUE_TYPES.all:
  18098. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  18099. break;
  18100. case VAR_OR_VALUE_TYPES.variable_and_function:
  18101. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  18102. break;
  18103. case VAR_OR_VALUE_TYPES.only_function:
  18104. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_function') + '</i>');
  18105. break;
  18106. }
  18107. }
  18108. function isFunctionInProgram(function_called_obj) {
  18109. if (function_called_obj.name) {
  18110. if (window.program_obj.functions) {
  18111. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18112. if (window.program_obj.functions[i] == function_called_obj) {
  18113. return window.program_obj.functions[i];
  18114. }
  18115. }
  18116. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18117. if (window.program_obj.functions[i].name == function_called_obj.name) {
  18118. return window.program_obj.functions[i];
  18119. }
  18120. }
  18121. }
  18122. } else if (function_called_obj.identifier) {
  18123. for (var i = 0; i < window.system_functions.length; i++) {
  18124. if (window.system_functions[i].identifier == function_called_obj.identifier) {
  18125. return window.system_functions[i];
  18126. }
  18127. }
  18128. }
  18129. return null;
  18130. }
  18131. function isVarInProgram(var_obj, function_obj) {
  18132. // Verify in locals:
  18133. if (function_obj.variables_list) {
  18134. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18135. if (function_obj.variables_list[i] == var_obj) {
  18136. return function_obj.variables_list[i];
  18137. }
  18138. }
  18139. }
  18140. // Verify in parameters:
  18141. if (function_obj.parameters_list) {
  18142. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18143. if (function_obj.parameters_list[i] == var_obj) {
  18144. return function_obj.parameters_list[i];
  18145. }
  18146. }
  18147. }
  18148. // Verify in globals:
  18149. if (window.program_obj.globals) {
  18150. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18151. if (window.program_obj.globals[i] == var_obj) {
  18152. return window.program_obj.globals[i];
  18153. }
  18154. }
  18155. }
  18156. // If not found, verify if the reference was lost
  18157. if (var_obj) {
  18158. if (function_obj.variables_list) {
  18159. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18160. if (function_obj.variables_list[i].name == var_obj.name) {
  18161. return function_obj.variables_list[i];
  18162. }
  18163. }
  18164. }
  18165. if (function_obj.parameters_list) {
  18166. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18167. if (function_obj.parameters_list[i].name == var_obj.name) {
  18168. return function_obj.parameters_list[i];
  18169. }
  18170. }
  18171. }
  18172. if (window.program_obj.globals) {
  18173. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18174. if (window.program_obj.globals[i].name == var_obj.name) {
  18175. return window.program_obj.globals[i];
  18176. }
  18177. }
  18178. }
  18179. }
  18180. return null;
  18181. }
  18182. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  18183. if (ref_object.function_called) {
  18184. menu_var_or_value.remove();
  18185. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18186. } else if (ref_object.content.type) {
  18187. menu_var_or_value.remove();
  18188. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18189. } else {
  18190. menu_var_or_value.remove();
  18191. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18192. }
  18193. }
  18194. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  18195. if (variable_obj.content || variable_obj.function_called) {
  18196. // Verificar se a variável ainda existe:
  18197. var var_fun = isVarInProgram(variable_obj.content, function_obj);
  18198. if (var_fun) {
  18199. variable_obj.content = var_fun;
  18200. } else {
  18201. if (variable_obj.content && variable_obj.content.type) {
  18202. variable_obj.content = null;
  18203. appendSelectText(variable_obj, menu_var_or_value);
  18204. }
  18205. }
  18206. } else {
  18207. appendSelectText(variable_obj, menu_var_or_value);
  18208. }
  18209. if (variable_obj.content == null && variable_obj.function_called == null) {
  18210. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18211. return;
  18212. }
  18213. var ret = '';
  18214. if (variable_obj.function_called) {
  18215. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  18216. menu_var_or_value.find('.text').text(' ');
  18217. dom_object.find('.menu_var_or_value_dom').remove();
  18218. var parameters_menu;
  18219. if (variable_obj.function_called.name) {
  18220. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  18221. } else {
  18222. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  18223. }
  18224. parameters_menu += '<span> ) </span></div>';
  18225. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18226. dom_object.append(parameters_menu);
  18227. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18228. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18229. if (command.type == Models.COMMAND_TYPES.attribution) {
  18230. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18231. context_menu += '<div class="menu">';
  18232. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18233. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18234. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18235. context_menu += '</div></div>';
  18236. }
  18237. context_menu += '</div></div>';
  18238. context_menu = (0, _jquery2.default)(context_menu);
  18239. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18240. context_menu.dropdown({
  18241. onChange: function onChange(value, text, $selectedItem) {
  18242. console.log('S1');
  18243. if ($selectedItem.data('clear')) {
  18244. console.log('PP1');
  18245. dom_object.text('');
  18246. variable_obj.content = null;
  18247. variable_obj.row = null;
  18248. variable_obj.column = null;
  18249. delete variable_obj.function_called;
  18250. delete variable_obj.parameters_list;
  18251. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18252. }
  18253. if ($selectedItem.data('exp')) {
  18254. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18255. }
  18256. },
  18257. selectOnKeydown: false
  18258. });
  18259. } else {
  18260. menu_var_or_value.find('.text').text(' ');
  18261. dom_object.find('.menu_var_or_value_dom').remove();
  18262. var parameters_menu;
  18263. if (variable_obj.function_called.name) {
  18264. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  18265. } else {
  18266. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  18267. }
  18268. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  18269. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18270. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  18271. parameters_menu += ' , ';
  18272. }
  18273. }
  18274. parameters_menu += '<span> ) </span></div>';
  18275. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18276. dom_object.append(parameters_menu);
  18277. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  18278. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  18279. }
  18280. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18281. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18282. if (command.type == Models.COMMAND_TYPES.attribution) {
  18283. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18284. context_menu += '<div class="menu">';
  18285. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18286. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18287. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18288. context_menu += '</div></div>';
  18289. }
  18290. context_menu += '</div></div>';
  18291. context_menu = (0, _jquery2.default)(context_menu);
  18292. context_menu.insertAfter(parameters_menu);
  18293. context_menu.dropdown({
  18294. onChange: function onChange(value, text, $selectedItem) {
  18295. console.log('S2');
  18296. if ($selectedItem.data('clear')) {
  18297. console.log('PP2');
  18298. dom_object.text('');
  18299. variable_obj.content = null;
  18300. variable_obj.row = null;
  18301. variable_obj.column = null;
  18302. delete variable_obj.function_called;
  18303. delete variable_obj.parameters_list;
  18304. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18305. }
  18306. if ($selectedItem.data('exp')) {
  18307. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18308. }
  18309. },
  18310. selectOnKeydown: false
  18311. });
  18312. }
  18313. } else if (variable_obj.content.type) {
  18314. var variable_render = "";
  18315. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  18316. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18317. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18318. variable_render += '</div>';
  18319. variable_render = (0, _jquery2.default)(variable_render);
  18320. dom_object.append(variable_render);
  18321. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18322. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18323. if (command.type == Models.COMMAND_TYPES.attribution) {
  18324. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18325. context_menu += '<div class="menu">';
  18326. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18327. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18328. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18329. context_menu += '</div></div>';
  18330. }
  18331. context_menu += '</div></div>';
  18332. context_menu = (0, _jquery2.default)(context_menu);
  18333. variable_render.append(context_menu);
  18334. context_menu.dropdown({
  18335. onChange: function onChange(value, text, $selectedItem) {
  18336. console.log('S3');
  18337. if ($selectedItem.data('clear')) {
  18338. console.log('PP3');
  18339. dom_object.text('');
  18340. variable_obj.content = null;
  18341. variable_obj.row = null;
  18342. variable_obj.column = null;
  18343. delete variable_obj.function_called;
  18344. delete variable_obj.parameters_list;
  18345. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18346. }
  18347. if ($selectedItem.data('exp')) {
  18348. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18349. }
  18350. },
  18351. selectOnKeydown: false
  18352. });
  18353. if (!variable_obj.column) {
  18354. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18355. }
  18356. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18357. } else if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  18358. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18359. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  18360. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  18361. variable_render += '</div>';
  18362. variable_render = (0, _jquery2.default)(variable_render);
  18363. dom_object.append(variable_render);
  18364. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18365. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18366. if (command.type == Models.COMMAND_TYPES.attribution) {
  18367. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18368. context_menu += '<div class="menu">';
  18369. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18370. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18371. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18372. context_menu += '</div></div>';
  18373. }
  18374. context_menu += '</div></div>';
  18375. context_menu = (0, _jquery2.default)(context_menu);
  18376. variable_render.append(context_menu);
  18377. context_menu.dropdown({
  18378. onChange: function onChange(value, text, $selectedItem) {
  18379. console.log('S4');
  18380. if ($selectedItem.data('clear')) {
  18381. console.log('PP4');
  18382. dom_object.text('');
  18383. variable_obj.content = null;
  18384. variable_obj.row = null;
  18385. variable_obj.column = null;
  18386. delete variable_obj.function_called;
  18387. delete variable_obj.parameters_list;
  18388. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18389. }
  18390. if ($selectedItem.data('exp')) {
  18391. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18392. }
  18393. },
  18394. selectOnKeydown: false
  18395. });
  18396. if (!variable_obj.column) {
  18397. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18398. }
  18399. if (!variable_obj.row) {
  18400. variable_obj.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18401. }
  18402. variableValueMenuCode(command, variable_obj.row, (0, _jquery2.default)(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  18403. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18404. } else {
  18405. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18406. variable_render += '</div>';
  18407. variable_render = (0, _jquery2.default)(variable_render);
  18408. dom_object.append(variable_render);
  18409. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18410. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18411. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18412. console.log('dom_object6');
  18413. console.log(dom_object);
  18414. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18415. context_menu += '<div class="menu">';
  18416. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18417. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18418. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18419. context_menu += '</div></div>';
  18420. }
  18421. context_menu += '</div></div>';
  18422. context_menu = (0, _jquery2.default)(context_menu);
  18423. variable_render.append(context_menu);
  18424. context_menu.dropdown({
  18425. onChange: function onChange(value, text, $selectedItem) {
  18426. console.log('S5');
  18427. if ($selectedItem.data('clear')) {
  18428. console.log('PP5');
  18429. dom_object.text('');
  18430. variable_obj.content = null;
  18431. variable_obj.row = null;
  18432. variable_obj.column = null;
  18433. delete variable_obj.function_called;
  18434. delete variable_obj.parameters_list;
  18435. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18436. }
  18437. if ($selectedItem.data('exp')) {
  18438. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18439. }
  18440. },
  18441. selectOnKeydown: false
  18442. });
  18443. }
  18444. } else {
  18445. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  18446. variable_render += '</div>';
  18447. variable_render = (0, _jquery2.default)(variable_render);
  18448. dom_object.append(variable_render);
  18449. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18450. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18451. if (command.type == Models.COMMAND_TYPES.attribution) {
  18452. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18453. context_menu += '<div class="menu">';
  18454. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18455. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18456. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18457. context_menu += '</div></div>';
  18458. }
  18459. context_menu += '</div></div>';
  18460. context_menu = (0, _jquery2.default)(context_menu);
  18461. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18462. context_menu.insertAfter(variable_render);
  18463. }
  18464. context_menu.dropdown({
  18465. onChange: function onChange(value, text, $selectedItem) {
  18466. console.log('S6');
  18467. if ($selectedItem.data('clear')) {
  18468. console.log('PP6');
  18469. dom_object.text('');
  18470. variable_obj.content = null;
  18471. variable_obj.row = null;
  18472. variable_obj.column = null;
  18473. delete variable_obj.function_called;
  18474. delete variable_obj.parameters_list;
  18475. dom_object.find('.value_rendered').remove();
  18476. dom_object.find('.context_menu_clear').remove();
  18477. dom_object.find('.width-dynamic-minus').remove();
  18478. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18479. }
  18480. if ($selectedItem.data('exp')) {
  18481. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18482. }
  18483. },
  18484. selectOnKeydown: false
  18485. });
  18486. variable_render.on('click', function (e) {
  18487. variable_render.remove();
  18488. variable_render.empty();
  18489. variable_render.remove();
  18490. dom_object.empty();
  18491. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18492. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  18493. });
  18494. }
  18495. }
  18496. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18497. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18498. sub_menu.append('<div class="divider"></div><div class="header">' + _localizedStringsService.LocalizedStrings.getUI('text_header_ivprog_functions') + '</div>');
  18499. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_math') + '<div class="menu menu_math_functions"></div></div>');
  18500. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_text') + '<div class="menu menu_text_functions"></div></div>');
  18501. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_arrangement') + '<div class="menu menu_arrangement_functions"></div></div>');
  18502. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_conversion') + '<div class="menu menu_conversion_functions"></div></div>');
  18503. // Insert Math functions:
  18504. for (var i = 0; i < window.system_functions.length; i++) {
  18505. var t = (0, _jquery2.default)('<div class="item"></div>');
  18506. t.data('function_reference', window.system_functions[i]);
  18507. t.data('option', VAR_OR_VALUE_TYPES.only_function);
  18508. t.text(_localizedStringsService.LocalizedStrings.getUI(window.system_functions[i].identifier));
  18509. switch (window.system_functions[i].category) {
  18510. case Models.SYSTEM_FUNCTIONS_CATEGORIES.math:
  18511. sub_menu.find('.menu_math_functions').append(t);
  18512. break;
  18513. case Models.SYSTEM_FUNCTIONS_CATEGORIES.text:
  18514. sub_menu.find('.menu_text_functions').append(t);
  18515. break;
  18516. case Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement:
  18517. sub_menu.find('.menu_arrangement_functions').append(t);
  18518. break;
  18519. case Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion:
  18520. sub_menu.find('.menu_conversion_functions').append(t);
  18521. break;
  18522. }
  18523. }
  18524. }
  18525. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18526. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18527. sub_menu.text('');
  18528. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18529. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + ' </div>');
  18530. temp.data('function_reference', window.program_obj.functions[i]);
  18531. sub_menu.append(temp);
  18532. }
  18533. }
  18534. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18535. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  18536. sub_menu.text('');
  18537. var is_there = false;
  18538. if (window.program_obj.globals) {
  18539. if (ref_object.include_constant) {
  18540. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18541. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18542. temp.data('variable_reference', window.program_obj.globals[i]);
  18543. sub_menu.append(temp);
  18544. is_there = true;
  18545. }
  18546. } else {
  18547. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18548. if (!window.program_obj.globals[i].is_constant) {
  18549. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18550. temp.data('variable_reference', window.program_obj.globals[i]);
  18551. sub_menu.append(temp);
  18552. is_there = true;
  18553. }
  18554. }
  18555. }
  18556. }
  18557. if (function_obj.parameters_list) {
  18558. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18559. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + ' </div>');
  18560. temp.data('variable_reference', function_obj.parameters_list[i]);
  18561. sub_menu.append(temp);
  18562. is_there = true;
  18563. }
  18564. }
  18565. if (function_obj.variables_list) {
  18566. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18567. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + ' </div>');
  18568. temp.data('variable_reference', function_obj.variables_list[i]);
  18569. sub_menu.append(temp);
  18570. is_there = true;
  18571. }
  18572. }
  18573. if (!is_there) {
  18574. sub_menu.append((0, _jquery2.default)('<div class="header">' + _localizedStringsService.LocalizedStrings.getUI('text_none_variable') + '</div>'));
  18575. sub_menu.append((0, _jquery2.default)('<div class="item disabled">' + _localizedStringsService.LocalizedStrings.getUI('text_none_variable_instruction') + '</div>'));
  18576. }
  18577. }
  18578. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18579. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18580. menu_var_or_value.dropdown({
  18581. onChange: function onChange(value, text, $selectedItem) {
  18582. console.log('S7');
  18583. dom_object.find('.var_name').remove();
  18584. switch ($selectedItem.data('option')) {
  18585. case VAR_OR_VALUE_TYPES.only_function:
  18586. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('function_reference'), expression_element);
  18587. break;
  18588. case VAR_OR_VALUE_TYPES.only_value:
  18589. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18590. break;
  18591. case VAR_OR_VALUE_TYPES.only_variable:
  18592. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('variable_reference'), expression_element);
  18593. break;
  18594. }
  18595. if ($selectedItem.data('exp')) {
  18596. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18597. }
  18598. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18599. RepeatNTimesManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18600. }
  18601. },
  18602. selectOnKeydown: false
  18603. });
  18604. }
  18605. dom_object.find('.width-dynamic').on('input', function () {
  18606. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  18607. (0, _jquery2.default)(this).focus();
  18608. var tmpStr = (0, _jquery2.default)(this).val();
  18609. (0, _jquery2.default)(this).val('');
  18610. (0, _jquery2.default)(this).val(tmpStr);
  18611. (0, _jquery2.default)(this).css({
  18612. width: inputWidth
  18613. });
  18614. }).trigger('input');
  18615. if (command.type == Models.COMMAND_TYPES.comment) {
  18616. dom_object.parent().on('click', function (e) {
  18617. dom_object.find('.value_rendered').remove();
  18618. dom_object.find('.value_rendered').empty();
  18619. dom_object.find('.value_rendered').remove();
  18620. dom_object.empty();
  18621. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18622. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18623. });
  18624. }
  18625. }
  18626. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  18627. ref_object.function_called = function_selected;
  18628. ref_object.parameters_list = [];
  18629. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  18630. menu_var_or_value.find('.text').text(' ');
  18631. dom_object.find('.menu_var_or_value_dom').remove();
  18632. var parameters_menu;
  18633. if (function_selected.name) {
  18634. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18635. } else {
  18636. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18637. }
  18638. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18639. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18640. if (j + 1 != function_selected.parameters_list.length) {
  18641. parameters_menu += ' , ';
  18642. }
  18643. }
  18644. parameters_menu += '<span> ) </span></div>';
  18645. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18646. dom_object.append(parameters_menu);
  18647. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18648. var temp;
  18649. if (function_selected.parameters_list[j].dimensions > 0) {
  18650. temp = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, function_selected.parameters_list[j].dimensions);
  18651. } else {
  18652. temp = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18653. }
  18654. ref_object.parameters_list.push(temp);
  18655. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  18656. }
  18657. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18658. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18659. if (command.type == Models.COMMAND_TYPES.attribution) {
  18660. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18661. context_menu += '<div class="menu">';
  18662. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18663. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18664. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18665. context_menu += '</div></div>';
  18666. }
  18667. context_menu += '</div></div>';
  18668. context_menu = (0, _jquery2.default)(context_menu);
  18669. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18670. context_menu.dropdown({
  18671. onChange: function onChange(value, text, $selectedItem) {
  18672. console.log('S8');
  18673. if ($selectedItem.data('clear')) {
  18674. console.log('PP7');
  18675. dom_object.text('');
  18676. ref_object.content = null;
  18677. ref_object.row = null;
  18678. ref_object.column = null;
  18679. delete ref_object.function_called;
  18680. delete ref_object.parameters_list;
  18681. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18682. }
  18683. if ($selectedItem.data('exp')) {
  18684. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18685. }
  18686. },
  18687. selectOnKeydown: false
  18688. });
  18689. } else {
  18690. menu_var_or_value.find('.text').text(' ');
  18691. dom_object.find('.menu_var_or_value_dom').remove();
  18692. var parameters_menu;
  18693. if (function_selected.name) {
  18694. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18695. } else {
  18696. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18697. }
  18698. parameters_menu += '<span> ) </span></div>';
  18699. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18700. dom_object.append(parameters_menu);
  18701. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18702. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18703. if (command.type == Models.COMMAND_TYPES.attribution) {
  18704. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18705. context_menu += '<div class="menu">';
  18706. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18707. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18708. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18709. context_menu += '</div></div>';
  18710. }
  18711. context_menu += '</div></div>';
  18712. context_menu = (0, _jquery2.default)(context_menu);
  18713. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18714. context_menu.dropdown({
  18715. onChange: function onChange(value, text, $selectedItem) {
  18716. console.log('S9');
  18717. if ($selectedItem.data('clear')) {
  18718. console.log('PP8');
  18719. dom_object.text('');
  18720. ref_object.content = null;
  18721. ref_object.row = null;
  18722. ref_object.column = null;
  18723. delete ref_object.function_called;
  18724. delete ref_object.parameters_list;
  18725. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18726. }
  18727. if ($selectedItem.data('exp')) {
  18728. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18729. }
  18730. },
  18731. selectOnKeydown: false
  18732. });
  18733. }
  18734. if (command.type == Models.COMMAND_TYPES.attribution) {
  18735. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18736. }
  18737. }
  18738. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  18739. ref_object.content = variable_selected;
  18740. menu_var_or_value.find('.text').text(' ');
  18741. dom_object.find('.menu_var_or_value_dom').remove();
  18742. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  18743. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  18744. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18745. }
  18746. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  18747. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  18748. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18749. }
  18750. variable_render += '</div>';
  18751. variable_render = (0, _jquery2.default)(variable_render);
  18752. dom_object.append(variable_render);
  18753. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  18754. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18755. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18756. }
  18757. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  18758. ref_object.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18759. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  18760. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18761. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18762. }
  18763. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18764. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18765. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18766. console.log("dom_object 10: ");
  18767. console.log(dom_object);
  18768. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18769. context_menu += '<div class="menu">';
  18770. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18771. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18772. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18773. context_menu += '</div></div>';
  18774. }
  18775. context_menu += '</div></div>';
  18776. context_menu = (0, _jquery2.default)(context_menu);
  18777. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  18778. context_menu.dropdown({
  18779. onChange: function onChange(value, text, $selectedItem) {
  18780. console.log('S10');
  18781. if ($selectedItem.data('clear')) {
  18782. console.log('PP9');
  18783. dom_object.text('');
  18784. ref_object.content = null;
  18785. ref_object.row = null;
  18786. ref_object.column = null;
  18787. delete ref_object.function_called;
  18788. delete ref_object.parameters_list;
  18789. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18790. }
  18791. if ($selectedItem.data('exp')) {
  18792. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18793. }
  18794. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18795. RepeatNTimesManagement.manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18796. }
  18797. },
  18798. selectOnKeydown: false
  18799. });
  18800. if (command.type == Models.COMMAND_TYPES.attribution) {
  18801. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  18802. }
  18803. }
  18804. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18805. if (ref_object.content == null) {
  18806. ref_object.content = "";
  18807. }
  18808. menu_var_or_value.find('.text').text(' ');
  18809. var field = (0, _jquery2.default)('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  18810. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  18811. var rendered = (0, _jquery2.default)('<div class="value_rendered"></div>');
  18812. rendered.insertBefore(field);
  18813. field.focus();
  18814. field.val(ref_object.content);
  18815. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18816. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18817. if (command.type == Models.COMMAND_TYPES.attribution) {
  18818. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18819. context_menu += '<div class="menu">';
  18820. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18821. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18822. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18823. context_menu += '</div></div>';
  18824. }
  18825. context_menu += '</div></div>';
  18826. context_menu = (0, _jquery2.default)(context_menu);
  18827. dom_object.find('.menu_var_or_value_dom').remove();
  18828. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18829. context_menu.insertAfter(field);
  18830. }
  18831. context_menu.dropdown({
  18832. onChange: function onChange(value, text, $selectedItem) {
  18833. console.log('S11');
  18834. if ($selectedItem.data('clear')) {
  18835. console.log('PP10');
  18836. dom_object.text('');
  18837. dom_object.find('.value_rendered').remove();
  18838. dom_object.find('.context_menu_clear').remove();
  18839. dom_object.find('.width-dynamic-minus').remove();
  18840. ref_object.content = null;
  18841. ref_object.row = null;
  18842. ref_object.column = null;
  18843. delete ref_object.function_called;
  18844. delete ref_object.parameters_list;
  18845. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18846. }
  18847. if ($selectedItem.data('exp')) {
  18848. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18849. }
  18850. },
  18851. selectOnKeydown: false
  18852. });
  18853. dom_object.find('.width-dynamic-minus').focusout(function () {
  18854. if ((0, _jquery2.default)(this).val().trim()) {
  18855. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18856. }
  18857. rendered.text(ref_object.content);
  18858. (0, _jquery2.default)(this).remove();
  18859. });
  18860. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  18861. var code = e.keyCode || e.which;
  18862. if (code == 13) {
  18863. if ((0, _jquery2.default)(this).val().trim()) {
  18864. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18865. }
  18866. rendered.text(ref_object.content);
  18867. (0, _jquery2.default)(this).remove();
  18868. }
  18869. if (code == 27) {
  18870. rendered.text(ref_object.content);
  18871. (0, _jquery2.default)(this).remove();
  18872. }
  18873. });
  18874. if (command.type == Models.COMMAND_TYPES.comment) {
  18875. /*rendered.parent().on('click', function(e) {
  18876. rendered.parent().off();
  18877. console.log("TTT14");
  18878. rendered.remove();
  18879. rendered.empty();
  18880. rendered.remove();
  18881. dom_object.empty();
  18882. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18883. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element)
  18884. });*/
  18885. }
  18886. rendered.on('click', function (e) {
  18887. console.log("TTT2");
  18888. rendered.remove();
  18889. rendered.empty();
  18890. rendered.remove();
  18891. dom_object.empty();
  18892. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18893. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18894. });
  18895. if (command.type == Models.COMMAND_TYPES.attribution) {
  18896. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18897. }
  18898. }
  18899. _jquery2.default.fn.textWidth = function (text, font) {
  18900. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  18901. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  18902. return _jquery2.default.fn.textWidth.fakeEl.width();
  18903. };
  18904. /***/ }),
  18905. /***/ "./js/visualUI/commands/whiletrue.js":
  18906. /*!*******************************************!*\
  18907. !*** ./js/visualUI/commands/whiletrue.js ***!
  18908. \*******************************************/
  18909. /*! no static exports found */
  18910. /***/ (function(module, exports, __webpack_require__) {
  18911. "use strict";
  18912. Object.defineProperty(exports, "__esModule", {
  18913. value: true
  18914. });
  18915. exports.createFloatingCommand = createFloatingCommand;
  18916. exports.renderCommand = renderCommand;
  18917. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18918. var _jquery2 = _interopRequireDefault(_jquery);
  18919. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18920. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18921. var Models = _interopRequireWildcard(_ivprog_elements);
  18922. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18923. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18924. var GlobalsManagement = _interopRequireWildcard(_globals);
  18925. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18926. var VariablesManagement = _interopRequireWildcard(_variables);
  18927. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18928. var CommandsManagement = _interopRequireWildcard(_commands);
  18929. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  18930. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  18931. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  18932. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  18933. 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; } }
  18934. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18935. function createFloatingCommand() {
  18936. 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>');
  18937. }
  18938. function renderCommand(command, function_obj) {
  18939. var ret = '';
  18940. 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>';
  18941. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  18942. ret += ' </span>';
  18943. ret += '<div class="ui block_commands">';
  18944. ret += '</div>';
  18945. ret += '<span> </span>';
  18946. ret += '</div>';
  18947. var el = (0, _jquery2.default)(ret);
  18948. el.data('command', command);
  18949. el.find('.block_commands').data('command', command);
  18950. addHandlers(command, function_obj, el);
  18951. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  18952. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  18953. if (command.commands_block) {
  18954. for (var j = 0; j < command.commands_block.length; j++) {
  18955. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  18956. }
  18957. }
  18958. return el;
  18959. }
  18960. function addHandlers(command, function_obj, whiletrue_dom) {
  18961. whiletrue_dom.find('.button_remove_command').on('click', function () {
  18962. if (CommandsManagement.removeCommand(command, function_obj, whiletrue_dom)) {
  18963. whiletrue_dom.fadeOut();
  18964. }
  18965. });
  18966. }
  18967. /***/ }),
  18968. /***/ "./js/visualUI/commands/writer.js":
  18969. /*!****************************************!*\
  18970. !*** ./js/visualUI/commands/writer.js ***!
  18971. \****************************************/
  18972. /*! no static exports found */
  18973. /***/ (function(module, exports, __webpack_require__) {
  18974. "use strict";
  18975. Object.defineProperty(exports, "__esModule", {
  18976. value: true
  18977. });
  18978. exports.createFloatingCommand = createFloatingCommand;
  18979. exports.renderCommand = renderCommand;
  18980. exports.addContent = addContent;
  18981. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18982. var _jquery2 = _interopRequireDefault(_jquery);
  18983. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18984. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18985. var Models = _interopRequireWildcard(_ivprog_elements);
  18986. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18987. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18988. var GlobalsManagement = _interopRequireWildcard(_globals);
  18989. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18990. var VariablesManagement = _interopRequireWildcard(_variables);
  18991. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  18992. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  18993. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  18994. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18995. var CommandsManagement = _interopRequireWildcard(_commands);
  18996. __webpack_require__(/*! ../../Sortable.js */ "./js/Sortable.js");
  18997. 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; } }
  18998. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18999. function createFloatingCommand() {
  19000. 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>');
  19001. }
  19002. function renderCommand(command, function_obj) {
  19003. var ret = '';
  19004. 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="all_elements_write"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  19005. var el = (0, _jquery2.default)(ret);
  19006. el.data('command', command);
  19007. for (var i = 0; i < command.content.length; i++) {
  19008. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  19009. var div_parent_with_handler = (0, _jquery2.default)('<div class="div_parent_handler"></div>');
  19010. div_parent_with_handler.append((0, _jquery2.default)('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  19011. div_parent_with_handler.append(new_div_item);
  19012. div_parent_with_handler.append((0, _jquery2.default)('<i class="white inverted icon times handler"></i>'));
  19013. el.find('.all_elements_write').append(div_parent_with_handler);
  19014. VariableValueMenu.renderMenu(command, command.content[i], new_div_item, function_obj);
  19015. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  19016. addHandlersManager(command, function_obj, el, div_parent_with_handler, command.content[i]);
  19017. }
  19018. if (command.content.length == 0) {
  19019. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  19020. }
  19021. addHandlers(command, function_obj, el);
  19022. return el;
  19023. }
  19024. function addHandlersManager(command, function_obj, writer_dom, item_div, content_element) {
  19025. item_div.find('.times').on('click', function () {
  19026. for (var i = 0; i < command.content.length; i++) {
  19027. if (command.content[i] == content_element) {
  19028. delete command.content[i];
  19029. command.content.splice(i, 1);
  19030. item_div.children().off();
  19031. item_div.off();
  19032. item_div.fadeOut();
  19033. if (command.content.length > 0) {
  19034. item_div.next('.icon_add_item_to_writer').fadeOut();
  19035. }
  19036. break;
  19037. }
  19038. }
  19039. });
  19040. }
  19041. function addHandlers(command, function_obj, writer_dom) {
  19042. writer_dom.find('.button_remove_command').on('click', function () {
  19043. if (CommandsManagement.removeCommand(command, function_obj, writer_dom)) {
  19044. writer_dom.fadeOut();
  19045. }
  19046. });
  19047. Sortable.create(writer_dom.find(".all_elements_write")[0], {
  19048. handle: '.ellipsis',
  19049. animation: 100,
  19050. ghostClass: 'ghost',
  19051. group: 'writer_' + Math.floor(Math.random() * 10000000),
  19052. draggable: '.div_parent_handler',
  19053. onEnd: function onEnd(evt) {
  19054. command.content.splice(evt.newIndex, 0, command.content.splice(evt.oldIndex, 1)[0]);
  19055. writer_dom.empty();
  19056. writer_dom.replaceWith(renderCommand(command, function_obj));
  19057. }
  19058. });
  19059. }
  19060. function addHandlerIconAdd(dom_object, command, function_obj) {
  19061. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  19062. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  19063. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  19064. if (!insert_after) {
  19065. dom_object.append(icon_add_item);
  19066. } else {
  19067. icon_add_item.insertAfter(after_which);
  19068. }
  19069. icon_add_item.on('click', function (e) {
  19070. var div_parent_with_handler = (0, _jquery2.default)('<div class="div_parent_handler" style="display:none;"></div>');
  19071. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  19072. div_parent_with_handler.append((0, _jquery2.default)('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  19073. div_parent_with_handler.append(new_div_item);
  19074. div_parent_with_handler.append((0, _jquery2.default)('<i class="white inverted icon times handler"></i>'));
  19075. div_parent_with_handler.insertAfter(icon_add_item);
  19076. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  19077. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  19078. addHandlerIconAdd(dom_object, command, function_obj, true, div_parent_with_handler);
  19079. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  19080. var pos = 1;
  19081. dom_object.find('.icon_add_item_to_writer').each(function () {
  19082. if ((0, _jquery2.default)(this).get(0) === icon_add_item.get(0)) {
  19083. command.content.splice(pos, 0, new_related_menu);
  19084. } else {
  19085. pos++;
  19086. }
  19087. });
  19088. if (command.content.length == 1) {
  19089. icon_add_item.remove();
  19090. }
  19091. div_parent_with_handler.fadeIn();
  19092. });
  19093. }
  19094. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  19095. if (dom_object.hasClass('var_value_menu_div')) {
  19096. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  19097. icon_add_item.insertAfter(dom_object);
  19098. icon_add_item.on('click', function (e) {
  19099. var div_parent_with_handler = (0, _jquery2.default)('<div class="div_parent_handler"></div>');
  19100. div_parent_with_handler.append((0, _jquery2.default)('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  19101. div_parent_with_handler.append(new_div_item);
  19102. div_parent_with_handler.append((0, _jquery2.default)('<i class="white inverted icon times handler"></i>'));
  19103. div_parent_with_handler.insertAfter(icon_add_item);
  19104. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  19105. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  19106. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  19107. command.content.push(new_related_menu);
  19108. if (command.content.length == 1) {
  19109. icon_add_item.remove();
  19110. }
  19111. });
  19112. }
  19113. }
  19114. /***/ }),
  19115. /***/ "./js/visualUI/functions.js":
  19116. /*!**********************************!*\
  19117. !*** ./js/visualUI/functions.js ***!
  19118. \**********************************/
  19119. /*! no static exports found */
  19120. /***/ (function(module, exports, __webpack_require__) {
  19121. "use strict";
  19122. Object.defineProperty(exports, "__esModule", {
  19123. value: true
  19124. });
  19125. exports.renderFunction = renderFunction;
  19126. exports.initVisualUI = initVisualUI;
  19127. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19128. var _jquery2 = _interopRequireDefault(_jquery);
  19129. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19130. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19131. var Models = _interopRequireWildcard(_ivprog_elements);
  19132. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19133. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  19134. var GlobalsManagement = _interopRequireWildcard(_globals);
  19135. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  19136. var VariablesManagement = _interopRequireWildcard(_variables);
  19137. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  19138. var CommandsManagement = _interopRequireWildcard(_commands);
  19139. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  19140. var CodeManagement = _interopRequireWildcard(_code_generator);
  19141. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  19142. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  19143. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  19144. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  19145. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  19146. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  19147. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  19148. var _semanticAnalyser = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  19149. var _ivprogAssessment = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  19150. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  19151. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  19152. var _utils = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  19153. var Utils = _interopRequireWildcard(_utils);
  19154. var _ima_version = __webpack_require__(/*! ./../../.ima_version.json */ "./.ima_version.json");
  19155. var _ima_version2 = _interopRequireDefault(_ima_version);
  19156. __webpack_require__(/*! ../Sortable.js */ "./js/Sortable.js");
  19157. 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; } }
  19158. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19159. var counter_new_functions = 0;
  19160. var counter_new_parameters = 0;
  19161. var ivprog_version = _ima_version2.default.version;
  19162. var studentTemp = null;
  19163. var domConsole = null;
  19164. window.studentGrade = null;
  19165. window.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  19166. var program = new Models.Program();
  19167. window.system_functions = [];
  19168. // Adding math functions:
  19169. window.system_functions.push(new Models.SystemFunction('$sin', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19170. window.system_functions.push(new Models.SystemFunction('$cos', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19171. window.system_functions.push(new Models.SystemFunction('$tan', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19172. window.system_functions.push(new Models.SystemFunction('$sqrt', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19173. window.system_functions.push(new Models.SystemFunction('$pow', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19174. window.system_functions.push(new Models.SystemFunction('$log', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19175. window.system_functions.push(new Models.SystemFunction('$abs', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19176. window.system_functions.push(new Models.SystemFunction('$negate', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19177. window.system_functions.push(new Models.SystemFunction('$invert', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19178. window.system_functions.push(new Models.SystemFunction('$max', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19179. window.system_functions.push(new Models.SystemFunction('$min', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19180. // Adding text functions:
  19181. window.system_functions.push(new Models.SystemFunction('$substring', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  19182. window.system_functions.push(new Models.SystemFunction('$length', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  19183. window.system_functions.push(new Models.SystemFunction('$uppercase', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  19184. window.system_functions.push(new Models.SystemFunction('$lowercase', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  19185. window.system_functions.push(new Models.SystemFunction('$charAt', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  19186. // Adding arrangement functions:
  19187. window.system_functions.push(new Models.SystemFunction('$numElements', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, 1)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  19188. window.system_functions.push(new Models.SystemFunction('$matrixLines', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, 2)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  19189. window.system_functions.push(new Models.SystemFunction('$matrixColumns', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, 2)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  19190. // Adding conversion functions:
  19191. window.system_functions.push(new Models.SystemFunction('$isReal', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19192. window.system_functions.push(new Models.SystemFunction('$isInt', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19193. window.system_functions.push(new Models.SystemFunction('$isBool', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19194. window.system_functions.push(new Models.SystemFunction('$castReal', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19195. window.system_functions.push(new Models.SystemFunction('$castInt', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19196. window.system_functions.push(new Models.SystemFunction('$castBool', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19197. window.system_functions.push(new Models.SystemFunction('$castString', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19198. console.log(' ___ ___ ________ \n / / / / / ____/ \n / / / / / / \n / / / / ______ ___ / /__ \n / / / / / \\ / / / ___/ \n / /______ / / / /\\ \\/ / / / \n / / / / / / \\ / / /____ \n/__________/ /___/ /___/ \\___/ /________/ \n\n Laboratório de Informática na Educação\n http://line.ime.usp.br');
  19199. var mainFunction = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("start"), _types.Types.VOID, 0, [], true, false);
  19200. mainFunction.function_comment = new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_main'));
  19201. program.addFunction(mainFunction);
  19202. window.program_obj = program;
  19203. window.generator = CodeManagement.generate;
  19204. window.runCodeAssessment = runCodeAssessment;
  19205. window.renderAlgorithm = AlgorithmManagement.renderAlgorithm;
  19206. window.insertContext = false;
  19207. window.watchW = _melankeWatchjs2.default;
  19208. _melankeWatchjs2.default.watch(window.program_obj.globals, function () {
  19209. if (window.insertContext) {
  19210. setTimeout(function () {
  19211. AlgorithmManagement.renderAlgorithm();
  19212. }, 300);
  19213. window.insertContext = false;
  19214. } else {
  19215. AlgorithmManagement.renderAlgorithm();
  19216. }
  19217. }, 1);
  19218. _melankeWatchjs2.default.watch(window.program_obj.functions, function () {
  19219. if (window.insertContext) {
  19220. setTimeout(function () {
  19221. AlgorithmManagement.renderAlgorithm();
  19222. }, 300);
  19223. window.insertContext = false;
  19224. } else {
  19225. AlgorithmManagement.renderAlgorithm();
  19226. }
  19227. }, 1);
  19228. function addFunctionHandler() {
  19229. 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')));
  19230. program.addFunction(new_function);
  19231. counter_new_functions++;
  19232. window.insertContext = true;
  19233. var newe = renderFunction(new_function);
  19234. newe.css('display', 'none');
  19235. newe.fadeIn();
  19236. }
  19237. function addParameter(function_obj, function_container) {
  19238. var is_from_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  19239. if (function_obj.parameters_list == null) {
  19240. function_obj.parameters_list = [];
  19241. }
  19242. var new_parameter = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI("new_parameter") + "_" + counter_new_parameters);
  19243. function_obj.parameters_list.push(new_parameter);
  19244. counter_new_parameters++;
  19245. var newe = renderParameter(function_obj, new_parameter, function_container);
  19246. if (is_from_click) {
  19247. newe.css('display', 'none');
  19248. newe.fadeIn();
  19249. }
  19250. }
  19251. function updateReturnType(function_obj, new_type) {
  19252. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19253. function_obj.return_type = new_type;
  19254. function_obj.return_dimensions = new_dimensions;
  19255. }
  19256. function removeFunction(function_obj) {
  19257. var index = program.functions.indexOf(function_obj);
  19258. if (index > -1) {
  19259. program.functions.splice(index, 1);
  19260. }
  19261. }
  19262. function minimizeFunction(function_obj) {
  19263. function_obj.is_hidden = !function_obj.is_hidden;
  19264. }
  19265. function addHandlers(function_obj, function_container) {
  19266. function_container.find('.ui.dropdown.function_return').dropdown({
  19267. onChange: function onChange(value, text, $selectedItem) {
  19268. if ($selectedItem.data('dimensions')) {
  19269. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19270. } else {
  19271. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')]);
  19272. }
  19273. },
  19274. selectOnKeydown: false
  19275. });
  19276. function_container.find(".name_function_updated").on('click', function (e) {
  19277. enableNameFunctionUpdate(function_obj, function_container);
  19278. });
  19279. function_container.find(".add_parameter_button").on('click', function (e) {
  19280. window.insertContext = true;
  19281. addParameter(function_obj, function_container, true);
  19282. });
  19283. function_container.find('.menu_commands').dropdown({
  19284. on: 'hover'
  19285. });
  19286. function_container.find('.menu_commands a').on('click', function (evt) {
  19287. if (function_obj.commands == null || function_obj.commands.length == 0) {
  19288. function_obj.commands = [];
  19289. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  19290. function_obj.commands.push(new_cmd);
  19291. CommandsManagement.renderCommand(new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  19292. } else {
  19293. CommandsManagement.createFloatingCommand(function_obj, function_container, (0, _jquery2.default)(this).data('command'), evt);
  19294. }
  19295. });
  19296. function_container.find('.add_var_button_function').on('click', function (e) {
  19297. window.insertContext = true;
  19298. VariablesManagement.addVariable(function_obj, function_container, true);
  19299. });
  19300. function_container.find('.remove_function_button').on('click', function (e) {
  19301. removeFunction(function_obj);
  19302. function_container.fadeOut();
  19303. });
  19304. function_container.find('.minimize_function_button').on('click', function (e) {
  19305. minimizeFunction(function_obj);
  19306. if (function_obj.is_hidden) {
  19307. function_container.find(".add_var_button_function").toggle();
  19308. function_container.find(".inline_add_command").toggle();
  19309. function_container.find(".function_area").slideToggle();
  19310. } else {
  19311. function_container.find(".function_area").slideToggle(function () {
  19312. function_container.find(".add_var_button_function").toggle();
  19313. function_container.find(".inline_add_command").toggle();
  19314. });
  19315. }
  19316. });
  19317. }
  19318. // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  19319. function renderFunctionReturn(function_obj, function_element) {
  19320. var ret = '<div class="ui dropdown function_return">';
  19321. if (function_obj.return_dimensions > 0) {
  19322. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI("vector") + ':' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type);
  19323. if (function_obj.return_dimensions == 1) {
  19324. ret += ' [ ] ';
  19325. } else {
  19326. ret += ' [ ] [ ] ';
  19327. }
  19328. ret += '</div>';
  19329. } else {
  19330. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type) + '</div>';
  19331. }
  19332. ret += '<div class="menu">';
  19333. for (var tm in _types.Types) {
  19334. 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>';
  19335. }
  19336. for (var tm in _types.Types) {
  19337. if (tm == _types.Types.VOID.toUpperCase()) {
  19338. continue;
  19339. }
  19340. 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>';
  19341. }
  19342. ret += '</div></div>';
  19343. ret = (0, _jquery2.default)(ret);
  19344. function_element.find('.function_return').append(ret);
  19345. }
  19346. var cont = 0;
  19347. function renderFunction(function_obj) {
  19348. var appender = '<div class="ui secondary segment function_div list-group-item function_cont_' + cont + '">';
  19349. if (function_obj.function_comment) {
  19350. //appender += renderComment(function_obj.function_comment, sequence, true, -1);
  19351. }
  19352. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  19353. 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>';
  19354. appender += '<div class="function_signature_div">' + _localizedStringsService.LocalizedStrings.getUI("function") + ' ';
  19355. if (function_obj.is_main) {
  19356. 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">';
  19357. } else {
  19358. appender += '<div class="ui function_return"></div>';
  19359. 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">';
  19360. }
  19361. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  19362. appender += '<div class="ui add_var_context add_var_button_function" style="float: left;"><i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button purple"><i class="icon superscript"></i></div></div>';
  19363. appender += '<div class="ui top attached segment variables_list_div"></div>';
  19364. appender += '<div class="ui bottom attached segment commands_list_div commands_cont_' + cont + '">' + '<div class="ui rail" style="width: 35px; margin-left: -36px;"><div class="ui sticky sticky_cont_' + cont + '" style="top: 50px !important;">';
  19365. appender += '<i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button dropdown menu_commands orange" ><i class="icon code"></i> <div class="menu"> ';
  19366. 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>';
  19367. appender += '</div></div>' + '</div>';
  19368. appender += '</div></div>';
  19369. appender = (0, _jquery2.default)(appender);
  19370. (0, _jquery2.default)('.all_functions').append(appender);
  19371. appender.data('fun', function_obj);
  19372. appender.find('.commands_list_div').data('fun', function_obj);
  19373. renderFunctionReturn(function_obj, appender);
  19374. addHandlers(function_obj, appender);
  19375. // Rendering parameters:
  19376. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  19377. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  19378. }
  19379. // Rendering variables:
  19380. for (var j = 0; j < function_obj.variables_list.length; j++) {
  19381. VariablesManagement.renderVariable(appender, function_obj.variables_list[j], function_obj);
  19382. }
  19383. // Rendering commands:
  19384. for (var j = 0; j < function_obj.commands.length; j++) {
  19385. CommandsManagement.renderCommand(function_obj.commands[j], (0, _jquery2.default)(appender.find('.commands_list_div')[0]), 3, function_obj);
  19386. }
  19387. (0, _jquery2.default)('.minimize_function_button').popup({
  19388. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_minimize"),
  19389. delay: {
  19390. show: 750,
  19391. hide: 0
  19392. }
  19393. });
  19394. var function_index = program.functions.indexOf(function_obj);
  19395. Sortable.create(appender.find(".variables_list_div")[0], {
  19396. handle: '.ellipsis',
  19397. animation: 100,
  19398. ghostClass: 'ghost',
  19399. group: 'local_vars_drag_' + function_index,
  19400. onEnd: function onEnd(evt) {
  19401. updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  19402. }
  19403. });
  19404. addSortableHandler(appender.find(".commands_list_div")[0], function_index);
  19405. if (!function_obj.is_main) {
  19406. Sortable.create(appender.find(".container_parameters_list")[0], {
  19407. handle: '.ellipsis',
  19408. animation: 100,
  19409. ghostClass: 'ghost',
  19410. group: 'parameters_drag_' + program.functions.indexOf(function_obj),
  19411. onEnd: function onEnd(evt) {
  19412. updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
  19413. }
  19414. });
  19415. }
  19416. var teste = '.ui.sticky.sticky_cont_' + cont;
  19417. (0, _jquery2.default)(teste).sticky({
  19418. context: '.ui.bottom.attached.segment.commands_list_div.commands_cont_' + cont,
  19419. scrollContext: '.ivprog_visual_panel',
  19420. observeChanges: true,
  19421. offset: 40,
  19422. onStick: function onStick(evt) {
  19423. (0, _jquery2.default)(teste).css('top', '20px', 'important');
  19424. },
  19425. onBottom: function onBottom(evt) {
  19426. (0, _jquery2.default)(teste).css('top', '20px', 'important');
  19427. },
  19428. onUnstick: function onUnstick(evt) {
  19429. (0, _jquery2.default)(teste).css('top', '20px', 'important');
  19430. },
  19431. onReposition: function onReposition(evt) {
  19432. (0, _jquery2.default)(teste).css('top', '20px', 'important');
  19433. },
  19434. onScroll: function onScroll(evt) {
  19435. (0, _jquery2.default)(teste).css('top', '20px', 'important');
  19436. if (!isVisible((0, _jquery2.default)(teste), (0, _jquery2.default)(teste).parent())) {
  19437. (0, _jquery2.default)(teste).removeClass('fixed');
  19438. }
  19439. },
  19440. onTop: function onTop(evt) {
  19441. (0, _jquery2.default)(teste).css('top', '20px', 'important');
  19442. }
  19443. });
  19444. cont++;
  19445. return appender;
  19446. }
  19447. function isVisible(element, container) {
  19448. var elementTop = (0, _jquery2.default)(element).offset().top,
  19449. elementHeight = (0, _jquery2.default)(element).height(),
  19450. containerTop = (0, _jquery2.default)(container).offset().top,
  19451. containerHeight = (0, _jquery2.default)(container).height() - 30;
  19452. return elementTop - containerTop + elementHeight > 0 && elementTop - containerTop < containerHeight;
  19453. }
  19454. window.evento_drag;
  19455. function updateProgramObjDrag() {
  19456. var nodes = Array.prototype.slice.call((0, _jquery2.default)('.all_functions').children());
  19457. var function_index;
  19458. var start_index;
  19459. var function_obj;
  19460. (0, _jquery2.default)(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  19461. if ((0, _jquery2.default)(this).hasClass('function_div')) {
  19462. function_index = nodes.indexOf(this);
  19463. start_index = index;
  19464. function_obj = (0, _jquery2.default)(this);
  19465. }
  19466. });
  19467. console.log(function_index);
  19468. var path_target = [];
  19469. (0, _jquery2.default)(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  19470. if ((0, _jquery2.default)(this).hasClass('command_container')) {
  19471. path_target.push(this);
  19472. }
  19473. });
  19474. if (path_target.length == 0) {
  19475. //console.log('soltou na raiz, na posição: ' + evento_drag.newIndex + ' mas ainda não sei de onde saiu ');
  19476. } else {
  19477. //console.log('soltou dentro de algum bloco, sequência vem logo abaixo (de baixo pra cima): ');
  19478. //console.log(path_target);
  19479. }
  19480. var index_each = [];
  19481. var path_relative = [];
  19482. for (var i = path_target.length - 1; i >= 0; i--) {
  19483. console.log('da vez', (0, _jquery2.default)(path_target[i + 1]));
  19484. if (i == path_target.length - 1) {
  19485. // está na raiz
  19486. var indice_na_raiz = function_obj.find('.command_container').index(path_target[i]);
  19487. console.log('índice na raiz: ', indice_na_raiz);
  19488. } else {
  19489. if ((0, _jquery2.default)(path_target[i + 1]).hasClass('iftrue')) {
  19490. if ((0, _jquery2.default)(path_target[i]).parent().hasClass('commands_if')) {
  19491. path_relative.push('if');
  19492. index_each.push((0, _jquery2.default)(path_target[i]).parent().find('.command_container').index(path_target[i]));
  19493. } else {
  19494. path_relative.push('else');
  19495. index_each.push((0, _jquery2.default)(path_target[i]).parent().find('.command_container').index(path_target[i]));
  19496. }
  19497. } else if ((0, _jquery2.default)(path_target[i + 1]).hasClass('dowhiletrue')) {
  19498. path_relative.push('dowhiletrue');
  19499. index_each.push((0, _jquery2.default)(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19500. } else if ((0, _jquery2.default)(path_target[i + 1]).hasClass('repeatNtimes')) {
  19501. path_relative.push('repeatNtimes');
  19502. index_each.push((0, _jquery2.default)(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19503. } else if ((0, _jquery2.default)(path_target[i + 1]).hasClass('whiletrue')) {
  19504. path_relative.push('whiletrue');
  19505. index_each.push((0, _jquery2.default)(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19506. } else if ((0, _jquery2.default)(path_target[i + 1]).hasClass('switch')) {
  19507. path_relative.push('switch');
  19508. //index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19509. }
  19510. }
  19511. }
  19512. var index_in_block = -1;
  19513. var is_in_else = (0, _jquery2.default)(evento_drag.item).parent().hasClass('commands_else');
  19514. index_in_block = (0, _jquery2.default)(evento_drag.item).parent().find('.command_container').index(evento_drag.item);
  19515. var is_in_case_switch = (0, _jquery2.default)(evento_drag.item).parent().hasClass('case_commands_block');
  19516. var index_case_of_switch = -1;
  19517. if (is_in_case_switch) {
  19518. index_case_of_switch = (0, _jquery2.default)(evento_drag.item).parent().parent().parent().find('.case_div').index((0, _jquery2.default)(evento_drag.item).parent().parent());
  19519. }
  19520. /*console.log('path_relative:');
  19521. console.log(path_relative);
  19522. console.log('index_each:');
  19523. console.log(index_each);
  19524. console.log('index_in_block:');
  19525. console.log(index_in_block);
  19526. console.log('ele está em algum bloco de senão? ');
  19527. console.log(is_in_else);
  19528. console.log('ele está dentro de um case de switch?');
  19529. console.log(is_in_case_switch);
  19530. console.log('qual é o índice do case: ');
  19531. console.log(index_case_of_switch);*/
  19532. // encontrar o elemento na árvore:
  19533. var command_start_point = window.program_obj.functions[function_index].commands[indice_na_raiz];
  19534. var block_to_insert = command_start_point;
  19535. for (var i = 0; i < index_each.length; i++) {
  19536. if (path_relative[i] == "else") {
  19537. block_to_insert = block_to_insert.commands_else[index_each[i]];
  19538. } else if (path_relative[i] == "switch") {} else {
  19539. block_to_insert = block_to_insert.commands_block[index_each[i]];
  19540. }
  19541. }
  19542. //console.log('command_start_point', command_start_point);
  19543. //console.log('block_to_insert', block_to_insert);
  19544. // agora tem que alocar o comando na árvore, mas considerar as quatro situações:
  19545. // (1) se está em um else ou (2) se está em switch ou (3) será um caso padrão ou (4) se será na raiz.
  19546. if (path_target.length == 0) {
  19547. // soltou na raiz:
  19548. window.program_obj.functions[function_index].commands.splice(evento_drag.newIndex, 0, command_in_drag);
  19549. } else if (is_in_else) {
  19550. if (block_to_insert.commands_else) {
  19551. block_to_insert.commands_else.splice(evento_drag.newIndex, 0, command_in_drag);
  19552. } else {
  19553. block_to_insert.commands_else = [];
  19554. block_to_insert.commands_else.push(command_in_drag);
  19555. }
  19556. } else if (is_in_case_switch) {} else {
  19557. // verificar se tem alguma coisa no bloco:
  19558. if (block_to_insert.commands_block) {
  19559. block_to_insert.commands_block.splice(evento_drag.newIndex, 0, command_in_drag);
  19560. } else {
  19561. block_to_insert.commands_block = [];
  19562. block_to_insert.commands_block.push(command_in_drag);
  19563. }
  19564. }
  19565. window.draging = false;
  19566. renderAlgorithm();
  19567. }
  19568. function prepareDragHandler(evt) {
  19569. window.draging = true;
  19570. var nodes = Array.prototype.slice.call((0, _jquery2.default)('.all_functions').children());
  19571. var function_index;
  19572. var function_obj;
  19573. (0, _jquery2.default)(evt.item).parentsUntil(".all_functions").each(function (index) {
  19574. if ((0, _jquery2.default)(this).hasClass('function_div')) {
  19575. function_index = nodes.indexOf(this);
  19576. function_obj = window.program_obj.functions[function_index];
  19577. }
  19578. });
  19579. command_in_drag = (0, _jquery2.default)(evt.item).data("command");
  19580. //console.log('$(evt.item).parent(): ');
  19581. //console.log($(evt.item).parent());
  19582. // descobrir qual das quatro situações:
  19583. if ((0, _jquery2.default)(evt.item).parent().hasClass('commands_list_div')) {
  19584. // está na raiz:
  19585. if (function_obj.commands.indexOf(command_in_drag) > -1) {
  19586. function_obj.commands.splice(function_obj.commands.indexOf(command_in_drag), 1);
  19587. }
  19588. } else if ((0, _jquery2.default)(evt.item).parent().hasClass('commands_else')) {
  19589. // está no else:
  19590. if ((0, _jquery2.default)(evt.item).parent().data('command').commands_else.indexOf(command_in_drag) > -1) {
  19591. (0, _jquery2.default)(evt.item).parent().data('command').commands_else.splice((0, _jquery2.default)(evt.item).parent().data('command').commands_else.indexOf(command_in_drag), 1);
  19592. }
  19593. } else if ((0, _jquery2.default)(evt.item).parent().hasClass('case_commands_block')) {// está em um switch:
  19594. } else {
  19595. // caso padrão:
  19596. if ((0, _jquery2.default)(evt.item).parent().data('command').commands_block.indexOf(command_in_drag) > -1) {
  19597. (0, _jquery2.default)(evt.item).parent().data('command').commands_block.splice((0, _jquery2.default)(evt.item).parent().data('command').commands_block.indexOf(command_in_drag), 1);
  19598. }
  19599. }
  19600. }
  19601. var command_in_drag;
  19602. function addSortableHandler(element, id_function) {
  19603. var n_group = 'commands_drag_' + id_function;
  19604. Sortable.create(element, {
  19605. handle: '.command_drag',
  19606. ghostClass: 'ghost',
  19607. animation: 300,
  19608. group: { name: n_group },
  19609. onEnd: function onEnd(evt) {
  19610. //updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  19611. var itemEl = evt.item; // dragged HTMLElement
  19612. evt.to; // target list
  19613. evt.from; // previous list
  19614. evt.oldIndex; // element's old index within old parent
  19615. evt.newIndex; // element's new index within new parent
  19616. //console.log('::EVT::');
  19617. //console.log(evt);
  19618. window.evento_drag = evt;
  19619. try {
  19620. updateProgramObjDrag();
  19621. } catch (e) {
  19622. window.draging = false;
  19623. }
  19624. },
  19625. onStart: function onStart(evt) {
  19626. //console.log("START::EVT::");
  19627. //console.log(evt);
  19628. //console.log("\n\ncommand_in_drag");
  19629. try {
  19630. prepareDragHandler(evt);
  19631. } catch (e) {
  19632. window.draging = false;
  19633. }
  19634. }
  19635. });
  19636. element = (0, _jquery2.default)(element);
  19637. element.find(".iftrue").each(function (index) {
  19638. addSortableHandler((0, _jquery2.default)(this).find(".block_commands")[0], id_function);
  19639. addSortableHandler((0, _jquery2.default)(this).find(".block_commands")[1], id_function);
  19640. });
  19641. element.find(".repeatNtimes").each(function (index) {
  19642. addSortableHandler((0, _jquery2.default)(this).find(".block_commands")[0], id_function);
  19643. });
  19644. element.find(".dowhiletrue").each(function (index) {
  19645. addSortableHandler((0, _jquery2.default)(this).find(".block_commands")[0], id_function);
  19646. });
  19647. element.find(".whiletrue").each(function (index) {
  19648. addSortableHandler((0, _jquery2.default)(this).find(".block_commands")[0], id_function);
  19649. });
  19650. element.find(".switch").each(function (index) {
  19651. (0, _jquery2.default)(this).find(".case_div").each(function (index) {
  19652. addSortableHandler((0, _jquery2.default)(this).find(".case_commands_block")[0], id_function);
  19653. });
  19654. });
  19655. }
  19656. function initVisualUI() {
  19657. // MUST USE CONST, LET, OR VAR !!!!!!
  19658. var mainDiv = (0, _jquery2.default)('#visual-main-div');
  19659. // fill mainDiv with functions and globals...
  19660. // renderAlgorithm()...
  19661. (0, _jquery2.default)('.add_function_button').on('click', function () {
  19662. addFunctionHandler();
  19663. });
  19664. (0, _jquery2.default)('.add_global_button').on('click', function () {
  19665. window.insertContext = true;
  19666. GlobalsManagement.addGlobal(program, true);
  19667. });
  19668. (0, _jquery2.default)('.run_button').on('click', function () {
  19669. runCode();
  19670. });
  19671. (0, _jquery2.default)('.visual_coding_button').on('click', function () {
  19672. toggleVisualCoding();
  19673. });
  19674. (0, _jquery2.default)('.textual_coding_button').on('click', function () {
  19675. toggleTextualCoding();
  19676. });
  19677. (0, _jquery2.default)('.assessment').on('click', function () {
  19678. runCodeAssessment();
  19679. is_iassign = true;
  19680. });
  19681. (0, _jquery2.default)('.div_toggle_console').on('click', function () {
  19682. toggleConsole();
  19683. });
  19684. (0, _jquery2.default)('.expand_button').on('click', function () {
  19685. full_screen();
  19686. });
  19687. (0, _jquery2.default)('.main_title h2').prop('title', _localizedStringsService.LocalizedStrings.getUI('text_ivprog_description'));
  19688. }
  19689. var is_iassign = false;
  19690. (0, _jquery2.default)(document).ready(function () {
  19691. var time_show = 750;
  19692. (0, _jquery2.default)('.visual_coding_button').popup({
  19693. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_visual"),
  19694. delay: {
  19695. show: time_show,
  19696. hide: 0
  19697. }
  19698. });
  19699. (0, _jquery2.default)('.textual_coding_button').popup({
  19700. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_textual"),
  19701. delay: {
  19702. show: time_show,
  19703. hide: 0
  19704. }
  19705. });
  19706. (0, _jquery2.default)('.upload_file_button').popup({
  19707. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_upload"),
  19708. delay: {
  19709. show: time_show,
  19710. hide: 0
  19711. }
  19712. });
  19713. (0, _jquery2.default)('.download_file_button').popup({
  19714. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_download"),
  19715. delay: {
  19716. show: time_show,
  19717. hide: 0
  19718. }
  19719. });
  19720. (0, _jquery2.default)('.undo_button').popup({
  19721. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_undo"),
  19722. delay: {
  19723. show: time_show,
  19724. hide: 0
  19725. }
  19726. });
  19727. (0, _jquery2.default)('.redo_button').popup({
  19728. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_redo"),
  19729. delay: {
  19730. show: time_show,
  19731. hide: 0
  19732. }
  19733. });
  19734. (0, _jquery2.default)('.run_button').popup({
  19735. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_run"),
  19736. delay: {
  19737. show: time_show,
  19738. hide: 0
  19739. }
  19740. });
  19741. (0, _jquery2.default)('.assessment_button').popup({
  19742. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_evaluate"),
  19743. delay: {
  19744. show: time_show,
  19745. hide: 0
  19746. }
  19747. });
  19748. (0, _jquery2.default)('.help_button').popup({
  19749. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_help") + ' - ' + _localizedStringsService.LocalizedStrings.getUI("text_ivprog_version") + ' ' + ivprog_version,
  19750. delay: {
  19751. show: time_show,
  19752. hide: 0
  19753. }
  19754. });
  19755. (0, _jquery2.default)('.add_global_button').popup({
  19756. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_add_global"),
  19757. delay: {
  19758. show: time_show,
  19759. hide: 0
  19760. }
  19761. });
  19762. (0, _jquery2.default)('.div_toggle_console').popup({
  19763. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_console"),
  19764. delay: {
  19765. show: time_show,
  19766. hide: 0
  19767. }
  19768. });
  19769. Sortable.create(listWithHandle, {
  19770. handle: '.glyphicon-move',
  19771. animation: 100,
  19772. ghostClass: 'ghost',
  19773. group: 'functions_divs_drag',
  19774. onEnd: function onEnd(evt) {
  19775. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  19776. }
  19777. });
  19778. var listGlobalsHandle = document.getElementById("listGlobalsHandle");
  19779. Sortable.create(listGlobalsHandle, {
  19780. handle: '.ellipsis',
  19781. animation: 100,
  19782. ghostClass: 'ghost',
  19783. group: 'globals_divs_drag',
  19784. onEnd: function onEnd(evt) {
  19785. updateSequenceGlobals(evt.oldIndex, evt.newIndex);
  19786. }
  19787. });
  19788. });
  19789. function updateSequenceParameters(oldIndex, newIndex, function_obj) {
  19790. function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
  19791. }
  19792. function updateSequenceLocals(oldIndex, newIndex, function_obj) {
  19793. function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
  19794. }
  19795. function updateSequenceGlobals(oldIndex, newIndex) {
  19796. program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
  19797. }
  19798. function updateSequenceFunction(oldIndex, newIndex) {
  19799. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  19800. }
  19801. function runCodeAssessment() {
  19802. window.studentGrade = null;
  19803. studentTemp = null;
  19804. var strCode = CodeManagement.generate();
  19805. if (strCode == null) {
  19806. return;
  19807. }
  19808. toggleConsole(true);
  19809. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19810. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19811. var testCases = [{ input: [1], output: [1] }];
  19812. var runner = new _ivprogAssessment.IVProgAssessment(strCode, testCases, domConsole);
  19813. runner.runTest().then(function (grade) {
  19814. if (!is_iassign) {
  19815. parent.getEvaluationCallback(grade);
  19816. } else {
  19817. is_iassign = false;
  19818. }
  19819. }).catch(function (err) {
  19820. return console.log(err);
  19821. });
  19822. }
  19823. function runCode() {
  19824. var strCode = CodeManagement.generate();
  19825. if (strCode == null) {
  19826. return;
  19827. }
  19828. toggleConsole(true);
  19829. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19830. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19831. try {
  19832. var parser = _ivprogParser.IVProgParser.createParser(strCode);
  19833. var analyser = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  19834. var data = analyser.analyseTree();
  19835. var proc = new _ivprogProcessor.IVProgProcessor(data);
  19836. proc.registerInput(domConsole);
  19837. proc.registerOutput(domConsole);
  19838. (0, _jquery2.default)("#ivprog-term").addClass('ivprog-term-active');
  19839. proc.interpretAST().then(function (_) {
  19840. domConsole.info("Programa executado com sucesso!");
  19841. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19842. }).catch(function (err) {
  19843. domConsole.err(err.message);
  19844. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19845. });
  19846. } catch (error) {
  19847. domConsole.err(error.message);
  19848. console.log(error);
  19849. }
  19850. }
  19851. function toggleConsole(is_running) {
  19852. if (is_running) {
  19853. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19854. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19855. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19856. return;
  19857. }
  19858. if ((0, _jquery2.default)('#ivprog-term').css('min-height') == '160px') {
  19859. // esconder
  19860. (0, _jquery2.default)('.ivprog-term-div').css('display', 'none');
  19861. (0, _jquery2.default)('#ivprog-term').css('min-height', '0');
  19862. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-30px');
  19863. (0, _jquery2.default)('#ivprog-term').css('padding', '5px');
  19864. } else {
  19865. // mostrar
  19866. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19867. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19868. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19869. }
  19870. }
  19871. function waitToCloseConsole() {
  19872. domConsole.info("Aperte qualquer tecla para fechar...");
  19873. var p = new Promise(function (resolve, _) {
  19874. domConsole.requestInput(resolve, true);
  19875. });
  19876. p.then(function (_) {
  19877. domConsole.dispose();
  19878. domConsole = null;
  19879. (0, _jquery2.default)("#ivprog-term").hide();
  19880. });
  19881. }
  19882. function toggleTextualCoding() {
  19883. var code = CodeManagement.generate();
  19884. if (code == null) {
  19885. return;
  19886. }
  19887. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'none');
  19888. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'block');
  19889. (0, _jquery2.default)('.ivprog_textual_panel').removeClass('loading');
  19890. (0, _jquery2.default)('.ivprog_textual_code').text(code);
  19891. (0, _jquery2.default)('.visual_coding_button').removeClass('active');
  19892. (0, _jquery2.default)('.textual_coding_button').addClass('active');
  19893. }
  19894. function toggleVisualCoding() {
  19895. (0, _jquery2.default)('.ivprog_textual_panel').addClass('loading');
  19896. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'none');
  19897. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'block');
  19898. (0, _jquery2.default)('.textual_coding_button').removeClass('active');
  19899. (0, _jquery2.default)('.visual_coding_button').addClass('active');
  19900. }
  19901. function removeParameter(function_obj, parameter_obj, parameter_container) {
  19902. var index = function_obj.parameters_list.indexOf(parameter_obj);
  19903. if (index > -1) {
  19904. window.insertContext = true;
  19905. function_obj.parameters_list.splice(index, 1);
  19906. }
  19907. (0, _jquery2.default)(parameter_container).fadeOut();
  19908. }
  19909. function updateParameterType(parameter_obj, new_type) {
  19910. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19911. parameter_obj.type = new_type;
  19912. parameter_obj.dimensions = new_dimensions;
  19913. if (new_dimensions > 0) {
  19914. parameter_obj.rows = new_dimensions;
  19915. parameter_obj.columns = 2;
  19916. }
  19917. }
  19918. function renderParameter(function_obj, parameter_obj, function_container) {
  19919. var ret = "";
  19920. ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
  19921. ret += '<div class="ui dropdown parameter_type">';
  19922. if (parameter_obj.dimensions > 0) {
  19923. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type);
  19924. if (parameter_obj.dimensions == 1) {
  19925. ret += ' [ ] ';
  19926. } else {
  19927. ret += ' [ ] [ ] ';
  19928. }
  19929. ret += '</div>';
  19930. } else {
  19931. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type) + '</div>';
  19932. }
  19933. ret += '<div class="menu">';
  19934. for (var tm in _types.Types) {
  19935. if (tm == _types.Types.VOID.toUpperCase()) {
  19936. continue;
  19937. }
  19938. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  19939. }
  19940. for (var tm in _types.Types) {
  19941. if (tm == _types.Types.VOID.toUpperCase()) {
  19942. continue;
  19943. }
  19944. 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>';
  19945. }
  19946. ret += '</div></div>';
  19947. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  19948. ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
  19949. ret = (0, _jquery2.default)(ret);
  19950. function_container.find('.container_parameters_list').append(ret);
  19951. ret.find('.remove_parameter').on('click', function (e) {
  19952. removeParameter(function_obj, parameter_obj, ret);
  19953. });
  19954. ret.find('.ui.dropdown.parameter_type').dropdown({
  19955. onChange: function onChange(value, text, $selectedItem) {
  19956. if ($selectedItem.data('dimensions')) {
  19957. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19958. } else {
  19959. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')]);
  19960. }
  19961. },
  19962. selectOnKeydown: false
  19963. });
  19964. ret.find('.label_enable_name_parameter').on('click', function (e) {
  19965. enableNameParameterUpdate(parameter_obj, ret, function_obj);
  19966. });
  19967. return ret;
  19968. }
  19969. function updateParameterName(parameter_var, new_name, parameter_obj_dom, function_obj) {
  19970. if (parameter_var.name == new_name) {
  19971. return;
  19972. }
  19973. if (isValidIdentifier(new_name)) {
  19974. if (variableNameAlreadyExists(new_name, function_obj)) {
  19975. Utils.renderErrorMessage(parameter_obj_dom.find('.parameter_div_edit'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_variable_duplicated'));
  19976. } else {
  19977. parameter_var.name = new_name;
  19978. }
  19979. } else {
  19980. Utils.renderErrorMessage(parameter_obj_dom.find('.parameter_div_edit'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name'));
  19981. }
  19982. }
  19983. function variableNameAlreadyExists(name_var, function_obj) {
  19984. if (function_obj.parameters_list) {
  19985. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  19986. if (function_obj.parameters_list[i].name == name_var) {
  19987. return true;
  19988. }
  19989. }
  19990. }
  19991. if (function_obj.variables_list) {
  19992. for (var i = 0; i < function_obj.variables_list.length; i++) {
  19993. if (function_obj.variables_list[i].name == name_var) {
  19994. return true;
  19995. }
  19996. }
  19997. }
  19998. return false;
  19999. }
  20000. function updateFunctionName(function_var, new_name, function_obj_dom) {
  20001. if (function_var.name == new_name) {
  20002. return;
  20003. }
  20004. if (isValidIdentifier(new_name)) {
  20005. if (functionNameAlreadyExists(new_name)) {
  20006. Utils.renderErrorMessage(function_obj_dom.find('.function_name_div'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name_duplicated'));
  20007. } else {
  20008. function_var.name = new_name;
  20009. }
  20010. } else {
  20011. Utils.renderErrorMessage(function_obj_dom.find('.function_name_div'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name'));
  20012. }
  20013. }
  20014. function functionNameAlreadyExists(function_name) {
  20015. for (var i = 0; i < window.program_obj.functions.length; i++) {
  20016. if (window.program_obj.functions[i].name == function_name) {
  20017. return true;
  20018. }
  20019. }
  20020. return false;
  20021. }
  20022. function isValidIdentifier(identifier_str) {
  20023. return (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str)
  20024. );
  20025. }
  20026. var opened_name_parameter = false;
  20027. var opened_input_parameter = null;
  20028. function enableNameParameterUpdate(parameter_obj, parent_node, function_obj) {
  20029. if (opened_name_parameter) {
  20030. opened_input_parameter.focus();
  20031. return;
  20032. }
  20033. opened_name_parameter = true;
  20034. parent_node = (0, _jquery2.default)(parent_node);
  20035. var input_field;
  20036. parent_node.find('.span_name_parameter').text('');
  20037. 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 + "' />");
  20038. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  20039. input_field.on('input', function () {
  20040. var inputWidth = input_field.textWidth() + 10;
  20041. opened_input_parameter = input_field;
  20042. input_field.focus();
  20043. var tmpStr = input_field.val();
  20044. input_field.val('');
  20045. input_field.val(tmpStr);
  20046. input_field.css({
  20047. width: inputWidth
  20048. });
  20049. }).trigger('input');
  20050. input_field.focusout(function () {
  20051. /// update array:
  20052. if (input_field.val().trim()) {
  20053. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  20054. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  20055. }
  20056. input_field.off();
  20057. input_field.remove();
  20058. /// update elements:
  20059. opened_name_parameter = false;
  20060. opened_input_parameter = false;
  20061. });
  20062. input_field.on('keydown', function (e) {
  20063. var code = e.keyCode || e.which;
  20064. if (code == 13) {
  20065. if (input_field.val().trim()) {
  20066. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  20067. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  20068. }
  20069. input_field.off();
  20070. input_field.remove();
  20071. /// update elements:
  20072. opened_name_parameter = false;
  20073. opened_input_parameter = false;
  20074. }
  20075. if (code == 27) {
  20076. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  20077. input_field.off();
  20078. input_field.remove();
  20079. /// update elements:
  20080. opened_name_parameter = false;
  20081. opened_input_parameter = false;
  20082. }
  20083. });
  20084. input_field.select();
  20085. }
  20086. var opened_name_function = false;
  20087. var opened_input = null;
  20088. var previousPadding = null;
  20089. function enableNameFunctionUpdate(function_obj, parent_node) {
  20090. if (opened_name_function) {
  20091. opened_input.focus();
  20092. return;
  20093. }
  20094. parent_node = (0, _jquery2.default)(parent_node);
  20095. parent_node.find('.span_name_function').text('');
  20096. var input_field;
  20097. if (!previousPadding) {
  20098. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  20099. }
  20100. parent_node.find('.span_name_function').css('padding-left', '0');
  20101. parent_node.find('.span_name_function').css('padding-right', '0');
  20102. 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 + "' />");
  20103. input_field.insertBefore(parent_node.find('.span_name_function'));
  20104. input_field.on('input', function () {
  20105. var inputWidth = input_field.textWidth() + 10;
  20106. opened_input = input_field;
  20107. input_field.focus();
  20108. var tmpStr = input_field.val();
  20109. input_field.val('');
  20110. input_field.val(tmpStr);
  20111. input_field.css({
  20112. width: inputWidth
  20113. });
  20114. }).trigger('input');
  20115. input_field.focusout(function () {
  20116. /// update array:
  20117. if (input_field.val().trim()) {
  20118. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  20119. }
  20120. input_field.off();
  20121. input_field.remove();
  20122. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  20123. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  20124. parent_node.find('.span_name_function').text(function_obj.name);
  20125. /// update elements:
  20126. opened_name_function = false;
  20127. opened_input = false;
  20128. });
  20129. input_field.on('keydown', function (e) {
  20130. var code = e.keyCode || e.which;
  20131. if (code == 13) {
  20132. if (input_field.val().trim()) {
  20133. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  20134. }
  20135. input_field.off();
  20136. input_field.remove();
  20137. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  20138. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  20139. parent_node.find('.span_name_function').text(function_obj.name);
  20140. /// update elements:
  20141. opened_name_function = false;
  20142. opened_input = false;
  20143. }
  20144. if (code == 27) {
  20145. input_field.off();
  20146. input_field.remove();
  20147. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  20148. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  20149. parent_node.find('.span_name_function').text(function_obj.name);
  20150. /// update elements:
  20151. opened_name_function = false;
  20152. opened_input = false;
  20153. }
  20154. });
  20155. input_field.select();
  20156. }
  20157. /***/ }),
  20158. /***/ "./js/visualUI/globals.js":
  20159. /*!********************************!*\
  20160. !*** ./js/visualUI/globals.js ***!
  20161. \********************************/
  20162. /*! no static exports found */
  20163. /***/ (function(module, exports, __webpack_require__) {
  20164. "use strict";
  20165. Object.defineProperty(exports, "__esModule", {
  20166. value: true
  20167. });
  20168. exports.addGlobal = addGlobal;
  20169. exports.renderGlobal = renderGlobal;
  20170. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  20171. var _jquery2 = _interopRequireDefault(_jquery);
  20172. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20173. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  20174. var Models = _interopRequireWildcard(_ivprog_elements);
  20175. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  20176. var _utils = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  20177. var Utils = _interopRequireWildcard(_utils);
  20178. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  20179. 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; } }
  20180. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20181. window.jQuery = _jquery2.default;
  20182. var counter_new_globals = 0;
  20183. function addGlobal(program) {
  20184. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  20185. var new_global = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals, 1);
  20186. counter_new_globals++;
  20187. program.addGlobal(new_global);
  20188. var newe = renderGlobal(new_global);
  20189. if (is_from_click) {
  20190. newe.css('display', 'none');
  20191. newe.fadeIn();
  20192. }
  20193. }
  20194. function toggleConstant(global_var) {
  20195. global_var.is_constant = !global_var.is_constant;
  20196. }
  20197. function updateName(global_var, new_name, global_obj_dom) {
  20198. if (global_var.name == new_name) {
  20199. return;
  20200. }
  20201. if (isValidIdentifier(new_name)) {
  20202. if (globalNameAlreadyExists(new_name)) {
  20203. Utils.renderErrorMessage(global_obj_dom.find('.editing_name_var'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_global_duplicated'));
  20204. } else {
  20205. global_var.name = new_name;
  20206. }
  20207. } else {
  20208. Utils.renderErrorMessage(global_obj_dom.find('.editing_name_var'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name'));
  20209. }
  20210. }
  20211. function globalNameAlreadyExists(global_name) {
  20212. for (var i = 0; i < window.program_obj.globals.length; i++) {
  20213. if (window.program_obj.globals[i].name == global_name) {
  20214. return true;
  20215. }
  20216. }
  20217. return false;
  20218. }
  20219. function isValidIdentifier(identifier_str) {
  20220. return (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str)
  20221. );
  20222. }
  20223. function updateType(global_var, new_type) {
  20224. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20225. global_var.type = new_type;
  20226. global_var.dimensions = new_dimensions;
  20227. if (new_dimensions > 0) {
  20228. global_var.rows = new_dimensions;
  20229. global_var.columns = 2;
  20230. }
  20231. updateInitialValues(global_var);
  20232. }
  20233. function removeGlobal(global_var, global_container) {
  20234. var index = window.program_obj.globals.indexOf(global_var);
  20235. if (index > -1) {
  20236. window.insertContext = true;
  20237. window.program_obj.globals.splice(index, 1);
  20238. }
  20239. global_container.children().off();
  20240. global_container.off();
  20241. global_container.fadeOut();
  20242. }
  20243. function updateInitialValues(global_var) {
  20244. if (global_var.type == _types.Types.INTEGER) {
  20245. if (global_var.dimensions == 0) {
  20246. global_var.value = 1;
  20247. }
  20248. if (global_var.dimensions == 1) {
  20249. global_var.value = [1, 1];
  20250. }
  20251. if (global_var.dimensions == 2) {
  20252. global_var.value = [[1, 1], [1, 1]];
  20253. }
  20254. }
  20255. if (global_var.type == _types.Types.REAL) {
  20256. if (global_var.dimensions == 0) {
  20257. global_var.value = 1.0;
  20258. }
  20259. if (global_var.dimensions == 1) {
  20260. global_var.value = [1.0, 1.0];
  20261. }
  20262. if (global_var.dimensions == 2) {
  20263. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  20264. }
  20265. }
  20266. if (global_var.type == _types.Types.TEXT) {
  20267. if (global_var.dimensions == 0) {
  20268. global_var.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  20269. }
  20270. if (global_var.dimensions == 1) {
  20271. global_var.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  20272. }
  20273. if (global_var.dimensions == 2) {
  20274. global_var.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  20275. }
  20276. }
  20277. if (global_var.type == _types.Types.BOOLEAN) {
  20278. if (global_var.dimensions == 0) {
  20279. global_var.value = true;
  20280. }
  20281. if (global_var.dimensions == 1) {
  20282. global_var.value = [true, true];
  20283. }
  20284. if (global_var.dimensions == 2) {
  20285. global_var.value = [[true, true], [true, true]];
  20286. }
  20287. }
  20288. }
  20289. function alternateBooleanGlobalValue(global_var, value_container) {
  20290. global_var.value = !global_var.value;
  20291. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value));
  20292. }
  20293. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  20294. global_var.value[index] = !global_var.value[index];
  20295. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[index]));
  20296. }
  20297. function removeGlobalColumnVector(global_var) {
  20298. if (global_var.columns == 0) {
  20299. return;
  20300. }
  20301. global_var.columns--;
  20302. global_var.value.splice(global_var.value.length - 1, 1);
  20303. }
  20304. function addGlobalColumnVector(global_var) {
  20305. global_var.columns++;
  20306. if (global_var.type == _types.Types.INTEGER) {
  20307. global_var.value.push(1);
  20308. }
  20309. if (global_var.type == _types.Types.REAL) {
  20310. global_var.value.push(1.0);
  20311. }
  20312. if (global_var.type == _types.Types.TEXT) {
  20313. global_var.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20314. }
  20315. if (global_var.type == _types.Types.BOOLEAN) {
  20316. global_var.value.push(true);
  20317. }
  20318. }
  20319. function removeColumnGlobalMatrix(global_var) {
  20320. if (global_var.columns == 0) {
  20321. return;
  20322. }
  20323. global_var.columns--;
  20324. for (var i = 0; i < global_var.rows; i++) {
  20325. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  20326. }
  20327. }
  20328. function addColumnGlobalMatrix(global_var) {
  20329. global_var.columns++;
  20330. if (global_var.type == _types.Types.INTEGER) {
  20331. for (var i = 0; i < global_var.rows; i++) {
  20332. global_var.value[i].push(1);
  20333. }
  20334. }
  20335. if (global_var.type == _types.Types.REAL) {
  20336. for (var i = 0; i < global_var.rows; i++) {
  20337. global_var.value[i].push(1.0);
  20338. }
  20339. }
  20340. if (global_var.type == _types.Types.TEXT) {
  20341. for (var i = 0; i < global_var.rows; i++) {
  20342. global_var.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20343. }
  20344. }
  20345. if (global_var.type == _types.Types.BOOLEAN) {
  20346. for (var i = 0; i < global_var.rows; i++) {
  20347. global_var.value[i].push(true);
  20348. }
  20349. }
  20350. }
  20351. function removeLineGlobalMatrix(global_var) {
  20352. if (global_var.rows == 0) {
  20353. return;
  20354. }
  20355. global_var.rows--;
  20356. global_var.value.splice(global_var.value.length - 1, 1);
  20357. }
  20358. function addLineGlobalMatrix(global_var) {
  20359. global_var.rows++;
  20360. if (global_var.type == _types.Types.INTEGER) {
  20361. var n_l = [];
  20362. for (var i = 0; i < global_var.columns; i++) {
  20363. n_l.push(1);
  20364. }
  20365. global_var.value.push(n_l);
  20366. }
  20367. if (global_var.type == _types.Types.REAL) {
  20368. var n_l = [];
  20369. for (i = 0; i < global_var.columns; i++) {
  20370. n_l.push(1.0);
  20371. }
  20372. global_var.value.push(n_l);
  20373. }
  20374. if (global_var.type == _types.Types.TEXT) {
  20375. var n_l = [];
  20376. for (i = 0; i < global_var.columns; i++) {
  20377. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20378. }
  20379. global_var.value.push(n_l);
  20380. }
  20381. if (global_var.type == _types.Types.BOOLEAN) {
  20382. var n_l = [];
  20383. for (i = 0; i < global_var.columns; i++) {
  20384. n_l.push(true);
  20385. }
  20386. global_var.value.push(n_l);
  20387. }
  20388. }
  20389. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  20390. global_var.value[row][index] = !global_var.value[row][index];
  20391. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[row][index]));
  20392. }
  20393. function renderValues(global_var, global_container) {
  20394. var ret = "";
  20395. var j = 0;
  20396. if (global_var.dimensions == 0) {
  20397. if (global_var.type == _types.Types.REAL) {
  20398. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  20399. } else {
  20400. if (global_var.type == _types.Types.BOOLEAN) {
  20401. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value) + '</span> </div> ';
  20402. } else {
  20403. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  20404. }
  20405. }
  20406. } else {
  20407. ret += '<table class="tabela_var">';
  20408. if (global_var.dimensions == 1) {
  20409. ret += '<tr>';
  20410. if (global_var.type == _types.Types.REAL) {
  20411. for (var k = 0; k < global_var.columns; k++) {
  20412. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  20413. }
  20414. } else {
  20415. for (var k = 0; k < global_var.columns; k++) {
  20416. if (global_var.type == _types.Types.BOOLEAN) {
  20417. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[k]) + '</span></td>';
  20418. } else {
  20419. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  20420. }
  20421. }
  20422. }
  20423. ret += '</tr>';
  20424. ret += '</table>';
  20425. 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>';
  20426. }
  20427. if (global_var.dimensions == 2) {
  20428. if (global_var.type == _types.Types.REAL) {
  20429. for (var l = 0; l < global_var.rows; l++) {
  20430. ret += '<tr>';
  20431. for (var k = 0; k < global_var.columns; k++) {
  20432. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  20433. }
  20434. ret += '</tr>';
  20435. }
  20436. } else {
  20437. for (var l = 0; l < global_var.rows; l++) {
  20438. ret += '<tr>';
  20439. for (var k = 0; k < global_var.columns; k++) {
  20440. if (global_var.type == _types.Types.BOOLEAN) {
  20441. 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>';
  20442. } else {
  20443. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  20444. }
  20445. }
  20446. ret += '</tr>';
  20447. }
  20448. }
  20449. if (global_var.rows == 0) {
  20450. ret += '<tr><td></td></tr>';
  20451. }
  20452. 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>';
  20453. ret += '</table>';
  20454. 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>';
  20455. }
  20456. }
  20457. global_container.find(".div_valor_var").html('');
  20458. ret = (0, _jquery2.default)(ret);
  20459. ret.find('.span_value_variable').data('associatedOject', global_var);
  20460. ret.find(".boolean_simple_type").on('click', function (e) {
  20461. alternateBooleanGlobalValue(global_var, this.parentNode);
  20462. });
  20463. ret.find(".simple_var").on('click', function (e) {
  20464. enableGlobalValueUpdate(global_var, this.parentNode);
  20465. });
  20466. ret.find(".boolean_vector_var").on('click', function (e) {
  20467. alternateBooleanGlobalVectorValue(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20468. });
  20469. ret.find(".vector_var").on('click', function (e) {
  20470. enableGlobalVectorValueUpdate(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20471. });
  20472. ret.find(".remove_global_vector_column").on('click', function (e) {
  20473. removeGlobalColumnVector(global_var);
  20474. global_container.find(".div_valor_var").html('');
  20475. renderValues(global_var, global_container);
  20476. });
  20477. ret.find(".add_global_vector_column").on('click', function (e) {
  20478. addGlobalColumnVector(global_var);
  20479. global_container.find(".div_valor_var").html('');
  20480. renderValues(global_var, global_container);
  20481. });
  20482. ret.find(".remove_global_matrix_column").on('click', function (e) {
  20483. removeColumnGlobalMatrix(global_var);
  20484. global_container.find(".div_valor_var").html('');
  20485. renderValues(global_var, global_container);
  20486. });
  20487. ret.find(".add_global_matrix_column").on('click', function (e) {
  20488. addColumnGlobalMatrix(global_var);
  20489. global_container.find(".div_valor_var").html('');
  20490. renderValues(global_var, global_container);
  20491. });
  20492. ret.find(".remove_global_matrix_line").on('click', function (e) {
  20493. removeLineGlobalMatrix(global_var);
  20494. global_container.find(".div_valor_var").html('');
  20495. renderValues(global_var, global_container);
  20496. });
  20497. ret.find(".add_global_matrix_line").on('click', function (e) {
  20498. addLineGlobalMatrix(global_var);
  20499. global_container.find(".div_valor_var").html('');
  20500. renderValues(global_var, global_container);
  20501. });
  20502. ret.find(".boolean_matrix_var").on('click', function (e) {
  20503. alternateBooleanGlobalMatrixValue(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20504. });
  20505. ret.find(".matrix_var").on('click', function (e) {
  20506. enableGlobalMatrixValueUpdate(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20507. });
  20508. global_container.find(".div_valor_var").append(ret);
  20509. updateColumnsAndRowsText(global_container, global_var);
  20510. }
  20511. function addHandlers(global_container) {
  20512. var global_var = global_container.data('associatedOject');
  20513. // Manage constant option:
  20514. global_container.find(".alternate_constant").on('click', function (e) {
  20515. toggleConstant(global_var);
  20516. (0, _jquery2.default)(this).removeClass("on off");
  20517. if (global_var.is_constant) {
  20518. (0, _jquery2.default)(this).addClass("on");
  20519. } else {
  20520. (0, _jquery2.default)(this).addClass("off");
  20521. }
  20522. });
  20523. // Manage global name:
  20524. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  20525. enableNameUpdate(global_container);
  20526. });
  20527. // Menu to change type:
  20528. global_container.find('.ui.dropdown.global_type').dropdown({
  20529. onChange: function onChange(value, text, $selectedItem) {
  20530. if ($selectedItem.data('dimensions')) {
  20531. updateType(global_var, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  20532. } else {
  20533. updateType(global_var, _types.Types[$selectedItem.data('type')]);
  20534. }
  20535. renderValues(global_var, global_container);
  20536. },
  20537. selectOnKeydown: false
  20538. });
  20539. // Remove global:
  20540. global_container.find(".remove_global").on('click', function (e) {
  20541. removeGlobal(global_var, global_container);
  20542. });
  20543. }
  20544. function updateColumnsAndRowsText(global_container, global_var) {
  20545. var prev = global_container.find('.text').text().split('[');
  20546. if (prev.length == 2) {
  20547. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  20548. global_container.find('.text').empty();
  20549. global_container.find('.text').text(ff);
  20550. }
  20551. if (prev.length == 3) {
  20552. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  20553. global_container.find('.text').empty();
  20554. global_container.find('.text').text(ff);
  20555. }
  20556. }
  20557. function renderGlobal(global_var) {
  20558. var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  20559. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  20560. element += '<div class="ui dropdown global_type">';
  20561. if (global_var.dimensions > 0) {
  20562. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(global_var.type);
  20563. for (var i = 0; i < global_var.dimensions; i++) {
  20564. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  20565. }
  20566. element += '</div>';
  20567. } else {
  20568. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(global_var.type.toLowerCase()) + '</div>';
  20569. }
  20570. element += '<div class="menu">';
  20571. for (var tm in _types.Types) {
  20572. if (tm == _types.Types.VOID.toUpperCase()) {
  20573. continue;
  20574. }
  20575. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  20576. }
  20577. for (var tm in _types.Types) {
  20578. if (tm == _types.Types.VOID.toUpperCase()) {
  20579. continue;
  20580. }
  20581. 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>';
  20582. }
  20583. 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> ';
  20584. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  20585. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  20586. var complete_element = (0, _jquery2.default)(element);
  20587. complete_element.data('associatedOject', global_var);
  20588. (0, _jquery2.default)('.list_globals').append(complete_element);
  20589. addHandlers(complete_element);
  20590. renderValues(global_var, complete_element);
  20591. if (global_var.dimensions == 1) {
  20592. complete_element.find('.dimensions_0').text(global_var.columns);
  20593. }
  20594. if (global_var.dimensions == 2) {
  20595. complete_element.find('.dimensions_0').text(global_var.columns);
  20596. complete_element.find('.dimensions_1').text(global_var.rows);
  20597. }
  20598. return complete_element;
  20599. }
  20600. var opened_name_value_matrix_global_v = false;
  20601. var opened_input_value_matrix_global_v = null;
  20602. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  20603. if (opened_name_value_matrix_global_v) {
  20604. opened_input_value_matrix_global_v.focus();
  20605. return;
  20606. }
  20607. parent_node = (0, _jquery2.default)(parent_node);
  20608. opened_name_value_matrix_global_v = true;
  20609. parent_node.find('.span_value_variable').text('');
  20610. var input_field;
  20611. if (global_var.type == _types.Types.REAL) {
  20612. 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) + "' />");
  20613. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20614. } else {
  20615. 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] + "' />");
  20616. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20617. }
  20618. input_field.on('input', function () {
  20619. var inputWidth = input_field.textWidth() + 10;
  20620. opened_input_value_matrix_global_v = input_field;
  20621. input_field.focus();
  20622. var tmpStr = input_field.val();
  20623. input_field.val('');
  20624. input_field.val(tmpStr);
  20625. input_field.css({
  20626. width: inputWidth
  20627. });
  20628. }).trigger('input');
  20629. input_field.focusout(function () {
  20630. /// update array:
  20631. if (input_field.val().trim()) {
  20632. if (global_var.type == _types.Types.REAL) {
  20633. global_var.value[row][index] = parseFloat(input_field.val().trim());
  20634. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20635. } else {
  20636. if (global_var.type == _types.Types.INTEGER) {
  20637. global_var.value[row][index] = parseInt(input_field.val().trim());
  20638. } else {
  20639. global_var.value[row][index] = input_field.val().trim();
  20640. }
  20641. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20642. }
  20643. } else {
  20644. if (global_var.type == _types.Types.REAL) {
  20645. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20646. } else {
  20647. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20648. }
  20649. }
  20650. if (global_var.type == _types.Types.TEXT) {
  20651. global_var.value[row][index] = input_field.val();
  20652. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20653. }
  20654. input_field.off();
  20655. input_field.remove();
  20656. /// update elements:
  20657. opened_name_value_matrix_global_v = false;
  20658. opened_input_value_matrix_global_v = false;
  20659. });
  20660. input_field.on('keydown', function (e) {
  20661. var code = e.keyCode || e.which;
  20662. if (code == 13) {
  20663. if (input_field.val().trim()) {
  20664. if (global_var.type == _types.Types.REAL) {
  20665. global_var.value[row][index] = parseFloat(input_field.val().trim());
  20666. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20667. } else {
  20668. if (global_var.type == _types.Types.INTEGER) {
  20669. global_var.value[row][index] = parseInt(input_field.val().trim());
  20670. } else {
  20671. global_var.value[row][index] = input_field.val().trim();
  20672. }
  20673. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20674. }
  20675. } else {
  20676. if (global_var.type == _types.Types.REAL) {
  20677. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20678. } else {
  20679. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20680. }
  20681. }
  20682. if (global_var.type == _types.Types.TEXT) {
  20683. global_var.value[row][index] = input_field.val();
  20684. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20685. }
  20686. input_field.off();
  20687. input_field.remove();
  20688. /// update elements:
  20689. opened_name_value_matrix_global_v = false;
  20690. opened_input_value_matrix_global_v = false;
  20691. }
  20692. if (code == 27) {
  20693. if (global_var.type == _types.Types.REAL) {
  20694. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20695. } else {
  20696. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20697. }
  20698. input_field.off();
  20699. input_field.remove();
  20700. /// update elements:
  20701. opened_name_value_matrix_global_v = false;
  20702. opened_input_value_matrix_global_v = false;
  20703. }
  20704. });
  20705. input_field.select();
  20706. }
  20707. var opened_name_value_global_var = false;
  20708. var opened_input_value_global_ar = null;
  20709. function enableGlobalValueUpdate(global_var, parent_node) {
  20710. if (opened_name_value_global_var) {
  20711. opened_input_value_global_ar.focus();
  20712. return;
  20713. }
  20714. parent_node = (0, _jquery2.default)(parent_node);
  20715. opened_name_value_global_var = true;
  20716. parent_node.find('.span_value_variable').text('');
  20717. var input_field;
  20718. if (global_var.type == _types.Types.REAL) {
  20719. 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) + "' />");
  20720. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20721. } else {
  20722. 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 + "' />");
  20723. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20724. }
  20725. input_field.on('input', function () {
  20726. var inputWidth = input_field.textWidth() + 10;
  20727. opened_input_value_global_ar = input_field;
  20728. input_field.focus();
  20729. var tmpStr = input_field.val();
  20730. input_field.val('');
  20731. input_field.val(tmpStr);
  20732. input_field.css({
  20733. width: inputWidth
  20734. });
  20735. }).trigger('input');
  20736. input_field.focusout(function () {
  20737. /// update array:
  20738. if (input_field.val().trim()) {
  20739. if (global_var.type == _types.Types.REAL) {
  20740. global_var.value = parseFloat(input_field.val().trim());
  20741. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20742. } else {
  20743. if (global_var.type == _types.Types.INTEGER) {
  20744. global_var.value = parseInt(input_field.val().trim());
  20745. } else {
  20746. global_var.value = input_field.val().trim();
  20747. }
  20748. parent_node.find('.span_value_variable').text(global_var.value);
  20749. }
  20750. } else {
  20751. if (global_var.type == _types.Types.REAL) {
  20752. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20753. } else {
  20754. parent_node.find('.span_value_variable').text(global_var.value);
  20755. }
  20756. }
  20757. if (global_var.type == _types.Types.TEXT) {
  20758. global_var.value = input_field.val();
  20759. parent_node.find('.span_value_variable').text(global_var.value);
  20760. }
  20761. input_field.off();
  20762. input_field.remove();
  20763. /// update elements:
  20764. opened_name_value_global_var = false;
  20765. opened_input_value_global_ar = false;
  20766. });
  20767. input_field.on('keydown', function (e) {
  20768. var code = e.keyCode || e.which;
  20769. if (code == 13) {
  20770. if (input_field.val().trim()) {
  20771. if (global_var.type == _types.Types.REAL) {
  20772. global_var.value = parseFloat(input_field.val().trim());
  20773. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20774. } else {
  20775. if (global_var.type == _types.Types.INTEGER) {
  20776. global_var.value = parseInt(input_field.val().trim());
  20777. } else {
  20778. global_var.value = input_field.val().trim();
  20779. }
  20780. parent_node.find('.span_value_variable').text(global_var.value);
  20781. }
  20782. } else {
  20783. if (global_var.type == _types.Types.REAL) {
  20784. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20785. } else {
  20786. parent_node.find('.span_value_variable').text(global_var.value);
  20787. }
  20788. }
  20789. if (global_var.type == _types.Types.TEXT) {
  20790. global_var.value = input_field.val();
  20791. parent_node.find('.span_value_variable').text(global_var.value);
  20792. }
  20793. input_field.off();
  20794. input_field.remove();
  20795. /// update elements:
  20796. opened_name_value_global_var = false;
  20797. opened_input_value_global_ar = false;
  20798. }
  20799. if (code == 27) {
  20800. if (global_var.type == _types.Types.REAL) {
  20801. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20802. } else {
  20803. parent_node.find('.span_value_variable').text(global_var.value);
  20804. }
  20805. input_field.off();
  20806. input_field.remove();
  20807. /// update elements:
  20808. opened_name_value_global_var = false;
  20809. opened_input_value_global_ar = false;
  20810. }
  20811. });
  20812. input_field.select();
  20813. }
  20814. var opened_name_global = false;
  20815. var opened_input_global = null;
  20816. function enableNameUpdate(global_container) {
  20817. var global_var = global_container.data('associatedOject');
  20818. if (opened_name_global) {
  20819. opened_input_global.focus();
  20820. return;
  20821. }
  20822. opened_name_global = true;
  20823. global_container.find('.span_name_variable').text('');
  20824. 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 + "' />");
  20825. input_name.insertBefore(global_container.find('.span_name_variable'));
  20826. input_name.on('input', function () {
  20827. var inputWidth = input_name.textWidth() + 10;
  20828. opened_input_global = input_name;
  20829. opened_input_global.focus();
  20830. opened_input_global.css({
  20831. width: inputWidth
  20832. });
  20833. }).trigger('input');
  20834. input_name.focusout(function () {
  20835. /// update array:
  20836. if (input_name.val().trim().length > 0) {
  20837. updateName(global_var, input_name.val().trim(), global_container);
  20838. global_container.find('.span_name_variable').text(global_var.name);
  20839. } else {
  20840. global_container.find('.span_name_variable').text(global_var.name);
  20841. }
  20842. input_name.off();
  20843. input_name.remove();
  20844. /// update elements:
  20845. opened_name_global = false;
  20846. opened_input_global = false;
  20847. });
  20848. input_name.on('keydown', function (e) {
  20849. var code = e.keyCode || e.which;
  20850. if (code == 13) {
  20851. if (input_name.val().trim()) {
  20852. updateName(global_var, input_name.val().trim(), global_container);
  20853. global_container.find('.span_name_variable').text(global_var.name);
  20854. } else {
  20855. global_container.find('.span_name_variable').text(global_var.name);
  20856. }
  20857. input_name.off();
  20858. input_name.remove();
  20859. /// update elements:
  20860. opened_name_global = false;
  20861. opened_input_global = false;
  20862. }
  20863. if (code == 27) {
  20864. global_container.find('.span_name_variable').text(global_var.name);
  20865. input_name.off();
  20866. input_name.remove();
  20867. /// update elements:
  20868. opened_name_global = false;
  20869. opened_input_global = false;
  20870. }
  20871. });
  20872. input_name.select();
  20873. }
  20874. var opened_name_value_vector_global_ = false;
  20875. var opened_input_value_vector_global_ = null;
  20876. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  20877. if (opened_name_value_vector_global_) {
  20878. opened_input_value_vector_global_.focus();
  20879. return;
  20880. }
  20881. parent_node = (0, _jquery2.default)(parent_node);
  20882. opened_name_value_vector_global_ = true;
  20883. parent_node.find('.span_value_variable').text('');
  20884. var input_field;
  20885. if (global_var.type == _types.Types.REAL) {
  20886. 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) + "' />");
  20887. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20888. } else {
  20889. 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] + "' />");
  20890. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20891. }
  20892. input_field.on('input', function () {
  20893. var inputWidth = input_field.textWidth() + 10;
  20894. opened_input_value_vector_global_ = input_field;
  20895. input_field.focus();
  20896. var tmpStr = input_field.val();
  20897. input_field.val('');
  20898. input_field.val(tmpStr);
  20899. input_field.css({
  20900. width: inputWidth
  20901. });
  20902. }).trigger('input');
  20903. input_field.focusout(function () {
  20904. /// update array:
  20905. if (input_field.val().trim()) {
  20906. if (global_var.type == _types.Types.REAL) {
  20907. global_var.value[index] = parseFloat(input_field.val().trim());
  20908. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20909. } else {
  20910. if (global_var.type == _types.Types.INTEGER) {
  20911. global_var.value[index] = parseInt(input_field.val().trim());
  20912. } else {
  20913. global_var.value[index] = input_field.val().trim();
  20914. }
  20915. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20916. }
  20917. } else {
  20918. if (global_var.type == _types.Types.REAL) {
  20919. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20920. } else {
  20921. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20922. }
  20923. }
  20924. if (global_var.type == _types.Types.TEXT) {
  20925. global_var.value[index] = input_field.val();
  20926. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20927. }
  20928. input_field.off();
  20929. input_field.remove();
  20930. /// update elements:
  20931. opened_name_value_vector_global_ = false;
  20932. opened_input_value_vector_global_ = false;
  20933. });
  20934. input_field.on('keydown', function (e) {
  20935. var code = e.keyCode || e.which;
  20936. if (code == 13) {
  20937. if (input_field.val().trim()) {
  20938. if (global_var.type == _types.Types.REAL) {
  20939. global_var.value[index] = parseFloat(input_field.val().trim());
  20940. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20941. } else {
  20942. if (global_var.type == _types.Types.INTEGER) {
  20943. global_var.value[index] = parseInt(input_field.val().trim());
  20944. } else {
  20945. global_var.value[index] = input_field.val().trim();
  20946. }
  20947. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20948. }
  20949. } else {
  20950. if (global_var.type == _types.Types.REAL) {
  20951. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20952. } else {
  20953. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20954. }
  20955. }
  20956. if (global_var.type == _types.Types.TEXT) {
  20957. global_var.value[index] = input_field.val();
  20958. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20959. }
  20960. input_field.off();
  20961. input_field.remove();
  20962. /// update elements:
  20963. opened_name_value_vector_global_ = false;
  20964. opened_input_value_vector_global_ = false;
  20965. }
  20966. if (code == 27) {
  20967. if (global_var.type == _types.Types.REAL) {
  20968. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20969. } else {
  20970. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20971. }
  20972. input_field.off();
  20973. input_field.remove();
  20974. /// update elements:
  20975. opened_name_value_vector_global_ = false;
  20976. opened_input_value_vector_global_ = false;
  20977. }
  20978. });
  20979. input_field.select();
  20980. }
  20981. _jquery2.default.fn.textWidth = function (text, font) {
  20982. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  20983. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  20984. return _jquery2.default.fn.textWidth.fakeEl.width();
  20985. };
  20986. /***/ }),
  20987. /***/ "./js/visualUI/ivprog_elements.js":
  20988. /*!****************************************!*\
  20989. !*** ./js/visualUI/ivprog_elements.js ***!
  20990. \****************************************/
  20991. /*! no static exports found */
  20992. /***/ (function(module, exports, __webpack_require__) {
  20993. "use strict";
  20994. Object.defineProperty(exports, "__esModule", {
  20995. value: true
  20996. });
  20997. 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.SystemFunction = exports.Function = exports.Variable = exports.SYSTEM_FUNCTIONS_CATEGORIES = exports.LOGIC_COMPARISON = exports.ARITHMETIC_COMPARISON = exports.EXPRESSION_TYPES = exports.EXPRESSION_ELEMENTS = exports.ARITHMETIC_TYPES = exports.COMMAND_TYPES = undefined;
  20998. 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; }; }();
  20999. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  21000. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  21001. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  21002. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  21003. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  21004. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  21005. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  21006. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  21007. 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; } }
  21008. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  21009. var COMMAND_TYPES = exports.COMMAND_TYPES = Object.freeze({ function: "function", comment: "comment", reader: "reader", writer: "writer", attribution: "attribution", iftrue: "iftrue",
  21010. repeatNtimes: "repeatNtimes", whiletrue: "whiletrue", dowhiletrue: "dowhiletrue", switch: "switch", switchcase: "switchcase", functioncall: "functioncall", break: "break",
  21011. return: "return" });
  21012. var ARITHMETIC_TYPES = exports.ARITHMETIC_TYPES = Object.freeze({ plus: "plus", minus: "minus", multiplication: "multiplication", division: "division", module: "module", none: "none" });
  21013. 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" });
  21014. var EXPRESSION_TYPES = exports.EXPRESSION_TYPES = Object.freeze({ exp_conditional: "exp_conditional", exp_logic: "exp_logic", exp_arithmetic: "exp_arithmetic" });
  21015. 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" });
  21016. var LOGIC_COMPARISON = exports.LOGIC_COMPARISON = Object.freeze({ equals_to: "equals_to", not_equals_to: "not_equals_to", and: "and", or: "or" });
  21017. var SYSTEM_FUNCTIONS_CATEGORIES = exports.SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({ math: "math", text: "text_t", arrangement: "arrangement", conversion: "conversion" });
  21018. var Variable = exports.Variable = function Variable(type, name, value) {
  21019. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  21020. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  21021. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  21022. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  21023. _classCallCheck(this, Variable);
  21024. this.type = type;
  21025. this.name = name;
  21026. this.value = value;
  21027. this.dimensions = dimensions;
  21028. this.is_constant = is_constant;
  21029. this.rows = rows;
  21030. this.columns = columns;
  21031. };
  21032. var Function = exports.Function = function Function(name) {
  21033. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types.Types.VOID;
  21034. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  21035. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  21036. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  21037. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  21038. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  21039. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  21040. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  21041. _classCallCheck(this, Function);
  21042. this.type = COMMAND_TYPES.function;
  21043. this.name = name;
  21044. this.return_type = return_type;
  21045. this.return_dimensions = return_dimensions;
  21046. this.parameters_list = parameters_list;
  21047. this.is_main = is_main;
  21048. this.is_hidden = is_hidden;
  21049. this.variables_list = variables_list;
  21050. this.function_comment = function_comment;
  21051. this.commands = commands;
  21052. };
  21053. var SystemFunction = exports.SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  21054. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  21055. var category = arguments[5];
  21056. _classCallCheck(this, SystemFunction);
  21057. this.type = COMMAND_TYPES.function;
  21058. this.identifier = identifier;
  21059. this.return_type = return_type;
  21060. this.return_dimensions = return_dimensions;
  21061. this.parameters_list = parameters_list;
  21062. this.function_comment = function_comment;
  21063. this.category = category;
  21064. };
  21065. var Comment = exports.Comment = function Comment(comment_text) {
  21066. _classCallCheck(this, Comment);
  21067. this.type = COMMAND_TYPES.comment;
  21068. this.comment_text = comment_text;
  21069. };
  21070. var Break = exports.Break = function Break() {
  21071. _classCallCheck(this, Break);
  21072. this.type = COMMAND_TYPES.break;
  21073. };
  21074. var Reader = exports.Reader = function Reader() {
  21075. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  21076. _classCallCheck(this, Reader);
  21077. this.type = COMMAND_TYPES.reader;
  21078. this.variable_value_menu = variable_value_menu;
  21079. };
  21080. var Writer = exports.Writer = function Writer(content) {
  21081. _classCallCheck(this, Writer);
  21082. this.type = COMMAND_TYPES.writer;
  21083. this.content = content;
  21084. };
  21085. var Attribution = exports.Attribution = function Attribution(variable) {
  21086. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21087. _classCallCheck(this, Attribution);
  21088. this.type = COMMAND_TYPES.attribution;
  21089. this.variable = variable;
  21090. this.expression = expression;
  21091. };
  21092. var ExpressionElement = exports.ExpressionElement = function ExpressionElement(type_exp) {
  21093. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21094. _classCallCheck(this, ExpressionElement);
  21095. this.type_exp = type_exp;
  21096. this.itens = itens;
  21097. };
  21098. var ConditionalExpression = exports.ConditionalExpression = function ConditionalExpression(expression) {
  21099. _classCallCheck(this, ConditionalExpression);
  21100. this.type = EXPRESSION_TYPES.exp_conditional;
  21101. this.expression = expression;
  21102. };
  21103. var LogicExpression = exports.LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  21104. _classCallCheck(this, LogicExpression);
  21105. this.type = EXPRESSION_TYPES.exp_logic;
  21106. this.has_neg = has_neg;
  21107. this.first_operand = first_operand;
  21108. this.second_operand = second_operand;
  21109. this.operator = operator;
  21110. };
  21111. var ArithmeticExpression = exports.ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  21112. _classCallCheck(this, ArithmeticExpression);
  21113. this.type = EXPRESSION_TYPES.exp_arithmetic;
  21114. this.first_operand = first_operand;
  21115. this.second_operand = second_operand;
  21116. this.operator = operator;
  21117. };
  21118. var IfTrue = exports.IfTrue = function IfTrue(expression, commands_block, commands_else) {
  21119. _classCallCheck(this, IfTrue);
  21120. this.type = COMMAND_TYPES.iftrue;
  21121. this.expression = expression;
  21122. this.commands_block = commands_block;
  21123. this.commands_else = commands_else;
  21124. };
  21125. var RepeatNTimes = exports.RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  21126. _classCallCheck(this, RepeatNTimes);
  21127. this.type = COMMAND_TYPES.repeatNtimes;
  21128. this.var_attribution = var_attribution;
  21129. this.var_incrementation = var_incrementation;
  21130. this.expression1 = expression1;
  21131. this.expression2 = expression2;
  21132. this.expression3 = expression3;
  21133. this.commands_block = commands_block;
  21134. };
  21135. var WhileTrue = exports.WhileTrue = function WhileTrue(expression, commands_block) {
  21136. _classCallCheck(this, WhileTrue);
  21137. this.type = COMMAND_TYPES.whiletrue;
  21138. this.expression = expression;
  21139. this.commands_block = commands_block;
  21140. };
  21141. var DoWhileTrue = exports.DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  21142. _classCallCheck(this, DoWhileTrue);
  21143. this.type = COMMAND_TYPES.dowhiletrue;
  21144. this.expression = expression;
  21145. this.commands_block = commands_block;
  21146. };
  21147. var Switch = exports.Switch = function Switch(variable) {
  21148. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21149. _classCallCheck(this, Switch);
  21150. this.type = COMMAND_TYPES.switch;
  21151. this.variable = variable;
  21152. this.cases = cases;
  21153. };
  21154. var Return = exports.Return = function Return(variable_value_menu) {
  21155. _classCallCheck(this, Return);
  21156. this.type = COMMAND_TYPES.return;
  21157. this.variable_value_menu = variable_value_menu;
  21158. };
  21159. var SwitchCase = exports.SwitchCase = function SwitchCase(variable_value_menu) {
  21160. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21161. _classCallCheck(this, SwitchCase);
  21162. this.type = COMMAND_TYPES.switchcase;
  21163. this.variable_value_menu = variable_value_menu;
  21164. this.commands_block = commands_block;
  21165. };
  21166. var FunctionCall = exports.FunctionCall = function FunctionCall(function_called, parameters_list) {
  21167. _classCallCheck(this, FunctionCall);
  21168. this.type = COMMAND_TYPES.functioncall;
  21169. this.function_called = function_called;
  21170. this.parameters_list = parameters_list;
  21171. };
  21172. var VariableValueMenu = exports.VariableValueMenu = function VariableValueMenu() {
  21173. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  21174. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  21175. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  21176. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  21177. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  21178. var dimensions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  21179. _classCallCheck(this, VariableValueMenu);
  21180. this.type = "var_value";
  21181. this.variable_and_value = variable_and_value;
  21182. this.content = content;
  21183. this.row = row;
  21184. this.column = column;
  21185. this.include_constant = include_constant;
  21186. this.dimensions = dimensions;
  21187. };
  21188. var FunctionCallMenu = exports.FunctionCallMenu = function FunctionCallMenu() {
  21189. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  21190. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21191. _classCallCheck(this, FunctionCallMenu);
  21192. this.type = "function_call";
  21193. this.function_called = function_called;
  21194. this.parameters_list = parameters_list;
  21195. };
  21196. var Program = exports.Program = function () {
  21197. function Program() {
  21198. _classCallCheck(this, Program);
  21199. this.functions = [];
  21200. this.globals = [];
  21201. }
  21202. _createClass(Program, [{
  21203. key: 'addFunction',
  21204. value: function addFunction(function_to_add) {
  21205. _melankeWatchjs2.default.watch(function_to_add.parameters_list, function () {
  21206. if (window.insertContext) {
  21207. setTimeout(function () {
  21208. AlgorithmManagement.renderAlgorithm();
  21209. }, 300);
  21210. window.insertContext = false;
  21211. } else {
  21212. AlgorithmManagement.renderAlgorithm();
  21213. }
  21214. }, 1);
  21215. _melankeWatchjs2.default.watch(function_to_add.variables_list, function () {
  21216. if (window.insertContext) {
  21217. setTimeout(function () {
  21218. AlgorithmManagement.renderAlgorithm();
  21219. }, 300);
  21220. window.insertContext = false;
  21221. } else {
  21222. AlgorithmManagement.renderAlgorithm();
  21223. }
  21224. }, 1);
  21225. this.functions.push(function_to_add);
  21226. }
  21227. }, {
  21228. key: 'addVariable',
  21229. value: function addVariable(function_to_receive, variable) {
  21230. if (this.functions[function_to_receive].variable === null) {
  21231. this.functions[function_to_receive].variables_list = [];
  21232. }
  21233. this.functions[function_to_receive].variables_list.push(variable);
  21234. }
  21235. }, {
  21236. key: 'addGlobal',
  21237. value: function addGlobal(variable) {
  21238. this.globals.push(variable);
  21239. }
  21240. }]);
  21241. return Program;
  21242. }();
  21243. /***/ }),
  21244. /***/ "./js/visualUI/types.js":
  21245. /*!******************************!*\
  21246. !*** ./js/visualUI/types.js ***!
  21247. \******************************/
  21248. /*! no static exports found */
  21249. /***/ (function(module, exports, __webpack_require__) {
  21250. "use strict";
  21251. Object.defineProperty(exports, "__esModule", {
  21252. value: true
  21253. });
  21254. var Types = exports.Types = Object.freeze({
  21255. INTEGER: "integer",
  21256. REAL: "real",
  21257. TEXT: "text",
  21258. BOOLEAN: "boolean",
  21259. VOID: "void"
  21260. });
  21261. /***/ }),
  21262. /***/ "./js/visualUI/utils.js":
  21263. /*!******************************!*\
  21264. !*** ./js/visualUI/utils.js ***!
  21265. \******************************/
  21266. /*! no static exports found */
  21267. /***/ (function(module, exports, __webpack_require__) {
  21268. "use strict";
  21269. Object.defineProperty(exports, "__esModule", {
  21270. value: true
  21271. });
  21272. exports.renderErrorMessage = renderErrorMessage;
  21273. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21274. var _jquery2 = _interopRequireDefault(_jquery);
  21275. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  21276. function renderErrorMessage(dom_obj_target, message_text) {
  21277. dom_obj_target.popup({
  21278. html: '<i class="ui icon inverted exclamation triangle yellow"></i>' + message_text,
  21279. transition: "fade up",
  21280. on: 'click',
  21281. closable: true,
  21282. movePopup: true,
  21283. boundary: window,
  21284. preserve: false,
  21285. target: false,
  21286. className: {
  21287. popup: 'ui popup invalid-identifier'
  21288. },
  21289. onHidden: function onHidden($module) {
  21290. dom_obj_target.popup('destroy');
  21291. }
  21292. }).popup('toggle');
  21293. }
  21294. /***/ }),
  21295. /***/ "./js/visualUI/variables.js":
  21296. /*!**********************************!*\
  21297. !*** ./js/visualUI/variables.js ***!
  21298. \**********************************/
  21299. /*! no static exports found */
  21300. /***/ (function(module, exports, __webpack_require__) {
  21301. "use strict";
  21302. Object.defineProperty(exports, "__esModule", {
  21303. value: true
  21304. });
  21305. exports.addVariable = addVariable;
  21306. exports.renderVariable = renderVariable;
  21307. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21308. var _jquery2 = _interopRequireDefault(_jquery);
  21309. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  21310. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  21311. var Models = _interopRequireWildcard(_ivprog_elements);
  21312. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  21313. var _utils = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  21314. var Utils = _interopRequireWildcard(_utils);
  21315. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  21316. 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; } }
  21317. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  21318. window.jQuery = _jquery2.default;
  21319. var counter_new_variables = 0;
  21320. function addVariable(function_obj, function_container) {
  21321. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  21322. var new_var = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_variable') + '_' + counter_new_variables, 1);
  21323. if (function_obj.variables_list == null) {
  21324. function_obj.variables_list = [];
  21325. }
  21326. function_obj.variables_list.push(new_var);
  21327. counter_new_variables++;
  21328. var newe = renderVariable(function_container, new_var, function_obj);
  21329. if (is_in_click) {
  21330. newe.css('display', 'none');
  21331. newe.fadeIn();
  21332. }
  21333. }
  21334. function updateName(variable_obj, new_name, variable_obj_dom, function_obj) {
  21335. if (variable_obj.name == new_name) {
  21336. return;
  21337. }
  21338. if (isValidIdentifier(new_name)) {
  21339. if (variableNameAlreadyExists(new_name, function_obj)) {
  21340. Utils.renderErrorMessage(variable_obj_dom.find('.editing_name_var'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_variable_duplicated'));
  21341. } else {
  21342. variable_obj.name = new_name;
  21343. }
  21344. } else {
  21345. Utils.renderErrorMessage(variable_obj_dom.find('.editing_name_var'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name'));
  21346. }
  21347. }
  21348. function variableNameAlreadyExists(name_var, function_obj) {
  21349. if (function_obj.parameters_list) {
  21350. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  21351. if (function_obj.parameters_list[i].name == name_var) {
  21352. return true;
  21353. }
  21354. }
  21355. }
  21356. if (function_obj.variables_list) {
  21357. for (var i = 0; i < function_obj.variables_list.length; i++) {
  21358. if (function_obj.variables_list[i].name == name_var) {
  21359. return true;
  21360. }
  21361. }
  21362. }
  21363. return false;
  21364. }
  21365. function isValidIdentifier(identifier_str) {
  21366. return (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str)
  21367. );
  21368. }
  21369. function removeVariable(variable_obj, variable_container) {
  21370. var function_associated = variable_container.data('associatedFunction');
  21371. var index = function_associated.variables_list.indexOf(variable_obj);
  21372. if (index > -1) {
  21373. window.insertContext = true;
  21374. delete function_associated.variables_list[index];
  21375. function_associated.variables_list.splice(index, 1);
  21376. }
  21377. variable_container.children().off();
  21378. variable_container.off();
  21379. variable_container.fadeOut();
  21380. }
  21381. function updateType(variable_obj, new_type) {
  21382. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  21383. variable_obj.type = new_type;
  21384. variable_obj.dimensions = new_dimensions;
  21385. if (new_dimensions > 0) {
  21386. variable_obj.rows = new_dimensions;
  21387. variable_obj.columns = 2;
  21388. }
  21389. updateInitialValues(variable_obj);
  21390. }
  21391. function addHandlers(variable_obj, variable_container, function_obj) {
  21392. // Manage variable name:
  21393. variable_container.find(".enable_edit_name_variable").on('click', function (e) {
  21394. enableNameUpdate(variable_obj, variable_container, function_obj);
  21395. });
  21396. // Menu to change type:
  21397. variable_container.find('.ui.dropdown.variable_type').dropdown({
  21398. onChange: function onChange(value, text, $selectedItem) {
  21399. if ($selectedItem.data('dimensions')) {
  21400. updateType(variable_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  21401. } else {
  21402. updateType(variable_obj, _types.Types[$selectedItem.data('type')]);
  21403. }
  21404. renderValues(variable_obj, variable_container);
  21405. },
  21406. selectOnKeydown: false
  21407. });
  21408. // Remove variable:
  21409. variable_container.find(".remove_variable").on('click', function (e) {
  21410. removeVariable(variable_obj, variable_container);
  21411. });
  21412. }
  21413. function renderVariable(function_container, new_var, function_obj) {
  21414. var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
  21415. element += '<div class="ui dropdown variable_type">';
  21416. if (new_var.dimensions > 0) {
  21417. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase());
  21418. for (var i = 0; i < new_var.dimensions; i++) {
  21419. element += ' [ ] ';
  21420. }
  21421. element += '</div>';
  21422. } else {
  21423. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase()) + '</div>';
  21424. }
  21425. element += '<div class="menu">';
  21426. for (var tm in _types.Types) {
  21427. if (tm == _types.Types.VOID.toUpperCase()) {
  21428. continue;
  21429. }
  21430. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  21431. }
  21432. for (var tm in _types.Types) {
  21433. if (tm == _types.Types.VOID.toUpperCase()) {
  21434. continue;
  21435. }
  21436. 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>';
  21437. }
  21438. element += '</div></div> ';
  21439. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  21440. element += ' <span class="character_equals"> = </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  21441. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  21442. element = (0, _jquery2.default)(element);
  21443. element.data('associatedFunction', function_obj);
  21444. function_container.find('.variables_list_div').append(element);
  21445. addHandlers(new_var, element, function_obj);
  21446. renderValues(new_var, element);
  21447. return element;
  21448. }
  21449. function updateColumnsAndRowsText(variable_container, variable_var) {
  21450. var prev = variable_container.find('.text').text().split('[');
  21451. if (prev.length == 2) {
  21452. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  21453. variable_container.find('.text').empty();
  21454. variable_container.find('.text').text(ff);
  21455. }
  21456. if (prev.length == 3) {
  21457. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  21458. variable_container.find('.text').empty();
  21459. variable_container.find('.text').text(ff);
  21460. }
  21461. }
  21462. function renderValues(new_var, variable_container) {
  21463. var ret = "";
  21464. var j = 0;
  21465. if (new_var.dimensions == 0) {
  21466. if (new_var.type == _types.Types.REAL) {
  21467. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  21468. } else {
  21469. if (new_var.type == _types.Types.BOOLEAN) {
  21470. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value) + '</span> </div> ';
  21471. } else {
  21472. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  21473. }
  21474. }
  21475. } else {
  21476. ret += '<table class="tabela_var">';
  21477. if (new_var.dimensions == 1) {
  21478. ret += '<tr>';
  21479. if (new_var.type == _types.Types.REAL) {
  21480. for (var k = 0; k < new_var.columns; k++) {
  21481. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  21482. }
  21483. } else {
  21484. for (var k = 0; k < new_var.columns; k++) {
  21485. if (new_var.type == _types.Types.BOOLEAN) {
  21486. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value[k]) + '</span></td>';
  21487. } else {
  21488. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  21489. }
  21490. }
  21491. }
  21492. ret += '</tr>';
  21493. ret += '</table>';
  21494. 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>';
  21495. }
  21496. if (new_var.dimensions == 2) {
  21497. if (new_var.type == _types.Types.REAL) {
  21498. for (var l = 0; l < new_var.rows; l++) {
  21499. ret += '<tr>';
  21500. for (var k = 0; k < new_var.columns; k++) {
  21501. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  21502. }
  21503. ret += '</tr>';
  21504. }
  21505. } else {
  21506. for (var l = 0; l < new_var.rows; l++) {
  21507. ret += '<tr>';
  21508. for (var k = 0; k < new_var.columns; k++) {
  21509. if (new_var.type == _types.Types.BOOLEAN) {
  21510. 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>';
  21511. } else {
  21512. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  21513. }
  21514. }
  21515. ret += '</tr>';
  21516. }
  21517. }
  21518. if (new_var.rows == 0) {
  21519. ret += '<tr><td></td></tr>';
  21520. }
  21521. 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>';
  21522. ret += '</table>';
  21523. 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>';
  21524. }
  21525. }
  21526. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21527. ret = (0, _jquery2.default)(ret);
  21528. (0, _jquery2.default)(ret).find('.span_value_variable').data('associatedOject', new_var);
  21529. (0, _jquery2.default)(ret).find(".boolean_simple_type").on('click', function (e) {
  21530. alternateBooleanValue(new_var, this.parentNode);
  21531. });
  21532. (0, _jquery2.default)(ret).find(".simple_var").on('click', function (e) {
  21533. enableValueUpdate(new_var, this.parentNode);
  21534. });
  21535. (0, _jquery2.default)(ret).find(".boolean_vector_var").on('click', function (e) {
  21536. alternateBooleanVectorValue(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  21537. });
  21538. (0, _jquery2.default)(ret).find(".vector_var").on('click', function (e) {
  21539. enableVectorValueUpdate(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  21540. });
  21541. (0, _jquery2.default)(ret).find(".remove_global_vector_column").on('click', function (e) {
  21542. removeColumnVector(new_var);
  21543. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21544. renderValues(new_var, variable_container);
  21545. });
  21546. (0, _jquery2.default)(ret).find(".add_global_vector_column").on('click', function (e) {
  21547. addColumnVector(new_var);
  21548. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21549. renderValues(new_var, variable_container);
  21550. });
  21551. (0, _jquery2.default)(ret).find(".remove_global_matrix_column").on('click', function (e) {
  21552. removeColumnMatrix(new_var);
  21553. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21554. renderValues(new_var, variable_container);
  21555. });
  21556. (0, _jquery2.default)(ret).find(".add_global_matrix_column").on('click', function (e) {
  21557. addColumnMatrix(new_var);
  21558. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21559. renderValues(new_var, variable_container);
  21560. });
  21561. (0, _jquery2.default)(ret).find(".remove_global_matrix_line").on('click', function (e) {
  21562. removeLineMatrix(new_var);
  21563. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21564. renderValues(new_var, variable_container);
  21565. });
  21566. (0, _jquery2.default)(ret).find(".add_global_matrix_line").on('click', function (e) {
  21567. addLineMatrix(new_var);
  21568. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21569. renderValues(new_var, variable_container);
  21570. });
  21571. (0, _jquery2.default)(ret).find(".boolean_matrix_var").on('click', function (e) {
  21572. alternateBooleanMatrixValue(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  21573. });
  21574. (0, _jquery2.default)(ret).find(".matrix_var").on('click', function (e) {
  21575. enableMatrixValueUpdate(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  21576. });
  21577. (0, _jquery2.default)(variable_container).find(".div_valor_var").append(ret);
  21578. updateColumnsAndRowsText(variable_container, new_var);
  21579. }
  21580. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  21581. var_obj.value[row][index] = !var_obj.value[row][index];
  21582. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[row][index]));
  21583. }
  21584. function addLineMatrix(var_obj) {
  21585. var_obj.rows++;
  21586. if (var_obj.type == _types.Types.INTEGER) {
  21587. var n_l = [];
  21588. for (var i = 0; i < var_obj.columns; i++) {
  21589. n_l.push(1);
  21590. }
  21591. var_obj.value.push(n_l);
  21592. }
  21593. if (var_obj.type == _types.Types.REAL) {
  21594. var n_l = [];
  21595. for (i = 0; i < var_obj.columns; i++) {
  21596. n_l.push(1.0);
  21597. }
  21598. var_obj.value.push(n_l);
  21599. }
  21600. if (var_obj.type == _types.Types.TEXT) {
  21601. var n_l = [];
  21602. for (i = 0; i < var_obj.columns; i++) {
  21603. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  21604. }
  21605. var_obj.value.push(n_l);
  21606. }
  21607. if (var_obj.type == _types.Types.BOOLEAN) {
  21608. var n_l = [];
  21609. for (i = 0; i < var_obj.columns; i++) {
  21610. n_l.push(true);
  21611. }
  21612. var_obj.value.push(n_l);
  21613. }
  21614. }
  21615. function removeLineMatrix(var_obj) {
  21616. if (var_obj.rows == 0) {
  21617. return;
  21618. }
  21619. var_obj.rows--;
  21620. var_obj.value.splice(var_obj.value.length - 1, 1);
  21621. }
  21622. function addColumnMatrix(var_obj) {
  21623. var_obj.columns++;
  21624. if (var_obj.type == _types.Types.INTEGER) {
  21625. for (var i = 0; i < var_obj.rows; i++) {
  21626. var_obj.value[i].push(1);
  21627. }
  21628. }
  21629. if (var_obj.type == _types.Types.REAL) {
  21630. for (var i = 0; i < var_obj.rows; i++) {
  21631. var_obj.value[i].push(1.0);
  21632. }
  21633. }
  21634. if (var_obj.type == _types.Types.TEXT) {
  21635. for (var i = 0; i < var_obj.rows; i++) {
  21636. var_obj.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  21637. }
  21638. }
  21639. if (var_obj.type == _types.Types.BOOLEAN) {
  21640. for (var i = 0; i < var_obj.rows; i++) {
  21641. var_obj.value[i].push(true);
  21642. }
  21643. }
  21644. }
  21645. function removeColumnMatrix(var_obj) {
  21646. if (var_obj.columns == 0) {
  21647. return;
  21648. }
  21649. var_obj.columns--;
  21650. for (var i = 0; i < var_obj.rows; i++) {
  21651. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  21652. }
  21653. }
  21654. function addColumnVector(var_obj) {
  21655. var_obj.columns++;
  21656. if (var_obj.type == _types.Types.INTEGER) {
  21657. var_obj.value.push(1);
  21658. }
  21659. if (var_obj.type == _types.Types.REAL) {
  21660. var_obj.value.push(1.0);
  21661. }
  21662. if (var_obj.type == _types.Types.TEXT) {
  21663. var_obj.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  21664. }
  21665. if (var_obj.type == _types.Types.BOOLEAN) {
  21666. var_obj.value.push(true);
  21667. }
  21668. }
  21669. function removeColumnVector(var_obj) {
  21670. if (var_obj.columns == 0) {
  21671. return;
  21672. }
  21673. var_obj.columns--;
  21674. var_obj.value.splice(var_obj.value.length - 1, 1);
  21675. }
  21676. function alternateBooleanValue(var_obj, value_container) {
  21677. var_obj.value = !var_obj.value;
  21678. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value));
  21679. }
  21680. function alternateBooleanVectorValue(var_obj, index, value_container) {
  21681. var_obj.value[index] = !var_obj.value[index];
  21682. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[index]));
  21683. }
  21684. function updateInitialValues(variable_obj) {
  21685. if (variable_obj.type == _types.Types.INTEGER) {
  21686. if (variable_obj.dimensions == 0) {
  21687. variable_obj.value = 1;
  21688. }
  21689. if (variable_obj.dimensions == 1) {
  21690. variable_obj.value = [1, 1];
  21691. }
  21692. if (variable_obj.dimensions == 2) {
  21693. variable_obj.value = [[1, 1], [1, 1]];
  21694. }
  21695. }
  21696. if (variable_obj.type == _types.Types.REAL) {
  21697. if (variable_obj.dimensions == 0) {
  21698. variable_obj.value = 1.0;
  21699. }
  21700. if (variable_obj.dimensions == 1) {
  21701. variable_obj.value = [1.0, 1.0];
  21702. }
  21703. if (variable_obj.dimensions == 2) {
  21704. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  21705. }
  21706. }
  21707. if (variable_obj.type == _types.Types.TEXT) {
  21708. if (variable_obj.dimensions == 0) {
  21709. variable_obj.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  21710. }
  21711. if (variable_obj.dimensions == 1) {
  21712. variable_obj.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  21713. }
  21714. if (variable_obj.dimensions == 2) {
  21715. variable_obj.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  21716. }
  21717. }
  21718. if (variable_obj.type == _types.Types.BOOLEAN) {
  21719. if (variable_obj.dimensions == 0) {
  21720. variable_obj.value = true;
  21721. }
  21722. if (variable_obj.dimensions == 1) {
  21723. variable_obj.value = [true, true];
  21724. }
  21725. if (variable_obj.dimensions == 2) {
  21726. variable_obj.value = [[true, true], [true, true]];
  21727. }
  21728. }
  21729. }
  21730. var opened_name_value_vector_global_ = false;
  21731. var opened_input_value_vector_global_ = null;
  21732. function enableVectorValueUpdate(var_obj, index, parent_node) {
  21733. if (opened_name_value_vector_global_) {
  21734. opened_input_value_vector_global_.focus();
  21735. return;
  21736. }
  21737. parent_node = (0, _jquery2.default)(parent_node);
  21738. opened_name_value_vector_global_ = true;
  21739. parent_node.find('.span_value_variable').text('');
  21740. var input_field;
  21741. if (var_obj.type == _types.Types.REAL) {
  21742. 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) + "' />");
  21743. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21744. } else {
  21745. 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] + "' />");
  21746. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21747. }
  21748. input_field.on('input', function () {
  21749. var inputWidth = input_field.textWidth() + 10;
  21750. opened_input_value_vector_global_ = input_field;
  21751. input_field.focus();
  21752. var tmpStr = input_field.val();
  21753. input_field.val('');
  21754. input_field.val(tmpStr);
  21755. input_field.css({
  21756. width: inputWidth
  21757. });
  21758. }).trigger('input');
  21759. input_field.focusout(function () {
  21760. /// update array:
  21761. if (input_field.val().trim()) {
  21762. if (var_obj.type == _types.Types.REAL) {
  21763. var_obj.value[index] = parseFloat(input_field.val().trim());
  21764. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21765. } else {
  21766. if (var_obj.type == _types.Types.INTEGER) {
  21767. var_obj.value[index] = parseInt(input_field.val().trim());
  21768. } else {
  21769. var_obj.value[index] = input_field.val().trim();
  21770. }
  21771. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21772. }
  21773. } else {
  21774. if (var_obj.type == _types.Types.REAL) {
  21775. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21776. } else {
  21777. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21778. }
  21779. }
  21780. if (var_obj.type == _types.Types.TEXT) {
  21781. var_obj.value[index] = input_field.val();
  21782. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21783. }
  21784. input_field.off();
  21785. input_field.remove();
  21786. /// update elements:
  21787. opened_name_value_vector_global_ = false;
  21788. opened_input_value_vector_global_ = false;
  21789. });
  21790. input_field.on('keydown', function (e) {
  21791. var code = e.keyCode || e.which;
  21792. if (code == 13) {
  21793. if (input_field.val().trim()) {
  21794. if (var_obj.type == _types.Types.REAL) {
  21795. var_obj.value[index] = parseFloat(input_field.val().trim());
  21796. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21797. } else {
  21798. if (var_obj.type == _types.Types.INTEGER) {
  21799. var_obj.value[index] = parseInt(input_field.val().trim());
  21800. } else {
  21801. var_obj.value[index] = input_field.val().trim();
  21802. }
  21803. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21804. }
  21805. } else {
  21806. if (var_obj.type == _types.Types.REAL) {
  21807. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21808. } else {
  21809. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21810. }
  21811. }
  21812. if (var_obj.type == _types.Types.TEXT) {
  21813. var_obj.value[index] = input_field.val();
  21814. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21815. }
  21816. input_field.off();
  21817. input_field.remove();
  21818. /// update elements:
  21819. opened_name_value_vector_global_ = false;
  21820. opened_input_value_vector_global_ = false;
  21821. }
  21822. if (code == 27) {
  21823. if (var_obj.type == _types.Types.REAL) {
  21824. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21825. } else {
  21826. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21827. }
  21828. input_field.off();
  21829. input_field.remove();
  21830. /// update elements:
  21831. opened_name_value_vector_global_ = false;
  21832. opened_input_value_vector_global_ = false;
  21833. }
  21834. });
  21835. input_field.select();
  21836. }
  21837. var opened_name_value_global_var = false;
  21838. var opened_input_value_global_ar = null;
  21839. function enableValueUpdate(var_obj, parent_node) {
  21840. if (opened_name_value_global_var) {
  21841. opened_input_value_global_ar.focus();
  21842. return;
  21843. }
  21844. parent_node = (0, _jquery2.default)(parent_node);
  21845. opened_name_value_global_var = true;
  21846. var input_field;
  21847. parent_node.find('.span_value_variable').text('');
  21848. if (var_obj.type == _types.Types.REAL) {
  21849. 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) + "' />");
  21850. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21851. } else {
  21852. 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 + "' />");
  21853. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21854. }
  21855. input_field.on('input', function () {
  21856. var inputWidth = input_field.textWidth() + 10;
  21857. opened_input_value_global_ar = input_field;
  21858. input_field.focus();
  21859. var tmpStr = input_field.val();
  21860. input_field.val('');
  21861. input_field.val(tmpStr);
  21862. input_field.css({
  21863. width: inputWidth
  21864. });
  21865. }).trigger('input');
  21866. input_field.focusout(function () {
  21867. /// update array:
  21868. if (input_field.val().trim()) {
  21869. if (var_obj.type == _types.Types.REAL) {
  21870. var_obj.value = parseFloat(input_field.val().trim());
  21871. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21872. } else {
  21873. if (var_obj.type == _types.Types.INTEGER) {
  21874. var_obj.value = parseInt(input_field.val().trim());
  21875. } else {
  21876. var_obj.value = input_field.val().trim();
  21877. }
  21878. parent_node.find('.span_value_variable').text(var_obj.value);
  21879. }
  21880. } else {
  21881. if (var_obj.type == _types.Types.REAL) {
  21882. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21883. } else {
  21884. parent_node.find('.span_value_variable').text(var_obj.value);
  21885. }
  21886. }
  21887. if (var_obj.type == _types.Types.TEXT) {
  21888. var_obj.value = input_field.val();
  21889. parent_node.find('.span_value_variable').text(var_obj.value);
  21890. }
  21891. input_field.off();
  21892. input_field.remove();
  21893. /// update elements:
  21894. opened_name_value_global_var = false;
  21895. opened_input_value_global_ar = false;
  21896. });
  21897. input_field.on('keydown', function (e) {
  21898. var code = e.keyCode || e.which;
  21899. if (code == 13) {
  21900. if (input_field.val().trim()) {
  21901. if (var_obj.type == _types.Types.REAL) {
  21902. var_obj.value = parseFloat(input_field.val().trim());
  21903. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21904. } else {
  21905. if (var_obj.type == _types.Types.INTEGER) {
  21906. var_obj.value = parseInt(input_field.val().trim());
  21907. } else {
  21908. var_obj.value = input_field.val().trim();
  21909. }
  21910. parent_node.find('.span_value_variable').text(var_obj.value);
  21911. }
  21912. } else {
  21913. if (var_obj.type == _types.Types.REAL) {
  21914. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21915. } else {
  21916. parent_node.find('.span_value_variable').text(var_obj.value);
  21917. }
  21918. }
  21919. if (var_obj.type == _types.Types.TEXT) {
  21920. var_obj.value = input_field.val();
  21921. parent_node.find('.span_value_variable').text(var_obj.value);
  21922. }
  21923. input_field.off();
  21924. input_field.remove();
  21925. /// update elements:
  21926. opened_name_value_global_var = false;
  21927. opened_input_value_global_ar = false;
  21928. }
  21929. if (code == 27) {
  21930. if (var_obj.type == _types.Types.REAL) {
  21931. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21932. } else {
  21933. parent_node.find('.span_value_variable').text(var_obj.value);
  21934. }
  21935. input_field.off();
  21936. input_field.remove();
  21937. /// update elements:
  21938. opened_name_value_global_var = false;
  21939. opened_input_value_global_ar = false;
  21940. }
  21941. });
  21942. input_field.select();
  21943. }
  21944. var opened_name_global = false;
  21945. var opened_input_global = null;
  21946. function enableNameUpdate(variable_obj, variable_container, function_obj) {
  21947. if (opened_name_global) {
  21948. opened_input_global.focus();
  21949. return;
  21950. }
  21951. opened_name_global = true;
  21952. variable_container.find('.span_name_variable').text('');
  21953. var input_name;
  21954. 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 + "' />");
  21955. input_name.insertBefore(variable_container.find('.span_name_variable'));
  21956. input_name.on('input', function () {
  21957. var inputWidth = input_name.textWidth() + 10;
  21958. opened_input_global = input_name;
  21959. input_name.focus();
  21960. var tmpStr = input_name.val();
  21961. input_name.val('');
  21962. input_name.val(tmpStr);
  21963. input_name.css({
  21964. width: inputWidth
  21965. });
  21966. }).trigger('input');
  21967. input_name.focusout(function () {
  21968. /// update array:
  21969. if (input_name.val().trim().length > 0) {
  21970. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  21971. variable_container.find('.span_name_variable').text(variable_obj.name);
  21972. } else {
  21973. variable_container.find('.span_name_variable').text(variable_obj.name);
  21974. }
  21975. input_name.off();
  21976. input_name.remove();
  21977. /// update elements:
  21978. opened_name_global = false;
  21979. opened_input_global = false;
  21980. });
  21981. input_name.on('keydown', function (e) {
  21982. var code = e.keyCode || e.which;
  21983. if (code == 13) {
  21984. if (input_name.val().trim().length > 0) {
  21985. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  21986. variable_container.find('.span_name_variable').text(variable_obj.name);
  21987. } else {
  21988. variable_container.find('.span_name_variable').text(variable_obj.name);
  21989. }
  21990. input_name.off();
  21991. input_name.remove();
  21992. /// update elements:
  21993. opened_name_global = false;
  21994. opened_input_global = false;
  21995. }
  21996. if (code == 27) {
  21997. variable_container.find('.span_name_variable').text(variable_obj.name);
  21998. input_name.off();
  21999. input_name.remove();
  22000. /// update elements:
  22001. opened_name_global = false;
  22002. opened_input_global = false;
  22003. }
  22004. });
  22005. input_name.select();
  22006. }
  22007. var opened_name_value_matrix_global_v = false;
  22008. var opened_input_value_matrix_global_v = null;
  22009. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  22010. if (opened_name_value_matrix_global_v) {
  22011. opened_input_value_matrix_global_v.focus();
  22012. return;
  22013. }
  22014. parent_node = (0, _jquery2.default)(parent_node);
  22015. opened_name_value_matrix_global_v = true;
  22016. parent_node.find('.span_value_variable').text('');
  22017. var input_field;
  22018. if (var_obj.type == _types.Types.REAL) {
  22019. 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) + "' />");
  22020. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22021. } else {
  22022. 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] + "' />");
  22023. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22024. }
  22025. input_field.on('input', function () {
  22026. var inputWidth = input_field.textWidth() + 10;
  22027. opened_input_value_matrix_global_v = input_field;
  22028. input_field.focus();
  22029. var tmpStr = input_field.val();
  22030. input_field.val('');
  22031. input_field.val(tmpStr);
  22032. input_field.css({
  22033. width: inputWidth
  22034. });
  22035. }).trigger('input');
  22036. input_field.focusout(function () {
  22037. /// update array:
  22038. if (input_field.val().trim()) {
  22039. if (var_obj.type == _types.Types.REAL) {
  22040. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  22041. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  22042. } else {
  22043. if (var_obj.type == _types.Types.INTEGER) {
  22044. var_obj.value[row][index] = parseInt(input_field.val().trim());
  22045. } else {
  22046. var_obj.value[row][index] = input_field.val().trim();
  22047. }
  22048. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  22049. }
  22050. } else {
  22051. if (var_obj.type == _types.Types.REAL) {
  22052. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  22053. } else {
  22054. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  22055. }
  22056. }
  22057. if (var_obj.type == _types.Types.TEXT) {
  22058. var_obj.value[row][index] = input_field.val();
  22059. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  22060. }
  22061. input_field.off();
  22062. input_field.remove();
  22063. /// update elements:
  22064. opened_name_value_matrix_global_v = false;
  22065. opened_input_value_matrix_global_v = false;
  22066. });
  22067. input_field.on('keydown', function (e) {
  22068. var code = e.keyCode || e.which;
  22069. if (code == 13) {
  22070. if (input_field.val().trim()) {
  22071. if (var_obj.type == _types.Types.REAL) {
  22072. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  22073. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  22074. } else {
  22075. if (var_obj.type == _types.Types.INTEGER) {
  22076. var_obj.value[row][index] = parseInt(input_field.val().trim());
  22077. } else {
  22078. var_obj.value[row][index] = input_field.val().trim();
  22079. }
  22080. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  22081. }
  22082. } else {
  22083. if (var_obj.type == _types.Types.REAL) {
  22084. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  22085. } else {
  22086. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  22087. }
  22088. }
  22089. if (var_obj.type == _types.Types.TEXT) {
  22090. var_obj.value[row][index] = input_field.val();
  22091. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  22092. }
  22093. input_field.off();
  22094. input_field.remove();
  22095. /// update elements:
  22096. opened_name_value_matrix_global_v = false;
  22097. opened_input_value_matrix_global_v = false;
  22098. }
  22099. if (code == 27) {
  22100. if (var_obj.type == _types.Types.REAL) {
  22101. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  22102. } else {
  22103. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  22104. }
  22105. input_field.off();
  22106. input_field.remove();
  22107. /// update elements:
  22108. opened_name_value_matrix_global_v = false;
  22109. opened_input_value_matrix_global_v = false;
  22110. }
  22111. });
  22112. input_field.select();
  22113. }
  22114. /***/ }),
  22115. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  22116. /*!****************************************************!*\
  22117. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  22118. \****************************************************/
  22119. /*! no static exports found */
  22120. /***/ (function(module, exports, __webpack_require__) {
  22121. "use strict";
  22122. //
  22123. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22124. * Use of this file is governed by the BSD 3-clause license that
  22125. * can be found in the LICENSE.txt file in the project root.
  22126. */
  22127. // This implementation of {@link TokenStream} loads tokens from a
  22128. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  22129. // access to any previous token by index.
  22130. //
  22131. // <p>
  22132. // This token stream ignores the value of {@link Token//getChannel}. If your
  22133. // parser requires the token stream filter tokens to only those on a particular
  22134. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  22135. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  22136. // {@link CommonTokenStream}.</p>
  22137. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22138. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  22139. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  22140. // this is just to keep meaningful parameter types to Parser
  22141. function TokenStream() {
  22142. return this;
  22143. }
  22144. function BufferedTokenStream(tokenSource) {
  22145. TokenStream.call(this);
  22146. // The {@link TokenSource} from which tokens for this stream are fetched.
  22147. this.tokenSource = tokenSource;
  22148. // A collection of all tokens fetched from the token source. The list is
  22149. // considered a complete view of the input once {@link //fetchedEOF} is set
  22150. // to {@code true}.
  22151. this.tokens = [];
  22152. // The index into {@link //tokens} of the current token (next token to
  22153. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  22154. // be
  22155. // {@link //LT LT(1)}.
  22156. //
  22157. // <p>This field is set to -1 when the stream is first constructed or when
  22158. // {@link //setTokenSource} is called, indicating that the first token has
  22159. // not yet been fetched from the token source. For additional information,
  22160. // see the documentation of {@link IntStream} for a description of
  22161. // Initializing Methods.</p>
  22162. this.index = -1;
  22163. // Indicates whether the {@link Token//EOF} token has been fetched from
  22164. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  22165. // performance for the following cases:
  22166. //
  22167. // <ul>
  22168. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  22169. // prevent
  22170. // consuming the EOF symbol is optimized by checking the values of
  22171. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  22172. // //LA}.</li>
  22173. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  22174. // into
  22175. // {@link //tokens} is trivial with this field.</li>
  22176. // <ul>
  22177. this.fetchedEOF = false;
  22178. return this;
  22179. }
  22180. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  22181. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  22182. BufferedTokenStream.prototype.mark = function () {
  22183. return 0;
  22184. };
  22185. BufferedTokenStream.prototype.release = function (marker) {
  22186. // no resources to release
  22187. };
  22188. BufferedTokenStream.prototype.reset = function () {
  22189. this.seek(0);
  22190. };
  22191. BufferedTokenStream.prototype.seek = function (index) {
  22192. this.lazyInit();
  22193. this.index = this.adjustSeekIndex(index);
  22194. };
  22195. BufferedTokenStream.prototype.get = function (index) {
  22196. this.lazyInit();
  22197. return this.tokens[index];
  22198. };
  22199. BufferedTokenStream.prototype.consume = function () {
  22200. var skipEofCheck = false;
  22201. if (this.index >= 0) {
  22202. if (this.fetchedEOF) {
  22203. // the last token in tokens is EOF. skip check if p indexes any
  22204. // fetched token except the last.
  22205. skipEofCheck = this.index < this.tokens.length - 1;
  22206. } else {
  22207. // no EOF token in tokens. skip check if p indexes a fetched token.
  22208. skipEofCheck = this.index < this.tokens.length;
  22209. }
  22210. } else {
  22211. // not yet initialized
  22212. skipEofCheck = false;
  22213. }
  22214. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  22215. throw "cannot consume EOF";
  22216. }
  22217. if (this.sync(this.index + 1)) {
  22218. this.index = this.adjustSeekIndex(this.index + 1);
  22219. }
  22220. };
  22221. // Make sure index {@code i} in tokens has a token.
  22222. //
  22223. // @return {@code true} if a token is located at index {@code i}, otherwise
  22224. // {@code false}.
  22225. // @see //get(int i)
  22226. // /
  22227. BufferedTokenStream.prototype.sync = function (i) {
  22228. var n = i - this.tokens.length + 1; // how many more elements we need?
  22229. if (n > 0) {
  22230. var fetched = this.fetch(n);
  22231. return fetched >= n;
  22232. }
  22233. return true;
  22234. };
  22235. // Add {@code n} elements to buffer.
  22236. //
  22237. // @return The actual number of elements added to the buffer.
  22238. // /
  22239. BufferedTokenStream.prototype.fetch = function (n) {
  22240. if (this.fetchedEOF) {
  22241. return 0;
  22242. }
  22243. for (var i = 0; i < n; i++) {
  22244. var t = this.tokenSource.nextToken();
  22245. t.tokenIndex = this.tokens.length;
  22246. this.tokens.push(t);
  22247. if (t.type === Token.EOF) {
  22248. this.fetchedEOF = true;
  22249. return i + 1;
  22250. }
  22251. }
  22252. return n;
  22253. };
  22254. // Get all tokens from start..stop inclusively///
  22255. BufferedTokenStream.prototype.getTokens = function (start, stop, types) {
  22256. if (types === undefined) {
  22257. types = null;
  22258. }
  22259. if (start < 0 || stop < 0) {
  22260. return null;
  22261. }
  22262. this.lazyInit();
  22263. var subset = [];
  22264. if (stop >= this.tokens.length) {
  22265. stop = this.tokens.length - 1;
  22266. }
  22267. for (var i = start; i < stop; i++) {
  22268. var t = this.tokens[i];
  22269. if (t.type === Token.EOF) {
  22270. break;
  22271. }
  22272. if (types === null || types.contains(t.type)) {
  22273. subset.push(t);
  22274. }
  22275. }
  22276. return subset;
  22277. };
  22278. BufferedTokenStream.prototype.LA = function (i) {
  22279. return this.LT(i).type;
  22280. };
  22281. BufferedTokenStream.prototype.LB = function (k) {
  22282. if (this.index - k < 0) {
  22283. return null;
  22284. }
  22285. return this.tokens[this.index - k];
  22286. };
  22287. BufferedTokenStream.prototype.LT = function (k) {
  22288. this.lazyInit();
  22289. if (k === 0) {
  22290. return null;
  22291. }
  22292. if (k < 0) {
  22293. return this.LB(-k);
  22294. }
  22295. var i = this.index + k - 1;
  22296. this.sync(i);
  22297. if (i >= this.tokens.length) {
  22298. // return EOF token
  22299. // EOF must be last token
  22300. return this.tokens[this.tokens.length - 1];
  22301. }
  22302. return this.tokens[i];
  22303. };
  22304. // Allowed derived classes to modify the behavior of operations which change
  22305. // the current stream position by adjusting the target token index of a seek
  22306. // operation. The default implementation simply returns {@code i}. If an
  22307. // exception is thrown in this method, the current stream index should not be
  22308. // changed.
  22309. //
  22310. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  22311. // that
  22312. // the seek target is always an on-channel token.</p>
  22313. //
  22314. // @param i The target token index.
  22315. // @return The adjusted target token index.
  22316. BufferedTokenStream.prototype.adjustSeekIndex = function (i) {
  22317. return i;
  22318. };
  22319. BufferedTokenStream.prototype.lazyInit = function () {
  22320. if (this.index === -1) {
  22321. this.setup();
  22322. }
  22323. };
  22324. BufferedTokenStream.prototype.setup = function () {
  22325. this.sync(0);
  22326. this.index = this.adjustSeekIndex(0);
  22327. };
  22328. // Reset this token stream by setting its token source.///
  22329. BufferedTokenStream.prototype.setTokenSource = function (tokenSource) {
  22330. this.tokenSource = tokenSource;
  22331. this.tokens = [];
  22332. this.index = -1;
  22333. this.fetchedEOF = false;
  22334. };
  22335. // Given a starting index, return the index of the next token on channel.
  22336. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  22337. // on channel between i and EOF.
  22338. // /
  22339. BufferedTokenStream.prototype.nextTokenOnChannel = function (i, channel) {
  22340. this.sync(i);
  22341. if (i >= this.tokens.length) {
  22342. return -1;
  22343. }
  22344. var token = this.tokens[i];
  22345. while (token.channel !== this.channel) {
  22346. if (token.type === Token.EOF) {
  22347. return -1;
  22348. }
  22349. i += 1;
  22350. this.sync(i);
  22351. token = this.tokens[i];
  22352. }
  22353. return i;
  22354. };
  22355. // Given a starting index, return the index of the previous token on channel.
  22356. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  22357. // on channel between i and 0.
  22358. BufferedTokenStream.prototype.previousTokenOnChannel = function (i, channel) {
  22359. while (i >= 0 && this.tokens[i].channel !== channel) {
  22360. i -= 1;
  22361. }
  22362. return i;
  22363. };
  22364. // Collect all tokens on specified channel to the right of
  22365. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  22366. // EOF. If channel is -1, find any non default channel token.
  22367. BufferedTokenStream.prototype.getHiddenTokensToRight = function (tokenIndex, channel) {
  22368. if (channel === undefined) {
  22369. channel = -1;
  22370. }
  22371. this.lazyInit();
  22372. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  22373. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  22374. }
  22375. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  22376. var from_ = tokenIndex + 1;
  22377. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  22378. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  22379. return this.filterForChannel(from_, to, channel);
  22380. };
  22381. // Collect all tokens on specified channel to the left of
  22382. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  22383. // If channel is -1, find any non default channel token.
  22384. BufferedTokenStream.prototype.getHiddenTokensToLeft = function (tokenIndex, channel) {
  22385. if (channel === undefined) {
  22386. channel = -1;
  22387. }
  22388. this.lazyInit();
  22389. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  22390. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  22391. }
  22392. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  22393. if (prevOnChannel === tokenIndex - 1) {
  22394. return null;
  22395. }
  22396. // if none on channel to left, prevOnChannel=-1 then from=0
  22397. var from_ = prevOnChannel + 1;
  22398. var to = tokenIndex - 1;
  22399. return this.filterForChannel(from_, to, channel);
  22400. };
  22401. BufferedTokenStream.prototype.filterForChannel = function (left, right, channel) {
  22402. var hidden = [];
  22403. for (var i = left; i < right + 1; i++) {
  22404. var t = this.tokens[i];
  22405. if (channel === -1) {
  22406. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  22407. hidden.push(t);
  22408. }
  22409. } else if (t.channel === channel) {
  22410. hidden.push(t);
  22411. }
  22412. }
  22413. if (hidden.length === 0) {
  22414. return null;
  22415. }
  22416. return hidden;
  22417. };
  22418. BufferedTokenStream.prototype.getSourceName = function () {
  22419. return this.tokenSource.getSourceName();
  22420. };
  22421. // Get the text of all tokens in this buffer.///
  22422. BufferedTokenStream.prototype.getText = function (interval) {
  22423. this.lazyInit();
  22424. this.fill();
  22425. if (interval === undefined || interval === null) {
  22426. interval = new Interval(0, this.tokens.length - 1);
  22427. }
  22428. var start = interval.start;
  22429. if (start instanceof Token) {
  22430. start = start.tokenIndex;
  22431. }
  22432. var stop = interval.stop;
  22433. if (stop instanceof Token) {
  22434. stop = stop.tokenIndex;
  22435. }
  22436. if (start === null || stop === null || start < 0 || stop < 0) {
  22437. return "";
  22438. }
  22439. if (stop >= this.tokens.length) {
  22440. stop = this.tokens.length - 1;
  22441. }
  22442. var s = "";
  22443. for (var i = start; i < stop + 1; i++) {
  22444. var t = this.tokens[i];
  22445. if (t.type === Token.EOF) {
  22446. break;
  22447. }
  22448. s = s + t.text;
  22449. }
  22450. return s;
  22451. };
  22452. // Get all tokens from lexer until EOF///
  22453. BufferedTokenStream.prototype.fill = function () {
  22454. this.lazyInit();
  22455. while (this.fetch(1000) === 1000) {
  22456. continue;
  22457. }
  22458. };
  22459. exports.BufferedTokenStream = BufferedTokenStream;
  22460. /***/ }),
  22461. /***/ "./node_modules/antlr4/CharStreams.js":
  22462. /*!********************************************!*\
  22463. !*** ./node_modules/antlr4/CharStreams.js ***!
  22464. \********************************************/
  22465. /*! no static exports found */
  22466. /***/ (function(module, exports, __webpack_require__) {
  22467. "use strict";
  22468. //
  22469. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22470. * Use of this file is governed by the BSD 3-clause license that
  22471. * can be found in the LICENSE.txt file in the project root.
  22472. */
  22473. //
  22474. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  22475. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  22476. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  22477. // Utility functions to create InputStreams from various sources.
  22478. //
  22479. // All returned InputStreams support the full range of Unicode
  22480. // up to U+10FFFF (the default behavior of InputStream only supports
  22481. // code points up to U+FFFF).
  22482. var CharStreams = {
  22483. // Creates an InputStream from a string.
  22484. fromString: function fromString(str) {
  22485. return new InputStream(str, true);
  22486. },
  22487. // Asynchronously creates an InputStream from a blob given the
  22488. // encoding of the bytes in that blob (defaults to 'utf8' if
  22489. // encoding is null).
  22490. //
  22491. // Invokes onLoad(result) on success, onError(error) on
  22492. // failure.
  22493. fromBlob: function fromBlob(blob, encoding, onLoad, onError) {
  22494. var reader = FileReader();
  22495. reader.onload = function (e) {
  22496. var is = new InputStream(e.target.result, true);
  22497. onLoad(is);
  22498. };
  22499. reader.onerror = onError;
  22500. reader.readAsText(blob, encoding);
  22501. },
  22502. // Creates an InputStream from a Buffer given the
  22503. // encoding of the bytes in that buffer (defaults to 'utf8' if
  22504. // encoding is null).
  22505. fromBuffer: function fromBuffer(buffer, encoding) {
  22506. return new InputStream(buffer.toString(encoding), true);
  22507. },
  22508. // Asynchronously creates an InputStream from a file on disk given
  22509. // the encoding of the bytes in that file (defaults to 'utf8' if
  22510. // encoding is null).
  22511. //
  22512. // Invokes callback(error, result) on completion.
  22513. fromPath: function fromPath(path, encoding, callback) {
  22514. fs.readFile(path, encoding, function (err, data) {
  22515. var is = null;
  22516. if (data !== null) {
  22517. is = new InputStream(data, true);
  22518. }
  22519. callback(err, is);
  22520. });
  22521. },
  22522. // Synchronously creates an InputStream given a path to a file
  22523. // on disk and the encoding of the bytes in that file (defaults to
  22524. // 'utf8' if encoding is null).
  22525. fromPathSync: function fromPathSync(path, encoding) {
  22526. var data = fs.readFileSync(path, encoding);
  22527. return new InputStream(data, true);
  22528. }
  22529. };
  22530. exports.CharStreams = CharStreams;
  22531. /***/ }),
  22532. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  22533. /*!***************************************************!*\
  22534. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  22535. \***************************************************/
  22536. /*! no static exports found */
  22537. /***/ (function(module, exports, __webpack_require__) {
  22538. "use strict";
  22539. //
  22540. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22541. * Use of this file is governed by the BSD 3-clause license that
  22542. * can be found in the LICENSE.txt file in the project root.
  22543. */
  22544. //
  22545. //
  22546. // This default implementation of {@link TokenFactory} creates
  22547. // {@link CommonToken} objects.
  22548. //
  22549. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  22550. function TokenFactory() {
  22551. return this;
  22552. }
  22553. function CommonTokenFactory(copyText) {
  22554. TokenFactory.call(this);
  22555. // Indicates whether {@link CommonToken//setText} should be called after
  22556. // constructing tokens to explicitly set the text. This is useful for cases
  22557. // where the input stream might not be able to provide arbitrary substrings
  22558. // of text from the input after the lexer creates a token (e.g. the
  22559. // implementation of {@link CharStream//getText} in
  22560. // {@link UnbufferedCharStream} throws an
  22561. // {@link UnsupportedOperationException}). Explicitly setting the token text
  22562. // allows {@link Token//getText} to be called at any time regardless of the
  22563. // input stream implementation.
  22564. //
  22565. // <p>
  22566. // The default value is {@code false} to avoid the performance and memory
  22567. // overhead of copying text for every token unless explicitly requested.</p>
  22568. //
  22569. this.copyText = copyText === undefined ? false : copyText;
  22570. return this;
  22571. }
  22572. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  22573. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  22574. //
  22575. // The default {@link CommonTokenFactory} instance.
  22576. //
  22577. // <p>
  22578. // This token factory does not explicitly copy token text when constructing
  22579. // tokens.</p>
  22580. //
  22581. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  22582. CommonTokenFactory.prototype.create = function (source, type, text, channel, start, stop, line, column) {
  22583. var t = new CommonToken(source, type, channel, start, stop);
  22584. t.line = line;
  22585. t.column = column;
  22586. if (text !== null) {
  22587. t.text = text;
  22588. } else if (this.copyText && source[1] !== null) {
  22589. t.text = source[1].getText(start, stop);
  22590. }
  22591. return t;
  22592. };
  22593. CommonTokenFactory.prototype.createThin = function (type, text) {
  22594. var t = new CommonToken(null, type);
  22595. t.text = text;
  22596. return t;
  22597. };
  22598. exports.CommonTokenFactory = CommonTokenFactory;
  22599. /***/ }),
  22600. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  22601. /*!**************************************************!*\
  22602. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  22603. \**************************************************/
  22604. /*! no static exports found */
  22605. /***/ (function(module, exports, __webpack_require__) {
  22606. "use strict";
  22607. //
  22608. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22609. * Use of this file is governed by the BSD 3-clause license that
  22610. * can be found in the LICENSE.txt file in the project root.
  22611. */
  22612. ///
  22613. //
  22614. // This class extends {@link BufferedTokenStream} with functionality to filter
  22615. // token streams to tokens on a particular channel (tokens where
  22616. // {@link Token//getChannel} returns a particular value).
  22617. //
  22618. // <p>
  22619. // This token stream provides access to all tokens by index or when calling
  22620. // methods like {@link //getText}. The channel filtering is only used for code
  22621. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  22622. // {@link //LB}.</p>
  22623. //
  22624. // <p>
  22625. // By default, tokens are placed on the default channel
  22626. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  22627. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  22628. // call {@link Lexer//setChannel}.
  22629. // </p>
  22630. //
  22631. // <p>
  22632. // Note: lexer rules which use the {@code ->skip} lexer command or call
  22633. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  22634. // such a rule will not be available as part of the token stream, regardless of
  22635. // channel.</p>
  22636. ///
  22637. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22638. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  22639. function CommonTokenStream(lexer, channel) {
  22640. BufferedTokenStream.call(this, lexer);
  22641. this.channel = channel === undefined ? Token.DEFAULT_CHANNEL : channel;
  22642. return this;
  22643. }
  22644. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  22645. CommonTokenStream.prototype.constructor = CommonTokenStream;
  22646. CommonTokenStream.prototype.adjustSeekIndex = function (i) {
  22647. return this.nextTokenOnChannel(i, this.channel);
  22648. };
  22649. CommonTokenStream.prototype.LB = function (k) {
  22650. if (k === 0 || this.index - k < 0) {
  22651. return null;
  22652. }
  22653. var i = this.index;
  22654. var n = 1;
  22655. // find k good tokens looking backwards
  22656. while (n <= k) {
  22657. // skip off-channel tokens
  22658. i = this.previousTokenOnChannel(i - 1, this.channel);
  22659. n += 1;
  22660. }
  22661. if (i < 0) {
  22662. return null;
  22663. }
  22664. return this.tokens[i];
  22665. };
  22666. CommonTokenStream.prototype.LT = function (k) {
  22667. this.lazyInit();
  22668. if (k === 0) {
  22669. return null;
  22670. }
  22671. if (k < 0) {
  22672. return this.LB(-k);
  22673. }
  22674. var i = this.index;
  22675. var n = 1; // we know tokens[pos] is a good one
  22676. // find k good tokens
  22677. while (n < k) {
  22678. // skip off-channel tokens, but make sure to not look past EOF
  22679. if (this.sync(i + 1)) {
  22680. i = this.nextTokenOnChannel(i + 1, this.channel);
  22681. }
  22682. n += 1;
  22683. }
  22684. return this.tokens[i];
  22685. };
  22686. // Count EOF just once.///
  22687. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function () {
  22688. var n = 0;
  22689. this.fill();
  22690. for (var i = 0; i < this.tokens.length; i++) {
  22691. var t = this.tokens[i];
  22692. if (t.channel === this.channel) {
  22693. n += 1;
  22694. }
  22695. if (t.type === Token.EOF) {
  22696. break;
  22697. }
  22698. }
  22699. return n;
  22700. };
  22701. exports.CommonTokenStream = CommonTokenStream;
  22702. /***/ }),
  22703. /***/ "./node_modules/antlr4/FileStream.js":
  22704. /*!*******************************************!*\
  22705. !*** ./node_modules/antlr4/FileStream.js ***!
  22706. \*******************************************/
  22707. /*! no static exports found */
  22708. /***/ (function(module, exports, __webpack_require__) {
  22709. "use strict";
  22710. //
  22711. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22712. * Use of this file is governed by the BSD 3-clause license that
  22713. * can be found in the LICENSE.txt file in the project root.
  22714. */
  22715. //
  22716. //
  22717. // This is an InputStream that is loaded from a file all at once
  22718. // when you construct the object.
  22719. //
  22720. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  22721. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  22722. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  22723. function FileStream(fileName, decodeToUnicodeCodePoints) {
  22724. var data = fs.readFileSync(fileName, "utf8");
  22725. InputStream.call(this, data, decodeToUnicodeCodePoints);
  22726. this.fileName = fileName;
  22727. return this;
  22728. }
  22729. FileStream.prototype = Object.create(InputStream.prototype);
  22730. FileStream.prototype.constructor = FileStream;
  22731. exports.FileStream = FileStream;
  22732. /***/ }),
  22733. /***/ "./node_modules/antlr4/InputStream.js":
  22734. /*!********************************************!*\
  22735. !*** ./node_modules/antlr4/InputStream.js ***!
  22736. \********************************************/
  22737. /*! no static exports found */
  22738. /***/ (function(module, exports, __webpack_require__) {
  22739. "use strict";
  22740. //
  22741. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22742. * Use of this file is governed by the BSD 3-clause license that
  22743. * can be found in the LICENSE.txt file in the project root.
  22744. */
  22745. //
  22746. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22747. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  22748. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  22749. // Vacuum all input from a string and then treat it like a buffer.
  22750. function _loadString(stream, decodeToUnicodeCodePoints) {
  22751. stream._index = 0;
  22752. stream.data = [];
  22753. if (stream.decodeToUnicodeCodePoints) {
  22754. for (var i = 0; i < stream.strdata.length;) {
  22755. var codePoint = stream.strdata.codePointAt(i);
  22756. stream.data.push(codePoint);
  22757. i += codePoint <= 0xFFFF ? 1 : 2;
  22758. }
  22759. } else {
  22760. for (var i = 0; i < stream.strdata.length; i++) {
  22761. var codeUnit = stream.strdata.charCodeAt(i);
  22762. stream.data.push(codeUnit);
  22763. }
  22764. }
  22765. stream._size = stream.data.length;
  22766. }
  22767. // If decodeToUnicodeCodePoints is true, the input is treated
  22768. // as a series of Unicode code points.
  22769. //
  22770. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  22771. // units.
  22772. function InputStream(data, decodeToUnicodeCodePoints) {
  22773. this.name = "<empty>";
  22774. this.strdata = data;
  22775. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  22776. _loadString(this);
  22777. return this;
  22778. }
  22779. Object.defineProperty(InputStream.prototype, "index", {
  22780. get: function get() {
  22781. return this._index;
  22782. }
  22783. });
  22784. Object.defineProperty(InputStream.prototype, "size", {
  22785. get: function get() {
  22786. return this._size;
  22787. }
  22788. });
  22789. // Reset the stream so that it's in the same state it was
  22790. // when the object was created *except* the data array is not
  22791. // touched.
  22792. //
  22793. InputStream.prototype.reset = function () {
  22794. this._index = 0;
  22795. };
  22796. InputStream.prototype.consume = function () {
  22797. if (this._index >= this._size) {
  22798. // assert this.LA(1) == Token.EOF
  22799. throw "cannot consume EOF";
  22800. }
  22801. this._index += 1;
  22802. };
  22803. InputStream.prototype.LA = function (offset) {
  22804. if (offset === 0) {
  22805. return 0; // undefined
  22806. }
  22807. if (offset < 0) {
  22808. offset += 1; // e.g., translate LA(-1) to use offset=0
  22809. }
  22810. var pos = this._index + offset - 1;
  22811. if (pos < 0 || pos >= this._size) {
  22812. // invalid
  22813. return Token.EOF;
  22814. }
  22815. return this.data[pos];
  22816. };
  22817. InputStream.prototype.LT = function (offset) {
  22818. return this.LA(offset);
  22819. };
  22820. // mark/release do nothing; we have entire buffer
  22821. InputStream.prototype.mark = function () {
  22822. return -1;
  22823. };
  22824. InputStream.prototype.release = function (marker) {};
  22825. // consume() ahead until p==_index; can't just set p=_index as we must
  22826. // update line and column. If we seek backwards, just set p
  22827. //
  22828. InputStream.prototype.seek = function (_index) {
  22829. if (_index <= this._index) {
  22830. this._index = _index; // just jump; don't update stream state (line,
  22831. // ...)
  22832. return;
  22833. }
  22834. // seek forward
  22835. this._index = Math.min(_index, this._size);
  22836. };
  22837. InputStream.prototype.getText = function (start, stop) {
  22838. if (stop >= this._size) {
  22839. stop = this._size - 1;
  22840. }
  22841. if (start >= this._size) {
  22842. return "";
  22843. } else {
  22844. if (this.decodeToUnicodeCodePoints) {
  22845. var result = "";
  22846. for (var i = start; i <= stop; i++) {
  22847. result += String.fromCodePoint(this.data[i]);
  22848. }
  22849. return result;
  22850. } else {
  22851. return this.strdata.slice(start, stop + 1);
  22852. }
  22853. }
  22854. };
  22855. InputStream.prototype.toString = function () {
  22856. return this.strdata;
  22857. };
  22858. exports.InputStream = InputStream;
  22859. /***/ }),
  22860. /***/ "./node_modules/antlr4/IntervalSet.js":
  22861. /*!********************************************!*\
  22862. !*** ./node_modules/antlr4/IntervalSet.js ***!
  22863. \********************************************/
  22864. /*! no static exports found */
  22865. /***/ (function(module, exports, __webpack_require__) {
  22866. "use strict";
  22867. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22868. * Use of this file is governed by the BSD 3-clause license that
  22869. * can be found in the LICENSE.txt file in the project root.
  22870. */
  22871. /*jslint smarttabs:true */
  22872. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22873. /* stop is not included! */
  22874. function Interval(start, stop) {
  22875. this.start = start;
  22876. this.stop = stop;
  22877. return this;
  22878. }
  22879. Interval.prototype.contains = function (item) {
  22880. return item >= this.start && item < this.stop;
  22881. };
  22882. Interval.prototype.toString = function () {
  22883. if (this.start === this.stop - 1) {
  22884. return this.start.toString();
  22885. } else {
  22886. return this.start.toString() + ".." + (this.stop - 1).toString();
  22887. }
  22888. };
  22889. Object.defineProperty(Interval.prototype, "length", {
  22890. get: function get() {
  22891. return this.stop - this.start;
  22892. }
  22893. });
  22894. function IntervalSet() {
  22895. this.intervals = null;
  22896. this.readOnly = false;
  22897. }
  22898. IntervalSet.prototype.first = function (v) {
  22899. if (this.intervals === null || this.intervals.length === 0) {
  22900. return Token.INVALID_TYPE;
  22901. } else {
  22902. return this.intervals[0].start;
  22903. }
  22904. };
  22905. IntervalSet.prototype.addOne = function (v) {
  22906. this.addInterval(new Interval(v, v + 1));
  22907. };
  22908. IntervalSet.prototype.addRange = function (l, h) {
  22909. this.addInterval(new Interval(l, h + 1));
  22910. };
  22911. IntervalSet.prototype.addInterval = function (v) {
  22912. if (this.intervals === null) {
  22913. this.intervals = [];
  22914. this.intervals.push(v);
  22915. } else {
  22916. // find insert pos
  22917. for (var k = 0; k < this.intervals.length; k++) {
  22918. var i = this.intervals[k];
  22919. // distinct range -> insert
  22920. if (v.stop < i.start) {
  22921. this.intervals.splice(k, 0, v);
  22922. return;
  22923. }
  22924. // contiguous range -> adjust
  22925. else if (v.stop === i.start) {
  22926. this.intervals[k].start = v.start;
  22927. return;
  22928. }
  22929. // overlapping range -> adjust and reduce
  22930. else if (v.start <= i.stop) {
  22931. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  22932. this.reduce(k);
  22933. return;
  22934. }
  22935. }
  22936. // greater than any existing
  22937. this.intervals.push(v);
  22938. }
  22939. };
  22940. IntervalSet.prototype.addSet = function (other) {
  22941. if (other.intervals !== null) {
  22942. for (var k = 0; k < other.intervals.length; k++) {
  22943. var i = other.intervals[k];
  22944. this.addInterval(new Interval(i.start, i.stop));
  22945. }
  22946. }
  22947. return this;
  22948. };
  22949. IntervalSet.prototype.reduce = function (k) {
  22950. // only need to reduce if k is not the last
  22951. if (k < this.intervalslength - 1) {
  22952. var l = this.intervals[k];
  22953. var r = this.intervals[k + 1];
  22954. // if r contained in l
  22955. if (l.stop >= r.stop) {
  22956. this.intervals.pop(k + 1);
  22957. this.reduce(k);
  22958. } else if (l.stop >= r.start) {
  22959. this.intervals[k] = new Interval(l.start, r.stop);
  22960. this.intervals.pop(k + 1);
  22961. }
  22962. }
  22963. };
  22964. IntervalSet.prototype.complement = function (start, stop) {
  22965. var result = new IntervalSet();
  22966. result.addInterval(new Interval(start, stop + 1));
  22967. for (var i = 0; i < this.intervals.length; i++) {
  22968. result.removeRange(this.intervals[i]);
  22969. }
  22970. return result;
  22971. };
  22972. IntervalSet.prototype.contains = function (item) {
  22973. if (this.intervals === null) {
  22974. return false;
  22975. } else {
  22976. for (var k = 0; k < this.intervals.length; k++) {
  22977. if (this.intervals[k].contains(item)) {
  22978. return true;
  22979. }
  22980. }
  22981. return false;
  22982. }
  22983. };
  22984. Object.defineProperty(IntervalSet.prototype, "length", {
  22985. get: function get() {
  22986. var len = 0;
  22987. this.intervals.map(function (i) {
  22988. len += i.length;
  22989. });
  22990. return len;
  22991. }
  22992. });
  22993. IntervalSet.prototype.removeRange = function (v) {
  22994. if (v.start === v.stop - 1) {
  22995. this.removeOne(v.start);
  22996. } else if (this.intervals !== null) {
  22997. var k = 0;
  22998. for (var n = 0; n < this.intervals.length; n++) {
  22999. var i = this.intervals[k];
  23000. // intervals are ordered
  23001. if (v.stop <= i.start) {
  23002. return;
  23003. }
  23004. // check for including range, split it
  23005. else if (v.start > i.start && v.stop < i.stop) {
  23006. this.intervals[k] = new Interval(i.start, v.start);
  23007. var x = new Interval(v.stop, i.stop);
  23008. this.intervals.splice(k, 0, x);
  23009. return;
  23010. }
  23011. // check for included range, remove it
  23012. else if (v.start <= i.start && v.stop >= i.stop) {
  23013. this.intervals.splice(k, 1);
  23014. k = k - 1; // need another pass
  23015. }
  23016. // check for lower boundary
  23017. else if (v.start < i.stop) {
  23018. this.intervals[k] = new Interval(i.start, v.start);
  23019. }
  23020. // check for upper boundary
  23021. else if (v.stop < i.stop) {
  23022. this.intervals[k] = new Interval(v.stop, i.stop);
  23023. }
  23024. k += 1;
  23025. }
  23026. }
  23027. };
  23028. IntervalSet.prototype.removeOne = function (v) {
  23029. if (this.intervals !== null) {
  23030. for (var k = 0; k < this.intervals.length; k++) {
  23031. var i = this.intervals[k];
  23032. // intervals is ordered
  23033. if (v < i.start) {
  23034. return;
  23035. }
  23036. // check for single value range
  23037. else if (v === i.start && v === i.stop - 1) {
  23038. this.intervals.splice(k, 1);
  23039. return;
  23040. }
  23041. // check for lower boundary
  23042. else if (v === i.start) {
  23043. this.intervals[k] = new Interval(i.start + 1, i.stop);
  23044. return;
  23045. }
  23046. // check for upper boundary
  23047. else if (v === i.stop - 1) {
  23048. this.intervals[k] = new Interval(i.start, i.stop - 1);
  23049. return;
  23050. }
  23051. // split existing range
  23052. else if (v < i.stop - 1) {
  23053. var x = new Interval(i.start, v);
  23054. i.start = v + 1;
  23055. this.intervals.splice(k, 0, x);
  23056. return;
  23057. }
  23058. }
  23059. }
  23060. };
  23061. IntervalSet.prototype.toString = function (literalNames, symbolicNames, elemsAreChar) {
  23062. literalNames = literalNames || null;
  23063. symbolicNames = symbolicNames || null;
  23064. elemsAreChar = elemsAreChar || false;
  23065. if (this.intervals === null) {
  23066. return "{}";
  23067. } else if (literalNames !== null || symbolicNames !== null) {
  23068. return this.toTokenString(literalNames, symbolicNames);
  23069. } else if (elemsAreChar) {
  23070. return this.toCharString();
  23071. } else {
  23072. return this.toIndexString();
  23073. }
  23074. };
  23075. IntervalSet.prototype.toCharString = function () {
  23076. var names = [];
  23077. for (var i = 0; i < this.intervals.length; i++) {
  23078. var v = this.intervals[i];
  23079. if (v.stop === v.start + 1) {
  23080. if (v.start === Token.EOF) {
  23081. names.push("<EOF>");
  23082. } else {
  23083. names.push("'" + String.fromCharCode(v.start) + "'");
  23084. }
  23085. } else {
  23086. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop - 1) + "'");
  23087. }
  23088. }
  23089. if (names.length > 1) {
  23090. return "{" + names.join(", ") + "}";
  23091. } else {
  23092. return names[0];
  23093. }
  23094. };
  23095. IntervalSet.prototype.toIndexString = function () {
  23096. var names = [];
  23097. for (var i = 0; i < this.intervals.length; i++) {
  23098. var v = this.intervals[i];
  23099. if (v.stop === v.start + 1) {
  23100. if (v.start === Token.EOF) {
  23101. names.push("<EOF>");
  23102. } else {
  23103. names.push(v.start.toString());
  23104. }
  23105. } else {
  23106. names.push(v.start.toString() + ".." + (v.stop - 1).toString());
  23107. }
  23108. }
  23109. if (names.length > 1) {
  23110. return "{" + names.join(", ") + "}";
  23111. } else {
  23112. return names[0];
  23113. }
  23114. };
  23115. IntervalSet.prototype.toTokenString = function (literalNames, symbolicNames) {
  23116. var names = [];
  23117. for (var i = 0; i < this.intervals.length; i++) {
  23118. var v = this.intervals[i];
  23119. for (var j = v.start; j < v.stop; j++) {
  23120. names.push(this.elementName(literalNames, symbolicNames, j));
  23121. }
  23122. }
  23123. if (names.length > 1) {
  23124. return "{" + names.join(", ") + "}";
  23125. } else {
  23126. return names[0];
  23127. }
  23128. };
  23129. IntervalSet.prototype.elementName = function (literalNames, symbolicNames, a) {
  23130. if (a === Token.EOF) {
  23131. return "<EOF>";
  23132. } else if (a === Token.EPSILON) {
  23133. return "<EPSILON>";
  23134. } else {
  23135. return literalNames[a] || symbolicNames[a];
  23136. }
  23137. };
  23138. exports.Interval = Interval;
  23139. exports.IntervalSet = IntervalSet;
  23140. /***/ }),
  23141. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  23142. /*!********************************************!*\
  23143. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  23144. \********************************************/
  23145. /*! no static exports found */
  23146. /***/ (function(module, exports, __webpack_require__) {
  23147. "use strict";
  23148. //
  23149. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23150. * Use of this file is governed by the BSD 3-clause license that
  23151. * can be found in the LICENSE.txt file in the project root.
  23152. */
  23153. ///
  23154. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  23155. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  23156. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  23157. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  23158. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  23159. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  23160. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  23161. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  23162. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  23163. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  23164. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  23165. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  23166. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  23167. var PredictionContext = pc.PredictionContext;
  23168. var SingletonPredictionContext = pc.SingletonPredictionContext;
  23169. function LL1Analyzer(atn) {
  23170. this.atn = atn;
  23171. }
  23172. //* Special value added to the lookahead sets to indicate that we hit
  23173. // a predicate during analysis if {@code seeThruPreds==false}.
  23174. ///
  23175. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  23176. //*
  23177. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  23178. // of an {@link ATNState}. The returned array has one element for each
  23179. // outgoing transition in {@code s}. If the closure from transition
  23180. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  23181. // element at index <em>i</em> of the result will be {@code null}.
  23182. //
  23183. // @param s the ATN state
  23184. // @return the expected symbols for each outgoing transition of {@code s}.
  23185. ///
  23186. LL1Analyzer.prototype.getDecisionLookahead = function (s) {
  23187. if (s === null) {
  23188. return null;
  23189. }
  23190. var count = s.transitions.length;
  23191. var look = [];
  23192. for (var alt = 0; alt < count; alt++) {
  23193. look[alt] = new IntervalSet();
  23194. var lookBusy = new Set();
  23195. var seeThruPreds = false; // fail to get lookahead upon pred
  23196. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY, look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  23197. // Wipe out lookahead for this alternative if we found nothing
  23198. // or we had a predicate when we !seeThruPreds
  23199. if (look[alt].length === 0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  23200. look[alt] = null;
  23201. }
  23202. }
  23203. return look;
  23204. };
  23205. //*
  23206. // Compute set of tokens that can follow {@code s} in the ATN in the
  23207. // specified {@code ctx}.
  23208. //
  23209. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  23210. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  23211. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  23212. // reached, {@link Token//EOF} is added to the result set.</p>
  23213. //
  23214. // @param s the ATN state
  23215. // @param stopState the ATN state to stop at. This can be a
  23216. // {@link BlockEndState} to detect epsilon paths through a closure.
  23217. // @param ctx the complete parser context, or {@code null} if the context
  23218. // should be ignored
  23219. //
  23220. // @return The set of tokens that can follow {@code s} in the ATN in the
  23221. // specified {@code ctx}.
  23222. ///
  23223. LL1Analyzer.prototype.LOOK = function (s, stopState, ctx) {
  23224. var r = new IntervalSet();
  23225. var seeThruPreds = true; // ignore preds; get all lookahead
  23226. ctx = ctx || null;
  23227. var lookContext = ctx !== null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  23228. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  23229. return r;
  23230. };
  23231. //*
  23232. // Compute set of tokens that can follow {@code s} in the ATN in the
  23233. // specified {@code ctx}.
  23234. //
  23235. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  23236. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  23237. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  23238. // {@code true} and {@code stopState} or the end of the outermost rule is
  23239. // reached, {@link Token//EOF} is added to the result set.</p>
  23240. //
  23241. // @param s the ATN state.
  23242. // @param stopState the ATN state to stop at. This can be a
  23243. // {@link BlockEndState} to detect epsilon paths through a closure.
  23244. // @param ctx The outer context, or {@code null} if the outer context should
  23245. // not be used.
  23246. // @param look The result lookahead set.
  23247. // @param lookBusy A set used for preventing epsilon closures in the ATN
  23248. // from causing a stack overflow. Outside code should pass
  23249. // {@code new Set<ATNConfig>} for this argument.
  23250. // @param calledRuleStack A set used for preventing left recursion in the
  23251. // ATN from causing a stack overflow. Outside code should pass
  23252. // {@code new BitSet()} for this argument.
  23253. // @param seeThruPreds {@code true} to true semantic predicates as
  23254. // implicitly {@code true} and "see through them", otherwise {@code false}
  23255. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  23256. // result if one is encountered.
  23257. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  23258. // outermost context is reached. This parameter has no effect if {@code ctx}
  23259. // is {@code null}.
  23260. ///
  23261. LL1Analyzer.prototype._LOOK = function (s, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  23262. var c = new ATNConfig({ state: s, alt: 0, context: ctx }, null);
  23263. if (lookBusy.contains(c)) {
  23264. return;
  23265. }
  23266. lookBusy.add(c);
  23267. if (s === stopState) {
  23268. if (ctx === null) {
  23269. look.addOne(Token.EPSILON);
  23270. return;
  23271. } else if (ctx.isEmpty() && addEOF) {
  23272. look.addOne(Token.EOF);
  23273. return;
  23274. }
  23275. }
  23276. if (s instanceof RuleStopState) {
  23277. if (ctx === null) {
  23278. look.addOne(Token.EPSILON);
  23279. return;
  23280. } else if (ctx.isEmpty() && addEOF) {
  23281. look.addOne(Token.EOF);
  23282. return;
  23283. }
  23284. if (ctx !== PredictionContext.EMPTY) {
  23285. // run thru all possible stack tops in ctx
  23286. for (var i = 0; i < ctx.length; i++) {
  23287. var returnState = this.atn.states[ctx.getReturnState(i)];
  23288. var removed = calledRuleStack.contains(returnState.ruleIndex);
  23289. try {
  23290. calledRuleStack.remove(returnState.ruleIndex);
  23291. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  23292. } finally {
  23293. if (removed) {
  23294. calledRuleStack.add(returnState.ruleIndex);
  23295. }
  23296. }
  23297. }
  23298. return;
  23299. }
  23300. }
  23301. for (var j = 0; j < s.transitions.length; j++) {
  23302. var t = s.transitions[j];
  23303. if (t.constructor === RuleTransition) {
  23304. if (calledRuleStack.contains(t.target.ruleIndex)) {
  23305. continue;
  23306. }
  23307. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  23308. try {
  23309. calledRuleStack.add(t.target.ruleIndex);
  23310. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  23311. } finally {
  23312. calledRuleStack.remove(t.target.ruleIndex);
  23313. }
  23314. } else if (t instanceof AbstractPredicateTransition) {
  23315. if (seeThruPreds) {
  23316. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  23317. } else {
  23318. look.addOne(LL1Analyzer.HIT_PRED);
  23319. }
  23320. } else if (t.isEpsilon) {
  23321. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  23322. } else if (t.constructor === WildcardTransition) {
  23323. look.addRange(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  23324. } else {
  23325. var set = t.label;
  23326. if (set !== null) {
  23327. if (t instanceof NotSetTransition) {
  23328. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  23329. }
  23330. look.addSet(set);
  23331. }
  23332. }
  23333. }
  23334. };
  23335. exports.LL1Analyzer = LL1Analyzer;
  23336. /***/ }),
  23337. /***/ "./node_modules/antlr4/Lexer.js":
  23338. /*!**************************************!*\
  23339. !*** ./node_modules/antlr4/Lexer.js ***!
  23340. \**************************************/
  23341. /*! no static exports found */
  23342. /***/ (function(module, exports, __webpack_require__) {
  23343. "use strict";
  23344. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23345. * Use of this file is governed by the BSD 3-clause license that
  23346. * can be found in the LICENSE.txt file in the project root.
  23347. */
  23348. ///
  23349. // A lexer is recognizer that draws input symbols from a character stream.
  23350. // lexer grammars result in a subclass of this object. A Lexer object
  23351. // uses simplified match() and error recovery mechanisms in the interest of speed.
  23352. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  23353. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  23354. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  23355. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  23356. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  23357. function TokenSource() {
  23358. return this;
  23359. }
  23360. function Lexer(input) {
  23361. Recognizer.call(this);
  23362. this._input = input;
  23363. this._factory = CommonTokenFactory.DEFAULT;
  23364. this._tokenFactorySourcePair = [this, input];
  23365. this._interp = null; // child classes must populate this
  23366. // The goal of all lexer rules/methods is to create a token object.
  23367. // this is an instance variable as multiple rules may collaborate to
  23368. // create a single token. nextToken will return this object after
  23369. // matching lexer rule(s). If you subclass to allow multiple token
  23370. // emissions, then set this to the last token to be matched or
  23371. // something nonnull so that the auto token emit mechanism will not
  23372. // emit another token.
  23373. this._token = null;
  23374. // What character index in the stream did the current token start at?
  23375. // Needed, for example, to get the text for current token. Set at
  23376. // the start of nextToken.
  23377. this._tokenStartCharIndex = -1;
  23378. // The line on which the first character of the token resides///
  23379. this._tokenStartLine = -1;
  23380. // The character position of first character within the line///
  23381. this._tokenStartColumn = -1;
  23382. // Once we see EOF on char stream, next token will be EOF.
  23383. // If you have DONE : EOF ; then you see DONE EOF.
  23384. this._hitEOF = false;
  23385. // The channel number for the current token///
  23386. this._channel = Token.DEFAULT_CHANNEL;
  23387. // The token type for the current token///
  23388. this._type = Token.INVALID_TYPE;
  23389. this._modeStack = [];
  23390. this._mode = Lexer.DEFAULT_MODE;
  23391. // You can set the text for the current token to override what is in
  23392. // the input char buffer. Use setText() or can set this instance var.
  23393. // /
  23394. this._text = null;
  23395. return this;
  23396. }
  23397. Lexer.prototype = Object.create(Recognizer.prototype);
  23398. Lexer.prototype.constructor = Lexer;
  23399. Lexer.DEFAULT_MODE = 0;
  23400. Lexer.MORE = -2;
  23401. Lexer.SKIP = -3;
  23402. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  23403. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  23404. Lexer.MIN_CHAR_VALUE = 0x0000;
  23405. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  23406. Lexer.prototype.reset = function () {
  23407. // wack Lexer state variables
  23408. if (this._input !== null) {
  23409. this._input.seek(0); // rewind the input
  23410. }
  23411. this._token = null;
  23412. this._type = Token.INVALID_TYPE;
  23413. this._channel = Token.DEFAULT_CHANNEL;
  23414. this._tokenStartCharIndex = -1;
  23415. this._tokenStartColumn = -1;
  23416. this._tokenStartLine = -1;
  23417. this._text = null;
  23418. this._hitEOF = false;
  23419. this._mode = Lexer.DEFAULT_MODE;
  23420. this._modeStack = [];
  23421. this._interp.reset();
  23422. };
  23423. // Return a token from this source; i.e., match a token on the char stream.
  23424. Lexer.prototype.nextToken = function () {
  23425. if (this._input === null) {
  23426. throw "nextToken requires a non-null input stream.";
  23427. }
  23428. // Mark start location in char stream so unbuffered streams are
  23429. // guaranteed at least have text of current token
  23430. var tokenStartMarker = this._input.mark();
  23431. try {
  23432. while (true) {
  23433. if (this._hitEOF) {
  23434. this.emitEOF();
  23435. return this._token;
  23436. }
  23437. this._token = null;
  23438. this._channel = Token.DEFAULT_CHANNEL;
  23439. this._tokenStartCharIndex = this._input.index;
  23440. this._tokenStartColumn = this._interp.column;
  23441. this._tokenStartLine = this._interp.line;
  23442. this._text = null;
  23443. var continueOuter = false;
  23444. while (true) {
  23445. this._type = Token.INVALID_TYPE;
  23446. var ttype = Lexer.SKIP;
  23447. try {
  23448. ttype = this._interp.match(this._input, this._mode);
  23449. } catch (e) {
  23450. if (e instanceof RecognitionException) {
  23451. this.notifyListeners(e); // report error
  23452. this.recover(e);
  23453. } else {
  23454. console.log(e.stack);
  23455. throw e;
  23456. }
  23457. }
  23458. if (this._input.LA(1) === Token.EOF) {
  23459. this._hitEOF = true;
  23460. }
  23461. if (this._type === Token.INVALID_TYPE) {
  23462. this._type = ttype;
  23463. }
  23464. if (this._type === Lexer.SKIP) {
  23465. continueOuter = true;
  23466. break;
  23467. }
  23468. if (this._type !== Lexer.MORE) {
  23469. break;
  23470. }
  23471. }
  23472. if (continueOuter) {
  23473. continue;
  23474. }
  23475. if (this._token === null) {
  23476. this.emit();
  23477. }
  23478. return this._token;
  23479. }
  23480. } finally {
  23481. // make sure we release marker after match or
  23482. // unbuffered char stream will keep buffering
  23483. this._input.release(tokenStartMarker);
  23484. }
  23485. };
  23486. // Instruct the lexer to skip creating a token for current lexer rule
  23487. // and look for another token. nextToken() knows to keep looking when
  23488. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  23489. // if token==null at end of any token rule, it creates one for you
  23490. // and emits it.
  23491. // /
  23492. Lexer.prototype.skip = function () {
  23493. this._type = Lexer.SKIP;
  23494. };
  23495. Lexer.prototype.more = function () {
  23496. this._type = Lexer.MORE;
  23497. };
  23498. Lexer.prototype.mode = function (m) {
  23499. this._mode = m;
  23500. };
  23501. Lexer.prototype.pushMode = function (m) {
  23502. if (this._interp.debug) {
  23503. console.log("pushMode " + m);
  23504. }
  23505. this._modeStack.push(this._mode);
  23506. this.mode(m);
  23507. };
  23508. Lexer.prototype.popMode = function () {
  23509. if (this._modeStack.length === 0) {
  23510. throw "Empty Stack";
  23511. }
  23512. if (this._interp.debug) {
  23513. console.log("popMode back to " + this._modeStack.slice(0, -1));
  23514. }
  23515. this.mode(this._modeStack.pop());
  23516. return this._mode;
  23517. };
  23518. // Set the char stream and reset the lexer
  23519. Object.defineProperty(Lexer.prototype, "inputStream", {
  23520. get: function get() {
  23521. return this._input;
  23522. },
  23523. set: function set(input) {
  23524. this._input = null;
  23525. this._tokenFactorySourcePair = [this, this._input];
  23526. this.reset();
  23527. this._input = input;
  23528. this._tokenFactorySourcePair = [this, this._input];
  23529. }
  23530. });
  23531. Object.defineProperty(Lexer.prototype, "sourceName", {
  23532. get: function sourceName() {
  23533. return this._input.sourceName;
  23534. }
  23535. });
  23536. // By default does not support multiple emits per nextToken invocation
  23537. // for efficiency reasons. Subclass and override this method, nextToken,
  23538. // and getToken (to push tokens into a list and pull from that list
  23539. // rather than a single variable as this implementation does).
  23540. // /
  23541. Lexer.prototype.emitToken = function (token) {
  23542. this._token = token;
  23543. };
  23544. // The standard method called to automatically emit a token at the
  23545. // outermost lexical rule. The token object should point into the
  23546. // char buffer start..stop. If there is a text override in 'text',
  23547. // use that to set the token's text. Override this method to emit
  23548. // custom Token objects or provide a new factory.
  23549. // /
  23550. Lexer.prototype.emit = function () {
  23551. var t = this._factory.create(this._tokenFactorySourcePair, this._type, this._text, this._channel, this._tokenStartCharIndex, this.getCharIndex() - 1, this._tokenStartLine, this._tokenStartColumn);
  23552. this.emitToken(t);
  23553. return t;
  23554. };
  23555. Lexer.prototype.emitEOF = function () {
  23556. var cpos = this.column;
  23557. var lpos = this.line;
  23558. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, this._input.index, this._input.index - 1, lpos, cpos);
  23559. this.emitToken(eof);
  23560. return eof;
  23561. };
  23562. Object.defineProperty(Lexer.prototype, "type", {
  23563. get: function get() {
  23564. return this.type;
  23565. },
  23566. set: function set(type) {
  23567. this._type = type;
  23568. }
  23569. });
  23570. Object.defineProperty(Lexer.prototype, "line", {
  23571. get: function get() {
  23572. return this._interp.line;
  23573. },
  23574. set: function set(line) {
  23575. this._interp.line = line;
  23576. }
  23577. });
  23578. Object.defineProperty(Lexer.prototype, "column", {
  23579. get: function get() {
  23580. return this._interp.column;
  23581. },
  23582. set: function set(column) {
  23583. this._interp.column = column;
  23584. }
  23585. });
  23586. // What is the index of the current character of lookahead?///
  23587. Lexer.prototype.getCharIndex = function () {
  23588. return this._input.index;
  23589. };
  23590. // Return the text matched so far for the current token or any text override.
  23591. //Set the complete text of this token; it wipes any previous changes to the text.
  23592. Object.defineProperty(Lexer.prototype, "text", {
  23593. get: function get() {
  23594. if (this._text !== null) {
  23595. return this._text;
  23596. } else {
  23597. return this._interp.getText(this._input);
  23598. }
  23599. },
  23600. set: function set(text) {
  23601. this._text = text;
  23602. }
  23603. });
  23604. // Return a list of all Token objects in input char stream.
  23605. // Forces load of all tokens. Does not include EOF token.
  23606. // /
  23607. Lexer.prototype.getAllTokens = function () {
  23608. var tokens = [];
  23609. var t = this.nextToken();
  23610. while (t.type !== Token.EOF) {
  23611. tokens.push(t);
  23612. t = this.nextToken();
  23613. }
  23614. return tokens;
  23615. };
  23616. Lexer.prototype.notifyListeners = function (e) {
  23617. var start = this._tokenStartCharIndex;
  23618. var stop = this._input.index;
  23619. var text = this._input.getText(start, stop);
  23620. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  23621. var listener = this.getErrorListenerDispatch();
  23622. listener.syntaxError(this, null, this._tokenStartLine, this._tokenStartColumn, msg, e);
  23623. };
  23624. Lexer.prototype.getErrorDisplay = function (s) {
  23625. var d = [];
  23626. for (var i = 0; i < s.length; i++) {
  23627. d.push(s[i]);
  23628. }
  23629. return d.join('');
  23630. };
  23631. Lexer.prototype.getErrorDisplayForChar = function (c) {
  23632. if (c.charCodeAt(0) === Token.EOF) {
  23633. return "<EOF>";
  23634. } else if (c === '\n') {
  23635. return "\\n";
  23636. } else if (c === '\t') {
  23637. return "\\t";
  23638. } else if (c === '\r') {
  23639. return "\\r";
  23640. } else {
  23641. return c;
  23642. }
  23643. };
  23644. Lexer.prototype.getCharErrorDisplay = function (c) {
  23645. return "'" + this.getErrorDisplayForChar(c) + "'";
  23646. };
  23647. // Lexers can normally match any char in it's vocabulary after matching
  23648. // a token, so do the easy thing and just kill a character and hope
  23649. // it all works out. You can instead use the rule invocation stack
  23650. // to do sophisticated error recovery if you are in a fragment rule.
  23651. // /
  23652. Lexer.prototype.recover = function (re) {
  23653. if (this._input.LA(1) !== Token.EOF) {
  23654. if (re instanceof LexerNoViableAltException) {
  23655. // skip a char and try again
  23656. this._interp.consume(this._input);
  23657. } else {
  23658. // TODO: Do we lose character or line position information?
  23659. this._input.consume();
  23660. }
  23661. }
  23662. };
  23663. exports.Lexer = Lexer;
  23664. /***/ }),
  23665. /***/ "./node_modules/antlr4/Parser.js":
  23666. /*!***************************************!*\
  23667. !*** ./node_modules/antlr4/Parser.js ***!
  23668. \***************************************/
  23669. /*! no static exports found */
  23670. /***/ (function(module, exports, __webpack_require__) {
  23671. "use strict";
  23672. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23673. * Use of this file is governed by the BSD 3-clause license that
  23674. * can be found in the LICENSE.txt file in the project root.
  23675. */
  23676. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  23677. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  23678. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  23679. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  23680. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  23681. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  23682. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  23683. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  23684. function TraceListener(parser) {
  23685. ParseTreeListener.call(this);
  23686. this.parser = parser;
  23687. return this;
  23688. }
  23689. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  23690. TraceListener.prototype.constructor = TraceListener;
  23691. TraceListener.prototype.enterEveryRule = function (ctx) {
  23692. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  23693. };
  23694. TraceListener.prototype.visitTerminal = function (node) {
  23695. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  23696. };
  23697. TraceListener.prototype.exitEveryRule = function (ctx) {
  23698. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  23699. };
  23700. // this is all the parsing support code essentially; most of it is error
  23701. // recovery stuff.//
  23702. function Parser(input) {
  23703. Recognizer.call(this);
  23704. // The input stream.
  23705. this._input = null;
  23706. // The error handling strategy for the parser. The default value is a new
  23707. // instance of {@link DefaultErrorStrategy}.
  23708. this._errHandler = new DefaultErrorStrategy();
  23709. this._precedenceStack = [];
  23710. this._precedenceStack.push(0);
  23711. // The {@link ParserRuleContext} object for the currently executing rule.
  23712. // this is always non-null during the parsing process.
  23713. this._ctx = null;
  23714. // Specifies whether or not the parser should construct a parse tree during
  23715. // the parsing process. The default value is {@code true}.
  23716. this.buildParseTrees = true;
  23717. // When {@link //setTrace}{@code (true)} is called, a reference to the
  23718. // {@link TraceListener} is stored here so it can be easily removed in a
  23719. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  23720. // implemented as a parser listener so this field is not directly used by
  23721. // other parser methods.
  23722. this._tracer = null;
  23723. // The list of {@link ParseTreeListener} listeners registered to receive
  23724. // events during the parse.
  23725. this._parseListeners = null;
  23726. // The number of syntax errors reported during parsing. this value is
  23727. // incremented each time {@link //notifyErrorListeners} is called.
  23728. this._syntaxErrors = 0;
  23729. this.setInputStream(input);
  23730. return this;
  23731. }
  23732. Parser.prototype = Object.create(Recognizer.prototype);
  23733. Parser.prototype.contructor = Parser;
  23734. // this field maps from the serialized ATN string to the deserialized {@link
  23735. // ATN} with
  23736. // bypass alternatives.
  23737. //
  23738. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  23739. //
  23740. Parser.bypassAltsAtnCache = {};
  23741. // reset the parser's state//
  23742. Parser.prototype.reset = function () {
  23743. if (this._input !== null) {
  23744. this._input.seek(0);
  23745. }
  23746. this._errHandler.reset(this);
  23747. this._ctx = null;
  23748. this._syntaxErrors = 0;
  23749. this.setTrace(false);
  23750. this._precedenceStack = [];
  23751. this._precedenceStack.push(0);
  23752. if (this._interp !== null) {
  23753. this._interp.reset();
  23754. }
  23755. };
  23756. // Match current input symbol against {@code ttype}. If the symbol type
  23757. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  23758. // called to complete the match process.
  23759. //
  23760. // <p>If the symbol type does not match,
  23761. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  23762. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  23763. // {@code true} and the token index of the symbol returned by
  23764. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  23765. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  23766. //
  23767. // @param ttype the token type to match
  23768. // @return the matched symbol
  23769. // @throws RecognitionException if the current input symbol did not match
  23770. // {@code ttype} and the error strategy could not recover from the
  23771. // mismatched symbol
  23772. Parser.prototype.match = function (ttype) {
  23773. var t = this.getCurrentToken();
  23774. if (t.type === ttype) {
  23775. this._errHandler.reportMatch(this);
  23776. this.consume();
  23777. } else {
  23778. t = this._errHandler.recoverInline(this);
  23779. if (this.buildParseTrees && t.tokenIndex === -1) {
  23780. // we must have conjured up a new token during single token
  23781. // insertion
  23782. // if it's not the current symbol
  23783. this._ctx.addErrorNode(t);
  23784. }
  23785. }
  23786. return t;
  23787. };
  23788. // Match current input symbol as a wildcard. If the symbol type matches
  23789. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  23790. // and {@link //consume} are called to complete the match process.
  23791. //
  23792. // <p>If the symbol type does not match,
  23793. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  23794. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  23795. // {@code true} and the token index of the symbol returned by
  23796. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  23797. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  23798. //
  23799. // @return the matched symbol
  23800. // @throws RecognitionException if the current input symbol did not match
  23801. // a wildcard and the error strategy could not recover from the mismatched
  23802. // symbol
  23803. Parser.prototype.matchWildcard = function () {
  23804. var t = this.getCurrentToken();
  23805. if (t.type > 0) {
  23806. this._errHandler.reportMatch(this);
  23807. this.consume();
  23808. } else {
  23809. t = this._errHandler.recoverInline(this);
  23810. if (this._buildParseTrees && t.tokenIndex === -1) {
  23811. // we must have conjured up a new token during single token
  23812. // insertion
  23813. // if it's not the current symbol
  23814. this._ctx.addErrorNode(t);
  23815. }
  23816. }
  23817. return t;
  23818. };
  23819. Parser.prototype.getParseListeners = function () {
  23820. return this._parseListeners || [];
  23821. };
  23822. // Registers {@code listener} to receive events during the parsing process.
  23823. //
  23824. // <p>To support output-preserving grammar transformations (including but not
  23825. // limited to left-recursion removal, automated left-factoring, and
  23826. // optimized code generation), calls to listener methods during the parse
  23827. // may differ substantially from calls made by
  23828. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  23829. // particular, rule entry and exit events may occur in a different order
  23830. // during the parse than after the parser. In addition, calls to certain
  23831. // rule entry methods may be omitted.</p>
  23832. //
  23833. // <p>With the following specific exceptions, calls to listener events are
  23834. // <em>deterministic</em>, i.e. for identical input the calls to listener
  23835. // methods will be the same.</p>
  23836. //
  23837. // <ul>
  23838. // <li>Alterations to the grammar used to generate code may change the
  23839. // behavior of the listener calls.</li>
  23840. // <li>Alterations to the command line options passed to ANTLR 4 when
  23841. // generating the parser may change the behavior of the listener calls.</li>
  23842. // <li>Changing the version of the ANTLR Tool used to generate the parser
  23843. // may change the behavior of the listener calls.</li>
  23844. // </ul>
  23845. //
  23846. // @param listener the listener to add
  23847. //
  23848. // @throws NullPointerException if {@code} listener is {@code null}
  23849. //
  23850. Parser.prototype.addParseListener = function (listener) {
  23851. if (listener === null) {
  23852. throw "listener";
  23853. }
  23854. if (this._parseListeners === null) {
  23855. this._parseListeners = [];
  23856. }
  23857. this._parseListeners.push(listener);
  23858. };
  23859. //
  23860. // Remove {@code listener} from the list of parse listeners.
  23861. //
  23862. // <p>If {@code listener} is {@code null} or has not been added as a parse
  23863. // listener, this method does nothing.</p>
  23864. // @param listener the listener to remove
  23865. //
  23866. Parser.prototype.removeParseListener = function (listener) {
  23867. if (this._parseListeners !== null) {
  23868. var idx = this._parseListeners.indexOf(listener);
  23869. if (idx >= 0) {
  23870. this._parseListeners.splice(idx, 1);
  23871. }
  23872. if (this._parseListeners.length === 0) {
  23873. this._parseListeners = null;
  23874. }
  23875. }
  23876. };
  23877. // Remove all parse listeners.
  23878. Parser.prototype.removeParseListeners = function () {
  23879. this._parseListeners = null;
  23880. };
  23881. // Notify any parse listeners of an enter rule event.
  23882. Parser.prototype.triggerEnterRuleEvent = function () {
  23883. if (this._parseListeners !== null) {
  23884. var ctx = this._ctx;
  23885. this._parseListeners.map(function (listener) {
  23886. listener.enterEveryRule(ctx);
  23887. ctx.enterRule(listener);
  23888. });
  23889. }
  23890. };
  23891. //
  23892. // Notify any parse listeners of an exit rule event.
  23893. //
  23894. // @see //addParseListener
  23895. //
  23896. Parser.prototype.triggerExitRuleEvent = function () {
  23897. if (this._parseListeners !== null) {
  23898. // reverse order walk of listeners
  23899. var ctx = this._ctx;
  23900. this._parseListeners.slice(0).reverse().map(function (listener) {
  23901. ctx.exitRule(listener);
  23902. listener.exitEveryRule(ctx);
  23903. });
  23904. }
  23905. };
  23906. Parser.prototype.getTokenFactory = function () {
  23907. return this._input.tokenSource._factory;
  23908. };
  23909. // Tell our token source and error strategy about a new way to create tokens.//
  23910. Parser.prototype.setTokenFactory = function (factory) {
  23911. this._input.tokenSource._factory = factory;
  23912. };
  23913. // The ATN with bypass alternatives is expensive to create so we create it
  23914. // lazily.
  23915. //
  23916. // @throws UnsupportedOperationException if the current parser does not
  23917. // implement the {@link //getSerializedATN()} method.
  23918. //
  23919. Parser.prototype.getATNWithBypassAlts = function () {
  23920. var serializedAtn = this.getSerializedATN();
  23921. if (serializedAtn === null) {
  23922. throw "The current parser does not support an ATN with bypass alternatives.";
  23923. }
  23924. var result = this.bypassAltsAtnCache[serializedAtn];
  23925. if (result === null) {
  23926. var deserializationOptions = new ATNDeserializationOptions();
  23927. deserializationOptions.generateRuleBypassTransitions = true;
  23928. result = new ATNDeserializer(deserializationOptions).deserialize(serializedAtn);
  23929. this.bypassAltsAtnCache[serializedAtn] = result;
  23930. }
  23931. return result;
  23932. };
  23933. // The preferred method of getting a tree pattern. For example, here's a
  23934. // sample use:
  23935. //
  23936. // <pre>
  23937. // ParseTree t = parser.expr();
  23938. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  23939. // MyParser.RULE_expr);
  23940. // ParseTreeMatch m = p.match(t);
  23941. // String id = m.get("ID");
  23942. // </pre>
  23943. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  23944. Parser.prototype.compileParseTreePattern = function (pattern, patternRuleIndex, lexer) {
  23945. lexer = lexer || null;
  23946. if (lexer === null) {
  23947. if (this.getTokenStream() !== null) {
  23948. var tokenSource = this.getTokenStream().tokenSource;
  23949. if (tokenSource instanceof Lexer) {
  23950. lexer = tokenSource;
  23951. }
  23952. }
  23953. }
  23954. if (lexer === null) {
  23955. throw "Parser can't discover a lexer to use";
  23956. }
  23957. var m = new ParseTreePatternMatcher(lexer, this);
  23958. return m.compile(pattern, patternRuleIndex);
  23959. };
  23960. Parser.prototype.getInputStream = function () {
  23961. return this.getTokenStream();
  23962. };
  23963. Parser.prototype.setInputStream = function (input) {
  23964. this.setTokenStream(input);
  23965. };
  23966. Parser.prototype.getTokenStream = function () {
  23967. return this._input;
  23968. };
  23969. // Set the token stream and reset the parser.//
  23970. Parser.prototype.setTokenStream = function (input) {
  23971. this._input = null;
  23972. this.reset();
  23973. this._input = input;
  23974. };
  23975. // Match needs to return the current input symbol, which gets put
  23976. // into the label for the associated token ref; e.g., x=ID.
  23977. //
  23978. Parser.prototype.getCurrentToken = function () {
  23979. return this._input.LT(1);
  23980. };
  23981. Parser.prototype.notifyErrorListeners = function (msg, offendingToken, err) {
  23982. offendingToken = offendingToken || null;
  23983. err = err || null;
  23984. if (offendingToken === null) {
  23985. offendingToken = this.getCurrentToken();
  23986. }
  23987. this._syntaxErrors += 1;
  23988. var line = offendingToken.line;
  23989. var column = offendingToken.column;
  23990. var listener = this.getErrorListenerDispatch();
  23991. listener.syntaxError(this, offendingToken, line, column, msg, err);
  23992. };
  23993. //
  23994. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  23995. //
  23996. // <p>E.g., given the following input with {@code A} being the current
  23997. // lookahead symbol, this function moves the cursor to {@code B} and returns
  23998. // {@code A}.</p>
  23999. //
  24000. // <pre>
  24001. // A B
  24002. // ^
  24003. // </pre>
  24004. //
  24005. // If the parser is not in error recovery mode, the consumed symbol is added
  24006. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  24007. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  24008. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  24009. // added to the parse tree using
  24010. // {@link ParserRuleContext//addErrorNode(Token)}, and
  24011. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  24012. // listeners.
  24013. //
  24014. Parser.prototype.consume = function () {
  24015. var o = this.getCurrentToken();
  24016. if (o.type !== Token.EOF) {
  24017. this.getInputStream().consume();
  24018. }
  24019. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  24020. if (this.buildParseTrees || hasListener) {
  24021. var node;
  24022. if (this._errHandler.inErrorRecoveryMode(this)) {
  24023. node = this._ctx.addErrorNode(o);
  24024. } else {
  24025. node = this._ctx.addTokenNode(o);
  24026. }
  24027. node.invokingState = this.state;
  24028. if (hasListener) {
  24029. this._parseListeners.map(function (listener) {
  24030. if (node instanceof ErrorNode || node.isErrorNode !== undefined && node.isErrorNode()) {
  24031. listener.visitErrorNode(node);
  24032. } else if (node instanceof TerminalNode) {
  24033. listener.visitTerminal(node);
  24034. }
  24035. });
  24036. }
  24037. }
  24038. return o;
  24039. };
  24040. Parser.prototype.addContextToParseTree = function () {
  24041. // add current context to parent if we have a parent
  24042. if (this._ctx.parentCtx !== null) {
  24043. this._ctx.parentCtx.addChild(this._ctx);
  24044. }
  24045. };
  24046. // Always called by generated parsers upon entry to a rule. Access field
  24047. // {@link //_ctx} get the current context.
  24048. Parser.prototype.enterRule = function (localctx, state, ruleIndex) {
  24049. this.state = state;
  24050. this._ctx = localctx;
  24051. this._ctx.start = this._input.LT(1);
  24052. if (this.buildParseTrees) {
  24053. this.addContextToParseTree();
  24054. }
  24055. if (this._parseListeners !== null) {
  24056. this.triggerEnterRuleEvent();
  24057. }
  24058. };
  24059. Parser.prototype.exitRule = function () {
  24060. this._ctx.stop = this._input.LT(-1);
  24061. // trigger event on _ctx, before it reverts to parent
  24062. if (this._parseListeners !== null) {
  24063. this.triggerExitRuleEvent();
  24064. }
  24065. this.state = this._ctx.invokingState;
  24066. this._ctx = this._ctx.parentCtx;
  24067. };
  24068. Parser.prototype.enterOuterAlt = function (localctx, altNum) {
  24069. localctx.setAltNumber(altNum);
  24070. // if we have new localctx, make sure we replace existing ctx
  24071. // that is previous child of parse tree
  24072. if (this.buildParseTrees && this._ctx !== localctx) {
  24073. if (this._ctx.parentCtx !== null) {
  24074. this._ctx.parentCtx.removeLastChild();
  24075. this._ctx.parentCtx.addChild(localctx);
  24076. }
  24077. }
  24078. this._ctx = localctx;
  24079. };
  24080. // Get the precedence level for the top-most precedence rule.
  24081. //
  24082. // @return The precedence level for the top-most precedence rule, or -1 if
  24083. // the parser context is not nested within a precedence rule.
  24084. Parser.prototype.getPrecedence = function () {
  24085. if (this._precedenceStack.length === 0) {
  24086. return -1;
  24087. } else {
  24088. return this._precedenceStack[this._precedenceStack.length - 1];
  24089. }
  24090. };
  24091. Parser.prototype.enterRecursionRule = function (localctx, state, ruleIndex, precedence) {
  24092. this.state = state;
  24093. this._precedenceStack.push(precedence);
  24094. this._ctx = localctx;
  24095. this._ctx.start = this._input.LT(1);
  24096. if (this._parseListeners !== null) {
  24097. this.triggerEnterRuleEvent(); // simulates rule entry for
  24098. // left-recursive rules
  24099. }
  24100. };
  24101. //
  24102. // Like {@link //enterRule} but for recursive rules.
  24103. Parser.prototype.pushNewRecursionContext = function (localctx, state, ruleIndex) {
  24104. var previous = this._ctx;
  24105. previous.parentCtx = localctx;
  24106. previous.invokingState = state;
  24107. previous.stop = this._input.LT(-1);
  24108. this._ctx = localctx;
  24109. this._ctx.start = previous.start;
  24110. if (this.buildParseTrees) {
  24111. this._ctx.addChild(previous);
  24112. }
  24113. if (this._parseListeners !== null) {
  24114. this.triggerEnterRuleEvent(); // simulates rule entry for
  24115. // left-recursive rules
  24116. }
  24117. };
  24118. Parser.prototype.unrollRecursionContexts = function (parentCtx) {
  24119. this._precedenceStack.pop();
  24120. this._ctx.stop = this._input.LT(-1);
  24121. var retCtx = this._ctx; // save current ctx (return value)
  24122. // unroll so _ctx is as it was before call to recursive method
  24123. if (this._parseListeners !== null) {
  24124. while (this._ctx !== parentCtx) {
  24125. this.triggerExitRuleEvent();
  24126. this._ctx = this._ctx.parentCtx;
  24127. }
  24128. } else {
  24129. this._ctx = parentCtx;
  24130. }
  24131. // hook into tree
  24132. retCtx.parentCtx = parentCtx;
  24133. if (this.buildParseTrees && parentCtx !== null) {
  24134. // add return ctx into invoking rule's tree
  24135. parentCtx.addChild(retCtx);
  24136. }
  24137. };
  24138. Parser.prototype.getInvokingContext = function (ruleIndex) {
  24139. var ctx = this._ctx;
  24140. while (ctx !== null) {
  24141. if (ctx.ruleIndex === ruleIndex) {
  24142. return ctx;
  24143. }
  24144. ctx = ctx.parentCtx;
  24145. }
  24146. return null;
  24147. };
  24148. Parser.prototype.precpred = function (localctx, precedence) {
  24149. return precedence >= this._precedenceStack[this._precedenceStack.length - 1];
  24150. };
  24151. Parser.prototype.inContext = function (context) {
  24152. // TODO: useful in parser?
  24153. return false;
  24154. };
  24155. //
  24156. // Checks whether or not {@code symbol} can follow the current state in the
  24157. // ATN. The behavior of this method is equivalent to the following, but is
  24158. // implemented such that the complete context-sensitive follow set does not
  24159. // need to be explicitly constructed.
  24160. //
  24161. // <pre>
  24162. // return getExpectedTokens().contains(symbol);
  24163. // </pre>
  24164. //
  24165. // @param symbol the symbol type to check
  24166. // @return {@code true} if {@code symbol} can follow the current state in
  24167. // the ATN, otherwise {@code false}.
  24168. Parser.prototype.isExpectedToken = function (symbol) {
  24169. var atn = this._interp.atn;
  24170. var ctx = this._ctx;
  24171. var s = atn.states[this.state];
  24172. var following = atn.nextTokens(s);
  24173. if (following.contains(symbol)) {
  24174. return true;
  24175. }
  24176. if (!following.contains(Token.EPSILON)) {
  24177. return false;
  24178. }
  24179. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  24180. var invokingState = atn.states[ctx.invokingState];
  24181. var rt = invokingState.transitions[0];
  24182. following = atn.nextTokens(rt.followState);
  24183. if (following.contains(symbol)) {
  24184. return true;
  24185. }
  24186. ctx = ctx.parentCtx;
  24187. }
  24188. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  24189. return true;
  24190. } else {
  24191. return false;
  24192. }
  24193. };
  24194. // Computes the set of input symbols which could follow the current parser
  24195. // state and context, as given by {@link //getState} and {@link //getContext},
  24196. // respectively.
  24197. //
  24198. // @see ATN//getExpectedTokens(int, RuleContext)
  24199. //
  24200. Parser.prototype.getExpectedTokens = function () {
  24201. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  24202. };
  24203. Parser.prototype.getExpectedTokensWithinCurrentRule = function () {
  24204. var atn = this._interp.atn;
  24205. var s = atn.states[this.state];
  24206. return atn.nextTokens(s);
  24207. };
  24208. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  24209. Parser.prototype.getRuleIndex = function (ruleName) {
  24210. var ruleIndex = this.getRuleIndexMap()[ruleName];
  24211. if (ruleIndex !== null) {
  24212. return ruleIndex;
  24213. } else {
  24214. return -1;
  24215. }
  24216. };
  24217. // Return List&lt;String&gt; of the rule names in your parser instance
  24218. // leading up to a call to the current rule. You could override if
  24219. // you want more details such as the file/line info of where
  24220. // in the ATN a rule is invoked.
  24221. //
  24222. // this is very useful for error messages.
  24223. //
  24224. Parser.prototype.getRuleInvocationStack = function (p) {
  24225. p = p || null;
  24226. if (p === null) {
  24227. p = this._ctx;
  24228. }
  24229. var stack = [];
  24230. while (p !== null) {
  24231. // compute what follows who invoked us
  24232. var ruleIndex = p.ruleIndex;
  24233. if (ruleIndex < 0) {
  24234. stack.push("n/a");
  24235. } else {
  24236. stack.push(this.ruleNames[ruleIndex]);
  24237. }
  24238. p = p.parentCtx;
  24239. }
  24240. return stack;
  24241. };
  24242. // For debugging and other purposes.//
  24243. Parser.prototype.getDFAStrings = function () {
  24244. return this._interp.decisionToDFA.toString();
  24245. };
  24246. // For debugging and other purposes.//
  24247. Parser.prototype.dumpDFA = function () {
  24248. var seenOne = false;
  24249. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  24250. var dfa = this._interp.decisionToDFA[i];
  24251. if (dfa.states.length > 0) {
  24252. if (seenOne) {
  24253. console.log();
  24254. }
  24255. this.printer.println("Decision " + dfa.decision + ":");
  24256. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  24257. seenOne = true;
  24258. }
  24259. }
  24260. };
  24261. /*
  24262. " printer = function() {\r\n" +
  24263. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  24264. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  24265. " };\r\n" +
  24266. */
  24267. Parser.prototype.getSourceName = function () {
  24268. return this._input.sourceName;
  24269. };
  24270. // During a parse is sometimes useful to listen in on the rule entry and exit
  24271. // events as well as token matches. this is for quick and dirty debugging.
  24272. //
  24273. Parser.prototype.setTrace = function (trace) {
  24274. if (!trace) {
  24275. this.removeParseListener(this._tracer);
  24276. this._tracer = null;
  24277. } else {
  24278. if (this._tracer !== null) {
  24279. this.removeParseListener(this._tracer);
  24280. }
  24281. this._tracer = new TraceListener(this);
  24282. this.addParseListener(this._tracer);
  24283. }
  24284. };
  24285. exports.Parser = Parser;
  24286. /***/ }),
  24287. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  24288. /*!**************************************************!*\
  24289. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  24290. \**************************************************/
  24291. /*! no static exports found */
  24292. /***/ (function(module, exports, __webpack_require__) {
  24293. "use strict";
  24294. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24295. * Use of this file is governed by the BSD 3-clause license that
  24296. * can be found in the LICENSE.txt file in the project root.
  24297. */
  24298. //* A rule invocation record for parsing.
  24299. //
  24300. // Contains all of the information about the current rule not stored in the
  24301. // RuleContext. It handles parse tree children list, Any ATN state
  24302. // tracing, and the default values available for rule indications:
  24303. // start, stop, rule index, current alt number, current
  24304. // ATN state.
  24305. //
  24306. // Subclasses made for each rule and grammar track the parameters,
  24307. // return values, locals, and labels specific to that rule. These
  24308. // are the objects that are returned from rules.
  24309. //
  24310. // Note text is not an actual field of a rule return value; it is computed
  24311. // from start and stop using the input stream's toString() method. I
  24312. // could add a ctor to this so that we can pass in and store the input
  24313. // stream, but I'm not sure we want to do that. It would seem to be undefined
  24314. // to get the .text property anyway if the rule matches tokens from multiple
  24315. // input streams.
  24316. //
  24317. // I do not use getters for fields of objects that are used simply to
  24318. // group values such as this aggregate. The getters/setters are there to
  24319. // satisfy the superclass interface.
  24320. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  24321. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  24322. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  24323. var TerminalNode = Tree.TerminalNode;
  24324. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  24325. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  24326. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  24327. function ParserRuleContext(parent, invokingStateNumber) {
  24328. parent = parent || null;
  24329. invokingStateNumber = invokingStateNumber || null;
  24330. RuleContext.call(this, parent, invokingStateNumber);
  24331. this.ruleIndex = -1;
  24332. // * If we are debugging or building a parse tree for a visitor,
  24333. // we need to track all of the tokens and rule invocations associated
  24334. // with this rule's context. This is empty for parsing w/o tree constr.
  24335. // operation because we don't the need to track the details about
  24336. // how we parse this rule.
  24337. // /
  24338. this.children = null;
  24339. this.start = null;
  24340. this.stop = null;
  24341. // The exception that forced this rule to return. If the rule successfully
  24342. // completed, this is {@code null}.
  24343. this.exception = null;
  24344. }
  24345. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  24346. ParserRuleContext.prototype.constructor = ParserRuleContext;
  24347. // * COPY a ctx (I'm deliberately not using copy constructor)///
  24348. ParserRuleContext.prototype.copyFrom = function (ctx) {
  24349. // from RuleContext
  24350. this.parentCtx = ctx.parentCtx;
  24351. this.invokingState = ctx.invokingState;
  24352. this.children = null;
  24353. this.start = ctx.start;
  24354. this.stop = ctx.stop;
  24355. // copy any error nodes to alt label node
  24356. if (ctx.children) {
  24357. this.children = [];
  24358. // reset parent pointer for any error nodes
  24359. ctx.children.map(function (child) {
  24360. if (child instanceof ErrorNodeImpl) {
  24361. this.children.push(child);
  24362. child.parentCtx = this;
  24363. }
  24364. }, this);
  24365. }
  24366. };
  24367. // Double dispatch methods for listeners
  24368. ParserRuleContext.prototype.enterRule = function (listener) {};
  24369. ParserRuleContext.prototype.exitRule = function (listener) {};
  24370. // * Does not set parent link; other add methods do that///
  24371. ParserRuleContext.prototype.addChild = function (child) {
  24372. if (this.children === null) {
  24373. this.children = [];
  24374. }
  24375. this.children.push(child);
  24376. return child;
  24377. };
  24378. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  24379. // we entered a rule. If we have // label, we will need to remove
  24380. // generic ruleContext object.
  24381. // /
  24382. ParserRuleContext.prototype.removeLastChild = function () {
  24383. if (this.children !== null) {
  24384. this.children.pop();
  24385. }
  24386. };
  24387. ParserRuleContext.prototype.addTokenNode = function (token) {
  24388. var node = new TerminalNodeImpl(token);
  24389. this.addChild(node);
  24390. node.parentCtx = this;
  24391. return node;
  24392. };
  24393. ParserRuleContext.prototype.addErrorNode = function (badToken) {
  24394. var node = new ErrorNodeImpl(badToken);
  24395. this.addChild(node);
  24396. node.parentCtx = this;
  24397. return node;
  24398. };
  24399. ParserRuleContext.prototype.getChild = function (i, type) {
  24400. type = type || null;
  24401. if (this.children === null || i < 0 || i >= this.children.length) {
  24402. return null;
  24403. }
  24404. if (type === null) {
  24405. return this.children[i];
  24406. } else {
  24407. for (var j = 0; j < this.children.length; j++) {
  24408. var child = this.children[j];
  24409. if (child instanceof type) {
  24410. if (i === 0) {
  24411. return child;
  24412. } else {
  24413. i -= 1;
  24414. }
  24415. }
  24416. }
  24417. return null;
  24418. }
  24419. };
  24420. ParserRuleContext.prototype.getToken = function (ttype, i) {
  24421. if (this.children === null || i < 0 || i >= this.children.length) {
  24422. return null;
  24423. }
  24424. for (var j = 0; j < this.children.length; j++) {
  24425. var child = this.children[j];
  24426. if (child instanceof TerminalNode) {
  24427. if (child.symbol.type === ttype) {
  24428. if (i === 0) {
  24429. return child;
  24430. } else {
  24431. i -= 1;
  24432. }
  24433. }
  24434. }
  24435. }
  24436. return null;
  24437. };
  24438. ParserRuleContext.prototype.getTokens = function (ttype) {
  24439. if (this.children === null) {
  24440. return [];
  24441. } else {
  24442. var tokens = [];
  24443. for (var j = 0; j < this.children.length; j++) {
  24444. var child = this.children[j];
  24445. if (child instanceof TerminalNode) {
  24446. if (child.symbol.type === ttype) {
  24447. tokens.push(child);
  24448. }
  24449. }
  24450. }
  24451. return tokens;
  24452. }
  24453. };
  24454. ParserRuleContext.prototype.getTypedRuleContext = function (ctxType, i) {
  24455. return this.getChild(i, ctxType);
  24456. };
  24457. ParserRuleContext.prototype.getTypedRuleContexts = function (ctxType) {
  24458. if (this.children === null) {
  24459. return [];
  24460. } else {
  24461. var contexts = [];
  24462. for (var j = 0; j < this.children.length; j++) {
  24463. var child = this.children[j];
  24464. if (child instanceof ctxType) {
  24465. contexts.push(child);
  24466. }
  24467. }
  24468. return contexts;
  24469. }
  24470. };
  24471. ParserRuleContext.prototype.getChildCount = function () {
  24472. if (this.children === null) {
  24473. return 0;
  24474. } else {
  24475. return this.children.length;
  24476. }
  24477. };
  24478. ParserRuleContext.prototype.getSourceInterval = function () {
  24479. if (this.start === null || this.stop === null) {
  24480. return INVALID_INTERVAL;
  24481. } else {
  24482. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  24483. }
  24484. };
  24485. RuleContext.EMPTY = new ParserRuleContext();
  24486. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  24487. ParserRuleContext.call(parent, invokingStateNumber);
  24488. this.ruleIndex = ruleIndex;
  24489. return this;
  24490. }
  24491. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  24492. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  24493. exports.ParserRuleContext = ParserRuleContext;
  24494. /***/ }),
  24495. /***/ "./node_modules/antlr4/PredictionContext.js":
  24496. /*!**************************************************!*\
  24497. !*** ./node_modules/antlr4/PredictionContext.js ***!
  24498. \**************************************************/
  24499. /*! no static exports found */
  24500. /***/ (function(module, exports, __webpack_require__) {
  24501. "use strict";
  24502. //
  24503. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24504. * Use of this file is governed by the BSD 3-clause license that
  24505. * can be found in the LICENSE.txt file in the project root.
  24506. */
  24507. ///
  24508. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  24509. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  24510. function PredictionContext(cachedHashCode) {
  24511. this.cachedHashCode = cachedHashCode;
  24512. }
  24513. // Represents {@code $} in local context prediction, which means wildcard.
  24514. // {@code//+x =//}.
  24515. // /
  24516. PredictionContext.EMPTY = null;
  24517. // Represents {@code $} in an array in full context mode, when {@code $}
  24518. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  24519. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  24520. // /
  24521. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  24522. PredictionContext.globalNodeCount = 1;
  24523. PredictionContext.id = PredictionContext.globalNodeCount;
  24524. // Stores the computed hash code of this {@link PredictionContext}. The hash
  24525. // code is computed in parts to match the following reference algorithm.
  24526. //
  24527. // <pre>
  24528. // private int referenceHashCode() {
  24529. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  24530. // //INITIAL_HASH});
  24531. //
  24532. // for (int i = 0; i &lt; {@link //size()}; i++) {
  24533. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  24534. // getParent}(i));
  24535. // }
  24536. //
  24537. // for (int i = 0; i &lt; {@link //size()}; i++) {
  24538. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  24539. // //getReturnState getReturnState}(i));
  24540. // }
  24541. //
  24542. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  24543. // //size()});
  24544. // return hash;
  24545. // }
  24546. // </pre>
  24547. // /
  24548. // This means only the {@link //EMPTY} context is in set.
  24549. PredictionContext.prototype.isEmpty = function () {
  24550. return this === PredictionContext.EMPTY;
  24551. };
  24552. PredictionContext.prototype.hasEmptyPath = function () {
  24553. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  24554. };
  24555. PredictionContext.prototype.hashCode = function () {
  24556. return this.cachedHashCode;
  24557. };
  24558. PredictionContext.prototype.updateHashCode = function (hash) {
  24559. hash.update(this.cachedHashCode);
  24560. };
  24561. /*
  24562. function calculateHashString(parent, returnState) {
  24563. return "" + parent + returnState;
  24564. }
  24565. */
  24566. // Used to cache {@link PredictionContext} objects. Its used for the shared
  24567. // context cash associated with contexts in DFA states. This cache
  24568. // can be used for both lexers and parsers.
  24569. function PredictionContextCache() {
  24570. this.cache = {};
  24571. return this;
  24572. }
  24573. // Add a context to the cache and return it. If the context already exists,
  24574. // return that one instead and do not add a new context to the cache.
  24575. // Protect shared cache from unsafe thread access.
  24576. //
  24577. PredictionContextCache.prototype.add = function (ctx) {
  24578. if (ctx === PredictionContext.EMPTY) {
  24579. return PredictionContext.EMPTY;
  24580. }
  24581. var existing = this.cache[ctx] || null;
  24582. if (existing !== null) {
  24583. return existing;
  24584. }
  24585. this.cache[ctx] = ctx;
  24586. return ctx;
  24587. };
  24588. PredictionContextCache.prototype.get = function (ctx) {
  24589. return this.cache[ctx] || null;
  24590. };
  24591. Object.defineProperty(PredictionContextCache.prototype, "length", {
  24592. get: function get() {
  24593. return this.cache.length;
  24594. }
  24595. });
  24596. function SingletonPredictionContext(parent, returnState) {
  24597. var hashCode = 0;
  24598. if (parent !== null) {
  24599. var hash = new Hash();
  24600. hash.update(parent, returnState);
  24601. hashCode = hash.finish();
  24602. }
  24603. PredictionContext.call(this, hashCode);
  24604. this.parentCtx = parent;
  24605. this.returnState = returnState;
  24606. }
  24607. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  24608. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  24609. SingletonPredictionContext.create = function (parent, returnState) {
  24610. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  24611. // someone can pass in the bits of an array ctx that mean $
  24612. return PredictionContext.EMPTY;
  24613. } else {
  24614. return new SingletonPredictionContext(parent, returnState);
  24615. }
  24616. };
  24617. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  24618. get: function get() {
  24619. return 1;
  24620. }
  24621. });
  24622. SingletonPredictionContext.prototype.getParent = function (index) {
  24623. return this.parentCtx;
  24624. };
  24625. SingletonPredictionContext.prototype.getReturnState = function (index) {
  24626. return this.returnState;
  24627. };
  24628. SingletonPredictionContext.prototype.equals = function (other) {
  24629. if (this === other) {
  24630. return true;
  24631. } else if (!(other instanceof SingletonPredictionContext)) {
  24632. return false;
  24633. } else if (this.hashCode() !== other.hashCode()) {
  24634. return false; // can't be same if hash is different
  24635. } else {
  24636. if (this.returnState !== other.returnState) return false;else if (this.parentCtx == null) return other.parentCtx == null;else return this.parentCtx.equals(other.parentCtx);
  24637. }
  24638. };
  24639. SingletonPredictionContext.prototype.toString = function () {
  24640. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  24641. if (up.length === 0) {
  24642. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  24643. return "$";
  24644. } else {
  24645. return "" + this.returnState;
  24646. }
  24647. } else {
  24648. return "" + this.returnState + " " + up;
  24649. }
  24650. };
  24651. function EmptyPredictionContext() {
  24652. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  24653. return this;
  24654. }
  24655. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  24656. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  24657. EmptyPredictionContext.prototype.isEmpty = function () {
  24658. return true;
  24659. };
  24660. EmptyPredictionContext.prototype.getParent = function (index) {
  24661. return null;
  24662. };
  24663. EmptyPredictionContext.prototype.getReturnState = function (index) {
  24664. return this.returnState;
  24665. };
  24666. EmptyPredictionContext.prototype.equals = function (other) {
  24667. return this === other;
  24668. };
  24669. EmptyPredictionContext.prototype.toString = function () {
  24670. return "$";
  24671. };
  24672. PredictionContext.EMPTY = new EmptyPredictionContext();
  24673. function ArrayPredictionContext(parents, returnStates) {
  24674. // Parent can be null only if full ctx mode and we make an array
  24675. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  24676. // null parent and
  24677. // returnState == {@link //EMPTY_RETURN_STATE}.
  24678. var h = new Hash();
  24679. h.update(parents, returnStates);
  24680. var hashCode = h.finish();
  24681. PredictionContext.call(this, hashCode);
  24682. this.parents = parents;
  24683. this.returnStates = returnStates;
  24684. return this;
  24685. }
  24686. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  24687. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  24688. ArrayPredictionContext.prototype.isEmpty = function () {
  24689. // since EMPTY_RETURN_STATE can only appear in the last position, we
  24690. // don't need to verify that size==1
  24691. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  24692. };
  24693. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  24694. get: function get() {
  24695. return this.returnStates.length;
  24696. }
  24697. });
  24698. ArrayPredictionContext.prototype.getParent = function (index) {
  24699. return this.parents[index];
  24700. };
  24701. ArrayPredictionContext.prototype.getReturnState = function (index) {
  24702. return this.returnStates[index];
  24703. };
  24704. ArrayPredictionContext.prototype.equals = function (other) {
  24705. if (this === other) {
  24706. return true;
  24707. } else if (!(other instanceof ArrayPredictionContext)) {
  24708. return false;
  24709. } else if (this.hashCode() !== other.hashCode()) {
  24710. return false; // can't be same if hash is different
  24711. } else {
  24712. return this.returnStates === other.returnStates && this.parents === other.parents;
  24713. }
  24714. };
  24715. ArrayPredictionContext.prototype.toString = function () {
  24716. if (this.isEmpty()) {
  24717. return "[]";
  24718. } else {
  24719. var s = "[";
  24720. for (var i = 0; i < this.returnStates.length; i++) {
  24721. if (i > 0) {
  24722. s = s + ", ";
  24723. }
  24724. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  24725. s = s + "$";
  24726. continue;
  24727. }
  24728. s = s + this.returnStates[i];
  24729. if (this.parents[i] !== null) {
  24730. s = s + " " + this.parents[i];
  24731. } else {
  24732. s = s + "null";
  24733. }
  24734. }
  24735. return s + "]";
  24736. }
  24737. };
  24738. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  24739. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  24740. // /
  24741. function predictionContextFromRuleContext(atn, outerContext) {
  24742. if (outerContext === undefined || outerContext === null) {
  24743. outerContext = RuleContext.EMPTY;
  24744. }
  24745. // if we are in RuleContext of start rule, s, then PredictionContext
  24746. // is EMPTY. Nobody called us. (if we are empty, return empty)
  24747. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  24748. return PredictionContext.EMPTY;
  24749. }
  24750. // If we have a parent, convert it to a PredictionContext graph
  24751. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  24752. var state = atn.states[outerContext.invokingState];
  24753. var transition = state.transitions[0];
  24754. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  24755. }
  24756. /*
  24757. function calculateListsHashString(parents, returnStates) {
  24758. var s = "";
  24759. parents.map(function(p) {
  24760. s = s + p;
  24761. });
  24762. returnStates.map(function(r) {
  24763. s = s + r;
  24764. });
  24765. return s;
  24766. }
  24767. */
  24768. function merge(a, b, rootIsWildcard, mergeCache) {
  24769. // share same graph if both same
  24770. if (a === b) {
  24771. return a;
  24772. }
  24773. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  24774. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  24775. }
  24776. // At least one of a or b is array
  24777. // If one is $ and rootIsWildcard, return $ as// wildcard
  24778. if (rootIsWildcard) {
  24779. if (a instanceof EmptyPredictionContext) {
  24780. return a;
  24781. }
  24782. if (b instanceof EmptyPredictionContext) {
  24783. return b;
  24784. }
  24785. }
  24786. // convert singleton so both are arrays to normalize
  24787. if (a instanceof SingletonPredictionContext) {
  24788. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  24789. }
  24790. if (b instanceof SingletonPredictionContext) {
  24791. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  24792. }
  24793. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  24794. }
  24795. //
  24796. // Merge two {@link SingletonPredictionContext} instances.
  24797. //
  24798. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  24799. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  24800. // type="image/svg+xml"/></p>
  24801. //
  24802. // <p>Same stack top, parents differ; merge parents giving array node, then
  24803. // remainders of those graphs. A new root node is created to point to the
  24804. // merged parents.<br>
  24805. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  24806. // type="image/svg+xml"/></p>
  24807. //
  24808. // <p>Different stack tops pointing to same parent. Make array node for the
  24809. // root where both element in the root point to the same (original)
  24810. // parent.<br>
  24811. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  24812. // type="image/svg+xml"/></p>
  24813. //
  24814. // <p>Different stack tops pointing to different parents. Make array node for
  24815. // the root where each element points to the corresponding original
  24816. // parent.<br>
  24817. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  24818. // type="image/svg+xml"/></p>
  24819. //
  24820. // @param a the first {@link SingletonPredictionContext}
  24821. // @param b the second {@link SingletonPredictionContext}
  24822. // @param rootIsWildcard {@code true} if this is a local-context merge,
  24823. // otherwise false to indicate a full-context merge
  24824. // @param mergeCache
  24825. // /
  24826. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  24827. if (mergeCache !== null) {
  24828. var previous = mergeCache.get(a, b);
  24829. if (previous !== null) {
  24830. return previous;
  24831. }
  24832. previous = mergeCache.get(b, a);
  24833. if (previous !== null) {
  24834. return previous;
  24835. }
  24836. }
  24837. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  24838. if (rootMerge !== null) {
  24839. if (mergeCache !== null) {
  24840. mergeCache.set(a, b, rootMerge);
  24841. }
  24842. return rootMerge;
  24843. }
  24844. if (a.returnState === b.returnState) {
  24845. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  24846. // if parent is same as existing a or b parent or reduced to a parent,
  24847. // return it
  24848. if (parent === a.parentCtx) {
  24849. return a; // ax + bx = ax, if a=b
  24850. }
  24851. if (parent === b.parentCtx) {
  24852. return b; // ax + bx = bx, if a=b
  24853. }
  24854. // else: ax + ay = a'[x,y]
  24855. // merge parents x and y, giving array node with x,y then remainders
  24856. // of those graphs. dup a, a' points at merged array
  24857. // new joined parent so create new singleton pointing to it, a'
  24858. var spc = SingletonPredictionContext.create(parent, a.returnState);
  24859. if (mergeCache !== null) {
  24860. mergeCache.set(a, b, spc);
  24861. }
  24862. return spc;
  24863. } else {
  24864. // a != b payloads differ
  24865. // see if we can collapse parents due to $+x parents if local ctx
  24866. var singleParent = null;
  24867. if (a === b || a.parentCtx !== null && a.parentCtx === b.parentCtx) {
  24868. // ax +
  24869. // bx =
  24870. // [a,b]x
  24871. singleParent = a.parentCtx;
  24872. }
  24873. if (singleParent !== null) {
  24874. // parents are same
  24875. // sort payloads and use same parent
  24876. var payloads = [a.returnState, b.returnState];
  24877. if (a.returnState > b.returnState) {
  24878. payloads[0] = b.returnState;
  24879. payloads[1] = a.returnState;
  24880. }
  24881. var parents = [singleParent, singleParent];
  24882. var apc = new ArrayPredictionContext(parents, payloads);
  24883. if (mergeCache !== null) {
  24884. mergeCache.set(a, b, apc);
  24885. }
  24886. return apc;
  24887. }
  24888. // parents differ and can't merge them. Just pack together
  24889. // into array; can't merge.
  24890. // ax + by = [ax,by]
  24891. var payloads = [a.returnState, b.returnState];
  24892. var parents = [a.parentCtx, b.parentCtx];
  24893. if (a.returnState > b.returnState) {
  24894. // sort by payload
  24895. payloads[0] = b.returnState;
  24896. payloads[1] = a.returnState;
  24897. parents = [b.parentCtx, a.parentCtx];
  24898. }
  24899. var a_ = new ArrayPredictionContext(parents, payloads);
  24900. if (mergeCache !== null) {
  24901. mergeCache.set(a, b, a_);
  24902. }
  24903. return a_;
  24904. }
  24905. }
  24906. //
  24907. // Handle case where at least one of {@code a} or {@code b} is
  24908. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  24909. // to represent {@link //EMPTY}.
  24910. //
  24911. // <h2>Local-Context Merges</h2>
  24912. //
  24913. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  24914. // is true.</p>
  24915. //
  24916. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  24917. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24918. //
  24919. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  24920. // {@code //EMPTY}; return left graph.<br>
  24921. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  24922. //
  24923. // <p>Special case of last merge if local context.<br>
  24924. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  24925. //
  24926. // <h2>Full-Context Merges</h2>
  24927. //
  24928. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  24929. // is false.</p>
  24930. //
  24931. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  24932. //
  24933. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  24934. // null parent).<br>
  24935. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24936. //
  24937. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  24938. //
  24939. // @param a the first {@link SingletonPredictionContext}
  24940. // @param b the second {@link SingletonPredictionContext}
  24941. // @param rootIsWildcard {@code true} if this is a local-context merge,
  24942. // otherwise false to indicate a full-context merge
  24943. // /
  24944. function mergeRoot(a, b, rootIsWildcard) {
  24945. if (rootIsWildcard) {
  24946. if (a === PredictionContext.EMPTY) {
  24947. return PredictionContext.EMPTY; // // + b =//
  24948. }
  24949. if (b === PredictionContext.EMPTY) {
  24950. return PredictionContext.EMPTY; // a +// =//
  24951. }
  24952. } else {
  24953. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  24954. return PredictionContext.EMPTY; // $ + $ = $
  24955. } else if (a === PredictionContext.EMPTY) {
  24956. // $ + x = [$,x]
  24957. var payloads = [b.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24958. var parents = [b.parentCtx, null];
  24959. return new ArrayPredictionContext(parents, payloads);
  24960. } else if (b === PredictionContext.EMPTY) {
  24961. // x + $ = [$,x] ($ is always first if present)
  24962. var payloads = [a.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24963. var parents = [a.parentCtx, null];
  24964. return new ArrayPredictionContext(parents, payloads);
  24965. }
  24966. }
  24967. return null;
  24968. }
  24969. //
  24970. // Merge two {@link ArrayPredictionContext} instances.
  24971. //
  24972. // <p>Different tops, different parents.<br>
  24973. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  24974. //
  24975. // <p>Shared top, same parents.<br>
  24976. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  24977. //
  24978. // <p>Shared top, different parents.<br>
  24979. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  24980. //
  24981. // <p>Shared top, all shared parents.<br>
  24982. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  24983. // type="image/svg+xml"/></p>
  24984. //
  24985. // <p>Equal tops, merge parents and reduce top to
  24986. // {@link SingletonPredictionContext}.<br>
  24987. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  24988. // /
  24989. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  24990. if (mergeCache !== null) {
  24991. var previous = mergeCache.get(a, b);
  24992. if (previous !== null) {
  24993. return previous;
  24994. }
  24995. previous = mergeCache.get(b, a);
  24996. if (previous !== null) {
  24997. return previous;
  24998. }
  24999. }
  25000. // merge sorted payloads a + b => M
  25001. var i = 0; // walks a
  25002. var j = 0; // walks b
  25003. var k = 0; // walks target M array
  25004. var mergedReturnStates = [];
  25005. var mergedParents = [];
  25006. // walk and merge to yield mergedParents, mergedReturnStates
  25007. while (i < a.returnStates.length && j < b.returnStates.length) {
  25008. var a_parent = a.parents[i];
  25009. var b_parent = b.parents[j];
  25010. if (a.returnStates[i] === b.returnStates[j]) {
  25011. // same payload (stack tops are equal), must yield merged singleton
  25012. var payload = a.returnStates[i];
  25013. // $+$ = $
  25014. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE && a_parent === null && b_parent === null;
  25015. var ax_ax = a_parent !== null && b_parent !== null && a_parent === b_parent; // ax+ax
  25016. // ->
  25017. // ax
  25018. if (bothDollars || ax_ax) {
  25019. mergedParents[k] = a_parent; // choose left
  25020. mergedReturnStates[k] = payload;
  25021. } else {
  25022. // ax+ay -> a'[x,y]
  25023. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  25024. mergedParents[k] = mergedParent;
  25025. mergedReturnStates[k] = payload;
  25026. }
  25027. i += 1; // hop over left one as usual
  25028. j += 1; // but also skip one in right side since we merge
  25029. } else if (a.returnStates[i] < b.returnStates[j]) {
  25030. // copy a[i] to M
  25031. mergedParents[k] = a_parent;
  25032. mergedReturnStates[k] = a.returnStates[i];
  25033. i += 1;
  25034. } else {
  25035. // b > a, copy b[j] to M
  25036. mergedParents[k] = b_parent;
  25037. mergedReturnStates[k] = b.returnStates[j];
  25038. j += 1;
  25039. }
  25040. k += 1;
  25041. }
  25042. // copy over any payloads remaining in either array
  25043. if (i < a.returnStates.length) {
  25044. for (var p = i; p < a.returnStates.length; p++) {
  25045. mergedParents[k] = a.parents[p];
  25046. mergedReturnStates[k] = a.returnStates[p];
  25047. k += 1;
  25048. }
  25049. } else {
  25050. for (var p = j; p < b.returnStates.length; p++) {
  25051. mergedParents[k] = b.parents[p];
  25052. mergedReturnStates[k] = b.returnStates[p];
  25053. k += 1;
  25054. }
  25055. }
  25056. // trim merged if we combined a few that had same stack tops
  25057. if (k < mergedParents.length) {
  25058. // write index < last position; trim
  25059. if (k === 1) {
  25060. // for just one merged element, return singleton top
  25061. var a_ = SingletonPredictionContext.create(mergedParents[0], mergedReturnStates[0]);
  25062. if (mergeCache !== null) {
  25063. mergeCache.set(a, b, a_);
  25064. }
  25065. return a_;
  25066. }
  25067. mergedParents = mergedParents.slice(0, k);
  25068. mergedReturnStates = mergedReturnStates.slice(0, k);
  25069. }
  25070. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  25071. // if we created same array as a or b, return that instead
  25072. // TODO: track whether this is possible above during merge sort for speed
  25073. if (M === a) {
  25074. if (mergeCache !== null) {
  25075. mergeCache.set(a, b, a);
  25076. }
  25077. return a;
  25078. }
  25079. if (M === b) {
  25080. if (mergeCache !== null) {
  25081. mergeCache.set(a, b, b);
  25082. }
  25083. return b;
  25084. }
  25085. combineCommonParents(mergedParents);
  25086. if (mergeCache !== null) {
  25087. mergeCache.set(a, b, M);
  25088. }
  25089. return M;
  25090. }
  25091. //
  25092. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  25093. // ones.
  25094. // /
  25095. function combineCommonParents(parents) {
  25096. var uniqueParents = {};
  25097. for (var p = 0; p < parents.length; p++) {
  25098. var parent = parents[p];
  25099. if (!(parent in uniqueParents)) {
  25100. uniqueParents[parent] = parent;
  25101. }
  25102. }
  25103. for (var q = 0; q < parents.length; q++) {
  25104. parents[q] = uniqueParents[parents[q]];
  25105. }
  25106. }
  25107. function getCachedPredictionContext(context, contextCache, visited) {
  25108. if (context.isEmpty()) {
  25109. return context;
  25110. }
  25111. var existing = visited[context] || null;
  25112. if (existing !== null) {
  25113. return existing;
  25114. }
  25115. existing = contextCache.get(context);
  25116. if (existing !== null) {
  25117. visited[context] = existing;
  25118. return existing;
  25119. }
  25120. var changed = false;
  25121. var parents = [];
  25122. for (var i = 0; i < parents.length; i++) {
  25123. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  25124. if (changed || parent !== context.getParent(i)) {
  25125. if (!changed) {
  25126. parents = [];
  25127. for (var j = 0; j < context.length; j++) {
  25128. parents[j] = context.getParent(j);
  25129. }
  25130. changed = true;
  25131. }
  25132. parents[i] = parent;
  25133. }
  25134. }
  25135. if (!changed) {
  25136. contextCache.add(context);
  25137. visited[context] = context;
  25138. return context;
  25139. }
  25140. var updated = null;
  25141. if (parents.length === 0) {
  25142. updated = PredictionContext.EMPTY;
  25143. } else if (parents.length === 1) {
  25144. updated = SingletonPredictionContext.create(parents[0], context.getReturnState(0));
  25145. } else {
  25146. updated = new ArrayPredictionContext(parents, context.returnStates);
  25147. }
  25148. contextCache.add(updated);
  25149. visited[updated] = updated;
  25150. visited[context] = updated;
  25151. return updated;
  25152. }
  25153. // ter's recursive version of Sam's getAllNodes()
  25154. function getAllContextNodes(context, nodes, visited) {
  25155. if (nodes === null) {
  25156. nodes = [];
  25157. return getAllContextNodes(context, nodes, visited);
  25158. } else if (visited === null) {
  25159. visited = {};
  25160. return getAllContextNodes(context, nodes, visited);
  25161. } else {
  25162. if (context === null || visited[context] !== null) {
  25163. return nodes;
  25164. }
  25165. visited[context] = context;
  25166. nodes.push(context);
  25167. for (var i = 0; i < context.length; i++) {
  25168. getAllContextNodes(context.getParent(i), nodes, visited);
  25169. }
  25170. return nodes;
  25171. }
  25172. }
  25173. exports.merge = merge;
  25174. exports.PredictionContext = PredictionContext;
  25175. exports.PredictionContextCache = PredictionContextCache;
  25176. exports.SingletonPredictionContext = SingletonPredictionContext;
  25177. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  25178. exports.getCachedPredictionContext = getCachedPredictionContext;
  25179. /***/ }),
  25180. /***/ "./node_modules/antlr4/Recognizer.js":
  25181. /*!*******************************************!*\
  25182. !*** ./node_modules/antlr4/Recognizer.js ***!
  25183. \*******************************************/
  25184. /*! no static exports found */
  25185. /***/ (function(module, exports, __webpack_require__) {
  25186. "use strict";
  25187. //
  25188. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25189. * Use of this file is governed by the BSD 3-clause license that
  25190. * can be found in the LICENSE.txt file in the project root.
  25191. */
  25192. //
  25193. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  25194. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  25195. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  25196. function Recognizer() {
  25197. this._listeners = [ConsoleErrorListener.INSTANCE];
  25198. this._interp = null;
  25199. this._stateNumber = -1;
  25200. return this;
  25201. }
  25202. Recognizer.tokenTypeMapCache = {};
  25203. Recognizer.ruleIndexMapCache = {};
  25204. Recognizer.prototype.checkVersion = function (toolVersion) {
  25205. var runtimeVersion = "4.7.1";
  25206. if (runtimeVersion !== toolVersion) {
  25207. console.log("ANTLR runtime and generated code versions disagree: " + runtimeVersion + "!=" + toolVersion);
  25208. }
  25209. };
  25210. Recognizer.prototype.addErrorListener = function (listener) {
  25211. this._listeners.push(listener);
  25212. };
  25213. Recognizer.prototype.removeErrorListeners = function () {
  25214. this._listeners = [];
  25215. };
  25216. Recognizer.prototype.getTokenTypeMap = function () {
  25217. var tokenNames = this.getTokenNames();
  25218. if (tokenNames === null) {
  25219. throw "The current recognizer does not provide a list of token names.";
  25220. }
  25221. var result = this.tokenTypeMapCache[tokenNames];
  25222. if (result === undefined) {
  25223. result = tokenNames.reduce(function (o, k, i) {
  25224. o[k] = i;
  25225. });
  25226. result.EOF = Token.EOF;
  25227. this.tokenTypeMapCache[tokenNames] = result;
  25228. }
  25229. return result;
  25230. };
  25231. // Get a map from rule names to rule indexes.
  25232. //
  25233. // <p>Used for XPath and tree pattern compilation.</p>
  25234. //
  25235. Recognizer.prototype.getRuleIndexMap = function () {
  25236. var ruleNames = this.ruleNames;
  25237. if (ruleNames === null) {
  25238. throw "The current recognizer does not provide a list of rule names.";
  25239. }
  25240. var result = this.ruleIndexMapCache[ruleNames];
  25241. if (result === undefined) {
  25242. result = ruleNames.reduce(function (o, k, i) {
  25243. o[k] = i;
  25244. });
  25245. this.ruleIndexMapCache[ruleNames] = result;
  25246. }
  25247. return result;
  25248. };
  25249. Recognizer.prototype.getTokenType = function (tokenName) {
  25250. var ttype = this.getTokenTypeMap()[tokenName];
  25251. if (ttype !== undefined) {
  25252. return ttype;
  25253. } else {
  25254. return Token.INVALID_TYPE;
  25255. }
  25256. };
  25257. // What is the error header, normally line/character position information?//
  25258. Recognizer.prototype.getErrorHeader = function (e) {
  25259. var line = e.getOffendingToken().line;
  25260. var column = e.getOffendingToken().column;
  25261. return "line " + line + ":" + column;
  25262. };
  25263. // How should a token be displayed in an error message? The default
  25264. // is to display just the text, but during development you might
  25265. // want to have a lot of information spit out. Override in that case
  25266. // to use t.toString() (which, for CommonToken, dumps everything about
  25267. // the token). This is better than forcing you to override a method in
  25268. // your token objects because you don't have to go modify your lexer
  25269. // so that it creates a new Java type.
  25270. //
  25271. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  25272. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  25273. // feature when necessary. For example, see
  25274. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  25275. //
  25276. Recognizer.prototype.getTokenErrorDisplay = function (t) {
  25277. if (t === null) {
  25278. return "<no token>";
  25279. }
  25280. var s = t.text;
  25281. if (s === null) {
  25282. if (t.type === Token.EOF) {
  25283. s = "<EOF>";
  25284. } else {
  25285. s = "<" + t.type + ">";
  25286. }
  25287. }
  25288. s = s.replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t");
  25289. return "'" + s + "'";
  25290. };
  25291. Recognizer.prototype.getErrorListenerDispatch = function () {
  25292. return new ProxyErrorListener(this._listeners);
  25293. };
  25294. // subclass needs to override these if there are sempreds or actions
  25295. // that the ATN interp needs to execute
  25296. Recognizer.prototype.sempred = function (localctx, ruleIndex, actionIndex) {
  25297. return true;
  25298. };
  25299. Recognizer.prototype.precpred = function (localctx, precedence) {
  25300. return true;
  25301. };
  25302. //Indicate that the recognizer has changed internal state that is
  25303. //consistent with the ATN state passed in. This way we always know
  25304. //where we are in the ATN as the parser goes along. The rule
  25305. //context objects form a stack that lets us see the stack of
  25306. //invoking rules. Combine this and we have complete ATN
  25307. //configuration information.
  25308. Object.defineProperty(Recognizer.prototype, "state", {
  25309. get: function get() {
  25310. return this._stateNumber;
  25311. },
  25312. set: function set(state) {
  25313. this._stateNumber = state;
  25314. }
  25315. });
  25316. exports.Recognizer = Recognizer;
  25317. /***/ }),
  25318. /***/ "./node_modules/antlr4/RuleContext.js":
  25319. /*!********************************************!*\
  25320. !*** ./node_modules/antlr4/RuleContext.js ***!
  25321. \********************************************/
  25322. /*! no static exports found */
  25323. /***/ (function(module, exports, __webpack_require__) {
  25324. "use strict";
  25325. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25326. * Use of this file is governed by the BSD 3-clause license that
  25327. * can be found in the LICENSE.txt file in the project root.
  25328. */
  25329. ///
  25330. // A rule context is a record of a single rule invocation. It knows
  25331. // which context invoked it, if any. If there is no parent context, then
  25332. // naturally the invoking state is not valid. The parent link
  25333. // provides a chain upwards from the current rule invocation to the root
  25334. // of the invocation tree, forming a stack. We actually carry no
  25335. // information about the rule associated with this context (except
  25336. // when parsing). We keep only the state number of the invoking state from
  25337. // the ATN submachine that invoked this. Contrast this with the s
  25338. // pointer inside ParserRuleContext that tracks the current state
  25339. // being "executed" for the current rule.
  25340. //
  25341. // The parent contexts are useful for computing lookahead sets and
  25342. // getting error information.
  25343. //
  25344. // These objects are used during parsing and prediction.
  25345. // For the special case of parsers, we use the subclass
  25346. // ParserRuleContext.
  25347. //
  25348. // @see ParserRuleContext
  25349. ///
  25350. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  25351. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  25352. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  25353. function RuleContext(parent, invokingState) {
  25354. RuleNode.call(this);
  25355. // What context invoked this rule?
  25356. this.parentCtx = parent || null;
  25357. // What state invoked the rule associated with this context?
  25358. // The "return address" is the followState of invokingState
  25359. // If parent is null, this should be -1.
  25360. this.invokingState = invokingState || -1;
  25361. return this;
  25362. }
  25363. RuleContext.prototype = Object.create(RuleNode.prototype);
  25364. RuleContext.prototype.constructor = RuleContext;
  25365. RuleContext.prototype.depth = function () {
  25366. var n = 0;
  25367. var p = this;
  25368. while (p !== null) {
  25369. p = p.parentCtx;
  25370. n += 1;
  25371. }
  25372. return n;
  25373. };
  25374. // A context is empty if there is no invoking state; meaning nobody call
  25375. // current context.
  25376. RuleContext.prototype.isEmpty = function () {
  25377. return this.invokingState === -1;
  25378. };
  25379. // satisfy the ParseTree / SyntaxTree interface
  25380. RuleContext.prototype.getSourceInterval = function () {
  25381. return INVALID_INTERVAL;
  25382. };
  25383. RuleContext.prototype.getRuleContext = function () {
  25384. return this;
  25385. };
  25386. RuleContext.prototype.getPayload = function () {
  25387. return this;
  25388. };
  25389. // Return the combined text of all child nodes. This method only considers
  25390. // tokens which have been added to the parse tree.
  25391. // <p>
  25392. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  25393. // added to the parse trees, they will not appear in the output of this
  25394. // method.
  25395. // /
  25396. RuleContext.prototype.getText = function () {
  25397. if (this.getChildCount() === 0) {
  25398. return "";
  25399. } else {
  25400. return this.children.map(function (child) {
  25401. return child.getText();
  25402. }).join("");
  25403. }
  25404. };
  25405. // For rule associated with this parse tree internal node, return
  25406. // the outer alternative number used to match the input. Default
  25407. // implementation does not compute nor store this alt num. Create
  25408. // a subclass of ParserRuleContext with backing field and set
  25409. // option contextSuperClass.
  25410. // to set it.
  25411. RuleContext.prototype.getAltNumber = function () {
  25412. return INVALID_ALT_NUMBER;
  25413. };
  25414. // Set the outer alternative number for this context node. Default
  25415. // implementation does nothing to avoid backing field overhead for
  25416. // trees that don't need it. Create
  25417. // a subclass of ParserRuleContext with backing field and set
  25418. // option contextSuperClass.
  25419. RuleContext.prototype.setAltNumber = function (altNumber) {};
  25420. RuleContext.prototype.getChild = function (i) {
  25421. return null;
  25422. };
  25423. RuleContext.prototype.getChildCount = function () {
  25424. return 0;
  25425. };
  25426. RuleContext.prototype.accept = function (visitor) {
  25427. return visitor.visitChildren(this);
  25428. };
  25429. //need to manage circular dependencies, so export now
  25430. exports.RuleContext = RuleContext;
  25431. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  25432. // Print out a whole tree, not just a node, in LISP format
  25433. // (root child1 .. childN). Print just a node if this is a leaf.
  25434. //
  25435. RuleContext.prototype.toStringTree = function (ruleNames, recog) {
  25436. return Trees.toStringTree(this, ruleNames, recog);
  25437. };
  25438. RuleContext.prototype.toString = function (ruleNames, stop) {
  25439. ruleNames = ruleNames || null;
  25440. stop = stop || null;
  25441. var p = this;
  25442. var s = "[";
  25443. while (p !== null && p !== stop) {
  25444. if (ruleNames === null) {
  25445. if (!p.isEmpty()) {
  25446. s += p.invokingState;
  25447. }
  25448. } else {
  25449. var ri = p.ruleIndex;
  25450. var ruleName = ri >= 0 && ri < ruleNames.length ? ruleNames[ri] : "" + ri;
  25451. s += ruleName;
  25452. }
  25453. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  25454. s += " ";
  25455. }
  25456. p = p.parentCtx;
  25457. }
  25458. s += "]";
  25459. return s;
  25460. };
  25461. /***/ }),
  25462. /***/ "./node_modules/antlr4/Token.js":
  25463. /*!**************************************!*\
  25464. !*** ./node_modules/antlr4/Token.js ***!
  25465. \**************************************/
  25466. /*! no static exports found */
  25467. /***/ (function(module, exports, __webpack_require__) {
  25468. "use strict";
  25469. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25470. * Use of this file is governed by the BSD 3-clause license that
  25471. * can be found in the LICENSE.txt file in the project root.
  25472. */
  25473. //
  25474. // A token has properties: text, type, line, character position in the line
  25475. // (so we can ignore tabs), token channel, index, and source from which
  25476. // we obtained this token.
  25477. function Token() {
  25478. this.source = null;
  25479. this.type = null; // token type of the token
  25480. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  25481. this.start = null; // optional; return -1 if not implemented.
  25482. this.stop = null; // optional; return -1 if not implemented.
  25483. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  25484. this.line = null; // line=1..n of the 1st character
  25485. this.column = null; // beginning of the line at which it occurs, 0..n-1
  25486. this._text = null; // text of the token.
  25487. return this;
  25488. }
  25489. Token.INVALID_TYPE = 0;
  25490. // During lookahead operations, this "token" signifies we hit rule end ATN state
  25491. // and did not follow it despite needing to.
  25492. Token.EPSILON = -2;
  25493. Token.MIN_USER_TOKEN_TYPE = 1;
  25494. Token.EOF = -1;
  25495. // All tokens go to the parser (unless skip() is called in that rule)
  25496. // on a particular "channel". The parser tunes to a particular channel
  25497. // so that whitespace etc... can go to the parser on a "hidden" channel.
  25498. Token.DEFAULT_CHANNEL = 0;
  25499. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  25500. // by parser.
  25501. Token.HIDDEN_CHANNEL = 1;
  25502. // Explicitly set the text for this token. If {code text} is not
  25503. // {@code null}, then {@link //getText} will return this value rather than
  25504. // extracting the text from the input.
  25505. //
  25506. // @param text The explicit text of the token, or {@code null} if the text
  25507. // should be obtained from the input along with the start and stop indexes
  25508. // of the token.
  25509. Object.defineProperty(Token.prototype, "text", {
  25510. get: function get() {
  25511. return this._text;
  25512. },
  25513. set: function set(text) {
  25514. this._text = text;
  25515. }
  25516. });
  25517. Token.prototype.getTokenSource = function () {
  25518. return this.source[0];
  25519. };
  25520. Token.prototype.getInputStream = function () {
  25521. return this.source[1];
  25522. };
  25523. function CommonToken(source, type, channel, start, stop) {
  25524. Token.call(this);
  25525. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  25526. this.type = type !== undefined ? type : null;
  25527. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  25528. this.start = start !== undefined ? start : -1;
  25529. this.stop = stop !== undefined ? stop : -1;
  25530. this.tokenIndex = -1;
  25531. if (this.source[0] !== null) {
  25532. this.line = source[0].line;
  25533. this.column = source[0].column;
  25534. } else {
  25535. this.column = -1;
  25536. }
  25537. return this;
  25538. }
  25539. CommonToken.prototype = Object.create(Token.prototype);
  25540. CommonToken.prototype.constructor = CommonToken;
  25541. // An empty {@link Pair} which is used as the default value of
  25542. // {@link //source} for tokens that do not have a source.
  25543. CommonToken.EMPTY_SOURCE = [null, null];
  25544. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  25545. //
  25546. // <p>
  25547. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  25548. // constructed token will share a reference to the {@link //text} field and
  25549. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  25550. // be assigned the result of calling {@link //getText}, and {@link //source}
  25551. // will be constructed from the result of {@link Token//getTokenSource} and
  25552. // {@link Token//getInputStream}.</p>
  25553. //
  25554. // @param oldToken The token to copy.
  25555. //
  25556. CommonToken.prototype.clone = function () {
  25557. var t = new CommonToken(this.source, this.type, this.channel, this.start, this.stop);
  25558. t.tokenIndex = this.tokenIndex;
  25559. t.line = this.line;
  25560. t.column = this.column;
  25561. t.text = this.text;
  25562. return t;
  25563. };
  25564. Object.defineProperty(CommonToken.prototype, "text", {
  25565. get: function get() {
  25566. if (this._text !== null) {
  25567. return this._text;
  25568. }
  25569. var input = this.getInputStream();
  25570. if (input === null) {
  25571. return null;
  25572. }
  25573. var n = input.size;
  25574. if (this.start < n && this.stop < n) {
  25575. return input.getText(this.start, this.stop);
  25576. } else {
  25577. return "<EOF>";
  25578. }
  25579. },
  25580. set: function set(text) {
  25581. this._text = text;
  25582. }
  25583. });
  25584. CommonToken.prototype.toString = function () {
  25585. var txt = this.text;
  25586. if (txt !== null) {
  25587. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  25588. } else {
  25589. txt = "<no text>";
  25590. }
  25591. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" + txt + "',<" + this.type + ">" + (this.channel > 0 ? ",channel=" + this.channel : "") + "," + this.line + ":" + this.column + "]";
  25592. };
  25593. exports.Token = Token;
  25594. exports.CommonToken = CommonToken;
  25595. /***/ }),
  25596. /***/ "./node_modules/antlr4/Utils.js":
  25597. /*!**************************************!*\
  25598. !*** ./node_modules/antlr4/Utils.js ***!
  25599. \**************************************/
  25600. /*! no static exports found */
  25601. /***/ (function(module, exports, __webpack_require__) {
  25602. "use strict";
  25603. 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; };
  25604. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25605. * Use of this file is governed by the BSD 3-clause license that
  25606. * can be found in the LICENSE.txt file in the project root.
  25607. */
  25608. function arrayToString(a) {
  25609. return "[" + a.join(", ") + "]";
  25610. }
  25611. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  25612. String.prototype.hashCode = function () {
  25613. var remainder,
  25614. bytes,
  25615. h1,
  25616. h1b,
  25617. c1,
  25618. c1b,
  25619. c2,
  25620. c2b,
  25621. k1,
  25622. i,
  25623. key = this.toString();
  25624. remainder = key.length & 3; // key.length % 4
  25625. bytes = key.length - remainder;
  25626. h1 = String.prototype.seed;
  25627. c1 = 0xcc9e2d51;
  25628. c2 = 0x1b873593;
  25629. i = 0;
  25630. while (i < bytes) {
  25631. k1 = key.charCodeAt(i) & 0xff | (key.charCodeAt(++i) & 0xff) << 8 | (key.charCodeAt(++i) & 0xff) << 16 | (key.charCodeAt(++i) & 0xff) << 24;
  25632. ++i;
  25633. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  25634. k1 = k1 << 15 | k1 >>> 17;
  25635. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  25636. h1 ^= k1;
  25637. h1 = h1 << 13 | h1 >>> 19;
  25638. h1b = (h1 & 0xffff) * 5 + (((h1 >>> 16) * 5 & 0xffff) << 16) & 0xffffffff;
  25639. h1 = (h1b & 0xffff) + 0x6b64 + (((h1b >>> 16) + 0xe654 & 0xffff) << 16);
  25640. }
  25641. k1 = 0;
  25642. switch (remainder) {
  25643. case 3:
  25644. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  25645. case 2:
  25646. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  25647. case 1:
  25648. k1 ^= key.charCodeAt(i) & 0xff;
  25649. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  25650. k1 = k1 << 15 | k1 >>> 17;
  25651. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  25652. h1 ^= k1;
  25653. }
  25654. h1 ^= key.length;
  25655. h1 ^= h1 >>> 16;
  25656. h1 = (h1 & 0xffff) * 0x85ebca6b + (((h1 >>> 16) * 0x85ebca6b & 0xffff) << 16) & 0xffffffff;
  25657. h1 ^= h1 >>> 13;
  25658. h1 = (h1 & 0xffff) * 0xc2b2ae35 + (((h1 >>> 16) * 0xc2b2ae35 & 0xffff) << 16) & 0xffffffff;
  25659. h1 ^= h1 >>> 16;
  25660. return h1 >>> 0;
  25661. };
  25662. function standardEqualsFunction(a, b) {
  25663. return a.equals(b);
  25664. }
  25665. function standardHashCodeFunction(a) {
  25666. return a.hashCode();
  25667. }
  25668. function Set(hashFunction, equalsFunction) {
  25669. this.data = {};
  25670. this.hashFunction = hashFunction || standardHashCodeFunction;
  25671. this.equalsFunction = equalsFunction || standardEqualsFunction;
  25672. return this;
  25673. }
  25674. Object.defineProperty(Set.prototype, "length", {
  25675. get: function get() {
  25676. var l = 0;
  25677. for (var key in this.data) {
  25678. if (key.indexOf("hash_") === 0) {
  25679. l = l + this.data[key].length;
  25680. }
  25681. }
  25682. return l;
  25683. }
  25684. });
  25685. Set.prototype.add = function (value) {
  25686. var hash = this.hashFunction(value);
  25687. var key = "hash_" + hash;
  25688. if (key in this.data) {
  25689. var values = this.data[key];
  25690. for (var i = 0; i < values.length; i++) {
  25691. if (this.equalsFunction(value, values[i])) {
  25692. return values[i];
  25693. }
  25694. }
  25695. values.push(value);
  25696. return value;
  25697. } else {
  25698. this.data[key] = [value];
  25699. return value;
  25700. }
  25701. };
  25702. Set.prototype.contains = function (value) {
  25703. return this.get(value) != null;
  25704. };
  25705. Set.prototype.get = function (value) {
  25706. var hash = this.hashFunction(value);
  25707. var key = "hash_" + hash;
  25708. if (key in this.data) {
  25709. var values = this.data[key];
  25710. for (var i = 0; i < values.length; i++) {
  25711. if (this.equalsFunction(value, values[i])) {
  25712. return values[i];
  25713. }
  25714. }
  25715. }
  25716. return null;
  25717. };
  25718. Set.prototype.values = function () {
  25719. var l = [];
  25720. for (var key in this.data) {
  25721. if (key.indexOf("hash_") === 0) {
  25722. l = l.concat(this.data[key]);
  25723. }
  25724. }
  25725. return l;
  25726. };
  25727. Set.prototype.toString = function () {
  25728. return arrayToString(this.values());
  25729. };
  25730. function BitSet() {
  25731. this.data = [];
  25732. return this;
  25733. }
  25734. BitSet.prototype.add = function (value) {
  25735. this.data[value] = true;
  25736. };
  25737. BitSet.prototype.or = function (set) {
  25738. var bits = this;
  25739. Object.keys(set.data).map(function (alt) {
  25740. bits.add(alt);
  25741. });
  25742. };
  25743. BitSet.prototype.remove = function (value) {
  25744. delete this.data[value];
  25745. };
  25746. BitSet.prototype.contains = function (value) {
  25747. return this.data[value] === true;
  25748. };
  25749. BitSet.prototype.values = function () {
  25750. return Object.keys(this.data);
  25751. };
  25752. BitSet.prototype.minValue = function () {
  25753. return Math.min.apply(null, this.values());
  25754. };
  25755. BitSet.prototype.hashCode = function () {
  25756. var hash = new Hash();
  25757. hash.update(this.values());
  25758. return hash.finish();
  25759. };
  25760. BitSet.prototype.equals = function (other) {
  25761. if (!(other instanceof BitSet)) {
  25762. return false;
  25763. }
  25764. return this.hashCode() === other.hashCode();
  25765. };
  25766. Object.defineProperty(BitSet.prototype, "length", {
  25767. get: function get() {
  25768. return this.values().length;
  25769. }
  25770. });
  25771. BitSet.prototype.toString = function () {
  25772. return "{" + this.values().join(", ") + "}";
  25773. };
  25774. function Map(hashFunction, equalsFunction) {
  25775. this.data = {};
  25776. this.hashFunction = hashFunction || standardHashCodeFunction;
  25777. this.equalsFunction = equalsFunction || standardEqualsFunction;
  25778. return this;
  25779. }
  25780. Object.defineProperty(Map.prototype, "length", {
  25781. get: function get() {
  25782. var l = 0;
  25783. for (var hashKey in this.data) {
  25784. if (hashKey.indexOf("hash_") === 0) {
  25785. l = l + this.data[hashKey].length;
  25786. }
  25787. }
  25788. return l;
  25789. }
  25790. });
  25791. Map.prototype.put = function (key, value) {
  25792. var hashKey = "hash_" + this.hashFunction(key);
  25793. if (hashKey in this.data) {
  25794. var entries = this.data[hashKey];
  25795. for (var i = 0; i < entries.length; i++) {
  25796. var entry = entries[i];
  25797. if (this.equalsFunction(key, entry.key)) {
  25798. var oldValue = entry.value;
  25799. entry.value = value;
  25800. return oldValue;
  25801. }
  25802. }
  25803. entries.push({ key: key, value: value });
  25804. return value;
  25805. } else {
  25806. this.data[hashKey] = [{ key: key, value: value }];
  25807. return value;
  25808. }
  25809. };
  25810. Map.prototype.containsKey = function (key) {
  25811. var hashKey = "hash_" + this.hashFunction(key);
  25812. if (hashKey in this.data) {
  25813. var entries = this.data[hashKey];
  25814. for (var i = 0; i < entries.length; i++) {
  25815. var entry = entries[i];
  25816. if (this.equalsFunction(key, entry.key)) return true;
  25817. }
  25818. }
  25819. return false;
  25820. };
  25821. Map.prototype.get = function (key) {
  25822. var hashKey = "hash_" + this.hashFunction(key);
  25823. if (hashKey in this.data) {
  25824. var entries = this.data[hashKey];
  25825. for (var i = 0; i < entries.length; i++) {
  25826. var entry = entries[i];
  25827. if (this.equalsFunction(key, entry.key)) return entry.value;
  25828. }
  25829. }
  25830. return null;
  25831. };
  25832. Map.prototype.entries = function () {
  25833. var l = [];
  25834. for (var key in this.data) {
  25835. if (key.indexOf("hash_") === 0) {
  25836. l = l.concat(this.data[key]);
  25837. }
  25838. }
  25839. return l;
  25840. };
  25841. Map.prototype.getKeys = function () {
  25842. return this.entries().map(function (e) {
  25843. return e.key;
  25844. });
  25845. };
  25846. Map.prototype.getValues = function () {
  25847. return this.entries().map(function (e) {
  25848. return e.value;
  25849. });
  25850. };
  25851. Map.prototype.toString = function () {
  25852. var ss = this.entries().map(function (entry) {
  25853. return '{' + entry.key + ':' + entry.value + '}';
  25854. });
  25855. return '[' + ss.join(", ") + ']';
  25856. };
  25857. function AltDict() {
  25858. this.data = {};
  25859. return this;
  25860. }
  25861. AltDict.prototype.get = function (key) {
  25862. key = "k-" + key;
  25863. if (key in this.data) {
  25864. return this.data[key];
  25865. } else {
  25866. return null;
  25867. }
  25868. };
  25869. AltDict.prototype.put = function (key, value) {
  25870. key = "k-" + key;
  25871. this.data[key] = value;
  25872. };
  25873. AltDict.prototype.values = function () {
  25874. var data = this.data;
  25875. var keys = Object.keys(this.data);
  25876. return keys.map(function (key) {
  25877. return data[key];
  25878. });
  25879. };
  25880. function DoubleDict() {
  25881. return this;
  25882. }
  25883. function Hash() {
  25884. this.count = 0;
  25885. this.hash = 0;
  25886. return this;
  25887. }
  25888. Hash.prototype.update = function () {
  25889. for (var i = 0; i < arguments.length; i++) {
  25890. var value = arguments[i];
  25891. if (value == null) continue;
  25892. if (Array.isArray(value)) this.update.apply(value);else {
  25893. var k = 0;
  25894. switch (typeof value === "undefined" ? "undefined" : _typeof(value)) {
  25895. case 'undefined':
  25896. case 'function':
  25897. continue;
  25898. case 'number':
  25899. case 'boolean':
  25900. k = value;
  25901. break;
  25902. case 'string':
  25903. k = value.hashCode();
  25904. break;
  25905. default:
  25906. value.updateHashCode(this);
  25907. continue;
  25908. }
  25909. k = k * 0xCC9E2D51;
  25910. k = k << 15 | k >>> 32 - 15;
  25911. k = k * 0x1B873593;
  25912. this.count = this.count + 1;
  25913. var hash = this.hash ^ k;
  25914. hash = hash << 13 | hash >>> 32 - 13;
  25915. hash = hash * 5 + 0xE6546B64;
  25916. this.hash = hash;
  25917. }
  25918. }
  25919. };
  25920. Hash.prototype.finish = function () {
  25921. var hash = this.hash ^ this.count * 4;
  25922. hash = hash ^ hash >>> 16;
  25923. hash = hash * 0x85EBCA6B;
  25924. hash = hash ^ hash >>> 13;
  25925. hash = hash * 0xC2B2AE35;
  25926. hash = hash ^ hash >>> 16;
  25927. return hash;
  25928. };
  25929. function hashStuff() {
  25930. var hash = new Hash();
  25931. hash.update.apply(arguments);
  25932. return hash.finish();
  25933. }
  25934. DoubleDict.prototype.get = function (a, b) {
  25935. var d = this[a] || null;
  25936. return d === null ? null : d[b] || null;
  25937. };
  25938. DoubleDict.prototype.set = function (a, b, o) {
  25939. var d = this[a] || null;
  25940. if (d === null) {
  25941. d = {};
  25942. this[a] = d;
  25943. }
  25944. d[b] = o;
  25945. };
  25946. function escapeWhitespace(s, escapeSpaces) {
  25947. s = s.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
  25948. if (escapeSpaces) {
  25949. s = s.replace(/ /g, "\xB7");
  25950. }
  25951. return s;
  25952. }
  25953. function titleCase(str) {
  25954. return str.replace(/\w\S*/g, function (txt) {
  25955. return txt.charAt(0).toUpperCase() + txt.substr(1);
  25956. });
  25957. };
  25958. function equalArrays(a, b) {
  25959. if (!Array.isArray(a) || !Array.isArray(b)) return false;
  25960. if (a == b) return true;
  25961. if (a.length != b.length) return false;
  25962. for (var i = 0; i < a.length; i++) {
  25963. if (a[i] == b[i]) continue;
  25964. if (!a[i].equals(b[i])) return false;
  25965. }
  25966. return true;
  25967. };
  25968. exports.Hash = Hash;
  25969. exports.Set = Set;
  25970. exports.Map = Map;
  25971. exports.BitSet = BitSet;
  25972. exports.AltDict = AltDict;
  25973. exports.DoubleDict = DoubleDict;
  25974. exports.hashStuff = hashStuff;
  25975. exports.escapeWhitespace = escapeWhitespace;
  25976. exports.arrayToString = arrayToString;
  25977. exports.titleCase = titleCase;
  25978. exports.equalArrays = equalArrays;
  25979. /***/ }),
  25980. /***/ "./node_modules/antlr4/atn/ATN.js":
  25981. /*!****************************************!*\
  25982. !*** ./node_modules/antlr4/atn/ATN.js ***!
  25983. \****************************************/
  25984. /*! no static exports found */
  25985. /***/ (function(module, exports, __webpack_require__) {
  25986. "use strict";
  25987. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25988. * Use of this file is governed by the BSD 3-clause license that
  25989. * can be found in the LICENSE.txt file in the project root.
  25990. */
  25991. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  25992. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  25993. function ATN(grammarType, maxTokenType) {
  25994. // Used for runtime deserialization of ATNs from strings///
  25995. // The type of the ATN.
  25996. this.grammarType = grammarType;
  25997. // The maximum value for any symbol recognized by a transition in the ATN.
  25998. this.maxTokenType = maxTokenType;
  25999. this.states = [];
  26000. // Each subrule/rule is a decision point and we must track them so we
  26001. // can go back later and build DFA predictors for them. This includes
  26002. // all the rules, subrules, optional blocks, ()+, ()* etc...
  26003. this.decisionToState = [];
  26004. // Maps from rule index to starting state number.
  26005. this.ruleToStartState = [];
  26006. // Maps from rule index to stop state number.
  26007. this.ruleToStopState = null;
  26008. this.modeNameToStartState = {};
  26009. // For lexer ATNs, this maps the rule index to the resulting token type.
  26010. // For parser ATNs, this maps the rule index to the generated bypass token
  26011. // type if the
  26012. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  26013. // deserialization option was specified; otherwise, this is {@code null}.
  26014. this.ruleToTokenType = null;
  26015. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  26016. // be referenced by action transitions in the ATN.
  26017. this.lexerActions = null;
  26018. this.modeToStartState = [];
  26019. return this;
  26020. }
  26021. // Compute the set of valid tokens that can occur starting in state {@code s}.
  26022. // If {@code ctx} is null, the set of tokens will not include what can follow
  26023. // the rule surrounding {@code s}. In other words, the set will be
  26024. // restricted to tokens reachable staying within {@code s}'s rule.
  26025. ATN.prototype.nextTokensInContext = function (s, ctx) {
  26026. var anal = new LL1Analyzer(this);
  26027. return anal.LOOK(s, null, ctx);
  26028. };
  26029. // Compute the set of valid tokens that can occur starting in {@code s} and
  26030. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  26031. // rule.
  26032. ATN.prototype.nextTokensNoContext = function (s) {
  26033. if (s.nextTokenWithinRule !== null) {
  26034. return s.nextTokenWithinRule;
  26035. }
  26036. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  26037. s.nextTokenWithinRule.readOnly = true;
  26038. return s.nextTokenWithinRule;
  26039. };
  26040. ATN.prototype.nextTokens = function (s, ctx) {
  26041. if (ctx === undefined) {
  26042. return this.nextTokensNoContext(s);
  26043. } else {
  26044. return this.nextTokensInContext(s, ctx);
  26045. }
  26046. };
  26047. ATN.prototype.addState = function (state) {
  26048. if (state !== null) {
  26049. state.atn = this;
  26050. state.stateNumber = this.states.length;
  26051. }
  26052. this.states.push(state);
  26053. };
  26054. ATN.prototype.removeState = function (state) {
  26055. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  26056. };
  26057. ATN.prototype.defineDecisionState = function (s) {
  26058. this.decisionToState.push(s);
  26059. s.decision = this.decisionToState.length - 1;
  26060. return s.decision;
  26061. };
  26062. ATN.prototype.getDecisionState = function (decision) {
  26063. if (this.decisionToState.length === 0) {
  26064. return null;
  26065. } else {
  26066. return this.decisionToState[decision];
  26067. }
  26068. };
  26069. // Computes the set of input symbols which could follow ATN state number
  26070. // {@code stateNumber} in the specified full {@code context}. This method
  26071. // considers the complete parser context, but does not evaluate semantic
  26072. // predicates (i.e. all predicates encountered during the calculation are
  26073. // assumed true). If a path in the ATN exists from the starting state to the
  26074. // {@link RuleStopState} of the outermost context without matching any
  26075. // symbols, {@link Token//EOF} is added to the returned set.
  26076. //
  26077. // <p>If {@code context} is {@code null}, it is treated as
  26078. // {@link ParserRuleContext//EMPTY}.</p>
  26079. //
  26080. // @param stateNumber the ATN state number
  26081. // @param context the full parse context
  26082. // @return The set of potentially valid input symbols which could follow the
  26083. // specified state in the specified context.
  26084. // @throws IllegalArgumentException if the ATN does not contain a state with
  26085. // number {@code stateNumber}
  26086. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  26087. ATN.prototype.getExpectedTokens = function (stateNumber, ctx) {
  26088. if (stateNumber < 0 || stateNumber >= this.states.length) {
  26089. throw "Invalid state number.";
  26090. }
  26091. var s = this.states[stateNumber];
  26092. var following = this.nextTokens(s);
  26093. if (!following.contains(Token.EPSILON)) {
  26094. return following;
  26095. }
  26096. var expected = new IntervalSet();
  26097. expected.addSet(following);
  26098. expected.removeOne(Token.EPSILON);
  26099. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  26100. var invokingState = this.states[ctx.invokingState];
  26101. var rt = invokingState.transitions[0];
  26102. following = this.nextTokens(rt.followState);
  26103. expected.addSet(following);
  26104. expected.removeOne(Token.EPSILON);
  26105. ctx = ctx.parentCtx;
  26106. }
  26107. if (following.contains(Token.EPSILON)) {
  26108. expected.addOne(Token.EOF);
  26109. }
  26110. return expected;
  26111. };
  26112. ATN.INVALID_ALT_NUMBER = 0;
  26113. exports.ATN = ATN;
  26114. /***/ }),
  26115. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  26116. /*!**********************************************!*\
  26117. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  26118. \**********************************************/
  26119. /*! no static exports found */
  26120. /***/ (function(module, exports, __webpack_require__) {
  26121. "use strict";
  26122. //
  26123. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26124. * Use of this file is governed by the BSD 3-clause license that
  26125. * can be found in the LICENSE.txt file in the project root.
  26126. */
  26127. ///
  26128. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  26129. // The syntactic context is a graph-structured stack node whose
  26130. // path(s) to the root is the rule invocation(s)
  26131. // chain used to arrive at the state. The semantic context is
  26132. // the tree of semantic predicates encountered before reaching
  26133. // an ATN state.
  26134. ///
  26135. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  26136. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  26137. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  26138. function checkParams(params, isCfg) {
  26139. if (params === null) {
  26140. var result = { state: null, alt: null, context: null, semanticContext: null };
  26141. if (isCfg) {
  26142. result.reachesIntoOuterContext = 0;
  26143. }
  26144. return result;
  26145. } else {
  26146. var props = {};
  26147. props.state = params.state || null;
  26148. props.alt = params.alt === undefined ? null : params.alt;
  26149. props.context = params.context || null;
  26150. props.semanticContext = params.semanticContext || null;
  26151. if (isCfg) {
  26152. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  26153. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  26154. }
  26155. return props;
  26156. }
  26157. }
  26158. function ATNConfig(params, config) {
  26159. this.checkContext(params, config);
  26160. params = checkParams(params);
  26161. config = checkParams(config, true);
  26162. // The ATN state associated with this configuration///
  26163. this.state = params.state !== null ? params.state : config.state;
  26164. // What alt (or lexer rule) is predicted by this configuration///
  26165. this.alt = params.alt !== null ? params.alt : config.alt;
  26166. // The stack of invoking states leading to the rule/states associated
  26167. // with this config. We track only those contexts pushed during
  26168. // execution of the ATN simulator.
  26169. this.context = params.context !== null ? params.context : config.context;
  26170. this.semanticContext = params.semanticContext !== null ? params.semanticContext : config.semanticContext !== null ? config.semanticContext : SemanticContext.NONE;
  26171. // We cannot execute predicates dependent upon local context unless
  26172. // we know for sure we are in the correct context. Because there is
  26173. // no way to do this efficiently, we simply cannot evaluate
  26174. // dependent predicates unless we are in the rule that initially
  26175. // invokes the ATN simulator.
  26176. //
  26177. // closure() tracks the depth of how far we dip into the
  26178. // outer context: depth &gt; 0. Note that it may not be totally
  26179. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  26180. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  26181. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  26182. return this;
  26183. }
  26184. ATNConfig.prototype.checkContext = function (params, config) {
  26185. if ((params.context === null || params.context === undefined) && (config === null || config.context === null || config.context === undefined)) {
  26186. this.context = null;
  26187. }
  26188. };
  26189. ATNConfig.prototype.hashCode = function () {
  26190. var hash = new Hash();
  26191. this.updateHashCode(hash);
  26192. return hash.finish();
  26193. };
  26194. ATNConfig.prototype.updateHashCode = function (hash) {
  26195. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  26196. };
  26197. // An ATN configuration is equal to another if both have
  26198. // the same state, they predict the same alternative, and
  26199. // syntactic/semantic contexts are the same.
  26200. ATNConfig.prototype.equals = function (other) {
  26201. if (this === other) {
  26202. return true;
  26203. } else if (!(other instanceof ATNConfig)) {
  26204. return false;
  26205. } else {
  26206. 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;
  26207. }
  26208. };
  26209. ATNConfig.prototype.hashCodeForConfigSet = function () {
  26210. var hash = new Hash();
  26211. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  26212. return hash.finish();
  26213. };
  26214. ATNConfig.prototype.equalsForConfigSet = function (other) {
  26215. if (this === other) {
  26216. return true;
  26217. } else if (!(other instanceof ATNConfig)) {
  26218. return false;
  26219. } else {
  26220. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && this.semanticContext.equals(other.semanticContext);
  26221. }
  26222. };
  26223. ATNConfig.prototype.toString = function () {
  26224. return "(" + this.state + "," + this.alt + (this.context !== null ? ",[" + this.context.toString() + "]" : "") + (this.semanticContext !== SemanticContext.NONE ? "," + this.semanticContext.toString() : "") + (this.reachesIntoOuterContext > 0 ? ",up=" + this.reachesIntoOuterContext : "") + ")";
  26225. };
  26226. function LexerATNConfig(params, config) {
  26227. ATNConfig.call(this, params, config);
  26228. // This is the backing field for {@link //getLexerActionExecutor}.
  26229. var lexerActionExecutor = params.lexerActionExecutor || null;
  26230. this.lexerActionExecutor = lexerActionExecutor || (config !== null ? config.lexerActionExecutor : null);
  26231. this.passedThroughNonGreedyDecision = config !== null ? this.checkNonGreedyDecision(config, this.state) : false;
  26232. return this;
  26233. }
  26234. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  26235. LexerATNConfig.prototype.constructor = LexerATNConfig;
  26236. LexerATNConfig.prototype.updateHashCode = function (hash) {
  26237. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  26238. };
  26239. LexerATNConfig.prototype.equals = function (other) {
  26240. 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);
  26241. };
  26242. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  26243. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  26244. LexerATNConfig.prototype.checkNonGreedyDecision = function (source, target) {
  26245. return source.passedThroughNonGreedyDecision || target instanceof DecisionState && target.nonGreedy;
  26246. };
  26247. exports.ATNConfig = ATNConfig;
  26248. exports.LexerATNConfig = LexerATNConfig;
  26249. /***/ }),
  26250. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  26251. /*!*************************************************!*\
  26252. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  26253. \*************************************************/
  26254. /*! no static exports found */
  26255. /***/ (function(module, exports, __webpack_require__) {
  26256. "use strict";
  26257. //
  26258. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26259. * Use of this file is governed by the BSD 3-clause license that
  26260. * can be found in the LICENSE.txt file in the project root.
  26261. */
  26262. //
  26263. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  26264. // info about the set, with support for combining similar configurations using a
  26265. // graph-structured stack.
  26266. ///
  26267. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  26268. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  26269. var Hash = Utils.Hash;
  26270. var Set = Utils.Set;
  26271. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  26272. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  26273. function hashATNConfig(c) {
  26274. return c.hashCodeForConfigSet();
  26275. }
  26276. function equalATNConfigs(a, b) {
  26277. if (a === b) {
  26278. return true;
  26279. } else if (a === null || b === null) {
  26280. return false;
  26281. } else return a.equalsForConfigSet(b);
  26282. }
  26283. function ATNConfigSet(fullCtx) {
  26284. //
  26285. // The reason that we need this is because we don't want the hash map to use
  26286. // the standard hash code and equals. We need all configurations with the
  26287. // same
  26288. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  26289. // doubles
  26290. // the number of objects associated with ATNConfigs. The other solution is
  26291. // to
  26292. // use a hash table that lets us specify the equals/hashcode operation.
  26293. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  26294. // when we go readonly as this set becomes a DFA state.
  26295. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  26296. // Indicates that this configuration set is part of a full context
  26297. // LL prediction. It will be used to determine how to merge $. With SLL
  26298. // it's a wildcard whereas it is not for LL context merge.
  26299. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  26300. // Indicates that the set of configurations is read-only. Do not
  26301. // allow any code to manipulate the set; DFA states will point at
  26302. // the sets and they must not change. This does not protect the other
  26303. // fields; in particular, conflictingAlts is set after
  26304. // we've made this readonly.
  26305. this.readOnly = false;
  26306. // Track the elements as they are added to the set; supports get(i)///
  26307. this.configs = [];
  26308. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  26309. // together, saves recomputation
  26310. // TODO: can we track conflicts as they are added to save scanning configs
  26311. // later?
  26312. this.uniqueAlt = 0;
  26313. this.conflictingAlts = null;
  26314. // Used in parser and lexer. In lexer, it indicates we hit a pred
  26315. // while computing a closure operation. Don't make a DFA state from this.
  26316. this.hasSemanticContext = false;
  26317. this.dipsIntoOuterContext = false;
  26318. this.cachedHashCode = -1;
  26319. return this;
  26320. }
  26321. // Adding a new config means merging contexts with existing configs for
  26322. // {@code (s, i, pi, _)}, where {@code s} is the
  26323. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  26324. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  26325. // {@code (s,i,pi)} as key.
  26326. //
  26327. // <p>This method updates {@link //dipsIntoOuterContext} and
  26328. // {@link //hasSemanticContext} when necessary.</p>
  26329. // /
  26330. ATNConfigSet.prototype.add = function (config, mergeCache) {
  26331. if (mergeCache === undefined) {
  26332. mergeCache = null;
  26333. }
  26334. if (this.readOnly) {
  26335. throw "This set is readonly";
  26336. }
  26337. if (config.semanticContext !== SemanticContext.NONE) {
  26338. this.hasSemanticContext = true;
  26339. }
  26340. if (config.reachesIntoOuterContext > 0) {
  26341. this.dipsIntoOuterContext = true;
  26342. }
  26343. var existing = this.configLookup.add(config);
  26344. if (existing === config) {
  26345. this.cachedHashCode = -1;
  26346. this.configs.push(config); // track order here
  26347. return true;
  26348. }
  26349. // a previous (s,i,pi,_), merge with it and save result
  26350. var rootIsWildcard = !this.fullCtx;
  26351. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  26352. // no need to check for existing.context, config.context in cache
  26353. // since only way to create new graphs is "call rule" and here. We
  26354. // cache at both places.
  26355. existing.reachesIntoOuterContext = Math.max(existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  26356. // make sure to preserve the precedence filter suppression during the merge
  26357. if (config.precedenceFilterSuppressed) {
  26358. existing.precedenceFilterSuppressed = true;
  26359. }
  26360. existing.context = merged; // replace context; no need to alt mapping
  26361. return true;
  26362. };
  26363. ATNConfigSet.prototype.getStates = function () {
  26364. var states = new Set();
  26365. for (var i = 0; i < this.configs.length; i++) {
  26366. states.add(this.configs[i].state);
  26367. }
  26368. return states;
  26369. };
  26370. ATNConfigSet.prototype.getPredicates = function () {
  26371. var preds = [];
  26372. for (var i = 0; i < this.configs.length; i++) {
  26373. var c = this.configs[i].semanticContext;
  26374. if (c !== SemanticContext.NONE) {
  26375. preds.push(c.semanticContext);
  26376. }
  26377. }
  26378. return preds;
  26379. };
  26380. Object.defineProperty(ATNConfigSet.prototype, "items", {
  26381. get: function get() {
  26382. return this.configs;
  26383. }
  26384. });
  26385. ATNConfigSet.prototype.optimizeConfigs = function (interpreter) {
  26386. if (this.readOnly) {
  26387. throw "This set is readonly";
  26388. }
  26389. if (this.configLookup.length === 0) {
  26390. return;
  26391. }
  26392. for (var i = 0; i < this.configs.length; i++) {
  26393. var config = this.configs[i];
  26394. config.context = interpreter.getCachedContext(config.context);
  26395. }
  26396. };
  26397. ATNConfigSet.prototype.addAll = function (coll) {
  26398. for (var i = 0; i < coll.length; i++) {
  26399. this.add(coll[i]);
  26400. }
  26401. return false;
  26402. };
  26403. ATNConfigSet.prototype.equals = function (other) {
  26404. 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;
  26405. };
  26406. ATNConfigSet.prototype.hashCode = function () {
  26407. var hash = new Hash();
  26408. this.updateHashCode(hash);
  26409. return hash.finish();
  26410. };
  26411. ATNConfigSet.prototype.updateHashCode = function (hash) {
  26412. if (this.readOnly) {
  26413. if (this.cachedHashCode === -1) {
  26414. var hash = new Hash();
  26415. hash.update(this.configs);
  26416. this.cachedHashCode = hash.finish();
  26417. }
  26418. hash.update(this.cachedHashCode);
  26419. } else {
  26420. hash.update(this.configs);
  26421. }
  26422. };
  26423. Object.defineProperty(ATNConfigSet.prototype, "length", {
  26424. get: function get() {
  26425. return this.configs.length;
  26426. }
  26427. });
  26428. ATNConfigSet.prototype.isEmpty = function () {
  26429. return this.configs.length === 0;
  26430. };
  26431. ATNConfigSet.prototype.contains = function (item) {
  26432. if (this.configLookup === null) {
  26433. throw "This method is not implemented for readonly sets.";
  26434. }
  26435. return this.configLookup.contains(item);
  26436. };
  26437. ATNConfigSet.prototype.containsFast = function (item) {
  26438. if (this.configLookup === null) {
  26439. throw "This method is not implemented for readonly sets.";
  26440. }
  26441. return this.configLookup.containsFast(item);
  26442. };
  26443. ATNConfigSet.prototype.clear = function () {
  26444. if (this.readOnly) {
  26445. throw "This set is readonly";
  26446. }
  26447. this.configs = [];
  26448. this.cachedHashCode = -1;
  26449. this.configLookup = new Set();
  26450. };
  26451. ATNConfigSet.prototype.setReadonly = function (readOnly) {
  26452. this.readOnly = readOnly;
  26453. if (readOnly) {
  26454. this.configLookup = null; // can't mod, no need for lookup cache
  26455. }
  26456. };
  26457. ATNConfigSet.prototype.toString = function () {
  26458. 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" : "");
  26459. };
  26460. function OrderedATNConfigSet() {
  26461. ATNConfigSet.call(this);
  26462. this.configLookup = new Set();
  26463. return this;
  26464. }
  26465. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  26466. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  26467. exports.ATNConfigSet = ATNConfigSet;
  26468. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  26469. /***/ }),
  26470. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  26471. /*!**************************************************************!*\
  26472. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  26473. \**************************************************************/
  26474. /*! no static exports found */
  26475. /***/ (function(module, exports, __webpack_require__) {
  26476. "use strict";
  26477. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26478. * Use of this file is governed by the BSD 3-clause license that
  26479. * can be found in the LICENSE.txt file in the project root.
  26480. */
  26481. function ATNDeserializationOptions(copyFrom) {
  26482. if (copyFrom === undefined) {
  26483. copyFrom = null;
  26484. }
  26485. this.readOnly = false;
  26486. this.verifyATN = copyFrom === null ? true : copyFrom.verifyATN;
  26487. this.generateRuleBypassTransitions = copyFrom === null ? false : copyFrom.generateRuleBypassTransitions;
  26488. return this;
  26489. }
  26490. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  26491. ATNDeserializationOptions.defaultOptions.readOnly = true;
  26492. // def __setattr__(self, key, value):
  26493. // if key!="readOnly" and self.readOnly:
  26494. // raise Exception("The object is read only.")
  26495. // super(type(self), self).__setattr__(key,value)
  26496. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  26497. /***/ }),
  26498. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  26499. /*!****************************************************!*\
  26500. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  26501. \****************************************************/
  26502. /*! no static exports found */
  26503. /***/ (function(module, exports, __webpack_require__) {
  26504. "use strict";
  26505. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26506. * Use of this file is governed by the BSD 3-clause license that
  26507. * can be found in the LICENSE.txt file in the project root.
  26508. */
  26509. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  26510. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  26511. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  26512. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  26513. var ATNState = ATNStates.ATNState;
  26514. var BasicState = ATNStates.BasicState;
  26515. var DecisionState = ATNStates.DecisionState;
  26516. var BlockStartState = ATNStates.BlockStartState;
  26517. var BlockEndState = ATNStates.BlockEndState;
  26518. var LoopEndState = ATNStates.LoopEndState;
  26519. var RuleStartState = ATNStates.RuleStartState;
  26520. var RuleStopState = ATNStates.RuleStopState;
  26521. var TokensStartState = ATNStates.TokensStartState;
  26522. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  26523. var StarLoopbackState = ATNStates.StarLoopbackState;
  26524. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  26525. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  26526. var StarBlockStartState = ATNStates.StarBlockStartState;
  26527. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  26528. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  26529. var Transition = Transitions.Transition;
  26530. var AtomTransition = Transitions.AtomTransition;
  26531. var SetTransition = Transitions.SetTransition;
  26532. var NotSetTransition = Transitions.NotSetTransition;
  26533. var RuleTransition = Transitions.RuleTransition;
  26534. var RangeTransition = Transitions.RangeTransition;
  26535. var ActionTransition = Transitions.ActionTransition;
  26536. var EpsilonTransition = Transitions.EpsilonTransition;
  26537. var WildcardTransition = Transitions.WildcardTransition;
  26538. var PredicateTransition = Transitions.PredicateTransition;
  26539. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  26540. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  26541. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  26542. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  26543. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  26544. var LexerActionType = LexerActions.LexerActionType;
  26545. var LexerSkipAction = LexerActions.LexerSkipAction;
  26546. var LexerChannelAction = LexerActions.LexerChannelAction;
  26547. var LexerCustomAction = LexerActions.LexerCustomAction;
  26548. var LexerMoreAction = LexerActions.LexerMoreAction;
  26549. var LexerTypeAction = LexerActions.LexerTypeAction;
  26550. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  26551. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  26552. var LexerModeAction = LexerActions.LexerModeAction;
  26553. // This is the earliest supported serialized UUID.
  26554. // stick to serialized version for now, we don't need a UUID instance
  26555. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  26556. //
  26557. // This UUID indicates the serialized ATN contains two sets of
  26558. // IntervalSets, where the second set's values are encoded as
  26559. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  26560. //
  26561. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  26562. // This list contains all of the currently supported UUIDs, ordered by when
  26563. // the feature first appeared in this branch.
  26564. var SUPPORTED_UUIDS = [BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP];
  26565. var SERIALIZED_VERSION = 3;
  26566. // This is the current serialized UUID.
  26567. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  26568. function initArray(length, value) {
  26569. var tmp = [];
  26570. tmp[length - 1] = value;
  26571. return tmp.map(function (i) {
  26572. return value;
  26573. });
  26574. }
  26575. function ATNDeserializer(options) {
  26576. if (options === undefined || options === null) {
  26577. options = ATNDeserializationOptions.defaultOptions;
  26578. }
  26579. this.deserializationOptions = options;
  26580. this.stateFactories = null;
  26581. this.actionFactories = null;
  26582. return this;
  26583. }
  26584. // Determines if a particular serialized representation of an ATN supports
  26585. // a particular feature, identified by the {@link UUID} used for serializing
  26586. // the ATN at the time the feature was first introduced.
  26587. //
  26588. // @param feature The {@link UUID} marking the first time the feature was
  26589. // supported in the serialized ATN.
  26590. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  26591. // currently being deserialized.
  26592. // @return {@code true} if the {@code actualUuid} value represents a
  26593. // serialized ATN at or after the feature identified by {@code feature} was
  26594. // introduced; otherwise, {@code false}.
  26595. ATNDeserializer.prototype.isFeatureSupported = function (feature, actualUuid) {
  26596. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  26597. if (idx1 < 0) {
  26598. return false;
  26599. }
  26600. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  26601. return idx2 >= idx1;
  26602. };
  26603. ATNDeserializer.prototype.deserialize = function (data) {
  26604. this.reset(data);
  26605. this.checkVersion();
  26606. this.checkUUID();
  26607. var atn = this.readATN();
  26608. this.readStates(atn);
  26609. this.readRules(atn);
  26610. this.readModes(atn);
  26611. var sets = [];
  26612. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  26613. this.readSets(atn, sets, this.readInt.bind(this));
  26614. // Next, if the ATN was serialized with the Unicode SMP feature,
  26615. // deserialize sets with 32-bit arguments <= U+10FFFF.
  26616. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  26617. this.readSets(atn, sets, this.readInt32.bind(this));
  26618. }
  26619. this.readEdges(atn, sets);
  26620. this.readDecisions(atn);
  26621. this.readLexerActions(atn);
  26622. this.markPrecedenceDecisions(atn);
  26623. this.verifyATN(atn);
  26624. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER) {
  26625. this.generateRuleBypassTransitions(atn);
  26626. // re-verify after modification
  26627. this.verifyATN(atn);
  26628. }
  26629. return atn;
  26630. };
  26631. ATNDeserializer.prototype.reset = function (data) {
  26632. var adjust = function adjust(c) {
  26633. var v = c.charCodeAt(0);
  26634. return v > 1 ? v - 2 : v + 65533;
  26635. };
  26636. var temp = data.split("").map(adjust);
  26637. // don't adjust the first value since that's the version number
  26638. temp[0] = data.charCodeAt(0);
  26639. this.data = temp;
  26640. this.pos = 0;
  26641. };
  26642. ATNDeserializer.prototype.checkVersion = function () {
  26643. var version = this.readInt();
  26644. if (version !== SERIALIZED_VERSION) {
  26645. throw "Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").";
  26646. }
  26647. };
  26648. ATNDeserializer.prototype.checkUUID = function () {
  26649. var uuid = this.readUUID();
  26650. if (SUPPORTED_UUIDS.indexOf(uuid) < 0) {
  26651. throw "Could not deserialize ATN with UUID: " + uuid + " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID;
  26652. }
  26653. this.uuid = uuid;
  26654. };
  26655. ATNDeserializer.prototype.readATN = function () {
  26656. var grammarType = this.readInt();
  26657. var maxTokenType = this.readInt();
  26658. return new ATN(grammarType, maxTokenType);
  26659. };
  26660. ATNDeserializer.prototype.readStates = function (atn) {
  26661. var j, pair, stateNumber;
  26662. var loopBackStateNumbers = [];
  26663. var endStateNumbers = [];
  26664. var nstates = this.readInt();
  26665. for (var i = 0; i < nstates; i++) {
  26666. var stype = this.readInt();
  26667. // ignore bad type of states
  26668. if (stype === ATNState.INVALID_TYPE) {
  26669. atn.addState(null);
  26670. continue;
  26671. }
  26672. var ruleIndex = this.readInt();
  26673. if (ruleIndex === 0xFFFF) {
  26674. ruleIndex = -1;
  26675. }
  26676. var s = this.stateFactory(stype, ruleIndex);
  26677. if (stype === ATNState.LOOP_END) {
  26678. // special case
  26679. var loopBackStateNumber = this.readInt();
  26680. loopBackStateNumbers.push([s, loopBackStateNumber]);
  26681. } else if (s instanceof BlockStartState) {
  26682. var endStateNumber = this.readInt();
  26683. endStateNumbers.push([s, endStateNumber]);
  26684. }
  26685. atn.addState(s);
  26686. }
  26687. // delay the assignment of loop back and end states until we know all the
  26688. // state instances have been initialized
  26689. for (j = 0; j < loopBackStateNumbers.length; j++) {
  26690. pair = loopBackStateNumbers[j];
  26691. pair[0].loopBackState = atn.states[pair[1]];
  26692. }
  26693. for (j = 0; j < endStateNumbers.length; j++) {
  26694. pair = endStateNumbers[j];
  26695. pair[0].endState = atn.states[pair[1]];
  26696. }
  26697. var numNonGreedyStates = this.readInt();
  26698. for (j = 0; j < numNonGreedyStates; j++) {
  26699. stateNumber = this.readInt();
  26700. atn.states[stateNumber].nonGreedy = true;
  26701. }
  26702. var numPrecedenceStates = this.readInt();
  26703. for (j = 0; j < numPrecedenceStates; j++) {
  26704. stateNumber = this.readInt();
  26705. atn.states[stateNumber].isPrecedenceRule = true;
  26706. }
  26707. };
  26708. ATNDeserializer.prototype.readRules = function (atn) {
  26709. var i;
  26710. var nrules = this.readInt();
  26711. if (atn.grammarType === ATNType.LEXER) {
  26712. atn.ruleToTokenType = initArray(nrules, 0);
  26713. }
  26714. atn.ruleToStartState = initArray(nrules, 0);
  26715. for (i = 0; i < nrules; i++) {
  26716. var s = this.readInt();
  26717. var startState = atn.states[s];
  26718. atn.ruleToStartState[i] = startState;
  26719. if (atn.grammarType === ATNType.LEXER) {
  26720. var tokenType = this.readInt();
  26721. if (tokenType === 0xFFFF) {
  26722. tokenType = Token.EOF;
  26723. }
  26724. atn.ruleToTokenType[i] = tokenType;
  26725. }
  26726. }
  26727. atn.ruleToStopState = initArray(nrules, 0);
  26728. for (i = 0; i < atn.states.length; i++) {
  26729. var state = atn.states[i];
  26730. if (!(state instanceof RuleStopState)) {
  26731. continue;
  26732. }
  26733. atn.ruleToStopState[state.ruleIndex] = state;
  26734. atn.ruleToStartState[state.ruleIndex].stopState = state;
  26735. }
  26736. };
  26737. ATNDeserializer.prototype.readModes = function (atn) {
  26738. var nmodes = this.readInt();
  26739. for (var i = 0; i < nmodes; i++) {
  26740. var s = this.readInt();
  26741. atn.modeToStartState.push(atn.states[s]);
  26742. }
  26743. };
  26744. ATNDeserializer.prototype.readSets = function (atn, sets, readUnicode) {
  26745. var m = this.readInt();
  26746. for (var i = 0; i < m; i++) {
  26747. var iset = new IntervalSet();
  26748. sets.push(iset);
  26749. var n = this.readInt();
  26750. var containsEof = this.readInt();
  26751. if (containsEof !== 0) {
  26752. iset.addOne(-1);
  26753. }
  26754. for (var j = 0; j < n; j++) {
  26755. var i1 = readUnicode();
  26756. var i2 = readUnicode();
  26757. iset.addRange(i1, i2);
  26758. }
  26759. }
  26760. };
  26761. ATNDeserializer.prototype.readEdges = function (atn, sets) {
  26762. var i, j, state, trans, target;
  26763. var nedges = this.readInt();
  26764. for (i = 0; i < nedges; i++) {
  26765. var src = this.readInt();
  26766. var trg = this.readInt();
  26767. var ttype = this.readInt();
  26768. var arg1 = this.readInt();
  26769. var arg2 = this.readInt();
  26770. var arg3 = this.readInt();
  26771. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  26772. var srcState = atn.states[src];
  26773. srcState.addTransition(trans);
  26774. }
  26775. // edges for rule stop states can be derived, so they aren't serialized
  26776. for (i = 0; i < atn.states.length; i++) {
  26777. state = atn.states[i];
  26778. for (j = 0; j < state.transitions.length; j++) {
  26779. var t = state.transitions[j];
  26780. if (!(t instanceof RuleTransition)) {
  26781. continue;
  26782. }
  26783. var outermostPrecedenceReturn = -1;
  26784. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  26785. if (t.precedence === 0) {
  26786. outermostPrecedenceReturn = t.target.ruleIndex;
  26787. }
  26788. }
  26789. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  26790. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  26791. }
  26792. }
  26793. for (i = 0; i < atn.states.length; i++) {
  26794. state = atn.states[i];
  26795. if (state instanceof BlockStartState) {
  26796. // we need to know the end state to set its start state
  26797. if (state.endState === null) {
  26798. throw "IllegalState";
  26799. }
  26800. // block end states can only be associated to a single block start
  26801. // state
  26802. if (state.endState.startState !== null) {
  26803. throw "IllegalState";
  26804. }
  26805. state.endState.startState = state;
  26806. }
  26807. if (state instanceof PlusLoopbackState) {
  26808. for (j = 0; j < state.transitions.length; j++) {
  26809. target = state.transitions[j].target;
  26810. if (target instanceof PlusBlockStartState) {
  26811. target.loopBackState = state;
  26812. }
  26813. }
  26814. } else if (state instanceof StarLoopbackState) {
  26815. for (j = 0; j < state.transitions.length; j++) {
  26816. target = state.transitions[j].target;
  26817. if (target instanceof StarLoopEntryState) {
  26818. target.loopBackState = state;
  26819. }
  26820. }
  26821. }
  26822. }
  26823. };
  26824. ATNDeserializer.prototype.readDecisions = function (atn) {
  26825. var ndecisions = this.readInt();
  26826. for (var i = 0; i < ndecisions; i++) {
  26827. var s = this.readInt();
  26828. var decState = atn.states[s];
  26829. atn.decisionToState.push(decState);
  26830. decState.decision = i;
  26831. }
  26832. };
  26833. ATNDeserializer.prototype.readLexerActions = function (atn) {
  26834. if (atn.grammarType === ATNType.LEXER) {
  26835. var count = this.readInt();
  26836. atn.lexerActions = initArray(count, null);
  26837. for (var i = 0; i < count; i++) {
  26838. var actionType = this.readInt();
  26839. var data1 = this.readInt();
  26840. if (data1 === 0xFFFF) {
  26841. data1 = -1;
  26842. }
  26843. var data2 = this.readInt();
  26844. if (data2 === 0xFFFF) {
  26845. data2 = -1;
  26846. }
  26847. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  26848. atn.lexerActions[i] = lexerAction;
  26849. }
  26850. }
  26851. };
  26852. ATNDeserializer.prototype.generateRuleBypassTransitions = function (atn) {
  26853. var i;
  26854. var count = atn.ruleToStartState.length;
  26855. for (i = 0; i < count; i++) {
  26856. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  26857. }
  26858. for (i = 0; i < count; i++) {
  26859. this.generateRuleBypassTransition(atn, i);
  26860. }
  26861. };
  26862. ATNDeserializer.prototype.generateRuleBypassTransition = function (atn, idx) {
  26863. var i, state;
  26864. var bypassStart = new BasicBlockStartState();
  26865. bypassStart.ruleIndex = idx;
  26866. atn.addState(bypassStart);
  26867. var bypassStop = new BlockEndState();
  26868. bypassStop.ruleIndex = idx;
  26869. atn.addState(bypassStop);
  26870. bypassStart.endState = bypassStop;
  26871. atn.defineDecisionState(bypassStart);
  26872. bypassStop.startState = bypassStart;
  26873. var excludeTransition = null;
  26874. var endState = null;
  26875. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  26876. // wrap from the beginning of the rule to the StarLoopEntryState
  26877. endState = null;
  26878. for (i = 0; i < atn.states.length; i++) {
  26879. state = atn.states[i];
  26880. if (this.stateIsEndStateFor(state, idx)) {
  26881. endState = state;
  26882. excludeTransition = state.loopBackState.transitions[0];
  26883. break;
  26884. }
  26885. }
  26886. if (excludeTransition === null) {
  26887. throw "Couldn't identify final state of the precedence rule prefix section.";
  26888. }
  26889. } else {
  26890. endState = atn.ruleToStopState[idx];
  26891. }
  26892. // all non-excluded transitions that currently target end state need to
  26893. // target blockEnd instead
  26894. for (i = 0; i < atn.states.length; i++) {
  26895. state = atn.states[i];
  26896. for (var j = 0; j < state.transitions.length; j++) {
  26897. var transition = state.transitions[j];
  26898. if (transition === excludeTransition) {
  26899. continue;
  26900. }
  26901. if (transition.target === endState) {
  26902. transition.target = bypassStop;
  26903. }
  26904. }
  26905. }
  26906. // all transitions leaving the rule start state need to leave blockStart
  26907. // instead
  26908. var ruleToStartState = atn.ruleToStartState[idx];
  26909. var count = ruleToStartState.transitions.length;
  26910. while (count > 0) {
  26911. bypassStart.addTransition(ruleToStartState.transitions[count - 1]);
  26912. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  26913. }
  26914. // link the new states
  26915. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  26916. bypassStop.addTransition(new EpsilonTransition(endState));
  26917. var matchState = new BasicState();
  26918. atn.addState(matchState);
  26919. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  26920. bypassStart.addTransition(new EpsilonTransition(matchState));
  26921. };
  26922. ATNDeserializer.prototype.stateIsEndStateFor = function (state, idx) {
  26923. if (state.ruleIndex !== idx) {
  26924. return null;
  26925. }
  26926. if (!(state instanceof StarLoopEntryState)) {
  26927. return null;
  26928. }
  26929. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26930. if (!(maybeLoopEndState instanceof LoopEndState)) {
  26931. return null;
  26932. }
  26933. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26934. return state;
  26935. } else {
  26936. return null;
  26937. }
  26938. };
  26939. //
  26940. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  26941. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  26942. // correct value.
  26943. //
  26944. // @param atn The ATN.
  26945. //
  26946. ATNDeserializer.prototype.markPrecedenceDecisions = function (atn) {
  26947. for (var i = 0; i < atn.states.length; i++) {
  26948. var state = atn.states[i];
  26949. if (!(state instanceof StarLoopEntryState)) {
  26950. continue;
  26951. }
  26952. // We analyze the ATN to determine if this ATN decision state is the
  26953. // decision for the closure block that determines whether a
  26954. // precedence rule should continue or complete.
  26955. //
  26956. if (atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  26957. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26958. if (maybeLoopEndState instanceof LoopEndState) {
  26959. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26960. state.isPrecedenceDecision = true;
  26961. }
  26962. }
  26963. }
  26964. }
  26965. };
  26966. ATNDeserializer.prototype.verifyATN = function (atn) {
  26967. if (!this.deserializationOptions.verifyATN) {
  26968. return;
  26969. }
  26970. // verify assumptions
  26971. for (var i = 0; i < atn.states.length; i++) {
  26972. var state = atn.states[i];
  26973. if (state === null) {
  26974. continue;
  26975. }
  26976. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  26977. if (state instanceof PlusBlockStartState) {
  26978. this.checkCondition(state.loopBackState !== null);
  26979. } else if (state instanceof StarLoopEntryState) {
  26980. this.checkCondition(state.loopBackState !== null);
  26981. this.checkCondition(state.transitions.length === 2);
  26982. if (state.transitions[0].target instanceof StarBlockStartState) {
  26983. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  26984. this.checkCondition(!state.nonGreedy);
  26985. } else if (state.transitions[0].target instanceof LoopEndState) {
  26986. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  26987. this.checkCondition(state.nonGreedy);
  26988. } else {
  26989. throw "IllegalState";
  26990. }
  26991. } else if (state instanceof StarLoopbackState) {
  26992. this.checkCondition(state.transitions.length === 1);
  26993. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  26994. } else if (state instanceof LoopEndState) {
  26995. this.checkCondition(state.loopBackState !== null);
  26996. } else if (state instanceof RuleStartState) {
  26997. this.checkCondition(state.stopState !== null);
  26998. } else if (state instanceof BlockStartState) {
  26999. this.checkCondition(state.endState !== null);
  27000. } else if (state instanceof BlockEndState) {
  27001. this.checkCondition(state.startState !== null);
  27002. } else if (state instanceof DecisionState) {
  27003. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  27004. } else {
  27005. this.checkCondition(state.transitions.length <= 1 || state instanceof RuleStopState);
  27006. }
  27007. }
  27008. };
  27009. ATNDeserializer.prototype.checkCondition = function (condition, message) {
  27010. if (!condition) {
  27011. if (message === undefined || message === null) {
  27012. message = "IllegalState";
  27013. }
  27014. throw message;
  27015. }
  27016. };
  27017. ATNDeserializer.prototype.readInt = function () {
  27018. return this.data[this.pos++];
  27019. };
  27020. ATNDeserializer.prototype.readInt32 = function () {
  27021. var low = this.readInt();
  27022. var high = this.readInt();
  27023. return low | high << 16;
  27024. };
  27025. ATNDeserializer.prototype.readLong = function () {
  27026. var low = this.readInt32();
  27027. var high = this.readInt32();
  27028. return low & 0x00000000FFFFFFFF | high << 32;
  27029. };
  27030. function createByteToHex() {
  27031. var bth = [];
  27032. for (var i = 0; i < 256; i++) {
  27033. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  27034. }
  27035. return bth;
  27036. }
  27037. var byteToHex = createByteToHex();
  27038. ATNDeserializer.prototype.readUUID = function () {
  27039. var bb = [];
  27040. for (var i = 7; i >= 0; i--) {
  27041. var int = this.readInt();
  27042. /* jshint bitwise: false */
  27043. bb[2 * i + 1] = int & 0xFF;
  27044. bb[2 * i] = int >> 8 & 0xFF;
  27045. }
  27046. 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]];
  27047. };
  27048. ATNDeserializer.prototype.edgeFactory = function (atn, type, src, trg, arg1, arg2, arg3, sets) {
  27049. var target = atn.states[trg];
  27050. switch (type) {
  27051. case Transition.EPSILON:
  27052. return new EpsilonTransition(target);
  27053. case Transition.RANGE:
  27054. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  27055. case Transition.RULE:
  27056. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  27057. case Transition.PREDICATE:
  27058. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  27059. case Transition.PRECEDENCE:
  27060. return new PrecedencePredicateTransition(target, arg1);
  27061. case Transition.ATOM:
  27062. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  27063. case Transition.ACTION:
  27064. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  27065. case Transition.SET:
  27066. return new SetTransition(target, sets[arg1]);
  27067. case Transition.NOT_SET:
  27068. return new NotSetTransition(target, sets[arg1]);
  27069. case Transition.WILDCARD:
  27070. return new WildcardTransition(target);
  27071. default:
  27072. throw "The specified transition type: " + type + " is not valid.";
  27073. }
  27074. };
  27075. ATNDeserializer.prototype.stateFactory = function (type, ruleIndex) {
  27076. if (this.stateFactories === null) {
  27077. var sf = [];
  27078. sf[ATNState.INVALID_TYPE] = null;
  27079. sf[ATNState.BASIC] = function () {
  27080. return new BasicState();
  27081. };
  27082. sf[ATNState.RULE_START] = function () {
  27083. return new RuleStartState();
  27084. };
  27085. sf[ATNState.BLOCK_START] = function () {
  27086. return new BasicBlockStartState();
  27087. };
  27088. sf[ATNState.PLUS_BLOCK_START] = function () {
  27089. return new PlusBlockStartState();
  27090. };
  27091. sf[ATNState.STAR_BLOCK_START] = function () {
  27092. return new StarBlockStartState();
  27093. };
  27094. sf[ATNState.TOKEN_START] = function () {
  27095. return new TokensStartState();
  27096. };
  27097. sf[ATNState.RULE_STOP] = function () {
  27098. return new RuleStopState();
  27099. };
  27100. sf[ATNState.BLOCK_END] = function () {
  27101. return new BlockEndState();
  27102. };
  27103. sf[ATNState.STAR_LOOP_BACK] = function () {
  27104. return new StarLoopbackState();
  27105. };
  27106. sf[ATNState.STAR_LOOP_ENTRY] = function () {
  27107. return new StarLoopEntryState();
  27108. };
  27109. sf[ATNState.PLUS_LOOP_BACK] = function () {
  27110. return new PlusLoopbackState();
  27111. };
  27112. sf[ATNState.LOOP_END] = function () {
  27113. return new LoopEndState();
  27114. };
  27115. this.stateFactories = sf;
  27116. }
  27117. if (type > this.stateFactories.length || this.stateFactories[type] === null) {
  27118. throw "The specified state type " + type + " is not valid.";
  27119. } else {
  27120. var s = this.stateFactories[type]();
  27121. if (s !== null) {
  27122. s.ruleIndex = ruleIndex;
  27123. return s;
  27124. }
  27125. }
  27126. };
  27127. ATNDeserializer.prototype.lexerActionFactory = function (type, data1, data2) {
  27128. if (this.actionFactories === null) {
  27129. var af = [];
  27130. af[LexerActionType.CHANNEL] = function (data1, data2) {
  27131. return new LexerChannelAction(data1);
  27132. };
  27133. af[LexerActionType.CUSTOM] = function (data1, data2) {
  27134. return new LexerCustomAction(data1, data2);
  27135. };
  27136. af[LexerActionType.MODE] = function (data1, data2) {
  27137. return new LexerModeAction(data1);
  27138. };
  27139. af[LexerActionType.MORE] = function (data1, data2) {
  27140. return LexerMoreAction.INSTANCE;
  27141. };
  27142. af[LexerActionType.POP_MODE] = function (data1, data2) {
  27143. return LexerPopModeAction.INSTANCE;
  27144. };
  27145. af[LexerActionType.PUSH_MODE] = function (data1, data2) {
  27146. return new LexerPushModeAction(data1);
  27147. };
  27148. af[LexerActionType.SKIP] = function (data1, data2) {
  27149. return LexerSkipAction.INSTANCE;
  27150. };
  27151. af[LexerActionType.TYPE] = function (data1, data2) {
  27152. return new LexerTypeAction(data1);
  27153. };
  27154. this.actionFactories = af;
  27155. }
  27156. if (type > this.actionFactories.length || this.actionFactories[type] === null) {
  27157. throw "The specified lexer action type " + type + " is not valid.";
  27158. } else {
  27159. return this.actionFactories[type](data1, data2);
  27160. }
  27161. };
  27162. exports.ATNDeserializer = ATNDeserializer;
  27163. /***/ }),
  27164. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  27165. /*!*************************************************!*\
  27166. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  27167. \*************************************************/
  27168. /*! no static exports found */
  27169. /***/ (function(module, exports, __webpack_require__) {
  27170. "use strict";
  27171. //
  27172. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27173. * Use of this file is governed by the BSD 3-clause license that
  27174. * can be found in the LICENSE.txt file in the project root.
  27175. */
  27176. ///
  27177. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  27178. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  27179. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  27180. function ATNSimulator(atn, sharedContextCache) {
  27181. // The context cache maps all PredictionContext objects that are ==
  27182. // to a single cached copy. This cache is shared across all contexts
  27183. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  27184. // to use only cached nodes/graphs in addDFAState(). We don't want to
  27185. // fill this during closure() since there are lots of contexts that
  27186. // pop up but are not used ever again. It also greatly slows down closure().
  27187. //
  27188. // <p>This cache makes a huge difference in memory and a little bit in speed.
  27189. // For the Java grammar on java.*, it dropped the memory requirements
  27190. // at the end from 25M to 16M. We don't store any of the full context
  27191. // graphs in the DFA because they are limited to local context only,
  27192. // but apparently there's a lot of repetition there as well. We optimize
  27193. // the config contexts before storing the config set in the DFA states
  27194. // by literally rebuilding them with cached subgraphs only.</p>
  27195. //
  27196. // <p>I tried a cache for use during closure operations, that was
  27197. // whacked after each adaptivePredict(). It cost a little bit
  27198. // more time I think and doesn't save on the overall footprint
  27199. // so it's not worth the complexity.</p>
  27200. ///
  27201. this.atn = atn;
  27202. this.sharedContextCache = sharedContextCache;
  27203. return this;
  27204. }
  27205. // Must distinguish between missing edge and edge we know leads nowhere///
  27206. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  27207. ATNSimulator.prototype.getCachedContext = function (context) {
  27208. if (this.sharedContextCache === null) {
  27209. return context;
  27210. }
  27211. var visited = {};
  27212. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  27213. };
  27214. exports.ATNSimulator = ATNSimulator;
  27215. /***/ }),
  27216. /***/ "./node_modules/antlr4/atn/ATNState.js":
  27217. /*!*********************************************!*\
  27218. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  27219. \*********************************************/
  27220. /*! no static exports found */
  27221. /***/ (function(module, exports, __webpack_require__) {
  27222. "use strict";
  27223. //
  27224. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27225. * Use of this file is governed by the BSD 3-clause license that
  27226. * can be found in the LICENSE.txt file in the project root.
  27227. */
  27228. //
  27229. // The following images show the relation of states and
  27230. // {@link ATNState//transitions} for various grammar constructs.
  27231. //
  27232. // <ul>
  27233. //
  27234. // <li>Solid edges marked with an &//0949; indicate a required
  27235. // {@link EpsilonTransition}.</li>
  27236. //
  27237. // <li>Dashed edges indicate locations where any transition derived from
  27238. // {@link Transition} might appear.</li>
  27239. //
  27240. // <li>Dashed nodes are place holders for either a sequence of linked
  27241. // {@link BasicState} states or the inclusion of a block representing a nested
  27242. // construct in one of the forms below.</li>
  27243. //
  27244. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  27245. // any number of alternatives (one or more). Nodes without the {@code ...} only
  27246. // support the exact number of alternatives shown in the diagram.</li>
  27247. //
  27248. // </ul>
  27249. //
  27250. // <h2>Basic Blocks</h2>
  27251. //
  27252. // <h3>Rule</h3>
  27253. //
  27254. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  27255. //
  27256. // <h3>Block of 1 or more alternatives</h3>
  27257. //
  27258. // <embed src="images/Block.svg" type="image/svg+xml"/>
  27259. //
  27260. // <h2>Greedy Loops</h2>
  27261. //
  27262. // <h3>Greedy Closure: {@code (...)*}</h3>
  27263. //
  27264. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  27265. //
  27266. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  27267. //
  27268. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  27269. //
  27270. // <h3>Greedy Optional: {@code (...)?}</h3>
  27271. //
  27272. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  27273. //
  27274. // <h2>Non-Greedy Loops</h2>
  27275. //
  27276. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  27277. //
  27278. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  27279. //
  27280. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  27281. //
  27282. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  27283. //
  27284. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  27285. //
  27286. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  27287. //
  27288. var INITIAL_NUM_TRANSITIONS = 4;
  27289. function ATNState() {
  27290. // Which ATN are we in?
  27291. this.atn = null;
  27292. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  27293. this.stateType = null;
  27294. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  27295. this.epsilonOnlyTransitions = false;
  27296. // Track the transitions emanating from this ATN state.
  27297. this.transitions = [];
  27298. // Used to cache lookahead during parsing, not used during construction
  27299. this.nextTokenWithinRule = null;
  27300. return this;
  27301. }
  27302. // constants for serialization
  27303. ATNState.INVALID_TYPE = 0;
  27304. ATNState.BASIC = 1;
  27305. ATNState.RULE_START = 2;
  27306. ATNState.BLOCK_START = 3;
  27307. ATNState.PLUS_BLOCK_START = 4;
  27308. ATNState.STAR_BLOCK_START = 5;
  27309. ATNState.TOKEN_START = 6;
  27310. ATNState.RULE_STOP = 7;
  27311. ATNState.BLOCK_END = 8;
  27312. ATNState.STAR_LOOP_BACK = 9;
  27313. ATNState.STAR_LOOP_ENTRY = 10;
  27314. ATNState.PLUS_LOOP_BACK = 11;
  27315. ATNState.LOOP_END = 12;
  27316. 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"];
  27317. ATNState.INVALID_STATE_NUMBER = -1;
  27318. ATNState.prototype.toString = function () {
  27319. return this.stateNumber;
  27320. };
  27321. ATNState.prototype.equals = function (other) {
  27322. if (other instanceof ATNState) {
  27323. return this.stateNumber === other.stateNumber;
  27324. } else {
  27325. return false;
  27326. }
  27327. };
  27328. ATNState.prototype.isNonGreedyExitState = function () {
  27329. return false;
  27330. };
  27331. ATNState.prototype.addTransition = function (trans, index) {
  27332. if (index === undefined) {
  27333. index = -1;
  27334. }
  27335. if (this.transitions.length === 0) {
  27336. this.epsilonOnlyTransitions = trans.isEpsilon;
  27337. } else if (this.epsilonOnlyTransitions !== trans.isEpsilon) {
  27338. this.epsilonOnlyTransitions = false;
  27339. }
  27340. if (index === -1) {
  27341. this.transitions.push(trans);
  27342. } else {
  27343. this.transitions.splice(index, 1, trans);
  27344. }
  27345. };
  27346. function BasicState() {
  27347. ATNState.call(this);
  27348. this.stateType = ATNState.BASIC;
  27349. return this;
  27350. }
  27351. BasicState.prototype = Object.create(ATNState.prototype);
  27352. BasicState.prototype.constructor = BasicState;
  27353. function DecisionState() {
  27354. ATNState.call(this);
  27355. this.decision = -1;
  27356. this.nonGreedy = false;
  27357. return this;
  27358. }
  27359. DecisionState.prototype = Object.create(ATNState.prototype);
  27360. DecisionState.prototype.constructor = DecisionState;
  27361. // The start of a regular {@code (...)} block.
  27362. function BlockStartState() {
  27363. DecisionState.call(this);
  27364. this.endState = null;
  27365. return this;
  27366. }
  27367. BlockStartState.prototype = Object.create(DecisionState.prototype);
  27368. BlockStartState.prototype.constructor = BlockStartState;
  27369. function BasicBlockStartState() {
  27370. BlockStartState.call(this);
  27371. this.stateType = ATNState.BLOCK_START;
  27372. return this;
  27373. }
  27374. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  27375. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  27376. // Terminal node of a simple {@code (a|b|c)} block.
  27377. function BlockEndState() {
  27378. ATNState.call(this);
  27379. this.stateType = ATNState.BLOCK_END;
  27380. this.startState = null;
  27381. return this;
  27382. }
  27383. BlockEndState.prototype = Object.create(ATNState.prototype);
  27384. BlockEndState.prototype.constructor = BlockEndState;
  27385. // The last node in the ATN for a rule, unless that rule is the start symbol.
  27386. // In that case, there is one transition to EOF. Later, we might encode
  27387. // references to all calls to this rule to compute FOLLOW sets for
  27388. // error handling.
  27389. //
  27390. function RuleStopState() {
  27391. ATNState.call(this);
  27392. this.stateType = ATNState.RULE_STOP;
  27393. return this;
  27394. }
  27395. RuleStopState.prototype = Object.create(ATNState.prototype);
  27396. RuleStopState.prototype.constructor = RuleStopState;
  27397. function RuleStartState() {
  27398. ATNState.call(this);
  27399. this.stateType = ATNState.RULE_START;
  27400. this.stopState = null;
  27401. this.isPrecedenceRule = false;
  27402. return this;
  27403. }
  27404. RuleStartState.prototype = Object.create(ATNState.prototype);
  27405. RuleStartState.prototype.constructor = RuleStartState;
  27406. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  27407. // one to the loop back to start of the block and one to exit.
  27408. //
  27409. function PlusLoopbackState() {
  27410. DecisionState.call(this);
  27411. this.stateType = ATNState.PLUS_LOOP_BACK;
  27412. return this;
  27413. }
  27414. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  27415. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  27416. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  27417. // we don't use for code generation; somebody might need it, so I'm defining
  27418. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  27419. // real decision-making note for {@code A+}.
  27420. //
  27421. function PlusBlockStartState() {
  27422. BlockStartState.call(this);
  27423. this.stateType = ATNState.PLUS_BLOCK_START;
  27424. this.loopBackState = null;
  27425. return this;
  27426. }
  27427. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  27428. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  27429. // The block that begins a closure loop.
  27430. function StarBlockStartState() {
  27431. BlockStartState.call(this);
  27432. this.stateType = ATNState.STAR_BLOCK_START;
  27433. return this;
  27434. }
  27435. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  27436. StarBlockStartState.prototype.constructor = StarBlockStartState;
  27437. function StarLoopbackState() {
  27438. ATNState.call(this);
  27439. this.stateType = ATNState.STAR_LOOP_BACK;
  27440. return this;
  27441. }
  27442. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  27443. StarLoopbackState.prototype.constructor = StarLoopbackState;
  27444. function StarLoopEntryState() {
  27445. DecisionState.call(this);
  27446. this.stateType = ATNState.STAR_LOOP_ENTRY;
  27447. this.loopBackState = null;
  27448. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  27449. this.isPrecedenceDecision = null;
  27450. return this;
  27451. }
  27452. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  27453. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  27454. // Mark the end of a * or + loop.
  27455. function LoopEndState() {
  27456. ATNState.call(this);
  27457. this.stateType = ATNState.LOOP_END;
  27458. this.loopBackState = null;
  27459. return this;
  27460. }
  27461. LoopEndState.prototype = Object.create(ATNState.prototype);
  27462. LoopEndState.prototype.constructor = LoopEndState;
  27463. // The Tokens rule start state linking to each lexer rule start state */
  27464. function TokensStartState() {
  27465. DecisionState.call(this);
  27466. this.stateType = ATNState.TOKEN_START;
  27467. return this;
  27468. }
  27469. TokensStartState.prototype = Object.create(DecisionState.prototype);
  27470. TokensStartState.prototype.constructor = TokensStartState;
  27471. exports.ATNState = ATNState;
  27472. exports.BasicState = BasicState;
  27473. exports.DecisionState = DecisionState;
  27474. exports.BlockStartState = BlockStartState;
  27475. exports.BlockEndState = BlockEndState;
  27476. exports.LoopEndState = LoopEndState;
  27477. exports.RuleStartState = RuleStartState;
  27478. exports.RuleStopState = RuleStopState;
  27479. exports.TokensStartState = TokensStartState;
  27480. exports.PlusLoopbackState = PlusLoopbackState;
  27481. exports.StarLoopbackState = StarLoopbackState;
  27482. exports.StarLoopEntryState = StarLoopEntryState;
  27483. exports.PlusBlockStartState = PlusBlockStartState;
  27484. exports.StarBlockStartState = StarBlockStartState;
  27485. exports.BasicBlockStartState = BasicBlockStartState;
  27486. /***/ }),
  27487. /***/ "./node_modules/antlr4/atn/ATNType.js":
  27488. /*!********************************************!*\
  27489. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  27490. \********************************************/
  27491. /*! no static exports found */
  27492. /***/ (function(module, exports, __webpack_require__) {
  27493. "use strict";
  27494. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27495. * Use of this file is governed by the BSD 3-clause license that
  27496. * can be found in the LICENSE.txt file in the project root.
  27497. */
  27498. ///
  27499. // Represents the type of recognizer an ATN applies to.
  27500. function ATNType() {}
  27501. ATNType.LEXER = 0;
  27502. ATNType.PARSER = 1;
  27503. exports.ATNType = ATNType;
  27504. /***/ }),
  27505. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  27506. /*!******************************************************!*\
  27507. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  27508. \******************************************************/
  27509. /*! no static exports found */
  27510. /***/ (function(module, exports, __webpack_require__) {
  27511. "use strict";
  27512. //
  27513. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27514. * Use of this file is governed by the BSD 3-clause license that
  27515. * can be found in the LICENSE.txt file in the project root.
  27516. */
  27517. ///
  27518. // When we hit an accept state in either the DFA or the ATN, we
  27519. // have to notify the character stream to start buffering characters
  27520. // via {@link IntStream//mark} and record the current state. The current sim state
  27521. // includes the current index into the input, the current line,
  27522. // and current character position in that line. Note that the Lexer is
  27523. // tracking the starting line and characterization of the token. These
  27524. // variables track the "state" of the simulator when it hits an accept state.
  27525. //
  27526. // <p>We track these variables separately for the DFA and ATN simulation
  27527. // because the DFA simulation often has to fail over to the ATN
  27528. // simulation. If the ATN simulation fails, we need the DFA to fall
  27529. // back to its previously accepted state, if any. If the ATN succeeds,
  27530. // then the ATN does the accept and the DFA simulator that invoked it
  27531. // can simply return the predicted token type.</p>
  27532. ///
  27533. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  27534. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  27535. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  27536. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  27537. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  27538. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  27539. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  27540. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  27541. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  27542. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  27543. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  27544. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  27545. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  27546. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  27547. function resetSimState(sim) {
  27548. sim.index = -1;
  27549. sim.line = 0;
  27550. sim.column = -1;
  27551. sim.dfaState = null;
  27552. }
  27553. function SimState() {
  27554. resetSimState(this);
  27555. return this;
  27556. }
  27557. SimState.prototype.reset = function () {
  27558. resetSimState(this);
  27559. };
  27560. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  27561. ATNSimulator.call(this, atn, sharedContextCache);
  27562. this.decisionToDFA = decisionToDFA;
  27563. this.recog = recog;
  27564. // The current token's starting index into the character stream.
  27565. // Shared across DFA to ATN simulation in case the ATN fails and the
  27566. // DFA did not have a previous accept state. In this case, we use the
  27567. // ATN-generated exception object.
  27568. this.startIndex = -1;
  27569. // line number 1..n within the input///
  27570. this.line = 1;
  27571. // The index of the character relative to the beginning of the line
  27572. // 0..n-1///
  27573. this.column = 0;
  27574. this.mode = Lexer.DEFAULT_MODE;
  27575. // Used during DFA/ATN exec to record the most recent accept configuration
  27576. // info
  27577. this.prevAccept = new SimState();
  27578. // done
  27579. return this;
  27580. }
  27581. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  27582. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  27583. LexerATNSimulator.debug = false;
  27584. LexerATNSimulator.dfa_debug = false;
  27585. LexerATNSimulator.MIN_DFA_EDGE = 0;
  27586. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  27587. LexerATNSimulator.match_calls = 0;
  27588. LexerATNSimulator.prototype.copyState = function (simulator) {
  27589. this.column = simulator.column;
  27590. this.line = simulator.line;
  27591. this.mode = simulator.mode;
  27592. this.startIndex = simulator.startIndex;
  27593. };
  27594. LexerATNSimulator.prototype.match = function (input, mode) {
  27595. this.match_calls += 1;
  27596. this.mode = mode;
  27597. var mark = input.mark();
  27598. try {
  27599. this.startIndex = input.index;
  27600. this.prevAccept.reset();
  27601. var dfa = this.decisionToDFA[mode];
  27602. if (dfa.s0 === null) {
  27603. return this.matchATN(input);
  27604. } else {
  27605. return this.execATN(input, dfa.s0);
  27606. }
  27607. } finally {
  27608. input.release(mark);
  27609. }
  27610. };
  27611. LexerATNSimulator.prototype.reset = function () {
  27612. this.prevAccept.reset();
  27613. this.startIndex = -1;
  27614. this.line = 1;
  27615. this.column = 0;
  27616. this.mode = Lexer.DEFAULT_MODE;
  27617. };
  27618. LexerATNSimulator.prototype.matchATN = function (input) {
  27619. var startState = this.atn.modeToStartState[this.mode];
  27620. if (LexerATNSimulator.debug) {
  27621. console.log("matchATN mode " + this.mode + " start: " + startState);
  27622. }
  27623. var old_mode = this.mode;
  27624. var s0_closure = this.computeStartState(input, startState);
  27625. var suppressEdge = s0_closure.hasSemanticContext;
  27626. s0_closure.hasSemanticContext = false;
  27627. var next = this.addDFAState(s0_closure);
  27628. if (!suppressEdge) {
  27629. this.decisionToDFA[this.mode].s0 = next;
  27630. }
  27631. var predict = this.execATN(input, next);
  27632. if (LexerATNSimulator.debug) {
  27633. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  27634. }
  27635. return predict;
  27636. };
  27637. LexerATNSimulator.prototype.execATN = function (input, ds0) {
  27638. if (LexerATNSimulator.debug) {
  27639. console.log("start state closure=" + ds0.configs);
  27640. }
  27641. if (ds0.isAcceptState) {
  27642. // allow zero-length tokens
  27643. this.captureSimState(this.prevAccept, input, ds0);
  27644. }
  27645. var t = input.LA(1);
  27646. var s = ds0; // s is current/from DFA state
  27647. while (true) {
  27648. // while more work
  27649. if (LexerATNSimulator.debug) {
  27650. console.log("execATN loop starting closure: " + s.configs);
  27651. }
  27652. // As we move src->trg, src->trg, we keep track of the previous trg to
  27653. // avoid looking up the DFA state again, which is expensive.
  27654. // If the previous target was already part of the DFA, we might
  27655. // be able to avoid doing a reach operation upon t. If s!=null,
  27656. // it means that semantic predicates didn't prevent us from
  27657. // creating a DFA state. Once we know s!=null, we check to see if
  27658. // the DFA state has an edge already for t. If so, we can just reuse
  27659. // it's configuration set; there's no point in re-computing it.
  27660. // This is kind of like doing DFA simulation within the ATN
  27661. // simulation because DFA simulation is really just a way to avoid
  27662. // computing reach/closure sets. Technically, once we know that
  27663. // we have a previously added DFA state, we could jump over to
  27664. // the DFA simulator. But, that would mean popping back and forth
  27665. // a lot and making things more complicated algorithmically.
  27666. // This optimization makes a lot of sense for loops within DFA.
  27667. // A character will take us back to an existing DFA state
  27668. // that already has lots of edges out of it. e.g., .* in comments.
  27669. // print("Target for:" + str(s) + " and:" + str(t))
  27670. var target = this.getExistingTargetState(s, t);
  27671. // print("Existing:" + str(target))
  27672. if (target === null) {
  27673. target = this.computeTargetState(input, s, t);
  27674. // print("Computed:" + str(target))
  27675. }
  27676. if (target === ATNSimulator.ERROR) {
  27677. break;
  27678. }
  27679. // If this is a consumable input element, make sure to consume before
  27680. // capturing the accept state so the input index, line, and char
  27681. // position accurately reflect the state of the interpreter at the
  27682. // end of the token.
  27683. if (t !== Token.EOF) {
  27684. this.consume(input);
  27685. }
  27686. if (target.isAcceptState) {
  27687. this.captureSimState(this.prevAccept, input, target);
  27688. if (t === Token.EOF) {
  27689. break;
  27690. }
  27691. }
  27692. t = input.LA(1);
  27693. s = target; // flip; current DFA target becomes new src/from state
  27694. }
  27695. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  27696. };
  27697. // Get an existing target state for an edge in the DFA. If the target state
  27698. // for the edge has not yet been computed or is otherwise not available,
  27699. // this method returns {@code null}.
  27700. //
  27701. // @param s The current DFA state
  27702. // @param t The next input symbol
  27703. // @return The existing target DFA state for the given input symbol
  27704. // {@code t}, or {@code null} if the target state for this edge is not
  27705. // already cached
  27706. LexerATNSimulator.prototype.getExistingTargetState = function (s, t) {
  27707. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  27708. return null;
  27709. }
  27710. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  27711. if (target === undefined) {
  27712. target = null;
  27713. }
  27714. if (LexerATNSimulator.debug && target !== null) {
  27715. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  27716. }
  27717. return target;
  27718. };
  27719. // Compute a target state for an edge in the DFA, and attempt to add the
  27720. // computed state and corresponding edge to the DFA.
  27721. //
  27722. // @param input The input stream
  27723. // @param s The current DFA state
  27724. // @param t The next input symbol
  27725. //
  27726. // @return The computed target DFA state for the given input symbol
  27727. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  27728. // returns {@link //ERROR}.
  27729. LexerATNSimulator.prototype.computeTargetState = function (input, s, t) {
  27730. var reach = new OrderedATNConfigSet();
  27731. // if we don't find an existing DFA state
  27732. // Fill reach starting from closure, following t transitions
  27733. this.getReachableConfigSet(input, s.configs, reach, t);
  27734. if (reach.items.length === 0) {
  27735. // we got nowhere on t from s
  27736. if (!reach.hasSemanticContext) {
  27737. // we got nowhere on t, don't throw out this knowledge; it'd
  27738. // cause a failover from DFA later.
  27739. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  27740. }
  27741. // stop when we can't match any more char
  27742. return ATNSimulator.ERROR;
  27743. }
  27744. // Add an edge from s to target DFA found/created for reach
  27745. return this.addDFAEdge(s, t, null, reach);
  27746. };
  27747. LexerATNSimulator.prototype.failOrAccept = function (prevAccept, input, reach, t) {
  27748. if (this.prevAccept.dfaState !== null) {
  27749. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  27750. this.accept(input, lexerActionExecutor, this.startIndex, prevAccept.index, prevAccept.line, prevAccept.column);
  27751. return prevAccept.dfaState.prediction;
  27752. } else {
  27753. // if no accept and EOF is first char, return EOF
  27754. if (t === Token.EOF && input.index === this.startIndex) {
  27755. return Token.EOF;
  27756. }
  27757. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  27758. }
  27759. };
  27760. // Given a starting configuration set, figure out all ATN configurations
  27761. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  27762. // parameter.
  27763. LexerATNSimulator.prototype.getReachableConfigSet = function (input, closure, reach, t) {
  27764. // this is used to skip processing for configs which have a lower priority
  27765. // than a config that already reached an accept state for the same rule
  27766. var skipAlt = ATN.INVALID_ALT_NUMBER;
  27767. for (var i = 0; i < closure.items.length; i++) {
  27768. var cfg = closure.items[i];
  27769. var currentAltReachedAcceptState = cfg.alt === skipAlt;
  27770. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  27771. continue;
  27772. }
  27773. if (LexerATNSimulator.debug) {
  27774. console.log("testing %s at %s\n", this.getTokenName(t), cfg.toString(this.recog, true));
  27775. }
  27776. for (var j = 0; j < cfg.state.transitions.length; j++) {
  27777. var trans = cfg.state.transitions[j]; // for each transition
  27778. var target = this.getReachableTarget(trans, t);
  27779. if (target !== null) {
  27780. var lexerActionExecutor = cfg.lexerActionExecutor;
  27781. if (lexerActionExecutor !== null) {
  27782. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  27783. }
  27784. var treatEofAsEpsilon = t === Token.EOF;
  27785. var config = new LexerATNConfig({ state: target, lexerActionExecutor: lexerActionExecutor }, cfg);
  27786. if (this.closure(input, config, reach, currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  27787. // any remaining configs for this alt have a lower priority
  27788. // than the one that just reached an accept state.
  27789. skipAlt = cfg.alt;
  27790. }
  27791. }
  27792. }
  27793. }
  27794. };
  27795. LexerATNSimulator.prototype.accept = function (input, lexerActionExecutor, startIndex, index, line, charPos) {
  27796. if (LexerATNSimulator.debug) {
  27797. console.log("ACTION %s\n", lexerActionExecutor);
  27798. }
  27799. // seek to after last char in token
  27800. input.seek(index);
  27801. this.line = line;
  27802. this.column = charPos;
  27803. if (lexerActionExecutor !== null && this.recog !== null) {
  27804. lexerActionExecutor.execute(this.recog, input, startIndex);
  27805. }
  27806. };
  27807. LexerATNSimulator.prototype.getReachableTarget = function (trans, t) {
  27808. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  27809. return trans.target;
  27810. } else {
  27811. return null;
  27812. }
  27813. };
  27814. LexerATNSimulator.prototype.computeStartState = function (input, p) {
  27815. var initialContext = PredictionContext.EMPTY;
  27816. var configs = new OrderedATNConfigSet();
  27817. for (var i = 0; i < p.transitions.length; i++) {
  27818. var target = p.transitions[i].target;
  27819. var cfg = new LexerATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  27820. this.closure(input, cfg, configs, false, false, false);
  27821. }
  27822. return configs;
  27823. };
  27824. // Since the alternatives within any lexer decision are ordered by
  27825. // preference, this method stops pursuing the closure as soon as an accept
  27826. // state is reached. After the first accept state is reached by depth-first
  27827. // search from {@code config}, all other (potentially reachable) states for
  27828. // this rule would have a lower priority.
  27829. //
  27830. // @return {@code true} if an accept state is reached, otherwise
  27831. // {@code false}.
  27832. LexerATNSimulator.prototype.closure = function (input, config, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  27833. var cfg = null;
  27834. if (LexerATNSimulator.debug) {
  27835. console.log("closure(" + config.toString(this.recog, true) + ")");
  27836. }
  27837. if (config.state instanceof RuleStopState) {
  27838. if (LexerATNSimulator.debug) {
  27839. if (this.recog !== null) {
  27840. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  27841. } else {
  27842. console.log("closure at rule stop %s\n", config);
  27843. }
  27844. }
  27845. if (config.context === null || config.context.hasEmptyPath()) {
  27846. if (config.context === null || config.context.isEmpty()) {
  27847. configs.add(config);
  27848. return true;
  27849. } else {
  27850. configs.add(new LexerATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config));
  27851. currentAltReachedAcceptState = true;
  27852. }
  27853. }
  27854. if (config.context !== null && !config.context.isEmpty()) {
  27855. for (var i = 0; i < config.context.length; i++) {
  27856. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  27857. var newContext = config.context.getParent(i); // "pop" return state
  27858. var returnState = this.atn.states[config.context.getReturnState(i)];
  27859. cfg = new LexerATNConfig({ state: returnState, context: newContext }, config);
  27860. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  27861. }
  27862. }
  27863. }
  27864. return currentAltReachedAcceptState;
  27865. }
  27866. // optimization
  27867. if (!config.state.epsilonOnlyTransitions) {
  27868. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  27869. configs.add(config);
  27870. }
  27871. }
  27872. for (var j = 0; j < config.state.transitions.length; j++) {
  27873. var trans = config.state.transitions[j];
  27874. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  27875. if (cfg !== null) {
  27876. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  27877. }
  27878. }
  27879. return currentAltReachedAcceptState;
  27880. };
  27881. // side-effect: can alter configs.hasSemanticContext
  27882. LexerATNSimulator.prototype.getEpsilonTarget = function (input, config, trans, configs, speculative, treatEofAsEpsilon) {
  27883. var cfg = null;
  27884. if (trans.serializationType === Transition.RULE) {
  27885. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  27886. cfg = new LexerATNConfig({ state: trans.target, context: newContext }, config);
  27887. } else if (trans.serializationType === Transition.PRECEDENCE) {
  27888. throw "Precedence predicates are not supported in lexers.";
  27889. } else if (trans.serializationType === Transition.PREDICATE) {
  27890. // Track traversing semantic predicates. If we traverse,
  27891. // we cannot add a DFA state for this "reach" computation
  27892. // because the DFA would not test the predicate again in the
  27893. // future. Rather than creating collections of semantic predicates
  27894. // like v3 and testing them on prediction, v4 will test them on the
  27895. // fly all the time using the ATN not the DFA. This is slower but
  27896. // semantically it's not used that often. One of the key elements to
  27897. // this predicate mechanism is not adding DFA states that see
  27898. // predicates immediately afterwards in the ATN. For example,
  27899. // a : ID {p1}? | ID {p2}? ;
  27900. // should create the start state for rule 'a' (to save start state
  27901. // competition), but should not create target of ID state. The
  27902. // collection of ATN states the following ID references includes
  27903. // states reached by traversing predicates. Since this is when we
  27904. // test them, we cannot cash the DFA state target of ID.
  27905. if (LexerATNSimulator.debug) {
  27906. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  27907. }
  27908. configs.hasSemanticContext = true;
  27909. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  27910. cfg = new LexerATNConfig({ state: trans.target }, config);
  27911. }
  27912. } else if (trans.serializationType === Transition.ACTION) {
  27913. if (config.context === null || config.context.hasEmptyPath()) {
  27914. // execute actions anywhere in the start rule for a token.
  27915. //
  27916. // TODO: if the entry rule is invoked recursively, some
  27917. // actions may be executed during the recursive call. The
  27918. // problem can appear when hasEmptyPath() is true but
  27919. // isEmpty() is false. In this case, the config needs to be
  27920. // split into two contexts - one with just the empty path
  27921. // and another with everything but the empty path.
  27922. // Unfortunately, the current algorithm does not allow
  27923. // getEpsilonTarget to return two configurations, so
  27924. // additional modifications are needed before we can support
  27925. // the split operation.
  27926. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor, this.atn.lexerActions[trans.actionIndex]);
  27927. cfg = new LexerATNConfig({ state: trans.target, lexerActionExecutor: lexerActionExecutor }, config);
  27928. } else {
  27929. // ignore actions in referenced rules
  27930. cfg = new LexerATNConfig({ state: trans.target }, config);
  27931. }
  27932. } else if (trans.serializationType === Transition.EPSILON) {
  27933. cfg = new LexerATNConfig({ state: trans.target }, config);
  27934. } else if (trans.serializationType === Transition.ATOM || trans.serializationType === Transition.RANGE || trans.serializationType === Transition.SET) {
  27935. if (treatEofAsEpsilon) {
  27936. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  27937. cfg = new LexerATNConfig({ state: trans.target }, config);
  27938. }
  27939. }
  27940. }
  27941. return cfg;
  27942. };
  27943. // Evaluate a predicate specified in the lexer.
  27944. //
  27945. // <p>If {@code speculative} is {@code true}, this method was called before
  27946. // {@link //consume} for the matched character. This method should call
  27947. // {@link //consume} before evaluating the predicate to ensure position
  27948. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  27949. // and {@link Lexer//getcolumn}, properly reflect the current
  27950. // lexer state. This method should restore {@code input} and the simulator
  27951. // to the original state before returning (i.e. undo the actions made by the
  27952. // call to {@link //consume}.</p>
  27953. //
  27954. // @param input The input stream.
  27955. // @param ruleIndex The rule containing the predicate.
  27956. // @param predIndex The index of the predicate within the rule.
  27957. // @param speculative {@code true} if the current index in {@code input} is
  27958. // one character before the predicate's location.
  27959. //
  27960. // @return {@code true} if the specified predicate evaluates to
  27961. // {@code true}.
  27962. // /
  27963. LexerATNSimulator.prototype.evaluatePredicate = function (input, ruleIndex, predIndex, speculative) {
  27964. // assume true if no recognizer was provided
  27965. if (this.recog === null) {
  27966. return true;
  27967. }
  27968. if (!speculative) {
  27969. return this.recog.sempred(null, ruleIndex, predIndex);
  27970. }
  27971. var savedcolumn = this.column;
  27972. var savedLine = this.line;
  27973. var index = input.index;
  27974. var marker = input.mark();
  27975. try {
  27976. this.consume(input);
  27977. return this.recog.sempred(null, ruleIndex, predIndex);
  27978. } finally {
  27979. this.column = savedcolumn;
  27980. this.line = savedLine;
  27981. input.seek(index);
  27982. input.release(marker);
  27983. }
  27984. };
  27985. LexerATNSimulator.prototype.captureSimState = function (settings, input, dfaState) {
  27986. settings.index = input.index;
  27987. settings.line = this.line;
  27988. settings.column = this.column;
  27989. settings.dfaState = dfaState;
  27990. };
  27991. LexerATNSimulator.prototype.addDFAEdge = function (from_, tk, to, cfgs) {
  27992. if (to === undefined) {
  27993. to = null;
  27994. }
  27995. if (cfgs === undefined) {
  27996. cfgs = null;
  27997. }
  27998. if (to === null && cfgs !== null) {
  27999. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  28000. // marker indicating dynamic predicate evaluation makes this edge
  28001. // dependent on the specific input sequence, so the static edge in the
  28002. // DFA should be omitted. The target DFAState is still created since
  28003. // execATN has the ability to resynchronize with the DFA state cache
  28004. // following the predicate evaluation step.
  28005. //
  28006. // TJP notes: next time through the DFA, we see a pred again and eval.
  28007. // If that gets us to a previously created (but dangling) DFA
  28008. // state, we can continue in pure DFA mode from there.
  28009. // /
  28010. var suppressEdge = cfgs.hasSemanticContext;
  28011. cfgs.hasSemanticContext = false;
  28012. to = this.addDFAState(cfgs);
  28013. if (suppressEdge) {
  28014. return to;
  28015. }
  28016. }
  28017. // add the edge
  28018. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  28019. // Only track edges within the DFA bounds
  28020. return to;
  28021. }
  28022. if (LexerATNSimulator.debug) {
  28023. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  28024. }
  28025. if (from_.edges === null) {
  28026. // make room for tokens 1..n and -1 masquerading as index 0
  28027. from_.edges = [];
  28028. }
  28029. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  28030. return to;
  28031. };
  28032. // Add a new DFA state if there isn't one with this set of
  28033. // configurations already. This method also detects the first
  28034. // configuration containing an ATN rule stop state. Later, when
  28035. // traversing the DFA, we will know which rule to accept.
  28036. LexerATNSimulator.prototype.addDFAState = function (configs) {
  28037. var proposed = new DFAState(null, configs);
  28038. var firstConfigWithRuleStopState = null;
  28039. for (var i = 0; i < configs.items.length; i++) {
  28040. var cfg = configs.items[i];
  28041. if (cfg.state instanceof RuleStopState) {
  28042. firstConfigWithRuleStopState = cfg;
  28043. break;
  28044. }
  28045. }
  28046. if (firstConfigWithRuleStopState !== null) {
  28047. proposed.isAcceptState = true;
  28048. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  28049. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  28050. }
  28051. var dfa = this.decisionToDFA[this.mode];
  28052. var existing = dfa.states.get(proposed);
  28053. if (existing !== null) {
  28054. return existing;
  28055. }
  28056. var newState = proposed;
  28057. newState.stateNumber = dfa.states.length;
  28058. configs.setReadonly(true);
  28059. newState.configs = configs;
  28060. dfa.states.add(newState);
  28061. return newState;
  28062. };
  28063. LexerATNSimulator.prototype.getDFA = function (mode) {
  28064. return this.decisionToDFA[mode];
  28065. };
  28066. // Get the text matched so far for the current token.
  28067. LexerATNSimulator.prototype.getText = function (input) {
  28068. // index is first lookahead char, don't include.
  28069. return input.getText(this.startIndex, input.index - 1);
  28070. };
  28071. LexerATNSimulator.prototype.consume = function (input) {
  28072. var curChar = input.LA(1);
  28073. if (curChar === "\n".charCodeAt(0)) {
  28074. this.line += 1;
  28075. this.column = 0;
  28076. } else {
  28077. this.column += 1;
  28078. }
  28079. input.consume();
  28080. };
  28081. LexerATNSimulator.prototype.getTokenName = function (tt) {
  28082. if (tt === -1) {
  28083. return "EOF";
  28084. } else {
  28085. return "'" + String.fromCharCode(tt) + "'";
  28086. }
  28087. };
  28088. exports.LexerATNSimulator = LexerATNSimulator;
  28089. /***/ }),
  28090. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  28091. /*!************************************************!*\
  28092. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  28093. \************************************************/
  28094. /*! no static exports found */
  28095. /***/ (function(module, exports, __webpack_require__) {
  28096. "use strict";
  28097. //
  28098. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28099. * Use of this file is governed by the BSD 3-clause license that
  28100. * can be found in the LICENSE.txt file in the project root.
  28101. */
  28102. //
  28103. function LexerActionType() {}
  28104. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  28105. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  28106. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  28107. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  28108. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  28109. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  28110. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  28111. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  28112. function LexerAction(action) {
  28113. this.actionType = action;
  28114. this.isPositionDependent = false;
  28115. return this;
  28116. }
  28117. LexerAction.prototype.hashCode = function () {
  28118. var hash = new Hash();
  28119. this.updateHashCode(hash);
  28120. return hash.finish();
  28121. };
  28122. LexerAction.prototype.updateHashCode = function (hash) {
  28123. hash.update(this.actionType);
  28124. };
  28125. LexerAction.prototype.equals = function (other) {
  28126. return this === other;
  28127. };
  28128. //
  28129. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  28130. //
  28131. // <p>The {@code skip} command does not have any parameters, so this action is
  28132. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  28133. function LexerSkipAction() {
  28134. LexerAction.call(this, LexerActionType.SKIP);
  28135. return this;
  28136. }
  28137. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  28138. LexerSkipAction.prototype.constructor = LexerSkipAction;
  28139. // Provides a singleton instance of this parameterless lexer action.
  28140. LexerSkipAction.INSTANCE = new LexerSkipAction();
  28141. LexerSkipAction.prototype.execute = function (lexer) {
  28142. lexer.skip();
  28143. };
  28144. LexerSkipAction.prototype.toString = function () {
  28145. return "skip";
  28146. };
  28147. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  28148. // with the assigned type.
  28149. function LexerTypeAction(type) {
  28150. LexerAction.call(this, LexerActionType.TYPE);
  28151. this.type = type;
  28152. return this;
  28153. }
  28154. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  28155. LexerTypeAction.prototype.constructor = LexerTypeAction;
  28156. LexerTypeAction.prototype.execute = function (lexer) {
  28157. lexer.type = this.type;
  28158. };
  28159. LexerTypeAction.prototype.updateHashCode = function (hash) {
  28160. hash.update(this.actionType, this.type);
  28161. };
  28162. LexerTypeAction.prototype.equals = function (other) {
  28163. if (this === other) {
  28164. return true;
  28165. } else if (!(other instanceof LexerTypeAction)) {
  28166. return false;
  28167. } else {
  28168. return this.type === other.type;
  28169. }
  28170. };
  28171. LexerTypeAction.prototype.toString = function () {
  28172. return "type(" + this.type + ")";
  28173. };
  28174. // Implements the {@code pushMode} lexer action by calling
  28175. // {@link Lexer//pushMode} with the assigned mode.
  28176. function LexerPushModeAction(mode) {
  28177. LexerAction.call(this, LexerActionType.PUSH_MODE);
  28178. this.mode = mode;
  28179. return this;
  28180. }
  28181. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  28182. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  28183. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  28184. // value provided by {@link //getMode}.</p>
  28185. LexerPushModeAction.prototype.execute = function (lexer) {
  28186. lexer.pushMode(this.mode);
  28187. };
  28188. LexerPushModeAction.prototype.updateHashCode = function (hash) {
  28189. hash.update(this.actionType, this.mode);
  28190. };
  28191. LexerPushModeAction.prototype.equals = function (other) {
  28192. if (this === other) {
  28193. return true;
  28194. } else if (!(other instanceof LexerPushModeAction)) {
  28195. return false;
  28196. } else {
  28197. return this.mode === other.mode;
  28198. }
  28199. };
  28200. LexerPushModeAction.prototype.toString = function () {
  28201. return "pushMode(" + this.mode + ")";
  28202. };
  28203. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  28204. //
  28205. // <p>The {@code popMode} command does not have any parameters, so this action is
  28206. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  28207. function LexerPopModeAction() {
  28208. LexerAction.call(this, LexerActionType.POP_MODE);
  28209. return this;
  28210. }
  28211. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  28212. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  28213. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  28214. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  28215. LexerPopModeAction.prototype.execute = function (lexer) {
  28216. lexer.popMode();
  28217. };
  28218. LexerPopModeAction.prototype.toString = function () {
  28219. return "popMode";
  28220. };
  28221. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  28222. //
  28223. // <p>The {@code more} command does not have any parameters, so this action is
  28224. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  28225. function LexerMoreAction() {
  28226. LexerAction.call(this, LexerActionType.MORE);
  28227. return this;
  28228. }
  28229. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  28230. LexerMoreAction.prototype.constructor = LexerMoreAction;
  28231. LexerMoreAction.INSTANCE = new LexerMoreAction();
  28232. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  28233. LexerMoreAction.prototype.execute = function (lexer) {
  28234. lexer.more();
  28235. };
  28236. LexerMoreAction.prototype.toString = function () {
  28237. return "more";
  28238. };
  28239. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  28240. // the assigned mode.
  28241. function LexerModeAction(mode) {
  28242. LexerAction.call(this, LexerActionType.MODE);
  28243. this.mode = mode;
  28244. return this;
  28245. }
  28246. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  28247. LexerModeAction.prototype.constructor = LexerModeAction;
  28248. // <p>This action is implemented by calling {@link Lexer//mode} with the
  28249. // value provided by {@link //getMode}.</p>
  28250. LexerModeAction.prototype.execute = function (lexer) {
  28251. lexer.mode(this.mode);
  28252. };
  28253. LexerModeAction.prototype.updateHashCode = function (hash) {
  28254. hash.update(this.actionType, this.mode);
  28255. };
  28256. LexerModeAction.prototype.equals = function (other) {
  28257. if (this === other) {
  28258. return true;
  28259. } else if (!(other instanceof LexerModeAction)) {
  28260. return false;
  28261. } else {
  28262. return this.mode === other.mode;
  28263. }
  28264. };
  28265. LexerModeAction.prototype.toString = function () {
  28266. return "mode(" + this.mode + ")";
  28267. };
  28268. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  28269. // rule and action indexes assigned to the custom action. The implementation of
  28270. // a custom action is added to the generated code for the lexer in an override
  28271. // of {@link Recognizer//action} when the grammar is compiled.
  28272. //
  28273. // <p>This class may represent embedded actions created with the <code>{...}</code>
  28274. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  28275. // command argument could not be evaluated when the grammar was compiled.</p>
  28276. // Constructs a custom lexer action with the specified rule and action
  28277. // indexes.
  28278. //
  28279. // @param ruleIndex The rule index to use for calls to
  28280. // {@link Recognizer//action}.
  28281. // @param actionIndex The action index to use for calls to
  28282. // {@link Recognizer//action}.
  28283. function LexerCustomAction(ruleIndex, actionIndex) {
  28284. LexerAction.call(this, LexerActionType.CUSTOM);
  28285. this.ruleIndex = ruleIndex;
  28286. this.actionIndex = actionIndex;
  28287. this.isPositionDependent = true;
  28288. return this;
  28289. }
  28290. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  28291. LexerCustomAction.prototype.constructor = LexerCustomAction;
  28292. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  28293. // appropriate rule and action indexes.</p>
  28294. LexerCustomAction.prototype.execute = function (lexer) {
  28295. lexer.action(null, this.ruleIndex, this.actionIndex);
  28296. };
  28297. LexerCustomAction.prototype.updateHashCode = function (hash) {
  28298. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  28299. };
  28300. LexerCustomAction.prototype.equals = function (other) {
  28301. if (this === other) {
  28302. return true;
  28303. } else if (!(other instanceof LexerCustomAction)) {
  28304. return false;
  28305. } else {
  28306. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  28307. }
  28308. };
  28309. // Implements the {@code channel} lexer action by calling
  28310. // {@link Lexer//setChannel} with the assigned channel.
  28311. // Constructs a new {@code channel} action with the specified channel value.
  28312. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  28313. function LexerChannelAction(channel) {
  28314. LexerAction.call(this, LexerActionType.CHANNEL);
  28315. this.channel = channel;
  28316. return this;
  28317. }
  28318. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  28319. LexerChannelAction.prototype.constructor = LexerChannelAction;
  28320. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  28321. // value provided by {@link //getChannel}.</p>
  28322. LexerChannelAction.prototype.execute = function (lexer) {
  28323. lexer._channel = this.channel;
  28324. };
  28325. LexerChannelAction.prototype.updateHashCode = function (hash) {
  28326. hash.update(this.actionType, this.channel);
  28327. };
  28328. LexerChannelAction.prototype.equals = function (other) {
  28329. if (this === other) {
  28330. return true;
  28331. } else if (!(other instanceof LexerChannelAction)) {
  28332. return false;
  28333. } else {
  28334. return this.channel === other.channel;
  28335. }
  28336. };
  28337. LexerChannelAction.prototype.toString = function () {
  28338. return "channel(" + this.channel + ")";
  28339. };
  28340. // This implementation of {@link LexerAction} is used for tracking input offsets
  28341. // for position-dependent actions within a {@link LexerActionExecutor}.
  28342. //
  28343. // <p>This action is not serialized as part of the ATN, and is only required for
  28344. // position-dependent lexer actions which appear at a location other than the
  28345. // end of a rule. For more information about DFA optimizations employed for
  28346. // lexer actions, see {@link LexerActionExecutor//append} and
  28347. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  28348. // Constructs a new indexed custom action by associating a character offset
  28349. // with a {@link LexerAction}.
  28350. //
  28351. // <p>Note: This class is only required for lexer actions for which
  28352. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  28353. //
  28354. // @param offset The offset into the input {@link CharStream}, relative to
  28355. // the token start index, at which the specified lexer action should be
  28356. // executed.
  28357. // @param action The lexer action to execute at a particular offset in the
  28358. // input {@link CharStream}.
  28359. function LexerIndexedCustomAction(offset, action) {
  28360. LexerAction.call(this, action.actionType);
  28361. this.offset = offset;
  28362. this.action = action;
  28363. this.isPositionDependent = true;
  28364. return this;
  28365. }
  28366. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  28367. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  28368. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  28369. // using the provided {@code lexer}.</p>
  28370. LexerIndexedCustomAction.prototype.execute = function (lexer) {
  28371. // assume the input stream position was properly set by the calling code
  28372. this.action.execute(lexer);
  28373. };
  28374. LexerIndexedCustomAction.prototype.updateHashCode = function (hash) {
  28375. hash.update(this.actionType, this.offset, this.action);
  28376. };
  28377. LexerIndexedCustomAction.prototype.equals = function (other) {
  28378. if (this === other) {
  28379. return true;
  28380. } else if (!(other instanceof LexerIndexedCustomAction)) {
  28381. return false;
  28382. } else {
  28383. return this.offset === other.offset && this.action === other.action;
  28384. }
  28385. };
  28386. exports.LexerActionType = LexerActionType;
  28387. exports.LexerSkipAction = LexerSkipAction;
  28388. exports.LexerChannelAction = LexerChannelAction;
  28389. exports.LexerCustomAction = LexerCustomAction;
  28390. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  28391. exports.LexerMoreAction = LexerMoreAction;
  28392. exports.LexerTypeAction = LexerTypeAction;
  28393. exports.LexerPushModeAction = LexerPushModeAction;
  28394. exports.LexerPopModeAction = LexerPopModeAction;
  28395. exports.LexerModeAction = LexerModeAction;
  28396. /***/ }),
  28397. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  28398. /*!********************************************************!*\
  28399. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  28400. \********************************************************/
  28401. /*! no static exports found */
  28402. /***/ (function(module, exports, __webpack_require__) {
  28403. "use strict";
  28404. //
  28405. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28406. * Use of this file is governed by the BSD 3-clause license that
  28407. * can be found in the LICENSE.txt file in the project root.
  28408. */
  28409. ///
  28410. // Represents an executor for a sequence of lexer actions which traversed during
  28411. // the matching operation of a lexer rule (token).
  28412. //
  28413. // <p>The executor tracks position information for position-dependent lexer actions
  28414. // efficiently, ensuring that actions appearing only at the end of the rule do
  28415. // not cause bloating of the {@link DFA} created for the lexer.</p>
  28416. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  28417. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  28418. function LexerActionExecutor(lexerActions) {
  28419. this.lexerActions = lexerActions === null ? [] : lexerActions;
  28420. // Caches the result of {@link //hashCode} since the hash code is an element
  28421. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  28422. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  28423. // lexerActions]))
  28424. return this;
  28425. }
  28426. // Creates a {@link LexerActionExecutor} which executes the actions for
  28427. // the input {@code lexerActionExecutor} followed by a specified
  28428. // {@code lexerAction}.
  28429. //
  28430. // @param lexerActionExecutor The executor for actions already traversed by
  28431. // the lexer while matching a token within a particular
  28432. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  28433. // though it were an empty executor.
  28434. // @param lexerAction The lexer action to execute after the actions
  28435. // specified in {@code lexerActionExecutor}.
  28436. //
  28437. // @return A {@link LexerActionExecutor} for executing the combine actions
  28438. // of {@code lexerActionExecutor} and {@code lexerAction}.
  28439. LexerActionExecutor.append = function (lexerActionExecutor, lexerAction) {
  28440. if (lexerActionExecutor === null) {
  28441. return new LexerActionExecutor([lexerAction]);
  28442. }
  28443. var lexerActions = lexerActionExecutor.lexerActions.concat([lexerAction]);
  28444. return new LexerActionExecutor(lexerActions);
  28445. };
  28446. // Creates a {@link LexerActionExecutor} which encodes the current offset
  28447. // for position-dependent lexer actions.
  28448. //
  28449. // <p>Normally, when the executor encounters lexer actions where
  28450. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  28451. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  28452. // position to the <em>end</em> of the current token. This behavior provides
  28453. // for efficient DFA representation of lexer actions which appear at the end
  28454. // of a lexer rule, even when the lexer rule matches a variable number of
  28455. // characters.</p>
  28456. //
  28457. // <p>Prior to traversing a match transition in the ATN, the current offset
  28458. // from the token start index is assigned to all position-dependent lexer
  28459. // actions which have not already been assigned a fixed offset. By storing
  28460. // the offsets relative to the token start index, the DFA representation of
  28461. // lexer actions which appear in the middle of tokens remains efficient due
  28462. // to sharing among tokens of the same length, regardless of their absolute
  28463. // position in the input stream.</p>
  28464. //
  28465. // <p>If the current executor already has offsets assigned to all
  28466. // position-dependent lexer actions, the method returns {@code this}.</p>
  28467. //
  28468. // @param offset The current offset to assign to all position-dependent
  28469. // lexer actions which do not already have offsets assigned.
  28470. //
  28471. // @return A {@link LexerActionExecutor} which stores input stream offsets
  28472. // for all position-dependent lexer actions.
  28473. // /
  28474. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function (offset) {
  28475. var updatedLexerActions = null;
  28476. for (var i = 0; i < this.lexerActions.length; i++) {
  28477. if (this.lexerActions[i].isPositionDependent && !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  28478. if (updatedLexerActions === null) {
  28479. updatedLexerActions = this.lexerActions.concat([]);
  28480. }
  28481. updatedLexerActions[i] = new LexerIndexedCustomAction(offset, this.lexerActions[i]);
  28482. }
  28483. }
  28484. if (updatedLexerActions === null) {
  28485. return this;
  28486. } else {
  28487. return new LexerActionExecutor(updatedLexerActions);
  28488. }
  28489. };
  28490. // Execute the actions encapsulated by this executor within the context of a
  28491. // particular {@link Lexer}.
  28492. //
  28493. // <p>This method calls {@link IntStream//seek} to set the position of the
  28494. // {@code input} {@link CharStream} prior to calling
  28495. // {@link LexerAction//execute} on a position-dependent action. Before the
  28496. // method returns, the input position will be restored to the same position
  28497. // it was in when the method was invoked.</p>
  28498. //
  28499. // @param lexer The lexer instance.
  28500. // @param input The input stream which is the source for the current token.
  28501. // When this method is called, the current {@link IntStream//index} for
  28502. // {@code input} should be the start of the following token, i.e. 1
  28503. // character past the end of the current token.
  28504. // @param startIndex The token start index. This value may be passed to
  28505. // {@link IntStream//seek} to set the {@code input} position to the beginning
  28506. // of the token.
  28507. // /
  28508. LexerActionExecutor.prototype.execute = function (lexer, input, startIndex) {
  28509. var requiresSeek = false;
  28510. var stopIndex = input.index;
  28511. try {
  28512. for (var i = 0; i < this.lexerActions.length; i++) {
  28513. var lexerAction = this.lexerActions[i];
  28514. if (lexerAction instanceof LexerIndexedCustomAction) {
  28515. var offset = lexerAction.offset;
  28516. input.seek(startIndex + offset);
  28517. lexerAction = lexerAction.action;
  28518. requiresSeek = startIndex + offset !== stopIndex;
  28519. } else if (lexerAction.isPositionDependent) {
  28520. input.seek(stopIndex);
  28521. requiresSeek = false;
  28522. }
  28523. lexerAction.execute(lexer);
  28524. }
  28525. } finally {
  28526. if (requiresSeek) {
  28527. input.seek(stopIndex);
  28528. }
  28529. }
  28530. };
  28531. LexerActionExecutor.prototype.hashCode = function () {
  28532. return this.cachedHashCode;
  28533. };
  28534. LexerActionExecutor.prototype.updateHashCode = function (hash) {
  28535. hash.update(this.cachedHashCode);
  28536. };
  28537. LexerActionExecutor.prototype.equals = function (other) {
  28538. if (this === other) {
  28539. return true;
  28540. } else if (!(other instanceof LexerActionExecutor)) {
  28541. return false;
  28542. } else if (this.cachedHashCode != other.cachedHashCode) {
  28543. return false;
  28544. } else if (this.lexerActions.length != other.lexerActions.length) {
  28545. return false;
  28546. } else {
  28547. var numActions = this.lexerActions.length;
  28548. for (var idx = 0; idx < numActions; ++idx) {
  28549. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  28550. return false;
  28551. }
  28552. }
  28553. return true;
  28554. }
  28555. };
  28556. exports.LexerActionExecutor = LexerActionExecutor;
  28557. /***/ }),
  28558. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  28559. /*!*******************************************************!*\
  28560. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  28561. \*******************************************************/
  28562. /*! no static exports found */
  28563. /***/ (function(module, exports, __webpack_require__) {
  28564. "use strict";
  28565. //
  28566. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28567. * Use of this file is governed by the BSD 3-clause license that
  28568. * can be found in the LICENSE.txt file in the project root.
  28569. */
  28570. //
  28571. //
  28572. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  28573. //
  28574. // <p>
  28575. // The basic complexity of the adaptive strategy makes it harder to understand.
  28576. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  28577. // requests go through the DFA first. If they reach a state without an edge for
  28578. // the current symbol, the algorithm fails over to the ATN simulation to
  28579. // complete the DFA path for the current input (until it finds a conflict state
  28580. // or uniquely predicting state).</p>
  28581. //
  28582. // <p>
  28583. // All of that is done without using the outer context because we want to create
  28584. // a DFA that is not dependent upon the rule invocation stack when we do a
  28585. // prediction. One DFA works in all contexts. We avoid using context not
  28586. // necessarily because it's slower, although it can be, but because of the DFA
  28587. // caching problem. The closure routine only considers the rule invocation stack
  28588. // created during prediction beginning in the decision rule. For example, if
  28589. // prediction occurs without invoking another rule's ATN, there are no context
  28590. // stacks in the configurations. When lack of context leads to a conflict, we
  28591. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  28592. // strategy (versus full LL(*)).</p>
  28593. //
  28594. // <p>
  28595. // When SLL yields a configuration set with conflict, we rewind the input and
  28596. // retry the ATN simulation, this time using full outer context without adding
  28597. // to the DFA. Configuration context stacks will be the full invocation stacks
  28598. // from the start rule. If we get a conflict using full context, then we can
  28599. // definitively say we have a true ambiguity for that input sequence. If we
  28600. // don't get a conflict, it implies that the decision is sensitive to the outer
  28601. // context. (It is not context-sensitive in the sense of context-sensitive
  28602. // grammars.)</p>
  28603. //
  28604. // <p>
  28605. // The next time we reach this DFA state with an SLL conflict, through DFA
  28606. // simulation, we will again retry the ATN simulation using full context mode.
  28607. // This is slow because we can't save the results and have to "interpret" the
  28608. // ATN each time we get that input.</p>
  28609. //
  28610. // <p>
  28611. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  28612. //
  28613. // <p>
  28614. // We could cache results from full context to predicted alternative easily and
  28615. // that saves a lot of time but doesn't work in presence of predicates. The set
  28616. // of visible predicates from the ATN start state changes depending on the
  28617. // context, because closure can fall off the end of a rule. I tried to cache
  28618. // tuples (stack context, semantic context, predicted alt) but it was slower
  28619. // than interpreting and much more complicated. Also required a huge amount of
  28620. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  28621. // to keep this algorithm simple. By launching multiple threads, we can improve
  28622. // the speed of parsing across a large number of files.</p>
  28623. //
  28624. // <p>
  28625. // There is no strict ordering between the amount of input used by SLL vs LL,
  28626. // which makes it really hard to build a cache for full context. Let's say that
  28627. // we have input A B C that leads to an SLL conflict with full context X. That
  28628. // implies that using X we might only use A B but we could also use A B C D to
  28629. // resolve conflict. Input A B C D could predict alternative 1 in one position
  28630. // in the input and A B C E could predict alternative 2 in another position in
  28631. // input. The conflicting SLL configurations could still be non-unique in the
  28632. // full context prediction, which would lead us to requiring more input than the
  28633. // original A B C. To make a prediction cache work, we have to track the exact
  28634. // input used during the previous prediction. That amounts to a cache that maps
  28635. // X to a specific DFA for that context.</p>
  28636. //
  28637. // <p>
  28638. // Something should be done for left-recursive expression predictions. They are
  28639. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  28640. // with full LL thing Sam does.</p>
  28641. //
  28642. // <p>
  28643. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  28644. //
  28645. // <p>
  28646. // We avoid doing full context retry when the outer context is empty, we did not
  28647. // dip into the outer context by falling off the end of the decision state rule,
  28648. // or when we force SLL mode.</p>
  28649. //
  28650. // <p>
  28651. // As an example of the not dip into outer context case, consider as super
  28652. // constructor calls versus function calls. One grammar might look like
  28653. // this:</p>
  28654. //
  28655. // <pre>
  28656. // ctorBody
  28657. // : '{' superCall? stat* '}'
  28658. // ;
  28659. // </pre>
  28660. //
  28661. // <p>
  28662. // Or, you might see something like</p>
  28663. //
  28664. // <pre>
  28665. // stat
  28666. // : superCall ';'
  28667. // | expression ';'
  28668. // | ...
  28669. // ;
  28670. // </pre>
  28671. //
  28672. // <p>
  28673. // In both cases I believe that no closure operations will dip into the outer
  28674. // context. In the first case ctorBody in the worst case will stop at the '}'.
  28675. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  28676. // entry rule and not dip into the outer context.</p>
  28677. //
  28678. // <p>
  28679. // <strong>PREDICATES</strong></p>
  28680. //
  28681. // <p>
  28682. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  28683. // LL simulation deals with predicates differently. SLL collects predicates as
  28684. // it performs closure operations like ANTLR v3 did. It delays predicate
  28685. // evaluation until it reaches and accept state. This allows us to cache the SLL
  28686. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  28687. // closure, the DFA state configuration sets would be different and we couldn't
  28688. // build up a suitable DFA.</p>
  28689. //
  28690. // <p>
  28691. // When building a DFA accept state during ATN simulation, we evaluate any
  28692. // predicates and return the sole semantically valid alternative. If there is
  28693. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  28694. // we throw an exception. Alternatives without predicates act like they have
  28695. // true predicates. The simple way to think about it is to strip away all
  28696. // alternatives with false predicates and choose the minimum alternative that
  28697. // remains.</p>
  28698. //
  28699. // <p>
  28700. // When we start in the DFA and reach an accept state that's predicated, we test
  28701. // those and return the minimum semantically viable alternative. If no
  28702. // alternatives are viable, we throw an exception.</p>
  28703. //
  28704. // <p>
  28705. // During full LL ATN simulation, closure always evaluates predicates and
  28706. // on-the-fly. This is crucial to reducing the configuration set size during
  28707. // closure. It hits a landmine when parsing with the Java grammar, for example,
  28708. // without this on-the-fly evaluation.</p>
  28709. //
  28710. // <p>
  28711. // <strong>SHARING DFA</strong></p>
  28712. //
  28713. // <p>
  28714. // All instances of the same parser share the same decision DFAs through a
  28715. // static field. Each instance gets its own ATN simulator but they share the
  28716. // same {@link //decisionToDFA} field. They also share a
  28717. // {@link PredictionContextCache} object that makes sure that all
  28718. // {@link PredictionContext} objects are shared among the DFA states. This makes
  28719. // a big size difference.</p>
  28720. //
  28721. // <p>
  28722. // <strong>THREAD SAFETY</strong></p>
  28723. //
  28724. // <p>
  28725. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  28726. // it adds a new DFA object to that array. {@link //addDFAEdge}
  28727. // locks on the DFA for the current decision when setting the
  28728. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  28729. // the DFA for the current decision when looking up a DFA state to see if it
  28730. // already exists. We must make sure that all requests to add DFA states that
  28731. // are equivalent result in the same shared DFA object. This is because lots of
  28732. // threads will be trying to update the DFA at once. The
  28733. // {@link //addDFAState} method also locks inside the DFA lock
  28734. // but this time on the shared context cache when it rebuilds the
  28735. // configurations' {@link PredictionContext} objects using cached
  28736. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  28737. // safe as long as we can guarantee that all threads referencing
  28738. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  28739. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  28740. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  28741. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  28742. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  28743. // {@code dfa.edges[t]} to be non-null. The
  28744. // {@link //addDFAEdge} method could be racing to set the field
  28745. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  28746. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  28747. // way it will work because it's not doing a test and set operation.</p>
  28748. //
  28749. // <p>
  28750. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  28751. // Parsing)</strong></p>
  28752. //
  28753. // <p>
  28754. // Sam pointed out that if SLL does not give a syntax error, then there is no
  28755. // point in doing full LL, which is slower. We only have to try LL if we get a
  28756. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  28757. // mode with the {@link BailErrorStrategy}:</p>
  28758. //
  28759. // <pre>
  28760. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  28761. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  28762. // </pre>
  28763. //
  28764. // <p>
  28765. // If it does not get a syntax error, then we're done. If it does get a syntax
  28766. // error, we need to retry with the combined SLL/LL strategy.</p>
  28767. //
  28768. // <p>
  28769. // The reason this works is as follows. If there are no SLL conflicts, then the
  28770. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  28771. // the full LL analysis must yield a set of viable alternatives which is a
  28772. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  28773. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  28774. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  28775. // is truly ambiguous on the current input. If the LL set is smaller, then the
  28776. // SLL conflict resolution might choose an alternative that the full LL would
  28777. // rule out as a possibility based upon better context information. If that's
  28778. // the case, then the SLL parse will definitely get an error because the full LL
  28779. // analysis says it's not viable. If SLL conflict resolution chooses an
  28780. // alternative within the LL set, them both SLL and LL would choose the same
  28781. // alternative because they both choose the minimum of multiple conflicting
  28782. // alternatives.</p>
  28783. //
  28784. // <p>
  28785. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  28786. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  28787. // parsing will get an error because SLL will pursue alternative 1. If
  28788. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  28789. // choose the same alternative because alternative one is the minimum of either
  28790. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  28791. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  28792. //
  28793. // <p>
  28794. // Of course, if the input is invalid, then we will get an error for sure in
  28795. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  28796. // the input.</p>
  28797. //
  28798. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  28799. var Set = Utils.Set;
  28800. var BitSet = Utils.BitSet;
  28801. var DoubleDict = Utils.DoubleDict;
  28802. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  28803. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  28804. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  28805. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  28806. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  28807. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  28808. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  28809. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  28810. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  28811. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  28812. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  28813. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  28814. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  28815. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  28816. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  28817. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  28818. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  28819. var Transition = Transitions.Transition;
  28820. var SetTransition = Transitions.SetTransition;
  28821. var NotSetTransition = Transitions.NotSetTransition;
  28822. var RuleTransition = Transitions.RuleTransition;
  28823. var ActionTransition = Transitions.ActionTransition;
  28824. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  28825. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  28826. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  28827. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  28828. ATNSimulator.call(this, atn, sharedContextCache);
  28829. this.parser = parser;
  28830. this.decisionToDFA = decisionToDFA;
  28831. // SLL, LL, or LL + exact ambig detection?//
  28832. this.predictionMode = PredictionMode.LL;
  28833. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  28834. this._input = null;
  28835. this._startIndex = 0;
  28836. this._outerContext = null;
  28837. this._dfa = null;
  28838. // Each prediction operation uses a cache for merge of prediction contexts.
  28839. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  28840. // isn't synchronized but we're ok since two threads shouldn't reuse same
  28841. // parser/atnsim object because it can only handle one input at a time.
  28842. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  28843. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  28844. // also be examined during cache lookup.
  28845. //
  28846. this.mergeCache = null;
  28847. return this;
  28848. }
  28849. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  28850. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  28851. ParserATNSimulator.prototype.debug = false;
  28852. ParserATNSimulator.prototype.debug_closure = false;
  28853. ParserATNSimulator.prototype.debug_add = false;
  28854. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  28855. ParserATNSimulator.prototype.dfa_debug = false;
  28856. ParserATNSimulator.prototype.retry_debug = false;
  28857. ParserATNSimulator.prototype.reset = function () {};
  28858. ParserATNSimulator.prototype.adaptivePredict = function (input, decision, outerContext) {
  28859. if (this.debug || this.debug_list_atn_decisions) {
  28860. console.log("adaptivePredict decision " + decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  28861. }
  28862. this._input = input;
  28863. this._startIndex = input.index;
  28864. this._outerContext = outerContext;
  28865. var dfa = this.decisionToDFA[decision];
  28866. this._dfa = dfa;
  28867. var m = input.mark();
  28868. var index = input.index;
  28869. // Now we are certain to have a specific decision's DFA
  28870. // But, do we still need an initial state?
  28871. try {
  28872. var s0;
  28873. if (dfa.precedenceDfa) {
  28874. // the start state for a precedence DFA depends on the current
  28875. // parser precedence, and is provided by a DFA method.
  28876. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  28877. } else {
  28878. // the start state for a "regular" DFA is just s0
  28879. s0 = dfa.s0;
  28880. }
  28881. if (s0 === null) {
  28882. if (outerContext === null) {
  28883. outerContext = RuleContext.EMPTY;
  28884. }
  28885. if (this.debug || this.debug_list_atn_decisions) {
  28886. console.log("predictATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  28887. }
  28888. var fullCtx = false;
  28889. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  28890. if (dfa.precedenceDfa) {
  28891. // If this is a precedence DFA, we use applyPrecedenceFilter
  28892. // to convert the computed start state to a precedence start
  28893. // state. We then use DFA.setPrecedenceStartState to set the
  28894. // appropriate start state for the precedence level rather
  28895. // than simply setting DFA.s0.
  28896. //
  28897. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  28898. s0_closure = this.applyPrecedenceFilter(s0_closure);
  28899. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28900. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  28901. } else {
  28902. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28903. dfa.s0 = s0;
  28904. }
  28905. }
  28906. var alt = this.execATN(dfa, s0, input, index, outerContext);
  28907. if (this.debug) {
  28908. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  28909. }
  28910. return alt;
  28911. } finally {
  28912. this._dfa = null;
  28913. this.mergeCache = null; // wack cache after each prediction
  28914. input.seek(index);
  28915. input.release(m);
  28916. }
  28917. };
  28918. // Performs ATN simulation to compute a predicted alternative based
  28919. // upon the remaining input, but also updates the DFA cache to avoid
  28920. // having to traverse the ATN again for the same input sequence.
  28921. // There are some key conditions we're looking for after computing a new
  28922. // set of ATN configs (proposed DFA state):
  28923. // if the set is empty, there is no viable alternative for current symbol
  28924. // does the state uniquely predict an alternative?
  28925. // does the state have a conflict that would prevent us from
  28926. // putting it on the work list?
  28927. // We also have some key operations to do:
  28928. // add an edge from previous DFA state to potentially new DFA state, D,
  28929. // upon current symbol but only if adding to work list, which means in all
  28930. // cases except no viable alternative (and possibly non-greedy decisions?)
  28931. // collecting predicates and adding semantic context to DFA accept states
  28932. // adding rule context to context-sensitive DFA accept states
  28933. // consuming an input symbol
  28934. // reporting a conflict
  28935. // reporting an ambiguity
  28936. // reporting a context sensitivity
  28937. // reporting insufficient predicates
  28938. // cover these cases:
  28939. // dead end
  28940. // single alt
  28941. // single alt + preds
  28942. // conflict
  28943. // conflict + preds
  28944. //
  28945. ParserATNSimulator.prototype.execATN = function (dfa, s0, input, startIndex, outerContext) {
  28946. if (this.debug || this.debug_list_atn_decisions) {
  28947. console.log("execATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  28948. }
  28949. var alt;
  28950. var previousD = s0;
  28951. if (this.debug) {
  28952. console.log("s0 = " + s0);
  28953. }
  28954. var t = input.LA(1);
  28955. while (true) {
  28956. // while more work
  28957. var D = this.getExistingTargetState(previousD, t);
  28958. if (D === null) {
  28959. D = this.computeTargetState(dfa, previousD, t);
  28960. }
  28961. if (D === ATNSimulator.ERROR) {
  28962. // if any configs in previous dipped into outer context, that
  28963. // means that input up to t actually finished entry rule
  28964. // at least for SLL decision. Full LL doesn't dip into outer
  28965. // so don't need special case.
  28966. // We will get an error no matter what so delay until after
  28967. // decision; better error message. Also, no reachable target
  28968. // ATN states in SLL implies LL will also get nowhere.
  28969. // If conflict in states that dip out, choose min since we
  28970. // will get error no matter what.
  28971. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  28972. input.seek(startIndex);
  28973. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  28974. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28975. return alt;
  28976. } else {
  28977. throw e;
  28978. }
  28979. }
  28980. if (D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  28981. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  28982. var conflictingAlts = null;
  28983. if (D.predicates !== null) {
  28984. if (this.debug) {
  28985. console.log("DFA state has preds in DFA sim LL failover");
  28986. }
  28987. var conflictIndex = input.index;
  28988. if (conflictIndex !== startIndex) {
  28989. input.seek(startIndex);
  28990. }
  28991. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  28992. if (conflictingAlts.length === 1) {
  28993. if (this.debug) {
  28994. console.log("Full LL avoided");
  28995. }
  28996. return conflictingAlts.minValue();
  28997. }
  28998. if (conflictIndex !== startIndex) {
  28999. // restore the index so reporting the fallback to full
  29000. // context occurs with the index at the correct spot
  29001. input.seek(conflictIndex);
  29002. }
  29003. }
  29004. if (this.dfa_debug) {
  29005. console.log("ctx sensitive state " + outerContext + " in " + D);
  29006. }
  29007. var fullCtx = true;
  29008. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  29009. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  29010. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  29011. return alt;
  29012. }
  29013. if (D.isAcceptState) {
  29014. if (D.predicates === null) {
  29015. return D.prediction;
  29016. }
  29017. var stopIndex = input.index;
  29018. input.seek(startIndex);
  29019. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  29020. if (alts.length === 0) {
  29021. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  29022. } else if (alts.length === 1) {
  29023. return alts.minValue();
  29024. } else {
  29025. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  29026. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  29027. return alts.minValue();
  29028. }
  29029. }
  29030. previousD = D;
  29031. if (t !== Token.EOF) {
  29032. input.consume();
  29033. t = input.LA(1);
  29034. }
  29035. }
  29036. };
  29037. //
  29038. // Get an existing target state for an edge in the DFA. If the target state
  29039. // for the edge has not yet been computed or is otherwise not available,
  29040. // this method returns {@code null}.
  29041. //
  29042. // @param previousD The current DFA state
  29043. // @param t The next input symbol
  29044. // @return The existing target DFA state for the given input symbol
  29045. // {@code t}, or {@code null} if the target state for this edge is not
  29046. // already cached
  29047. //
  29048. ParserATNSimulator.prototype.getExistingTargetState = function (previousD, t) {
  29049. var edges = previousD.edges;
  29050. if (edges === null) {
  29051. return null;
  29052. } else {
  29053. return edges[t + 1] || null;
  29054. }
  29055. };
  29056. //
  29057. // Compute a target state for an edge in the DFA, and attempt to add the
  29058. // computed state and corresponding edge to the DFA.
  29059. //
  29060. // @param dfa The DFA
  29061. // @param previousD The current DFA state
  29062. // @param t The next input symbol
  29063. //
  29064. // @return The computed target DFA state for the given input symbol
  29065. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  29066. // returns {@link //ERROR}.
  29067. //
  29068. ParserATNSimulator.prototype.computeTargetState = function (dfa, previousD, t) {
  29069. var reach = this.computeReachSet(previousD.configs, t, false);
  29070. if (reach === null) {
  29071. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  29072. return ATNSimulator.ERROR;
  29073. }
  29074. // create new target state; we'll add to DFA after it's complete
  29075. var D = new DFAState(null, reach);
  29076. var predictedAlt = this.getUniqueAlt(reach);
  29077. if (this.debug) {
  29078. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  29079. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) + ", previous=" + previousD.configs + ", configs=" + reach + ", predict=" + predictedAlt + ", allSubsetsConflict=" + PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" + this.getConflictingAlts(reach));
  29080. }
  29081. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  29082. // NO CONFLICT, UNIQUELY PREDICTED ALT
  29083. D.isAcceptState = true;
  29084. D.configs.uniqueAlt = predictedAlt;
  29085. D.prediction = predictedAlt;
  29086. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  29087. // MORE THAN ONE VIABLE ALTERNATIVE
  29088. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  29089. D.requiresFullContext = true;
  29090. // in SLL-only mode, we will stop at this state and return the minimum alt
  29091. D.isAcceptState = true;
  29092. D.prediction = D.configs.conflictingAlts.minValue();
  29093. }
  29094. if (D.isAcceptState && D.configs.hasSemanticContext) {
  29095. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  29096. if (D.predicates !== null) {
  29097. D.prediction = ATN.INVALID_ALT_NUMBER;
  29098. }
  29099. }
  29100. // all adds to dfa are done after we've created full D state
  29101. D = this.addDFAEdge(dfa, previousD, t, D);
  29102. return D;
  29103. };
  29104. ParserATNSimulator.prototype.predicateDFAState = function (dfaState, decisionState) {
  29105. // We need to test all predicates, even in DFA states that
  29106. // uniquely predict alternative.
  29107. var nalts = decisionState.transitions.length;
  29108. // Update DFA so reach becomes accept state with (predicate,alt)
  29109. // pairs if preds found for conflicting alts
  29110. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  29111. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  29112. if (altToPred !== null) {
  29113. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  29114. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  29115. } else {
  29116. // There are preds in configs but they might go away
  29117. // when OR'd together like {p}? || NONE == NONE. If neither
  29118. // alt has preds, resolve to min alt
  29119. dfaState.prediction = altsToCollectPredsFrom.minValue();
  29120. }
  29121. };
  29122. // comes back with reach.uniqueAlt set to a valid alt
  29123. ParserATNSimulator.prototype.execATNWithFullContext = function (dfa, D, // how far we got before failing over
  29124. s0, input, startIndex, outerContext) {
  29125. if (this.debug || this.debug_list_atn_decisions) {
  29126. console.log("execATNWithFullContext " + s0);
  29127. }
  29128. var fullCtx = true;
  29129. var foundExactAmbig = false;
  29130. var reach = null;
  29131. var previous = s0;
  29132. input.seek(startIndex);
  29133. var t = input.LA(1);
  29134. var predictedAlt = -1;
  29135. while (true) {
  29136. // while more work
  29137. reach = this.computeReachSet(previous, t, fullCtx);
  29138. if (reach === null) {
  29139. // if any configs in previous dipped into outer context, that
  29140. // means that input up to t actually finished entry rule
  29141. // at least for LL decision. Full LL doesn't dip into outer
  29142. // so don't need special case.
  29143. // We will get an error no matter what so delay until after
  29144. // decision; better error message. Also, no reachable target
  29145. // ATN states in SLL implies LL will also get nowhere.
  29146. // If conflict in states that dip out, choose min since we
  29147. // will get error no matter what.
  29148. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  29149. input.seek(startIndex);
  29150. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  29151. if (alt !== ATN.INVALID_ALT_NUMBER) {
  29152. return alt;
  29153. } else {
  29154. throw e;
  29155. }
  29156. }
  29157. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  29158. if (this.debug) {
  29159. console.log("LL altSubSets=" + altSubSets + ", predict=" + PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" + PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  29160. }
  29161. reach.uniqueAlt = this.getUniqueAlt(reach);
  29162. // unique prediction?
  29163. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  29164. predictedAlt = reach.uniqueAlt;
  29165. break;
  29166. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  29167. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  29168. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  29169. break;
  29170. }
  29171. } else {
  29172. // In exact ambiguity mode, we never try to terminate early.
  29173. // Just keeps scarfing until we know what the conflict is
  29174. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  29175. foundExactAmbig = true;
  29176. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  29177. break;
  29178. }
  29179. // else there are multiple non-conflicting subsets or
  29180. // we're not sure what the ambiguity is yet.
  29181. // So, keep going.
  29182. }
  29183. previous = reach;
  29184. if (t !== Token.EOF) {
  29185. input.consume();
  29186. t = input.LA(1);
  29187. }
  29188. }
  29189. // If the configuration set uniquely predicts an alternative,
  29190. // without conflict, then we know that it's a full LL decision
  29191. // not SLL.
  29192. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  29193. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  29194. return predictedAlt;
  29195. }
  29196. // We do not check predicates here because we have checked them
  29197. // on-the-fly when doing full context prediction.
  29198. //
  29199. // In non-exact ambiguity detection mode, we might actually be able to
  29200. // detect an exact ambiguity, but I'm not going to spend the cycles
  29201. // needed to check. We only emit ambiguity warnings in exact ambiguity
  29202. // mode.
  29203. //
  29204. // For example, we might know that we have conflicting configurations.
  29205. // But, that does not mean that there is no way forward without a
  29206. // conflict. It's possible to have nonconflicting alt subsets as in:
  29207. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  29208. // from
  29209. //
  29210. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  29211. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  29212. //
  29213. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  29214. // would resolve this without conflict to alternative 1. Any other viable
  29215. // next sequence, however, is associated with a conflict. We stop
  29216. // looking for input because no amount of further lookahead will alter
  29217. // the fact that we should predict alternative 1. We just can't say for
  29218. // sure that there is an ambiguity without looking further.
  29219. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  29220. return predictedAlt;
  29221. };
  29222. ParserATNSimulator.prototype.computeReachSet = function (closure, t, fullCtx) {
  29223. if (this.debug) {
  29224. console.log("in computeReachSet, starting closure: " + closure);
  29225. }
  29226. if (this.mergeCache === null) {
  29227. this.mergeCache = new DoubleDict();
  29228. }
  29229. var intermediate = new ATNConfigSet(fullCtx);
  29230. // Configurations already in a rule stop state indicate reaching the end
  29231. // of the decision rule (local context) or end of the start rule (full
  29232. // context). Once reached, these configurations are never updated by a
  29233. // closure operation, so they are handled separately for the performance
  29234. // advantage of having a smaller intermediate set when calling closure.
  29235. //
  29236. // For full-context reach operations, separate handling is required to
  29237. // ensure that the alternative matching the longest overall sequence is
  29238. // chosen when multiple such configurations can match the input.
  29239. var skippedStopStates = null;
  29240. // First figure out where we can reach on input t
  29241. for (var i = 0; i < closure.items.length; i++) {
  29242. var c = closure.items[i];
  29243. if (this.debug_add) {
  29244. console.log("testing " + this.getTokenName(t) + " at " + c);
  29245. }
  29246. if (c.state instanceof RuleStopState) {
  29247. if (fullCtx || t === Token.EOF) {
  29248. if (skippedStopStates === null) {
  29249. skippedStopStates = [];
  29250. }
  29251. skippedStopStates.push(c);
  29252. if (this.debug_add) {
  29253. console.log("added " + c + " to skippedStopStates");
  29254. }
  29255. }
  29256. continue;
  29257. }
  29258. for (var j = 0; j < c.state.transitions.length; j++) {
  29259. var trans = c.state.transitions[j];
  29260. var target = this.getReachableTarget(trans, t);
  29261. if (target !== null) {
  29262. var cfg = new ATNConfig({ state: target }, c);
  29263. intermediate.add(cfg, this.mergeCache);
  29264. if (this.debug_add) {
  29265. console.log("added " + cfg + " to intermediate");
  29266. }
  29267. }
  29268. }
  29269. }
  29270. // Now figure out where the reach operation can take us...
  29271. var reach = null;
  29272. // This block optimizes the reach operation for intermediate sets which
  29273. // trivially indicate a termination state for the overall
  29274. // adaptivePredict operation.
  29275. //
  29276. // The conditions assume that intermediate
  29277. // contains all configurations relevant to the reach set, but this
  29278. // condition is not true when one or more configurations have been
  29279. // withheld in skippedStopStates, or when the current symbol is EOF.
  29280. //
  29281. if (skippedStopStates === null && t !== Token.EOF) {
  29282. if (intermediate.items.length === 1) {
  29283. // Don't pursue the closure if there is just one state.
  29284. // It can only have one alternative; just add to result
  29285. // Also don't pursue the closure if there is unique alternative
  29286. // among the configurations.
  29287. reach = intermediate;
  29288. } else if (this.getUniqueAlt(intermediate) !== ATN.INVALID_ALT_NUMBER) {
  29289. // Also don't pursue the closure if there is unique alternative
  29290. // among the configurations.
  29291. reach = intermediate;
  29292. }
  29293. }
  29294. // If the reach set could not be trivially determined, perform a closure
  29295. // operation on the intermediate set to compute its initial value.
  29296. //
  29297. if (reach === null) {
  29298. reach = new ATNConfigSet(fullCtx);
  29299. var closureBusy = new Set();
  29300. var treatEofAsEpsilon = t === Token.EOF;
  29301. for (var k = 0; k < intermediate.items.length; k++) {
  29302. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  29303. }
  29304. }
  29305. if (t === Token.EOF) {
  29306. // After consuming EOF no additional input is possible, so we are
  29307. // only interested in configurations which reached the end of the
  29308. // decision rule (local context) or end of the start rule (full
  29309. // context). Update reach to contain only these configurations. This
  29310. // handles both explicit EOF transitions in the grammar and implicit
  29311. // EOF transitions following the end of the decision or start rule.
  29312. //
  29313. // When reach==intermediate, no closure operation was performed. In
  29314. // this case, removeAllConfigsNotInRuleStopState needs to check for
  29315. // reachable rule stop states as well as configurations already in
  29316. // a rule stop state.
  29317. //
  29318. // This is handled before the configurations in skippedStopStates,
  29319. // because any configurations potentially added from that list are
  29320. // already guaranteed to meet this condition whether or not it's
  29321. // required.
  29322. //
  29323. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  29324. }
  29325. // If skippedStopStates!==null, then it contains at least one
  29326. // configuration. For full-context reach operations, these
  29327. // configurations reached the end of the start rule, in which case we
  29328. // only add them back to reach if no configuration during the current
  29329. // closure operation reached such a state. This ensures adaptivePredict
  29330. // chooses an alternative matching the longest overall sequence when
  29331. // multiple alternatives are viable.
  29332. //
  29333. if (skippedStopStates !== null && (!fullCtx || !PredictionMode.hasConfigInRuleStopState(reach))) {
  29334. for (var l = 0; l < skippedStopStates.length; l++) {
  29335. reach.add(skippedStopStates[l], this.mergeCache);
  29336. }
  29337. }
  29338. if (reach.items.length === 0) {
  29339. return null;
  29340. } else {
  29341. return reach;
  29342. }
  29343. };
  29344. //
  29345. // Return a configuration set containing only the configurations from
  29346. // {@code configs} which are in a {@link RuleStopState}. If all
  29347. // configurations in {@code configs} are already in a rule stop state, this
  29348. // method simply returns {@code configs}.
  29349. //
  29350. // <p>When {@code lookToEndOfRule} is true, this method uses
  29351. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  29352. // not already in a rule stop state to see if a rule stop state is reachable
  29353. // from the configuration via epsilon-only transitions.</p>
  29354. //
  29355. // @param configs the configuration set to update
  29356. // @param lookToEndOfRule when true, this method checks for rule stop states
  29357. // reachable by epsilon-only transitions from each configuration in
  29358. // {@code configs}.
  29359. //
  29360. // @return {@code configs} if all configurations in {@code configs} are in a
  29361. // rule stop state, otherwise return a new configuration set containing only
  29362. // the configurations from {@code configs} which are in a rule stop state
  29363. //
  29364. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function (configs, lookToEndOfRule) {
  29365. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  29366. return configs;
  29367. }
  29368. var result = new ATNConfigSet(configs.fullCtx);
  29369. for (var i = 0; i < configs.items.length; i++) {
  29370. var config = configs.items[i];
  29371. if (config.state instanceof RuleStopState) {
  29372. result.add(config, this.mergeCache);
  29373. continue;
  29374. }
  29375. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  29376. var nextTokens = this.atn.nextTokens(config.state);
  29377. if (nextTokens.contains(Token.EPSILON)) {
  29378. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  29379. result.add(new ATNConfig({ state: endOfRuleState }, config), this.mergeCache);
  29380. }
  29381. }
  29382. }
  29383. return result;
  29384. };
  29385. ParserATNSimulator.prototype.computeStartState = function (p, ctx, fullCtx) {
  29386. // always at least the implicit call to start rule
  29387. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  29388. var configs = new ATNConfigSet(fullCtx);
  29389. for (var i = 0; i < p.transitions.length; i++) {
  29390. var target = p.transitions[i].target;
  29391. var c = new ATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  29392. var closureBusy = new Set();
  29393. this.closure(c, configs, closureBusy, true, fullCtx, false);
  29394. }
  29395. return configs;
  29396. };
  29397. //
  29398. // This method transforms the start state computed by
  29399. // {@link //computeStartState} to the special start state used by a
  29400. // precedence DFA for a particular precedence value. The transformation
  29401. // process applies the following changes to the start state's configuration
  29402. // set.
  29403. //
  29404. // <ol>
  29405. // <li>Evaluate the precedence predicates for each configuration using
  29406. // {@link SemanticContext//evalPrecedence}.</li>
  29407. // <li>Remove all configurations which predict an alternative greater than
  29408. // 1, for which another configuration that predicts alternative 1 is in the
  29409. // same ATN state with the same prediction context. This transformation is
  29410. // valid for the following reasons:
  29411. // <ul>
  29412. // <li>The closure block cannot contain any epsilon transitions which bypass
  29413. // the body of the closure, so all states reachable via alternative 1 are
  29414. // part of the precedence alternatives of the transformed left-recursive
  29415. // rule.</li>
  29416. // <li>The "primary" portion of a left recursive rule cannot contain an
  29417. // epsilon transition, so the only way an alternative other than 1 can exist
  29418. // in a state that is also reachable via alternative 1 is by nesting calls
  29419. // to the left-recursive rule, with the outer calls not being at the
  29420. // preferred precedence level.</li>
  29421. // </ul>
  29422. // </li>
  29423. // </ol>
  29424. //
  29425. // <p>
  29426. // The prediction context must be considered by this filter to address
  29427. // situations like the following.
  29428. // </p>
  29429. // <code>
  29430. // <pre>
  29431. // grammar TA;
  29432. // prog: statement* EOF;
  29433. // statement: letterA | statement letterA 'b' ;
  29434. // letterA: 'a';
  29435. // </pre>
  29436. // </code>
  29437. // <p>
  29438. // If the above grammar, the ATN state immediately before the token
  29439. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  29440. // of both the primary and closure blocks of the left-recursive rule
  29441. // {@code statement}. The prediction context associated with each of these
  29442. // configurations distinguishes between them, and prevents the alternative
  29443. // which stepped out to {@code prog} (and then back in to {@code statement}
  29444. // from being eliminated by the filter.
  29445. // </p>
  29446. //
  29447. // @param configs The configuration set computed by
  29448. // {@link //computeStartState} as the start state for the DFA.
  29449. // @return The transformed configuration set representing the start state
  29450. // for a precedence DFA at a particular precedence level (determined by
  29451. // calling {@link Parser//getPrecedence}).
  29452. //
  29453. ParserATNSimulator.prototype.applyPrecedenceFilter = function (configs) {
  29454. var config;
  29455. var statesFromAlt1 = [];
  29456. var configSet = new ATNConfigSet(configs.fullCtx);
  29457. for (var i = 0; i < configs.items.length; i++) {
  29458. config = configs.items[i];
  29459. // handle alt 1 first
  29460. if (config.alt !== 1) {
  29461. continue;
  29462. }
  29463. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  29464. if (updatedContext === null) {
  29465. // the configuration was eliminated
  29466. continue;
  29467. }
  29468. statesFromAlt1[config.state.stateNumber] = config.context;
  29469. if (updatedContext !== config.semanticContext) {
  29470. configSet.add(new ATNConfig({ semanticContext: updatedContext }, config), this.mergeCache);
  29471. } else {
  29472. configSet.add(config, this.mergeCache);
  29473. }
  29474. }
  29475. for (i = 0; i < configs.items.length; i++) {
  29476. config = configs.items[i];
  29477. if (config.alt === 1) {
  29478. // already handled
  29479. continue;
  29480. }
  29481. // In the future, this elimination step could be updated to also
  29482. // filter the prediction context for alternatives predicting alt>1
  29483. // (basically a graph subtraction algorithm).
  29484. if (!config.precedenceFilterSuppressed) {
  29485. var context = statesFromAlt1[config.state.stateNumber] || null;
  29486. if (context !== null && context.equals(config.context)) {
  29487. // eliminated
  29488. continue;
  29489. }
  29490. }
  29491. configSet.add(config, this.mergeCache);
  29492. }
  29493. return configSet;
  29494. };
  29495. ParserATNSimulator.prototype.getReachableTarget = function (trans, ttype) {
  29496. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  29497. return trans.target;
  29498. } else {
  29499. return null;
  29500. }
  29501. };
  29502. ParserATNSimulator.prototype.getPredsForAmbigAlts = function (ambigAlts, configs, nalts) {
  29503. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  29504. // altToPred starts as an array of all null contexts. The entry at index i
  29505. // corresponds to alternative i. altToPred[i] may have one of three values:
  29506. // 1. null: no ATNConfig c is found such that c.alt==i
  29507. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  29508. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  29509. // alt i has at least one unpredicated config.
  29510. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  29511. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  29512. //
  29513. // From this, it is clear that NONE||anything==NONE.
  29514. //
  29515. var altToPred = [];
  29516. for (var i = 0; i < configs.items.length; i++) {
  29517. var c = configs.items[i];
  29518. if (ambigAlts.contains(c.alt)) {
  29519. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  29520. }
  29521. }
  29522. var nPredAlts = 0;
  29523. for (i = 1; i < nalts + 1; i++) {
  29524. var pred = altToPred[i] || null;
  29525. if (pred === null) {
  29526. altToPred[i] = SemanticContext.NONE;
  29527. } else if (pred !== SemanticContext.NONE) {
  29528. nPredAlts += 1;
  29529. }
  29530. }
  29531. // nonambig alts are null in altToPred
  29532. if (nPredAlts === 0) {
  29533. altToPred = null;
  29534. }
  29535. if (this.debug) {
  29536. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  29537. }
  29538. return altToPred;
  29539. };
  29540. ParserATNSimulator.prototype.getPredicatePredictions = function (ambigAlts, altToPred) {
  29541. var pairs = [];
  29542. var containsPredicate = false;
  29543. for (var i = 1; i < altToPred.length; i++) {
  29544. var pred = altToPred[i];
  29545. // unpredicated is indicated by SemanticContext.NONE
  29546. if (ambigAlts !== null && ambigAlts.contains(i)) {
  29547. pairs.push(new PredPrediction(pred, i));
  29548. }
  29549. if (pred !== SemanticContext.NONE) {
  29550. containsPredicate = true;
  29551. }
  29552. }
  29553. if (!containsPredicate) {
  29554. return null;
  29555. }
  29556. return pairs;
  29557. };
  29558. //
  29559. // This method is used to improve the localization of error messages by
  29560. // choosing an alternative rather than throwing a
  29561. // {@link NoViableAltException} in particular prediction scenarios where the
  29562. // {@link //ERROR} state was reached during ATN simulation.
  29563. //
  29564. // <p>
  29565. // The default implementation of this method uses the following
  29566. // algorithm to identify an ATN configuration which successfully parsed the
  29567. // decision entry rule. Choosing such an alternative ensures that the
  29568. // {@link ParserRuleContext} returned by the calling rule will be complete
  29569. // and valid, and the syntax error will be reported later at a more
  29570. // localized location.</p>
  29571. //
  29572. // <ul>
  29573. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  29574. // they are semantically valid if predicated, return the min associated alt.</li>
  29575. // <li>Else, if a semantically invalid but syntactically valid path exist
  29576. // or paths exist, return the minimum associated alt.
  29577. // </li>
  29578. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  29579. // </ul>
  29580. //
  29581. // <p>
  29582. // In some scenarios, the algorithm described above could predict an
  29583. // alternative which will result in a {@link FailedPredicateException} in
  29584. // the parser. Specifically, this could occur if the <em>only</em> configuration
  29585. // capable of successfully parsing to the end of the decision rule is
  29586. // blocked by a semantic predicate. By choosing this alternative within
  29587. // {@link //adaptivePredict} instead of throwing a
  29588. // {@link NoViableAltException}, the resulting
  29589. // {@link FailedPredicateException} in the parser will identify the specific
  29590. // predicate which is preventing the parser from successfully parsing the
  29591. // decision rule, which helps developers identify and correct logic errors
  29592. // in semantic predicates.
  29593. // </p>
  29594. //
  29595. // @param configs The ATN configurations which were valid immediately before
  29596. // the {@link //ERROR} state was reached
  29597. // @param outerContext The is the \gamma_0 initial parser context from the paper
  29598. // or the parser stack at the instant before prediction commences.
  29599. //
  29600. // @return The value to return from {@link //adaptivePredict}, or
  29601. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  29602. // identified and {@link //adaptivePredict} should report an error instead.
  29603. //
  29604. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function (configs, outerContext) {
  29605. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  29606. var semValidConfigs = cfgs[0];
  29607. var semInvalidConfigs = cfgs[1];
  29608. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  29609. if (alt !== ATN.INVALID_ALT_NUMBER) {
  29610. // semantically/syntactically viable path exists
  29611. return alt;
  29612. }
  29613. // Is there a syntactically valid path with a failed pred?
  29614. if (semInvalidConfigs.items.length > 0) {
  29615. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  29616. if (alt !== ATN.INVALID_ALT_NUMBER) {
  29617. // syntactically viable path exists
  29618. return alt;
  29619. }
  29620. }
  29621. return ATN.INVALID_ALT_NUMBER;
  29622. };
  29623. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function (configs) {
  29624. var alts = [];
  29625. for (var i = 0; i < configs.items.length; i++) {
  29626. var c = configs.items[i];
  29627. if (c.reachesIntoOuterContext > 0 || c.state instanceof RuleStopState && c.context.hasEmptyPath()) {
  29628. if (alts.indexOf(c.alt) < 0) {
  29629. alts.push(c.alt);
  29630. }
  29631. }
  29632. }
  29633. if (alts.length === 0) {
  29634. return ATN.INVALID_ALT_NUMBER;
  29635. } else {
  29636. return Math.min.apply(null, alts);
  29637. }
  29638. };
  29639. // Walk the list of configurations and split them according to
  29640. // those that have preds evaluating to true/false. If no pred, assume
  29641. // true pred and include in succeeded set. Returns Pair of sets.
  29642. //
  29643. // Create a new set so as not to alter the incoming parameter.
  29644. //
  29645. // Assumption: the input stream has been restored to the starting point
  29646. // prediction, which is where predicates need to evaluate.
  29647. //
  29648. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function (configs, outerContext) {
  29649. var succeeded = new ATNConfigSet(configs.fullCtx);
  29650. var failed = new ATNConfigSet(configs.fullCtx);
  29651. for (var i = 0; i < configs.items.length; i++) {
  29652. var c = configs.items[i];
  29653. if (c.semanticContext !== SemanticContext.NONE) {
  29654. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  29655. if (predicateEvaluationResult) {
  29656. succeeded.add(c);
  29657. } else {
  29658. failed.add(c);
  29659. }
  29660. } else {
  29661. succeeded.add(c);
  29662. }
  29663. }
  29664. return [succeeded, failed];
  29665. };
  29666. // Look through a list of predicate/alt pairs, returning alts for the
  29667. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  29668. // unpredicated config which behaves as "always true." If !complete
  29669. // then we stop at the first predicate that evaluates to true. This
  29670. // includes pairs with null predicates.
  29671. //
  29672. ParserATNSimulator.prototype.evalSemanticContext = function (predPredictions, outerContext, complete) {
  29673. var predictions = new BitSet();
  29674. for (var i = 0; i < predPredictions.length; i++) {
  29675. var pair = predPredictions[i];
  29676. if (pair.pred === SemanticContext.NONE) {
  29677. predictions.add(pair.alt);
  29678. if (!complete) {
  29679. break;
  29680. }
  29681. continue;
  29682. }
  29683. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  29684. if (this.debug || this.dfa_debug) {
  29685. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  29686. }
  29687. if (predicateEvaluationResult) {
  29688. if (this.debug || this.dfa_debug) {
  29689. console.log("PREDICT " + pair.alt);
  29690. }
  29691. predictions.add(pair.alt);
  29692. if (!complete) {
  29693. break;
  29694. }
  29695. }
  29696. }
  29697. return predictions;
  29698. };
  29699. // TODO: If we are doing predicates, there is no point in pursuing
  29700. // closure operations if we reach a DFA state that uniquely predicts
  29701. // alternative. We will not be caching that DFA state and it is a
  29702. // waste to pursue the closure. Might have to advance when we do
  29703. // ambig detection thought :(
  29704. //
  29705. ParserATNSimulator.prototype.closure = function (config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  29706. var initialDepth = 0;
  29707. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates, fullCtx, initialDepth, treatEofAsEpsilon);
  29708. };
  29709. ParserATNSimulator.prototype.closureCheckingStopState = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  29710. if (this.debug || this.debug_closure) {
  29711. console.log("closure(" + config.toString(this.parser, true) + ")");
  29712. // console.log("configs(" + configs.toString() + ")");
  29713. if (config.reachesIntoOuterContext > 50) {
  29714. throw "problem";
  29715. }
  29716. }
  29717. if (config.state instanceof RuleStopState) {
  29718. // We hit rule end. If we have context info, use it
  29719. // run thru all possible stack tops in ctx
  29720. if (!config.context.isEmpty()) {
  29721. for (var i = 0; i < config.context.length; i++) {
  29722. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  29723. if (fullCtx) {
  29724. configs.add(new ATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config), this.mergeCache);
  29725. continue;
  29726. } else {
  29727. // we have no context info, just chase follow links (if greedy)
  29728. if (this.debug) {
  29729. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  29730. }
  29731. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  29732. }
  29733. continue;
  29734. }
  29735. var returnState = this.atn.states[config.context.getReturnState(i)];
  29736. var newContext = config.context.getParent(i); // "pop" return state
  29737. var parms = { state: returnState, alt: config.alt, context: newContext, semanticContext: config.semanticContext };
  29738. var c = new ATNConfig(parms, null);
  29739. // While we have context to pop back from, we may have
  29740. // gotten that context AFTER having falling off a rule.
  29741. // Make sure we track that we are now out of context.
  29742. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  29743. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  29744. }
  29745. return;
  29746. } else if (fullCtx) {
  29747. // reached end of start rule
  29748. configs.add(config, this.mergeCache);
  29749. return;
  29750. } else {
  29751. // else if we have no context info, just chase follow links (if greedy)
  29752. if (this.debug) {
  29753. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  29754. }
  29755. }
  29756. }
  29757. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  29758. };
  29759. // Do the actual work of walking epsilon edges//
  29760. ParserATNSimulator.prototype.closure_ = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  29761. var p = config.state;
  29762. // optimization
  29763. if (!p.epsilonOnlyTransitions) {
  29764. configs.add(config, this.mergeCache);
  29765. // make sure to not return here, because EOF transitions can act as
  29766. // both epsilon transitions and non-epsilon transitions.
  29767. }
  29768. for (var i = 0; i < p.transitions.length; i++) {
  29769. if (i == 0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config)) continue;
  29770. var t = p.transitions[i];
  29771. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  29772. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  29773. if (c !== null) {
  29774. if (!t.isEpsilon && closureBusy.add(c) !== c) {
  29775. // avoid infinite recursion for EOF* and EOF+
  29776. continue;
  29777. }
  29778. var newDepth = depth;
  29779. if (config.state instanceof RuleStopState) {
  29780. // target fell off end of rule; mark resulting c as having dipped into outer context
  29781. // We can't get here if incoming config was rule stop and we had context
  29782. // track how far we dip into outer context. Might
  29783. // come in handy and we avoid evaluating context dependent
  29784. // preds if this is > 0.
  29785. if (closureBusy.add(c) !== c) {
  29786. // avoid infinite recursion for right-recursive rules
  29787. continue;
  29788. }
  29789. if (this._dfa !== null && this._dfa.precedenceDfa) {
  29790. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  29791. c.precedenceFilterSuppressed = true;
  29792. }
  29793. }
  29794. c.reachesIntoOuterContext += 1;
  29795. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  29796. newDepth -= 1;
  29797. if (this.debug) {
  29798. console.log("dips into outer ctx: " + c);
  29799. }
  29800. } else if (t instanceof RuleTransition) {
  29801. // latch when newDepth goes negative - once we step out of the entry context we can't return
  29802. if (newDepth >= 0) {
  29803. newDepth += 1;
  29804. }
  29805. }
  29806. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  29807. }
  29808. }
  29809. };
  29810. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function (config) {
  29811. // return False
  29812. var p = config.state;
  29813. // First check to see if we are in StarLoopEntryState generated during
  29814. // left-recursion elimination. For efficiency, also check if
  29815. // the context has an empty stack case. If so, it would mean
  29816. // global FOLLOW so we can't perform optimization
  29817. // Are we the special loop entry/exit state? or SLL wildcard
  29818. if (p.stateType != ATNState.STAR_LOOP_ENTRY) return false;
  29819. if (p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision || config.context.isEmpty() || config.context.hasEmptyPath()) return false;
  29820. // Require all return states to return back to the same rule that p is in.
  29821. var numCtxs = config.context.length;
  29822. for (var i = 0; i < numCtxs; i++) {
  29823. // for each stack context
  29824. var returnState = this.atn.states[config.context.getReturnState(i)];
  29825. if (returnState.ruleIndex != p.ruleIndex) return false;
  29826. }
  29827. var decisionStartState = p.transitions[0].target;
  29828. var blockEndStateNum = decisionStartState.endState.stateNumber;
  29829. var blockEndState = this.atn.states[blockEndStateNum];
  29830. // Verify that the top of each stack context leads to loop entry/exit
  29831. // state through epsilon edges and w/o leaving rule.
  29832. for (var i = 0; i < numCtxs; i++) {
  29833. // for each stack context
  29834. var returnStateNumber = config.context.getReturnState(i);
  29835. var returnState = this.atn.states[returnStateNumber];
  29836. // all states must have single outgoing epsilon edge
  29837. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon) return false;
  29838. // Look for prefix op case like 'not expr', (' type ')' expr
  29839. var returnStateTarget = returnState.transitions[0].target;
  29840. if (returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p) continue;
  29841. // Look for 'expr op expr' or case where expr's return state is block end
  29842. // of (...)* internal block; the block end points to loop back
  29843. // which points to p but we don't need to check that
  29844. if (returnState == blockEndState) continue;
  29845. // Look for ternary expr ? expr : expr. The return state points at block end,
  29846. // which points at loop entry state
  29847. if (returnStateTarget == blockEndState) continue;
  29848. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  29849. // return state points at block end state of (...)* internal block
  29850. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1 && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p) continue;
  29851. // anything else ain't conforming
  29852. return false;
  29853. }
  29854. return true;
  29855. };
  29856. ParserATNSimulator.prototype.getRuleName = function (index) {
  29857. if (this.parser !== null && index >= 0) {
  29858. return this.parser.ruleNames[index];
  29859. } else {
  29860. return "<rule " + index + ">";
  29861. }
  29862. };
  29863. ParserATNSimulator.prototype.getEpsilonTarget = function (config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  29864. switch (t.serializationType) {
  29865. case Transition.RULE:
  29866. return this.ruleTransition(config, t);
  29867. case Transition.PRECEDENCE:
  29868. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  29869. case Transition.PREDICATE:
  29870. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  29871. case Transition.ACTION:
  29872. return this.actionTransition(config, t);
  29873. case Transition.EPSILON:
  29874. return new ATNConfig({ state: t.target }, config);
  29875. case Transition.ATOM:
  29876. case Transition.RANGE:
  29877. case Transition.SET:
  29878. // EOF transitions act like epsilon transitions after the first EOF
  29879. // transition is traversed
  29880. if (treatEofAsEpsilon) {
  29881. if (t.matches(Token.EOF, 0, 1)) {
  29882. return new ATNConfig({ state: t.target }, config);
  29883. }
  29884. }
  29885. return null;
  29886. default:
  29887. return null;
  29888. }
  29889. };
  29890. ParserATNSimulator.prototype.actionTransition = function (config, t) {
  29891. if (this.debug) {
  29892. var index = t.actionIndex == -1 ? 65535 : t.actionIndex;
  29893. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  29894. }
  29895. return new ATNConfig({ state: t.target }, config);
  29896. };
  29897. ParserATNSimulator.prototype.precedenceTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29898. if (this.debug) {
  29899. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.precedence + ">=_p, ctx dependent=true");
  29900. if (this.parser !== null) {
  29901. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29902. }
  29903. }
  29904. var c = null;
  29905. if (collectPredicates && inContext) {
  29906. if (fullCtx) {
  29907. // In full context mode, we can evaluate predicates on-the-fly
  29908. // during closure, which dramatically reduces the size of
  29909. // the config sets. It also obviates the need to test predicates
  29910. // later during conflict resolution.
  29911. var currentPosition = this._input.index;
  29912. this._input.seek(this._startIndex);
  29913. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29914. this._input.seek(currentPosition);
  29915. if (predSucceeds) {
  29916. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29917. }
  29918. } else {
  29919. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29920. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29921. }
  29922. } else {
  29923. c = new ATNConfig({ state: pt.target }, config);
  29924. }
  29925. if (this.debug) {
  29926. console.log("config from pred transition=" + c);
  29927. }
  29928. return c;
  29929. };
  29930. ParserATNSimulator.prototype.predTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29931. if (this.debug) {
  29932. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex + ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  29933. if (this.parser !== null) {
  29934. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29935. }
  29936. }
  29937. var c = null;
  29938. if (collectPredicates && (pt.isCtxDependent && inContext || !pt.isCtxDependent)) {
  29939. if (fullCtx) {
  29940. // In full context mode, we can evaluate predicates on-the-fly
  29941. // during closure, which dramatically reduces the size of
  29942. // the config sets. It also obviates the need to test predicates
  29943. // later during conflict resolution.
  29944. var currentPosition = this._input.index;
  29945. this._input.seek(this._startIndex);
  29946. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29947. this._input.seek(currentPosition);
  29948. if (predSucceeds) {
  29949. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29950. }
  29951. } else {
  29952. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29953. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29954. }
  29955. } else {
  29956. c = new ATNConfig({ state: pt.target }, config);
  29957. }
  29958. if (this.debug) {
  29959. console.log("config from pred transition=" + c);
  29960. }
  29961. return c;
  29962. };
  29963. ParserATNSimulator.prototype.ruleTransition = function (config, t) {
  29964. if (this.debug) {
  29965. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  29966. }
  29967. var returnState = t.followState;
  29968. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  29969. return new ATNConfig({ state: t.target, context: newContext }, config);
  29970. };
  29971. ParserATNSimulator.prototype.getConflictingAlts = function (configs) {
  29972. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  29973. return PredictionMode.getAlts(altsets);
  29974. };
  29975. // Sam pointed out a problem with the previous definition, v3, of
  29976. // ambiguous states. If we have another state associated with conflicting
  29977. // alternatives, we should keep going. For example, the following grammar
  29978. //
  29979. // s : (ID | ID ID?) ';' ;
  29980. //
  29981. // When the ATN simulation reaches the state before ';', it has a DFA
  29982. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  29983. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  29984. // because alternative to has another way to continue, via [6|2|[]].
  29985. // The key is that we have a single state that has config's only associated
  29986. // with a single alternative, 2, and crucially the state transitions
  29987. // among the configurations are all non-epsilon transitions. That means
  29988. // we don't consider any conflicts that include alternative 2. So, we
  29989. // ignore the conflict between alts 1 and 2. We ignore a set of
  29990. // conflicting alts when there is an intersection with an alternative
  29991. // associated with a single alt state in the state&rarr;config-list map.
  29992. //
  29993. // It's also the case that we might have two conflicting configurations but
  29994. // also a 3rd nonconflicting configuration for a different alternative:
  29995. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  29996. //
  29997. // a : A | A | A B ;
  29998. //
  29999. // After matching input A, we reach the stop state for rule A, state 1.
  30000. // State 8 is the state right before B. Clearly alternatives 1 and 2
  30001. // conflict and no amount of further lookahead will separate the two.
  30002. // However, alternative 3 will be able to continue and so we do not
  30003. // stop working on this state. In the previous example, we're concerned
  30004. // with states associated with the conflicting alternatives. Here alt
  30005. // 3 is not associated with the conflicting configs, but since we can continue
  30006. // looking for input reasonably, I don't declare the state done. We
  30007. // ignore a set of conflicting alts when we have an alternative
  30008. // that we still need to pursue.
  30009. //
  30010. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function (configs) {
  30011. var conflictingAlts = null;
  30012. if (configs.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  30013. conflictingAlts = new BitSet();
  30014. conflictingAlts.add(configs.uniqueAlt);
  30015. } else {
  30016. conflictingAlts = configs.conflictingAlts;
  30017. }
  30018. return conflictingAlts;
  30019. };
  30020. ParserATNSimulator.prototype.getTokenName = function (t) {
  30021. if (t === Token.EOF) {
  30022. return "EOF";
  30023. }
  30024. if (this.parser !== null && this.parser.literalNames !== null) {
  30025. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  30026. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  30027. console.log("" + this.parser.getInputStream().getTokens());
  30028. } else {
  30029. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  30030. return name + "<" + t + ">";
  30031. }
  30032. }
  30033. return "" + t;
  30034. };
  30035. ParserATNSimulator.prototype.getLookaheadName = function (input) {
  30036. return this.getTokenName(input.LA(1));
  30037. };
  30038. // Used for debugging in adaptivePredict around execATN but I cut
  30039. // it out for clarity now that alg. works well. We can leave this
  30040. // "dead" code for a bit.
  30041. //
  30042. ParserATNSimulator.prototype.dumpDeadEndConfigs = function (nvae) {
  30043. console.log("dead end configs: ");
  30044. var decs = nvae.getDeadEndConfigs();
  30045. for (var i = 0; i < decs.length; i++) {
  30046. var c = decs[i];
  30047. var trans = "no edges";
  30048. if (c.state.transitions.length > 0) {
  30049. var t = c.state.transitions[0];
  30050. if (t instanceof AtomTransition) {
  30051. trans = "Atom " + this.getTokenName(t.label);
  30052. } else if (t instanceof SetTransition) {
  30053. var neg = t instanceof NotSetTransition;
  30054. trans = (neg ? "~" : "") + "Set " + t.set;
  30055. }
  30056. }
  30057. console.error(c.toString(this.parser, true) + ":" + trans);
  30058. }
  30059. };
  30060. ParserATNSimulator.prototype.noViableAlt = function (input, outerContext, configs, startIndex) {
  30061. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  30062. };
  30063. ParserATNSimulator.prototype.getUniqueAlt = function (configs) {
  30064. var alt = ATN.INVALID_ALT_NUMBER;
  30065. for (var i = 0; i < configs.items.length; i++) {
  30066. var c = configs.items[i];
  30067. if (alt === ATN.INVALID_ALT_NUMBER) {
  30068. alt = c.alt; // found first alt
  30069. } else if (c.alt !== alt) {
  30070. return ATN.INVALID_ALT_NUMBER;
  30071. }
  30072. }
  30073. return alt;
  30074. };
  30075. //
  30076. // Add an edge to the DFA, if possible. This method calls
  30077. // {@link //addDFAState} to ensure the {@code to} state is present in the
  30078. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  30079. // range of edges that can be represented in the DFA tables, this method
  30080. // returns without adding the edge to the DFA.
  30081. //
  30082. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  30083. // Otherwise, this method returns the {@link DFAState} returned by calling
  30084. // {@link //addDFAState} for the {@code to} state.</p>
  30085. //
  30086. // @param dfa The DFA
  30087. // @param from The source state for the edge
  30088. // @param t The input symbol
  30089. // @param to The target state for the edge
  30090. //
  30091. // @return If {@code to} is {@code null}, this method returns {@code null};
  30092. // otherwise this method returns the result of calling {@link //addDFAState}
  30093. // on {@code to}
  30094. //
  30095. ParserATNSimulator.prototype.addDFAEdge = function (dfa, from_, t, to) {
  30096. if (this.debug) {
  30097. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  30098. }
  30099. if (to === null) {
  30100. return null;
  30101. }
  30102. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  30103. if (from_ === null || t < -1 || t > this.atn.maxTokenType) {
  30104. return to;
  30105. }
  30106. if (from_.edges === null) {
  30107. from_.edges = [];
  30108. }
  30109. from_.edges[t + 1] = to; // connect
  30110. if (this.debug) {
  30111. var literalNames = this.parser === null ? null : this.parser.literalNames;
  30112. var symbolicNames = this.parser === null ? null : this.parser.symbolicNames;
  30113. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  30114. }
  30115. return to;
  30116. };
  30117. //
  30118. // Add state {@code D} to the DFA if it is not already present, and return
  30119. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  30120. // is already in the DFA, the existing state is returned. Otherwise this
  30121. // method returns {@code D} after adding it to the DFA.
  30122. //
  30123. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  30124. // does not change the DFA.</p>
  30125. //
  30126. // @param dfa The dfa
  30127. // @param D The DFA state to add
  30128. // @return The state stored in the DFA. This will be either the existing
  30129. // state if {@code D} is already in the DFA, or {@code D} itself if the
  30130. // state was not already present.
  30131. //
  30132. ParserATNSimulator.prototype.addDFAState = function (dfa, D) {
  30133. if (D == ATNSimulator.ERROR) {
  30134. return D;
  30135. }
  30136. var existing = dfa.states.get(D);
  30137. if (existing !== null) {
  30138. return existing;
  30139. }
  30140. D.stateNumber = dfa.states.length;
  30141. if (!D.configs.readOnly) {
  30142. D.configs.optimizeConfigs(this);
  30143. D.configs.setReadonly(true);
  30144. }
  30145. dfa.states.add(D);
  30146. if (this.debug) {
  30147. console.log("adding new DFA state: " + D);
  30148. }
  30149. return D;
  30150. };
  30151. ParserATNSimulator.prototype.reportAttemptingFullContext = function (dfa, conflictingAlts, configs, startIndex, stopIndex) {
  30152. if (this.debug || this.retry_debug) {
  30153. var interval = new Interval(startIndex, stopIndex + 1);
  30154. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  30155. }
  30156. if (this.parser !== null) {
  30157. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  30158. }
  30159. };
  30160. ParserATNSimulator.prototype.reportContextSensitivity = function (dfa, prediction, configs, startIndex, stopIndex) {
  30161. if (this.debug || this.retry_debug) {
  30162. var interval = new Interval(startIndex, stopIndex + 1);
  30163. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  30164. }
  30165. if (this.parser !== null) {
  30166. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  30167. }
  30168. };
  30169. // If context sensitive parsing, we know it's ambiguity not conflict//
  30170. ParserATNSimulator.prototype.reportAmbiguity = function (dfa, D, startIndex, stopIndex, exact, ambigAlts, configs) {
  30171. if (this.debug || this.retry_debug) {
  30172. var interval = new Interval(startIndex, stopIndex + 1);
  30173. console.log("reportAmbiguity " + ambigAlts + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  30174. }
  30175. if (this.parser !== null) {
  30176. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  30177. }
  30178. };
  30179. exports.ParserATNSimulator = ParserATNSimulator;
  30180. /***/ }),
  30181. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  30182. /*!***************************************************!*\
  30183. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  30184. \***************************************************/
  30185. /*! no static exports found */
  30186. /***/ (function(module, exports, __webpack_require__) {
  30187. "use strict";
  30188. //
  30189. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30190. * Use of this file is governed by the BSD 3-clause license that
  30191. * can be found in the LICENSE.txt file in the project root.
  30192. */
  30193. //
  30194. //
  30195. // This enumeration defines the prediction modes available in ANTLR 4 along with
  30196. // utility methods for analyzing configuration sets for conflicts and/or
  30197. // ambiguities.
  30198. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  30199. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  30200. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  30201. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  30202. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  30203. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  30204. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  30205. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  30206. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  30207. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  30208. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  30209. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  30210. function PredictionMode() {
  30211. return this;
  30212. }
  30213. //
  30214. // The SLL(*) prediction mode. This prediction mode ignores the current
  30215. // parser context when making predictions. This is the fastest prediction
  30216. // mode, and provides correct results for many grammars. This prediction
  30217. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  30218. // may result in syntax errors for grammar and input combinations which are
  30219. // not SLL.
  30220. //
  30221. // <p>
  30222. // When using this prediction mode, the parser will either return a correct
  30223. // parse tree (i.e. the same parse tree that would be returned with the
  30224. // {@link //LL} prediction mode), or it will report a syntax error. If a
  30225. // syntax error is encountered when using the {@link //SLL} prediction mode,
  30226. // it may be due to either an actual syntax error in the input or indicate
  30227. // that the particular combination of grammar and input requires the more
  30228. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  30229. //
  30230. // <p>
  30231. // This prediction mode does not provide any guarantees for prediction
  30232. // behavior for syntactically-incorrect inputs.</p>
  30233. //
  30234. PredictionMode.SLL = 0;
  30235. //
  30236. // The LL(*) prediction mode. This prediction mode allows the current parser
  30237. // context to be used for resolving SLL conflicts that occur during
  30238. // prediction. This is the fastest prediction mode that guarantees correct
  30239. // parse results for all combinations of grammars with syntactically correct
  30240. // inputs.
  30241. //
  30242. // <p>
  30243. // When using this prediction mode, the parser will make correct decisions
  30244. // for all syntactically-correct grammar and input combinations. However, in
  30245. // cases where the grammar is truly ambiguous this prediction mode might not
  30246. // report a precise answer for <em>exactly which</em> alternatives are
  30247. // ambiguous.</p>
  30248. //
  30249. // <p>
  30250. // This prediction mode does not provide any guarantees for prediction
  30251. // behavior for syntactically-incorrect inputs.</p>
  30252. //
  30253. PredictionMode.LL = 1;
  30254. //
  30255. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  30256. // the correctness guarantees provided by the {@link //LL} prediction mode,
  30257. // this prediction mode instructs the prediction algorithm to determine the
  30258. // complete and exact set of ambiguous alternatives for every ambiguous
  30259. // decision encountered while parsing.
  30260. //
  30261. // <p>
  30262. // This prediction mode may be used for diagnosing ambiguities during
  30263. // grammar development. Due to the performance overhead of calculating sets
  30264. // of ambiguous alternatives, this prediction mode should be avoided when
  30265. // the exact results are not necessary.</p>
  30266. //
  30267. // <p>
  30268. // This prediction mode does not provide any guarantees for prediction
  30269. // behavior for syntactically-incorrect inputs.</p>
  30270. //
  30271. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  30272. //
  30273. // Computes the SLL prediction termination condition.
  30274. //
  30275. // <p>
  30276. // This method computes the SLL prediction termination condition for both of
  30277. // the following cases.</p>
  30278. //
  30279. // <ul>
  30280. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  30281. // <li>Pure SLL without LL fallback</li>
  30282. // </ul>
  30283. //
  30284. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  30285. //
  30286. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  30287. // ensured regardless of how the termination condition is computed by this
  30288. // method. Due to the substantially higher cost of LL prediction, the
  30289. // prediction should only fall back to LL when the additional lookahead
  30290. // cannot lead to a unique SLL prediction.</p>
  30291. //
  30292. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  30293. // conflicting subsets should fall back to full LL, even if the
  30294. // configuration sets don't resolve to the same alternative (e.g.
  30295. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  30296. // configuration, SLL could continue with the hopes that more lookahead will
  30297. // resolve via one of those non-conflicting configurations.</p>
  30298. //
  30299. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  30300. // stops when it sees only conflicting configuration subsets. In contrast,
  30301. // full LL keeps going when there is uncertainty.</p>
  30302. //
  30303. // <p><strong>HEURISTIC</strong></p>
  30304. //
  30305. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  30306. // unless we see a state that only has one alternative associated with it.
  30307. // The single-alt-state thing lets prediction continue upon rules like
  30308. // (otherwise, it would admit defeat too soon):</p>
  30309. //
  30310. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  30311. //
  30312. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  30313. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  30314. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  30315. // processing this node because alternative to has another way to continue,
  30316. // via {@code [6|2|[]]}.</p>
  30317. //
  30318. // <p>It also let's us continue for this rule:</p>
  30319. //
  30320. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  30321. //
  30322. // <p>After matching input A, we reach the stop state for rule A, state 1.
  30323. // State 8 is the state right before B. Clearly alternatives 1 and 2
  30324. // conflict and no amount of further lookahead will separate the two.
  30325. // However, alternative 3 will be able to continue and so we do not stop
  30326. // working on this state. In the previous example, we're concerned with
  30327. // states associated with the conflicting alternatives. Here alt 3 is not
  30328. // associated with the conflicting configs, but since we can continue
  30329. // looking for input reasonably, don't declare the state done.</p>
  30330. //
  30331. // <p><strong>PURE SLL PARSING</strong></p>
  30332. //
  30333. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  30334. // combine stack contexts for configurations that differ only by semantic
  30335. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  30336. //
  30337. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  30338. //
  30339. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  30340. // states because they need to create the DFA cache that works in all
  30341. // semantic situations. In contrast, full LL evaluates predicates collected
  30342. // during start state computation so it can ignore predicates thereafter.
  30343. // This means that SLL termination detection can totally ignore semantic
  30344. // predicates.</p>
  30345. //
  30346. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  30347. // semantic predicate contexts so we might see two configurations like the
  30348. // following.</p>
  30349. //
  30350. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  30351. //
  30352. // <p>Before testing these configurations against others, we have to merge
  30353. // {@code x} and {@code x'} (without modifying the existing configurations).
  30354. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  30355. // the following configurations.</p>
  30356. //
  30357. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  30358. //
  30359. // <p>If the configuration set has predicates (as indicated by
  30360. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  30361. // the configurations to strip out all of the predicates so that a standard
  30362. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  30363. //
  30364. PredictionMode.hasSLLConflictTerminatingPrediction = function (mode, configs) {
  30365. // Configs in rule stop states indicate reaching the end of the decision
  30366. // rule (local context) or end of start rule (full context). If all
  30367. // configs meet this condition, then none of the configurations is able
  30368. // to match additional input so we terminate prediction.
  30369. //
  30370. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  30371. return true;
  30372. }
  30373. // pure SLL mode parsing
  30374. if (mode === PredictionMode.SLL) {
  30375. // Don't bother with combining configs from different semantic
  30376. // contexts if we can fail over to full LL; costs more time
  30377. // since we'll often fail over anyway.
  30378. if (configs.hasSemanticContext) {
  30379. // dup configs, tossing out semantic predicates
  30380. var dup = new ATNConfigSet();
  30381. for (var i = 0; i < configs.items.length; i++) {
  30382. var c = configs.items[i];
  30383. c = new ATNConfig({ semanticContext: SemanticContext.NONE }, c);
  30384. dup.add(c);
  30385. }
  30386. configs = dup;
  30387. }
  30388. // now we have combined contexts for configs with dissimilar preds
  30389. }
  30390. // pure SLL or combined SLL+LL mode parsing
  30391. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  30392. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  30393. };
  30394. // Checks if any configuration in {@code configs} is in a
  30395. // {@link RuleStopState}. Configurations meeting this condition have reached
  30396. // the end of the decision rule (local context) or end of start rule (full
  30397. // context).
  30398. //
  30399. // @param configs the configuration set to test
  30400. // @return {@code true} if any configuration in {@code configs} is in a
  30401. // {@link RuleStopState}, otherwise {@code false}
  30402. PredictionMode.hasConfigInRuleStopState = function (configs) {
  30403. for (var i = 0; i < configs.items.length; i++) {
  30404. var c = configs.items[i];
  30405. if (c.state instanceof RuleStopState) {
  30406. return true;
  30407. }
  30408. }
  30409. return false;
  30410. };
  30411. // Checks if all configurations in {@code configs} are in a
  30412. // {@link RuleStopState}. Configurations meeting this condition have reached
  30413. // the end of the decision rule (local context) or end of start rule (full
  30414. // context).
  30415. //
  30416. // @param configs the configuration set to test
  30417. // @return {@code true} if all configurations in {@code configs} are in a
  30418. // {@link RuleStopState}, otherwise {@code false}
  30419. PredictionMode.allConfigsInRuleStopStates = function (configs) {
  30420. for (var i = 0; i < configs.items.length; i++) {
  30421. var c = configs.items[i];
  30422. if (!(c.state instanceof RuleStopState)) {
  30423. return false;
  30424. }
  30425. }
  30426. return true;
  30427. };
  30428. //
  30429. // Full LL prediction termination.
  30430. //
  30431. // <p>Can we stop looking ahead during ATN simulation or is there some
  30432. // uncertainty as to which alternative we will ultimately pick, after
  30433. // consuming more input? Even if there are partial conflicts, we might know
  30434. // that everything is going to resolve to the same minimum alternative. That
  30435. // means we can stop since no more lookahead will change that fact. On the
  30436. // other hand, there might be multiple conflicts that resolve to different
  30437. // minimums. That means we need more look ahead to decide which of those
  30438. // alternatives we should predict.</p>
  30439. //
  30440. // <p>The basic idea is to split the set of configurations {@code C}, into
  30441. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  30442. // non-conflicting configurations. Two configurations conflict if they have
  30443. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  30444. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  30445. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  30446. //
  30447. // <p>Reduce these configuration subsets to the set of possible alternatives.
  30448. // You can compute the alternative subsets in one pass as follows:</p>
  30449. //
  30450. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  30451. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  30452. //
  30453. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  30454. //
  30455. // <pre>
  30456. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  30457. // alt and not pred
  30458. // </pre>
  30459. //
  30460. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  30461. //
  30462. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  30463. // {@code s} and {@code ctx}.</p>
  30464. //
  30465. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  30466. // the union of these alternative subsets is a singleton, then no amount of
  30467. // more lookahead will help us. We will always pick that alternative. If,
  30468. // however, there is more than one alternative, then we are uncertain which
  30469. // alternative to predict and must continue looking for resolution. We may
  30470. // or may not discover an ambiguity in the future, even if there are no
  30471. // conflicting subsets this round.</p>
  30472. //
  30473. // <p>The biggest sin is to terminate early because it means we've made a
  30474. // decision but were uncertain as to the eventual outcome. We haven't used
  30475. // enough lookahead. On the other hand, announcing a conflict too late is no
  30476. // big deal; you will still have the conflict. It's just inefficient. It
  30477. // might even look until the end of file.</p>
  30478. //
  30479. // <p>No special consideration for semantic predicates is required because
  30480. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  30481. // no configuration contains a semantic context during the termination
  30482. // check.</p>
  30483. //
  30484. // <p><strong>CONFLICTING CONFIGS</strong></p>
  30485. //
  30486. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  30487. // when {@code i!=j} but {@code x=x'}. Because we merge all
  30488. // {@code (s, i, _)} configurations together, that means that there are at
  30489. // most {@code n} configurations associated with state {@code s} for
  30490. // {@code n} possible alternatives in the decision. The merged stacks
  30491. // complicate the comparison of configuration contexts {@code x} and
  30492. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  30493. // merge and checking to see if the merged result is either {@code x} or
  30494. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  30495. // is the superset, then {@code i} is the only possible prediction since the
  30496. // others resolve to {@code min(i)} as well. However, if {@code x} is
  30497. // associated with {@code j>i} then at least one stack configuration for
  30498. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  30499. // should keep going, looking for more lookahead due to the uncertainty.</p>
  30500. //
  30501. // <p>For simplicity, I'm doing a equality check between {@code x} and
  30502. // {@code x'} that lets the algorithm continue to consume lookahead longer
  30503. // than necessary. The reason I like the equality is of course the
  30504. // simplicity but also because that is the test you need to detect the
  30505. // alternatives that are actually in conflict.</p>
  30506. //
  30507. // <p><strong>CONTINUE/STOP RULE</strong></p>
  30508. //
  30509. // <p>Continue if union of resolved alternative sets from non-conflicting and
  30510. // conflicting alternative subsets has more than one alternative. We are
  30511. // uncertain about which alternative to predict.</p>
  30512. //
  30513. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  30514. // alternatives are still in the running for the amount of input we've
  30515. // consumed at this point. The conflicting sets let us to strip away
  30516. // configurations that won't lead to more states because we resolve
  30517. // conflicts to the configuration with a minimum alternate for the
  30518. // conflicting set.</p>
  30519. //
  30520. // <p><strong>CASES</strong></p>
  30521. //
  30522. // <ul>
  30523. //
  30524. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  30525. //
  30526. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  30527. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  30528. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  30529. // {@code {1,3}} =&gt; continue
  30530. // </li>
  30531. //
  30532. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  30533. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  30534. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  30535. // {@code {1}} =&gt; stop and predict 1</li>
  30536. //
  30537. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  30538. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  30539. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  30540. // ambiguity {@code {1,2}}</li>
  30541. //
  30542. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  30543. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  30544. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  30545. //
  30546. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  30547. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  30548. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  30549. //
  30550. // </ul>
  30551. //
  30552. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  30553. //
  30554. // <p>If all states report the same conflicting set of alternatives, then we
  30555. // know we have the exact ambiguity set.</p>
  30556. //
  30557. // <p><code>|A_<em>i</em>|&gt;1</code> and
  30558. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  30559. //
  30560. // <p>In other words, we continue examining lookahead until all {@code A_i}
  30561. // have more than one alternative and all {@code A_i} are the same. If
  30562. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  30563. // because the resolved set is {@code {1}}. To determine what the real
  30564. // ambiguity is, we have to know whether the ambiguity is between one and
  30565. // two or one and three so we keep going. We can only stop prediction when
  30566. // we need exact ambiguity detection when the sets look like
  30567. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  30568. //
  30569. PredictionMode.resolvesToJustOneViableAlt = function (altsets) {
  30570. return PredictionMode.getSingleViableAlt(altsets);
  30571. };
  30572. //
  30573. // Determines if every alternative subset in {@code altsets} contains more
  30574. // than one alternative.
  30575. //
  30576. // @param altsets a collection of alternative subsets
  30577. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  30578. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  30579. //
  30580. PredictionMode.allSubsetsConflict = function (altsets) {
  30581. return !PredictionMode.hasNonConflictingAltSet(altsets);
  30582. };
  30583. //
  30584. // Determines if any single alternative subset in {@code altsets} contains
  30585. // exactly one alternative.
  30586. //
  30587. // @param altsets a collection of alternative subsets
  30588. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  30589. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  30590. //
  30591. PredictionMode.hasNonConflictingAltSet = function (altsets) {
  30592. for (var i = 0; i < altsets.length; i++) {
  30593. var alts = altsets[i];
  30594. if (alts.length === 1) {
  30595. return true;
  30596. }
  30597. }
  30598. return false;
  30599. };
  30600. //
  30601. // Determines if any single alternative subset in {@code altsets} contains
  30602. // more than one alternative.
  30603. //
  30604. // @param altsets a collection of alternative subsets
  30605. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  30606. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  30607. //
  30608. PredictionMode.hasConflictingAltSet = function (altsets) {
  30609. for (var i = 0; i < altsets.length; i++) {
  30610. var alts = altsets[i];
  30611. if (alts.length > 1) {
  30612. return true;
  30613. }
  30614. }
  30615. return false;
  30616. };
  30617. //
  30618. // Determines if every alternative subset in {@code altsets} is equivalent.
  30619. //
  30620. // @param altsets a collection of alternative subsets
  30621. // @return {@code true} if every member of {@code altsets} is equal to the
  30622. // others, otherwise {@code false}
  30623. //
  30624. PredictionMode.allSubsetsEqual = function (altsets) {
  30625. var first = null;
  30626. for (var i = 0; i < altsets.length; i++) {
  30627. var alts = altsets[i];
  30628. if (first === null) {
  30629. first = alts;
  30630. } else if (alts !== first) {
  30631. return false;
  30632. }
  30633. }
  30634. return true;
  30635. };
  30636. //
  30637. // Returns the unique alternative predicted by all alternative subsets in
  30638. // {@code altsets}. If no such alternative exists, this method returns
  30639. // {@link ATN//INVALID_ALT_NUMBER}.
  30640. //
  30641. // @param altsets a collection of alternative subsets
  30642. //
  30643. PredictionMode.getUniqueAlt = function (altsets) {
  30644. var all = PredictionMode.getAlts(altsets);
  30645. if (all.length === 1) {
  30646. return all.minValue();
  30647. } else {
  30648. return ATN.INVALID_ALT_NUMBER;
  30649. }
  30650. };
  30651. // Gets the complete set of represented alternatives for a collection of
  30652. // alternative subsets. This method returns the union of each {@link BitSet}
  30653. // in {@code altsets}.
  30654. //
  30655. // @param altsets a collection of alternative subsets
  30656. // @return the set of represented alternatives in {@code altsets}
  30657. //
  30658. PredictionMode.getAlts = function (altsets) {
  30659. var all = new BitSet();
  30660. altsets.map(function (alts) {
  30661. all.or(alts);
  30662. });
  30663. return all;
  30664. };
  30665. //
  30666. // This function gets the conflicting alt subsets from a configuration set.
  30667. // For each configuration {@code c} in {@code configs}:
  30668. //
  30669. // <pre>
  30670. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  30671. // alt and not pred
  30672. // </pre>
  30673. PredictionMode.getConflictingAltSubsets = function (configs) {
  30674. var configToAlts = new Map();
  30675. configToAlts.hashFunction = function (cfg) {
  30676. hashStuff(cfg.state.stateNumber, cfg.context);
  30677. };
  30678. configToAlts.equalsFunction = function (c1, c2) {
  30679. return c1.state.stateNumber == c2.state.stateNumber && c1.context.equals(c2.context);
  30680. };
  30681. configs.items.map(function (cfg) {
  30682. var alts = configToAlts.get(cfg);
  30683. if (alts === null) {
  30684. alts = new BitSet();
  30685. configToAlts.put(cfg, alts);
  30686. }
  30687. alts.add(cfg.alt);
  30688. });
  30689. return configToAlts.getValues();
  30690. };
  30691. //
  30692. // Get a map from state to alt subset from a configuration set. For each
  30693. // configuration {@code c} in {@code configs}:
  30694. //
  30695. // <pre>
  30696. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  30697. // </pre>
  30698. //
  30699. PredictionMode.getStateToAltMap = function (configs) {
  30700. var m = new AltDict();
  30701. configs.items.map(function (c) {
  30702. var alts = m.get(c.state);
  30703. if (alts === null) {
  30704. alts = new BitSet();
  30705. m.put(c.state, alts);
  30706. }
  30707. alts.add(c.alt);
  30708. });
  30709. return m;
  30710. };
  30711. PredictionMode.hasStateAssociatedWithOneAlt = function (configs) {
  30712. var values = PredictionMode.getStateToAltMap(configs).values();
  30713. for (var i = 0; i < values.length; i++) {
  30714. if (values[i].length === 1) {
  30715. return true;
  30716. }
  30717. }
  30718. return false;
  30719. };
  30720. PredictionMode.getSingleViableAlt = function (altsets) {
  30721. var result = null;
  30722. for (var i = 0; i < altsets.length; i++) {
  30723. var alts = altsets[i];
  30724. var minAlt = alts.minValue();
  30725. if (result === null) {
  30726. result = minAlt;
  30727. } else if (result !== minAlt) {
  30728. // more than 1 viable alt
  30729. return ATN.INVALID_ALT_NUMBER;
  30730. }
  30731. }
  30732. return result;
  30733. };
  30734. exports.PredictionMode = PredictionMode;
  30735. /***/ }),
  30736. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  30737. /*!****************************************************!*\
  30738. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  30739. \****************************************************/
  30740. /*! no static exports found */
  30741. /***/ (function(module, exports, __webpack_require__) {
  30742. "use strict";
  30743. //
  30744. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30745. * Use of this file is governed by the BSD 3-clause license that
  30746. * can be found in the LICENSE.txt file in the project root.
  30747. */
  30748. //
  30749. // A tree structure used to record the semantic context in which
  30750. // an ATN configuration is valid. It's either a single predicate,
  30751. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  30752. //
  30753. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  30754. // {@link SemanticContext} within the scope of this outer class.</p>
  30755. //
  30756. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  30757. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  30758. function SemanticContext() {
  30759. return this;
  30760. }
  30761. SemanticContext.prototype.hashCode = function () {
  30762. var hash = new Hash();
  30763. this.updateHashCode(hash);
  30764. return hash.finish();
  30765. };
  30766. // For context independent predicates, we evaluate them without a local
  30767. // context (i.e., null context). That way, we can evaluate them without
  30768. // having to create proper rule-specific context during prediction (as
  30769. // opposed to the parser, which creates them naturally). In a practical
  30770. // sense, this avoids a cast exception from RuleContext to myruleContext.
  30771. //
  30772. // <p>For context dependent predicates, we must pass in a local context so that
  30773. // references such as $arg evaluate properly as _localctx.arg. We only
  30774. // capture context dependent predicates in the context in which we begin
  30775. // prediction, so we passed in the outer context here in case of context
  30776. // dependent predicate evaluation.</p>
  30777. //
  30778. SemanticContext.prototype.evaluate = function (parser, outerContext) {};
  30779. //
  30780. // Evaluate the precedence predicates for the context and reduce the result.
  30781. //
  30782. // @param parser The parser instance.
  30783. // @param outerContext The current parser context object.
  30784. // @return The simplified semantic context after precedence predicates are
  30785. // evaluated, which will be one of the following values.
  30786. // <ul>
  30787. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  30788. // precedence predicates are evaluated.</li>
  30789. // <li>{@code null}: if the predicate simplifies to {@code false} after
  30790. // precedence predicates are evaluated.</li>
  30791. // <li>{@code this}: if the semantic context is not changed as a result of
  30792. // precedence predicate evaluation.</li>
  30793. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  30794. // semantic context after precedence predicates are evaluated.</li>
  30795. // </ul>
  30796. //
  30797. SemanticContext.prototype.evalPrecedence = function (parser, outerContext) {
  30798. return this;
  30799. };
  30800. SemanticContext.andContext = function (a, b) {
  30801. if (a === null || a === SemanticContext.NONE) {
  30802. return b;
  30803. }
  30804. if (b === null || b === SemanticContext.NONE) {
  30805. return a;
  30806. }
  30807. var result = new AND(a, b);
  30808. if (result.opnds.length === 1) {
  30809. return result.opnds[0];
  30810. } else {
  30811. return result;
  30812. }
  30813. };
  30814. SemanticContext.orContext = function (a, b) {
  30815. if (a === null) {
  30816. return b;
  30817. }
  30818. if (b === null) {
  30819. return a;
  30820. }
  30821. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  30822. return SemanticContext.NONE;
  30823. }
  30824. var result = new OR(a, b);
  30825. if (result.opnds.length === 1) {
  30826. return result.opnds[0];
  30827. } else {
  30828. return result;
  30829. }
  30830. };
  30831. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  30832. SemanticContext.call(this);
  30833. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  30834. this.predIndex = predIndex === undefined ? -1 : predIndex;
  30835. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  30836. return this;
  30837. }
  30838. Predicate.prototype = Object.create(SemanticContext.prototype);
  30839. Predicate.prototype.constructor = Predicate;
  30840. //The default {@link SemanticContext}, which is semantically equivalent to
  30841. //a predicate of the form {@code {true}?}.
  30842. //
  30843. SemanticContext.NONE = new Predicate();
  30844. Predicate.prototype.evaluate = function (parser, outerContext) {
  30845. var localctx = this.isCtxDependent ? outerContext : null;
  30846. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  30847. };
  30848. Predicate.prototype.updateHashCode = function (hash) {
  30849. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  30850. };
  30851. Predicate.prototype.equals = function (other) {
  30852. if (this === other) {
  30853. return true;
  30854. } else if (!(other instanceof Predicate)) {
  30855. return false;
  30856. } else {
  30857. return this.ruleIndex === other.ruleIndex && this.predIndex === other.predIndex && this.isCtxDependent === other.isCtxDependent;
  30858. }
  30859. };
  30860. Predicate.prototype.toString = function () {
  30861. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  30862. };
  30863. function PrecedencePredicate(precedence) {
  30864. SemanticContext.call(this);
  30865. this.precedence = precedence === undefined ? 0 : precedence;
  30866. }
  30867. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  30868. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  30869. PrecedencePredicate.prototype.evaluate = function (parser, outerContext) {
  30870. return parser.precpred(outerContext, this.precedence);
  30871. };
  30872. PrecedencePredicate.prototype.evalPrecedence = function (parser, outerContext) {
  30873. if (parser.precpred(outerContext, this.precedence)) {
  30874. return SemanticContext.NONE;
  30875. } else {
  30876. return null;
  30877. }
  30878. };
  30879. PrecedencePredicate.prototype.compareTo = function (other) {
  30880. return this.precedence - other.precedence;
  30881. };
  30882. PrecedencePredicate.prototype.updateHashCode = function (hash) {
  30883. hash.update(31);
  30884. };
  30885. PrecedencePredicate.prototype.equals = function (other) {
  30886. if (this === other) {
  30887. return true;
  30888. } else if (!(other instanceof PrecedencePredicate)) {
  30889. return false;
  30890. } else {
  30891. return this.precedence === other.precedence;
  30892. }
  30893. };
  30894. PrecedencePredicate.prototype.toString = function () {
  30895. return "{" + this.precedence + ">=prec}?";
  30896. };
  30897. PrecedencePredicate.filterPrecedencePredicates = function (set) {
  30898. var result = [];
  30899. set.values().map(function (context) {
  30900. if (context instanceof PrecedencePredicate) {
  30901. result.push(context);
  30902. }
  30903. });
  30904. return result;
  30905. };
  30906. // A semantic context which is true whenever none of the contained contexts
  30907. // is false.
  30908. //
  30909. function AND(a, b) {
  30910. SemanticContext.call(this);
  30911. var operands = new Set();
  30912. if (a instanceof AND) {
  30913. a.opnds.map(function (o) {
  30914. operands.add(o);
  30915. });
  30916. } else {
  30917. operands.add(a);
  30918. }
  30919. if (b instanceof AND) {
  30920. b.opnds.map(function (o) {
  30921. operands.add(o);
  30922. });
  30923. } else {
  30924. operands.add(b);
  30925. }
  30926. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  30927. if (precedencePredicates.length > 0) {
  30928. // interested in the transition with the lowest precedence
  30929. var reduced = null;
  30930. precedencePredicates.map(function (p) {
  30931. if (reduced === null || p.precedence < reduced.precedence) {
  30932. reduced = p;
  30933. }
  30934. });
  30935. operands.add(reduced);
  30936. }
  30937. this.opnds = operands.values();
  30938. return this;
  30939. }
  30940. AND.prototype = Object.create(SemanticContext.prototype);
  30941. AND.prototype.constructor = AND;
  30942. AND.prototype.equals = function (other) {
  30943. if (this === other) {
  30944. return true;
  30945. } else if (!(other instanceof AND)) {
  30946. return false;
  30947. } else {
  30948. return this.opnds === other.opnds;
  30949. }
  30950. };
  30951. AND.prototype.updateHashCode = function (hash) {
  30952. hash.update(this.opnds, "AND");
  30953. };
  30954. //
  30955. // {@inheritDoc}
  30956. //
  30957. // <p>
  30958. // The evaluation of predicates by this context is short-circuiting, but
  30959. // unordered.</p>
  30960. //
  30961. AND.prototype.evaluate = function (parser, outerContext) {
  30962. for (var i = 0; i < this.opnds.length; i++) {
  30963. if (!this.opnds[i].evaluate(parser, outerContext)) {
  30964. return false;
  30965. }
  30966. }
  30967. return true;
  30968. };
  30969. AND.prototype.evalPrecedence = function (parser, outerContext) {
  30970. var differs = false;
  30971. var operands = [];
  30972. for (var i = 0; i < this.opnds.length; i++) {
  30973. var context = this.opnds[i];
  30974. var evaluated = context.evalPrecedence(parser, outerContext);
  30975. differs |= evaluated !== context;
  30976. if (evaluated === null) {
  30977. // The AND context is false if any element is false
  30978. return null;
  30979. } else if (evaluated !== SemanticContext.NONE) {
  30980. // Reduce the result by skipping true elements
  30981. operands.push(evaluated);
  30982. }
  30983. }
  30984. if (!differs) {
  30985. return this;
  30986. }
  30987. if (operands.length === 0) {
  30988. // all elements were true, so the AND context is true
  30989. return SemanticContext.NONE;
  30990. }
  30991. var result = null;
  30992. operands.map(function (o) {
  30993. result = result === null ? o : SemanticContext.andContext(result, o);
  30994. });
  30995. return result;
  30996. };
  30997. AND.prototype.toString = function () {
  30998. var s = "";
  30999. this.opnds.map(function (o) {
  31000. s += "&& " + o.toString();
  31001. });
  31002. return s.length > 3 ? s.slice(3) : s;
  31003. };
  31004. //
  31005. // A semantic context which is true whenever at least one of the contained
  31006. // contexts is true.
  31007. //
  31008. function OR(a, b) {
  31009. SemanticContext.call(this);
  31010. var operands = new Set();
  31011. if (a instanceof OR) {
  31012. a.opnds.map(function (o) {
  31013. operands.add(o);
  31014. });
  31015. } else {
  31016. operands.add(a);
  31017. }
  31018. if (b instanceof OR) {
  31019. b.opnds.map(function (o) {
  31020. operands.add(o);
  31021. });
  31022. } else {
  31023. operands.add(b);
  31024. }
  31025. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  31026. if (precedencePredicates.length > 0) {
  31027. // interested in the transition with the highest precedence
  31028. var s = precedencePredicates.sort(function (a, b) {
  31029. return a.compareTo(b);
  31030. });
  31031. var reduced = s[s.length - 1];
  31032. operands.add(reduced);
  31033. }
  31034. this.opnds = operands.values();
  31035. return this;
  31036. }
  31037. OR.prototype = Object.create(SemanticContext.prototype);
  31038. OR.prototype.constructor = OR;
  31039. OR.prototype.constructor = function (other) {
  31040. if (this === other) {
  31041. return true;
  31042. } else if (!(other instanceof OR)) {
  31043. return false;
  31044. } else {
  31045. return this.opnds === other.opnds;
  31046. }
  31047. };
  31048. OR.prototype.updateHashCode = function (hash) {
  31049. hash.update(this.opnds, "OR");
  31050. };
  31051. // <p>
  31052. // The evaluation of predicates by this context is short-circuiting, but
  31053. // unordered.</p>
  31054. //
  31055. OR.prototype.evaluate = function (parser, outerContext) {
  31056. for (var i = 0; i < this.opnds.length; i++) {
  31057. if (this.opnds[i].evaluate(parser, outerContext)) {
  31058. return true;
  31059. }
  31060. }
  31061. return false;
  31062. };
  31063. OR.prototype.evalPrecedence = function (parser, outerContext) {
  31064. var differs = false;
  31065. var operands = [];
  31066. for (var i = 0; i < this.opnds.length; i++) {
  31067. var context = this.opnds[i];
  31068. var evaluated = context.evalPrecedence(parser, outerContext);
  31069. differs |= evaluated !== context;
  31070. if (evaluated === SemanticContext.NONE) {
  31071. // The OR context is true if any element is true
  31072. return SemanticContext.NONE;
  31073. } else if (evaluated !== null) {
  31074. // Reduce the result by skipping false elements
  31075. operands.push(evaluated);
  31076. }
  31077. }
  31078. if (!differs) {
  31079. return this;
  31080. }
  31081. if (operands.length === 0) {
  31082. // all elements were false, so the OR context is false
  31083. return null;
  31084. }
  31085. var result = null;
  31086. operands.map(function (o) {
  31087. return result === null ? o : SemanticContext.orContext(result, o);
  31088. });
  31089. return result;
  31090. };
  31091. OR.prototype.toString = function () {
  31092. var s = "";
  31093. this.opnds.map(function (o) {
  31094. s += "|| " + o.toString();
  31095. });
  31096. return s.length > 3 ? s.slice(3) : s;
  31097. };
  31098. exports.SemanticContext = SemanticContext;
  31099. exports.PrecedencePredicate = PrecedencePredicate;
  31100. exports.Predicate = Predicate;
  31101. /***/ }),
  31102. /***/ "./node_modules/antlr4/atn/Transition.js":
  31103. /*!***********************************************!*\
  31104. !*** ./node_modules/antlr4/atn/Transition.js ***!
  31105. \***********************************************/
  31106. /*! no static exports found */
  31107. /***/ (function(module, exports, __webpack_require__) {
  31108. "use strict";
  31109. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31110. * Use of this file is governed by the BSD 3-clause license that
  31111. * can be found in the LICENSE.txt file in the project root.
  31112. */
  31113. //
  31114. // An ATN transition between any two ATN states. Subclasses define
  31115. // atom, set, epsilon, action, predicate, rule transitions.
  31116. //
  31117. // <p>This is a one way link. It emanates from a state (usually via a list of
  31118. // transitions) and has a target state.</p>
  31119. //
  31120. // <p>Since we never have to change the ATN transitions once we construct it,
  31121. // we can fix these transitions as specific classes. The DFA transitions
  31122. // on the other hand need to update the labels as it adds transitions to
  31123. // the states. We'll use the term Edge for the DFA to distinguish them from
  31124. // ATN transitions.</p>
  31125. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31126. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31127. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31128. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  31129. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  31130. function Transition(target) {
  31131. // The target of this transition.
  31132. if (target === undefined || target === null) {
  31133. throw "target cannot be null.";
  31134. }
  31135. this.target = target;
  31136. // Are we epsilon, action, sempred?
  31137. this.isEpsilon = false;
  31138. this.label = null;
  31139. return this;
  31140. }
  31141. // constants for serialization
  31142. Transition.EPSILON = 1;
  31143. Transition.RANGE = 2;
  31144. Transition.RULE = 3;
  31145. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  31146. Transition.ATOM = 5;
  31147. Transition.ACTION = 6;
  31148. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  31149. Transition.NOT_SET = 8;
  31150. Transition.WILDCARD = 9;
  31151. Transition.PRECEDENCE = 10;
  31152. Transition.serializationNames = ["INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE"];
  31153. Transition.serializationTypes = {
  31154. EpsilonTransition: Transition.EPSILON,
  31155. RangeTransition: Transition.RANGE,
  31156. RuleTransition: Transition.RULE,
  31157. PredicateTransition: Transition.PREDICATE,
  31158. AtomTransition: Transition.ATOM,
  31159. ActionTransition: Transition.ACTION,
  31160. SetTransition: Transition.SET,
  31161. NotSetTransition: Transition.NOT_SET,
  31162. WildcardTransition: Transition.WILDCARD,
  31163. PrecedencePredicateTransition: Transition.PRECEDENCE
  31164. };
  31165. // TODO: make all transitions sets? no, should remove set edges
  31166. function AtomTransition(target, label) {
  31167. Transition.call(this, target);
  31168. this.label_ = label; // The token type or character value; or, signifies special label.
  31169. this.label = this.makeLabel();
  31170. this.serializationType = Transition.ATOM;
  31171. return this;
  31172. }
  31173. AtomTransition.prototype = Object.create(Transition.prototype);
  31174. AtomTransition.prototype.constructor = AtomTransition;
  31175. AtomTransition.prototype.makeLabel = function () {
  31176. var s = new IntervalSet();
  31177. s.addOne(this.label_);
  31178. return s;
  31179. };
  31180. AtomTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31181. return this.label_ === symbol;
  31182. };
  31183. AtomTransition.prototype.toString = function () {
  31184. return this.label_;
  31185. };
  31186. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  31187. Transition.call(this, ruleStart);
  31188. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  31189. this.precedence = precedence;
  31190. this.followState = followState; // what node to begin computations following ref to rule
  31191. this.serializationType = Transition.RULE;
  31192. this.isEpsilon = true;
  31193. return this;
  31194. }
  31195. RuleTransition.prototype = Object.create(Transition.prototype);
  31196. RuleTransition.prototype.constructor = RuleTransition;
  31197. RuleTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31198. return false;
  31199. };
  31200. function EpsilonTransition(target, outermostPrecedenceReturn) {
  31201. Transition.call(this, target);
  31202. this.serializationType = Transition.EPSILON;
  31203. this.isEpsilon = true;
  31204. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  31205. return this;
  31206. }
  31207. EpsilonTransition.prototype = Object.create(Transition.prototype);
  31208. EpsilonTransition.prototype.constructor = EpsilonTransition;
  31209. EpsilonTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31210. return false;
  31211. };
  31212. EpsilonTransition.prototype.toString = function () {
  31213. return "epsilon";
  31214. };
  31215. function RangeTransition(target, start, stop) {
  31216. Transition.call(this, target);
  31217. this.serializationType = Transition.RANGE;
  31218. this.start = start;
  31219. this.stop = stop;
  31220. this.label = this.makeLabel();
  31221. return this;
  31222. }
  31223. RangeTransition.prototype = Object.create(Transition.prototype);
  31224. RangeTransition.prototype.constructor = RangeTransition;
  31225. RangeTransition.prototype.makeLabel = function () {
  31226. var s = new IntervalSet();
  31227. s.addRange(this.start, this.stop);
  31228. return s;
  31229. };
  31230. RangeTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31231. return symbol >= this.start && symbol <= this.stop;
  31232. };
  31233. RangeTransition.prototype.toString = function () {
  31234. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  31235. };
  31236. function AbstractPredicateTransition(target) {
  31237. Transition.call(this, target);
  31238. return this;
  31239. }
  31240. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  31241. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  31242. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  31243. AbstractPredicateTransition.call(this, target);
  31244. this.serializationType = Transition.PREDICATE;
  31245. this.ruleIndex = ruleIndex;
  31246. this.predIndex = predIndex;
  31247. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  31248. this.isEpsilon = true;
  31249. return this;
  31250. }
  31251. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  31252. PredicateTransition.prototype.constructor = PredicateTransition;
  31253. PredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31254. return false;
  31255. };
  31256. PredicateTransition.prototype.getPredicate = function () {
  31257. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  31258. };
  31259. PredicateTransition.prototype.toString = function () {
  31260. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  31261. };
  31262. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  31263. Transition.call(this, target);
  31264. this.serializationType = Transition.ACTION;
  31265. this.ruleIndex = ruleIndex;
  31266. this.actionIndex = actionIndex === undefined ? -1 : actionIndex;
  31267. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  31268. this.isEpsilon = true;
  31269. return this;
  31270. }
  31271. ActionTransition.prototype = Object.create(Transition.prototype);
  31272. ActionTransition.prototype.constructor = ActionTransition;
  31273. ActionTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31274. return false;
  31275. };
  31276. ActionTransition.prototype.toString = function () {
  31277. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  31278. };
  31279. // A transition containing a set of values.
  31280. function SetTransition(target, set) {
  31281. Transition.call(this, target);
  31282. this.serializationType = Transition.SET;
  31283. if (set !== undefined && set !== null) {
  31284. this.label = set;
  31285. } else {
  31286. this.label = new IntervalSet();
  31287. this.label.addOne(Token.INVALID_TYPE);
  31288. }
  31289. return this;
  31290. }
  31291. SetTransition.prototype = Object.create(Transition.prototype);
  31292. SetTransition.prototype.constructor = SetTransition;
  31293. SetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31294. return this.label.contains(symbol);
  31295. };
  31296. SetTransition.prototype.toString = function () {
  31297. return this.label.toString();
  31298. };
  31299. function NotSetTransition(target, set) {
  31300. SetTransition.call(this, target, set);
  31301. this.serializationType = Transition.NOT_SET;
  31302. return this;
  31303. }
  31304. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  31305. NotSetTransition.prototype.constructor = NotSetTransition;
  31306. NotSetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31307. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol && !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  31308. };
  31309. NotSetTransition.prototype.toString = function () {
  31310. return '~' + SetTransition.prototype.toString.call(this);
  31311. };
  31312. function WildcardTransition(target) {
  31313. Transition.call(this, target);
  31314. this.serializationType = Transition.WILDCARD;
  31315. return this;
  31316. }
  31317. WildcardTransition.prototype = Object.create(Transition.prototype);
  31318. WildcardTransition.prototype.constructor = WildcardTransition;
  31319. WildcardTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31320. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  31321. };
  31322. WildcardTransition.prototype.toString = function () {
  31323. return ".";
  31324. };
  31325. function PrecedencePredicateTransition(target, precedence) {
  31326. AbstractPredicateTransition.call(this, target);
  31327. this.serializationType = Transition.PRECEDENCE;
  31328. this.precedence = precedence;
  31329. this.isEpsilon = true;
  31330. return this;
  31331. }
  31332. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  31333. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  31334. PrecedencePredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31335. return false;
  31336. };
  31337. PrecedencePredicateTransition.prototype.getPredicate = function () {
  31338. return new PrecedencePredicate(this.precedence);
  31339. };
  31340. PrecedencePredicateTransition.prototype.toString = function () {
  31341. return this.precedence + " >= _p";
  31342. };
  31343. exports.Transition = Transition;
  31344. exports.AtomTransition = AtomTransition;
  31345. exports.SetTransition = SetTransition;
  31346. exports.NotSetTransition = NotSetTransition;
  31347. exports.RuleTransition = RuleTransition;
  31348. exports.ActionTransition = ActionTransition;
  31349. exports.EpsilonTransition = EpsilonTransition;
  31350. exports.RangeTransition = RangeTransition;
  31351. exports.WildcardTransition = WildcardTransition;
  31352. exports.PredicateTransition = PredicateTransition;
  31353. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  31354. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  31355. /***/ }),
  31356. /***/ "./node_modules/antlr4/atn/index.js":
  31357. /*!******************************************!*\
  31358. !*** ./node_modules/antlr4/atn/index.js ***!
  31359. \******************************************/
  31360. /*! no static exports found */
  31361. /***/ (function(module, exports, __webpack_require__) {
  31362. "use strict";
  31363. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31364. * Use of this file is governed by the BSD 3-clause license that
  31365. * can be found in the LICENSE.txt file in the project root.
  31366. */
  31367. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  31368. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  31369. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  31370. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  31371. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  31372. /***/ }),
  31373. /***/ "./node_modules/antlr4/dfa/DFA.js":
  31374. /*!****************************************!*\
  31375. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  31376. \****************************************/
  31377. /*! no static exports found */
  31378. /***/ (function(module, exports, __webpack_require__) {
  31379. "use strict";
  31380. //
  31381. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31382. * Use of this file is governed by the BSD 3-clause license that
  31383. * can be found in the LICENSE.txt file in the project root.
  31384. */
  31385. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  31386. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  31387. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  31388. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  31389. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  31390. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  31391. function DFA(atnStartState, decision) {
  31392. if (decision === undefined) {
  31393. decision = 0;
  31394. }
  31395. // From which ATN state did we create this DFA?
  31396. this.atnStartState = atnStartState;
  31397. this.decision = decision;
  31398. // A set of all DFA states. Use {@link Map} so we can get old state back
  31399. // ({@link Set} only allows you to see if it's there).
  31400. this._states = new Set();
  31401. this.s0 = null;
  31402. // {@code true} if this DFA is for a precedence decision; otherwise,
  31403. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  31404. // {@link //setPrecedenceDfa}.
  31405. this.precedenceDfa = false;
  31406. if (atnStartState instanceof StarLoopEntryState) {
  31407. if (atnStartState.isPrecedenceDecision) {
  31408. this.precedenceDfa = true;
  31409. var precedenceState = new DFAState(null, new ATNConfigSet());
  31410. precedenceState.edges = [];
  31411. precedenceState.isAcceptState = false;
  31412. precedenceState.requiresFullContext = false;
  31413. this.s0 = precedenceState;
  31414. }
  31415. }
  31416. return this;
  31417. }
  31418. // Get the start state for a specific precedence value.
  31419. //
  31420. // @param precedence The current precedence.
  31421. // @return The start state corresponding to the specified precedence, or
  31422. // {@code null} if no start state exists for the specified precedence.
  31423. //
  31424. // @throws IllegalStateException if this is not a precedence DFA.
  31425. // @see //isPrecedenceDfa()
  31426. DFA.prototype.getPrecedenceStartState = function (precedence) {
  31427. if (!this.precedenceDfa) {
  31428. throw "Only precedence DFAs may contain a precedence start state.";
  31429. }
  31430. // s0.edges is never null for a precedence DFA
  31431. if (precedence < 0 || precedence >= this.s0.edges.length) {
  31432. return null;
  31433. }
  31434. return this.s0.edges[precedence] || null;
  31435. };
  31436. // Set the start state for a specific precedence value.
  31437. //
  31438. // @param precedence The current precedence.
  31439. // @param startState The start state corresponding to the specified
  31440. // precedence.
  31441. //
  31442. // @throws IllegalStateException if this is not a precedence DFA.
  31443. // @see //isPrecedenceDfa()
  31444. //
  31445. DFA.prototype.setPrecedenceStartState = function (precedence, startState) {
  31446. if (!this.precedenceDfa) {
  31447. throw "Only precedence DFAs may contain a precedence start state.";
  31448. }
  31449. if (precedence < 0) {
  31450. return;
  31451. }
  31452. // synchronization on s0 here is ok. when the DFA is turned into a
  31453. // precedence DFA, s0 will be initialized once and not updated again
  31454. // s0.edges is never null for a precedence DFA
  31455. this.s0.edges[precedence] = startState;
  31456. };
  31457. //
  31458. // Sets whether this is a precedence DFA. If the specified value differs
  31459. // from the current DFA configuration, the following actions are taken;
  31460. // otherwise no changes are made to the current DFA.
  31461. //
  31462. // <ul>
  31463. // <li>The {@link //states} map is cleared</li>
  31464. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  31465. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  31466. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  31467. // store the start states for individual precedence values.</li>
  31468. // <li>The {@link //precedenceDfa} field is updated</li>
  31469. // </ul>
  31470. //
  31471. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  31472. // {@code false}
  31473. DFA.prototype.setPrecedenceDfa = function (precedenceDfa) {
  31474. if (this.precedenceDfa !== precedenceDfa) {
  31475. this._states = new DFAStatesSet();
  31476. if (precedenceDfa) {
  31477. var precedenceState = new DFAState(null, new ATNConfigSet());
  31478. precedenceState.edges = [];
  31479. precedenceState.isAcceptState = false;
  31480. precedenceState.requiresFullContext = false;
  31481. this.s0 = precedenceState;
  31482. } else {
  31483. this.s0 = null;
  31484. }
  31485. this.precedenceDfa = precedenceDfa;
  31486. }
  31487. };
  31488. Object.defineProperty(DFA.prototype, "states", {
  31489. get: function get() {
  31490. return this._states;
  31491. }
  31492. });
  31493. // Return a list of all states in this DFA, ordered by state number.
  31494. DFA.prototype.sortedStates = function () {
  31495. var list = this._states.values();
  31496. return list.sort(function (a, b) {
  31497. return a.stateNumber - b.stateNumber;
  31498. });
  31499. };
  31500. DFA.prototype.toString = function (literalNames, symbolicNames) {
  31501. literalNames = literalNames || null;
  31502. symbolicNames = symbolicNames || null;
  31503. if (this.s0 === null) {
  31504. return "";
  31505. }
  31506. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  31507. return serializer.toString();
  31508. };
  31509. DFA.prototype.toLexerString = function () {
  31510. if (this.s0 === null) {
  31511. return "";
  31512. }
  31513. var serializer = new LexerDFASerializer(this);
  31514. return serializer.toString();
  31515. };
  31516. exports.DFA = DFA;
  31517. /***/ }),
  31518. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  31519. /*!**************************************************!*\
  31520. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  31521. \**************************************************/
  31522. /*! no static exports found */
  31523. /***/ (function(module, exports, __webpack_require__) {
  31524. "use strict";
  31525. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31526. * Use of this file is governed by the BSD 3-clause license that
  31527. * can be found in the LICENSE.txt file in the project root.
  31528. */
  31529. // A DFA walker that knows how to dump them to serialized strings.#/
  31530. function DFASerializer(dfa, literalNames, symbolicNames) {
  31531. this.dfa = dfa;
  31532. this.literalNames = literalNames || [];
  31533. this.symbolicNames = symbolicNames || [];
  31534. return this;
  31535. }
  31536. DFASerializer.prototype.toString = function () {
  31537. if (this.dfa.s0 === null) {
  31538. return null;
  31539. }
  31540. var buf = "";
  31541. var states = this.dfa.sortedStates();
  31542. for (var i = 0; i < states.length; i++) {
  31543. var s = states[i];
  31544. if (s.edges !== null) {
  31545. var n = s.edges.length;
  31546. for (var j = 0; j < n; j++) {
  31547. var t = s.edges[j] || null;
  31548. if (t !== null && t.stateNumber !== 0x7FFFFFFF) {
  31549. buf = buf.concat(this.getStateString(s));
  31550. buf = buf.concat("-");
  31551. buf = buf.concat(this.getEdgeLabel(j));
  31552. buf = buf.concat("->");
  31553. buf = buf.concat(this.getStateString(t));
  31554. buf = buf.concat('\n');
  31555. }
  31556. }
  31557. }
  31558. }
  31559. return buf.length === 0 ? null : buf;
  31560. };
  31561. DFASerializer.prototype.getEdgeLabel = function (i) {
  31562. if (i === 0) {
  31563. return "EOF";
  31564. } else if (this.literalNames !== null || this.symbolicNames !== null) {
  31565. return this.literalNames[i - 1] || this.symbolicNames[i - 1];
  31566. } else {
  31567. return String.fromCharCode(i - 1);
  31568. }
  31569. };
  31570. DFASerializer.prototype.getStateString = function (s) {
  31571. var baseStateStr = (s.isAcceptState ? ":" : "") + "s" + s.stateNumber + (s.requiresFullContext ? "^" : "");
  31572. if (s.isAcceptState) {
  31573. if (s.predicates !== null) {
  31574. return baseStateStr + "=>" + s.predicates.toString();
  31575. } else {
  31576. return baseStateStr + "=>" + s.prediction.toString();
  31577. }
  31578. } else {
  31579. return baseStateStr;
  31580. }
  31581. };
  31582. function LexerDFASerializer(dfa) {
  31583. DFASerializer.call(this, dfa, null);
  31584. return this;
  31585. }
  31586. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  31587. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  31588. LexerDFASerializer.prototype.getEdgeLabel = function (i) {
  31589. return "'" + String.fromCharCode(i) + "'";
  31590. };
  31591. exports.DFASerializer = DFASerializer;
  31592. exports.LexerDFASerializer = LexerDFASerializer;
  31593. /***/ }),
  31594. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  31595. /*!*********************************************!*\
  31596. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  31597. \*********************************************/
  31598. /*! no static exports found */
  31599. /***/ (function(module, exports, __webpack_require__) {
  31600. "use strict";
  31601. //
  31602. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31603. * Use of this file is governed by the BSD 3-clause license that
  31604. * can be found in the LICENSE.txt file in the project root.
  31605. */
  31606. ///
  31607. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  31608. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  31609. var Hash = Utils.Hash;
  31610. var Set = Utils.Set;
  31611. // Map a predicate to a predicted alternative.///
  31612. function PredPrediction(pred, alt) {
  31613. this.alt = alt;
  31614. this.pred = pred;
  31615. return this;
  31616. }
  31617. PredPrediction.prototype.toString = function () {
  31618. return "(" + this.pred + ", " + this.alt + ")";
  31619. };
  31620. // A DFA state represents a set of possible ATN configurations.
  31621. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  31622. // to keep track of all possible states the ATN can be in after
  31623. // reading each input symbol. That is to say, after reading
  31624. // input a1a2..an, the DFA is in a state that represents the
  31625. // subset T of the states of the ATN that are reachable from the
  31626. // ATN's start state along some path labeled a1a2..an."
  31627. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  31628. // would be a bitset representing the set of states the
  31629. // ATN could be in. We need to track the alt predicted by each
  31630. // state as well, however. More importantly, we need to maintain
  31631. // a stack of states, tracking the closure operations as they
  31632. // jump from rule to rule, emulating rule invocations (method calls).
  31633. // I have to add a stack to simulate the proper lookahead sequences for
  31634. // the underlying LL grammar from which the ATN was derived.
  31635. //
  31636. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  31637. // is both a state (ala normal conversion) and a RuleContext describing
  31638. // the chain of rules (if any) followed to arrive at that state.</p>
  31639. //
  31640. // <p>A DFA state may have multiple references to a particular state,
  31641. // but with different ATN contexts (with same or different alts)
  31642. // meaning that state was reached via a different set of rule invocations.</p>
  31643. // /
  31644. function DFAState(stateNumber, configs) {
  31645. if (stateNumber === null) {
  31646. stateNumber = -1;
  31647. }
  31648. if (configs === null) {
  31649. configs = new ATNConfigSet();
  31650. }
  31651. this.stateNumber = stateNumber;
  31652. this.configs = configs;
  31653. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  31654. // {@link Token//EOF} maps to {@code edges[0]}.
  31655. this.edges = null;
  31656. this.isAcceptState = false;
  31657. // if accept state, what ttype do we match or alt do we predict?
  31658. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  31659. // //predicates}{@code !=null} or
  31660. // {@link //requiresFullContext}.
  31661. this.prediction = 0;
  31662. this.lexerActionExecutor = null;
  31663. // Indicates that this state was created during SLL prediction that
  31664. // discovered a conflict between the configurations in the state. Future
  31665. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  31666. // full context prediction if this field is true.
  31667. this.requiresFullContext = false;
  31668. // During SLL parsing, this is a list of predicates associated with the
  31669. // ATN configurations of the DFA state. When we have predicates,
  31670. // {@link //requiresFullContext} is {@code false} since full context
  31671. // prediction evaluates predicates
  31672. // on-the-fly. If this is not null, then {@link //prediction} is
  31673. // {@link ATN//INVALID_ALT_NUMBER}.
  31674. //
  31675. // <p>We only use these for non-{@link //requiresFullContext} but
  31676. // conflicting states. That
  31677. // means we know from the context (it's $ or we don't dip into outer
  31678. // context) that it's an ambiguity not a conflict.</p>
  31679. //
  31680. // <p>This list is computed by {@link
  31681. // ParserATNSimulator//predicateDFAState}.</p>
  31682. this.predicates = null;
  31683. return this;
  31684. }
  31685. // Get the set of all alts mentioned by all ATN configurations in this
  31686. // DFA state.
  31687. DFAState.prototype.getAltSet = function () {
  31688. var alts = new Set();
  31689. if (this.configs !== null) {
  31690. for (var i = 0; i < this.configs.length; i++) {
  31691. var c = this.configs[i];
  31692. alts.add(c.alt);
  31693. }
  31694. }
  31695. if (alts.length === 0) {
  31696. return null;
  31697. } else {
  31698. return alts;
  31699. }
  31700. };
  31701. // Two {@link DFAState} instances are equal if their ATN configuration sets
  31702. // are the same. This method is used to see if a state already exists.
  31703. //
  31704. // <p>Because the number of alternatives and number of ATN configurations are
  31705. // finite, there is a finite number of DFA states that can be processed.
  31706. // This is necessary to show that the algorithm terminates.</p>
  31707. //
  31708. // <p>Cannot test the DFA state numbers here because in
  31709. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  31710. // exists that has this exact set of ATN configurations. The
  31711. // {@link //stateNumber} is irrelevant.</p>
  31712. DFAState.prototype.equals = function (other) {
  31713. // compare set of ATN configurations in this set with other
  31714. return this === other || other instanceof DFAState && this.configs.equals(other.configs);
  31715. };
  31716. DFAState.prototype.toString = function () {
  31717. var s = "" + this.stateNumber + ":" + this.configs;
  31718. if (this.isAcceptState) {
  31719. s = s + "=>";
  31720. if (this.predicates !== null) s = s + this.predicates;else s = s + this.prediction;
  31721. }
  31722. return s;
  31723. };
  31724. DFAState.prototype.hashCode = function () {
  31725. var hash = new Hash();
  31726. hash.update(this.configs);
  31727. if (this.isAcceptState) {
  31728. if (this.predicates !== null) hash.update(this.predicates);else hash.update(this.prediction);
  31729. }
  31730. return hash.finish();
  31731. };
  31732. exports.DFAState = DFAState;
  31733. exports.PredPrediction = PredPrediction;
  31734. /***/ }),
  31735. /***/ "./node_modules/antlr4/dfa/index.js":
  31736. /*!******************************************!*\
  31737. !*** ./node_modules/antlr4/dfa/index.js ***!
  31738. \******************************************/
  31739. /*! no static exports found */
  31740. /***/ (function(module, exports, __webpack_require__) {
  31741. "use strict";
  31742. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31743. * Use of this file is governed by the BSD 3-clause license that
  31744. * can be found in the LICENSE.txt file in the project root.
  31745. */
  31746. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  31747. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  31748. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  31749. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  31750. /***/ }),
  31751. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  31752. /*!**************************************************************!*\
  31753. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  31754. \**************************************************************/
  31755. /*! no static exports found */
  31756. /***/ (function(module, exports, __webpack_require__) {
  31757. "use strict";
  31758. //
  31759. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31760. * Use of this file is governed by the BSD 3-clause license that
  31761. * can be found in the LICENSE.txt file in the project root.
  31762. */
  31763. //
  31764. //
  31765. // This implementation of {@link ANTLRErrorListener} can be used to identify
  31766. // certain potential correctness and performance problems in grammars. "Reports"
  31767. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  31768. // message.
  31769. //
  31770. // <ul>
  31771. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  31772. // grammar can match the input.</li>
  31773. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  31774. // prediction resolved an SLL conflict to a unique alternative which equaled the
  31775. // minimum alternative of the SLL conflict.</li>
  31776. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  31777. // full-context prediction resolved an SLL conflict to a unique alternative,
  31778. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  31779. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  31780. // this situation occurs.</li>
  31781. // </ul>
  31782. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  31783. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  31784. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31785. function DiagnosticErrorListener(exactOnly) {
  31786. ErrorListener.call(this);
  31787. exactOnly = exactOnly || true;
  31788. // whether all ambiguities or only exact ambiguities are reported.
  31789. this.exactOnly = exactOnly;
  31790. return this;
  31791. }
  31792. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  31793. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  31794. DiagnosticErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  31795. if (this.exactOnly && !exact) {
  31796. return;
  31797. }
  31798. var msg = "reportAmbiguity d=" + this.getDecisionDescription(recognizer, dfa) + ": ambigAlts=" + this.getConflictingAlts(ambigAlts, configs) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31799. recognizer.notifyErrorListeners(msg);
  31800. };
  31801. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  31802. var msg = "reportAttemptingFullContext d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31803. recognizer.notifyErrorListeners(msg);
  31804. };
  31805. DiagnosticErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  31806. var msg = "reportContextSensitivity d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31807. recognizer.notifyErrorListeners(msg);
  31808. };
  31809. DiagnosticErrorListener.prototype.getDecisionDescription = function (recognizer, dfa) {
  31810. var decision = dfa.decision;
  31811. var ruleIndex = dfa.atnStartState.ruleIndex;
  31812. var ruleNames = recognizer.ruleNames;
  31813. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  31814. return "" + decision;
  31815. }
  31816. var ruleName = ruleNames[ruleIndex] || null;
  31817. if (ruleName === null || ruleName.length === 0) {
  31818. return "" + decision;
  31819. }
  31820. return "" + decision + " (" + ruleName + ")";
  31821. };
  31822. //
  31823. // Computes the set of conflicting or ambiguous alternatives from a
  31824. // configuration set, if that information was not already provided by the
  31825. // parser.
  31826. //
  31827. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  31828. // reported by the parser.
  31829. // @param configs The conflicting or ambiguous configuration set.
  31830. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  31831. // returns the set of alternatives represented in {@code configs}.
  31832. //
  31833. DiagnosticErrorListener.prototype.getConflictingAlts = function (reportedAlts, configs) {
  31834. if (reportedAlts !== null) {
  31835. return reportedAlts;
  31836. }
  31837. var result = new BitSet();
  31838. for (var i = 0; i < configs.items.length; i++) {
  31839. result.add(configs.items[i].alt);
  31840. }
  31841. return "{" + result.values().join(", ") + "}";
  31842. };
  31843. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  31844. /***/ }),
  31845. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  31846. /*!****************************************************!*\
  31847. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  31848. \****************************************************/
  31849. /*! no static exports found */
  31850. /***/ (function(module, exports, __webpack_require__) {
  31851. "use strict";
  31852. //
  31853. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31854. * Use of this file is governed by the BSD 3-clause license that
  31855. * can be found in the LICENSE.txt file in the project root.
  31856. */
  31857. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  31858. // default implementation of each method does nothing, but can be overridden as
  31859. // necessary.
  31860. function ErrorListener() {
  31861. return this;
  31862. }
  31863. ErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {};
  31864. ErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {};
  31865. ErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {};
  31866. ErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {};
  31867. function ConsoleErrorListener() {
  31868. ErrorListener.call(this);
  31869. return this;
  31870. }
  31871. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  31872. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  31873. //
  31874. // Provides a default instance of {@link ConsoleErrorListener}.
  31875. //
  31876. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  31877. //
  31878. // {@inheritDoc}
  31879. //
  31880. // <p>
  31881. // This implementation prints messages to {@link System//err} containing the
  31882. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  31883. // the following format.</p>
  31884. //
  31885. // <pre>
  31886. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  31887. // </pre>
  31888. //
  31889. ConsoleErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31890. console.error("line " + line + ":" + column + " " + msg);
  31891. };
  31892. function ProxyErrorListener(delegates) {
  31893. ErrorListener.call(this);
  31894. if (delegates === null) {
  31895. throw "delegates";
  31896. }
  31897. this.delegates = delegates;
  31898. return this;
  31899. }
  31900. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  31901. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  31902. ProxyErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31903. this.delegates.map(function (d) {
  31904. d.syntaxError(recognizer, offendingSymbol, line, column, msg, e);
  31905. });
  31906. };
  31907. ProxyErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  31908. this.delegates.map(function (d) {
  31909. d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  31910. });
  31911. };
  31912. ProxyErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  31913. this.delegates.map(function (d) {
  31914. d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
  31915. });
  31916. };
  31917. ProxyErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  31918. this.delegates.map(function (d) {
  31919. d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs);
  31920. });
  31921. };
  31922. exports.ErrorListener = ErrorListener;
  31923. exports.ConsoleErrorListener = ConsoleErrorListener;
  31924. exports.ProxyErrorListener = ProxyErrorListener;
  31925. /***/ }),
  31926. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  31927. /*!****************************************************!*\
  31928. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  31929. \****************************************************/
  31930. /*! no static exports found */
  31931. /***/ (function(module, exports, __webpack_require__) {
  31932. "use strict";
  31933. //
  31934. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31935. * Use of this file is governed by the BSD 3-clause license that
  31936. * can be found in the LICENSE.txt file in the project root.
  31937. */
  31938. //
  31939. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31940. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  31941. var NoViableAltException = Errors.NoViableAltException;
  31942. var InputMismatchException = Errors.InputMismatchException;
  31943. var FailedPredicateException = Errors.FailedPredicateException;
  31944. var ParseCancellationException = Errors.ParseCancellationException;
  31945. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  31946. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31947. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31948. function ErrorStrategy() {}
  31949. ErrorStrategy.prototype.reset = function (recognizer) {};
  31950. ErrorStrategy.prototype.recoverInline = function (recognizer) {};
  31951. ErrorStrategy.prototype.recover = function (recognizer, e) {};
  31952. ErrorStrategy.prototype.sync = function (recognizer) {};
  31953. ErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {};
  31954. ErrorStrategy.prototype.reportError = function (recognizer) {};
  31955. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  31956. // error reporting and recovery in ANTLR parsers.
  31957. //
  31958. function DefaultErrorStrategy() {
  31959. ErrorStrategy.call(this);
  31960. // Indicates whether the error strategy is currently "recovering from an
  31961. // error". This is used to suppress reporting multiple error messages while
  31962. // attempting to recover from a detected syntax error.
  31963. //
  31964. // @see //inErrorRecoveryMode
  31965. //
  31966. this.errorRecoveryMode = false;
  31967. // The index into the input stream where the last error occurred.
  31968. // This is used to prevent infinite loops where an error is found
  31969. // but no token is consumed during recovery...another error is found,
  31970. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  31971. // one token/tree node is consumed for two errors.
  31972. //
  31973. this.lastErrorIndex = -1;
  31974. this.lastErrorStates = null;
  31975. return this;
  31976. }
  31977. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  31978. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  31979. // <p>The default implementation simply calls {@link //endErrorCondition} to
  31980. // ensure that the handler is not in error recovery mode.</p>
  31981. DefaultErrorStrategy.prototype.reset = function (recognizer) {
  31982. this.endErrorCondition(recognizer);
  31983. };
  31984. //
  31985. // This method is called to enter error recovery mode when a recognition
  31986. // exception is reported.
  31987. //
  31988. // @param recognizer the parser instance
  31989. //
  31990. DefaultErrorStrategy.prototype.beginErrorCondition = function (recognizer) {
  31991. this.errorRecoveryMode = true;
  31992. };
  31993. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {
  31994. return this.errorRecoveryMode;
  31995. };
  31996. //
  31997. // This method is called to leave error recovery mode after recovering from
  31998. // a recognition exception.
  31999. //
  32000. // @param recognizer
  32001. //
  32002. DefaultErrorStrategy.prototype.endErrorCondition = function (recognizer) {
  32003. this.errorRecoveryMode = false;
  32004. this.lastErrorStates = null;
  32005. this.lastErrorIndex = -1;
  32006. };
  32007. //
  32008. // {@inheritDoc}
  32009. //
  32010. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  32011. //
  32012. DefaultErrorStrategy.prototype.reportMatch = function (recognizer) {
  32013. this.endErrorCondition(recognizer);
  32014. };
  32015. //
  32016. // {@inheritDoc}
  32017. //
  32018. // <p>The default implementation returns immediately if the handler is already
  32019. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  32020. // and dispatches the reporting task based on the runtime type of {@code e}
  32021. // according to the following table.</p>
  32022. //
  32023. // <ul>
  32024. // <li>{@link NoViableAltException}: Dispatches the call to
  32025. // {@link //reportNoViableAlternative}</li>
  32026. // <li>{@link InputMismatchException}: Dispatches the call to
  32027. // {@link //reportInputMismatch}</li>
  32028. // <li>{@link FailedPredicateException}: Dispatches the call to
  32029. // {@link //reportFailedPredicate}</li>
  32030. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  32031. // the exception</li>
  32032. // </ul>
  32033. //
  32034. DefaultErrorStrategy.prototype.reportError = function (recognizer, e) {
  32035. // if we've already reported an error and have not matched a token
  32036. // yet successfully, don't report any errors.
  32037. if (this.inErrorRecoveryMode(recognizer)) {
  32038. return; // don't report spurious errors
  32039. }
  32040. this.beginErrorCondition(recognizer);
  32041. if (e instanceof NoViableAltException) {
  32042. this.reportNoViableAlternative(recognizer, e);
  32043. } else if (e instanceof InputMismatchException) {
  32044. this.reportInputMismatch(recognizer, e);
  32045. } else if (e instanceof FailedPredicateException) {
  32046. this.reportFailedPredicate(recognizer, e);
  32047. } else {
  32048. console.log("unknown recognition error type: " + e.constructor.name);
  32049. console.log(e.stack);
  32050. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  32051. }
  32052. };
  32053. //
  32054. // {@inheritDoc}
  32055. //
  32056. // <p>The default implementation resynchronizes the parser by consuming tokens
  32057. // until we find one in the resynchronization set--loosely the set of tokens
  32058. // that can follow the current rule.</p>
  32059. //
  32060. DefaultErrorStrategy.prototype.recover = function (recognizer, e) {
  32061. if (this.lastErrorIndex === recognizer.getInputStream().index && this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state) >= 0) {
  32062. // uh oh, another error at same token index and previously-visited
  32063. // state in ATN; must be a case where LT(1) is in the recovery
  32064. // token set so nothing got consumed. Consume a single token
  32065. // at least to prevent an infinite loop; this is a failsafe.
  32066. recognizer.consume();
  32067. }
  32068. this.lastErrorIndex = recognizer._input.index;
  32069. if (this.lastErrorStates === null) {
  32070. this.lastErrorStates = [];
  32071. }
  32072. this.lastErrorStates.push(recognizer.state);
  32073. var followSet = this.getErrorRecoverySet(recognizer);
  32074. this.consumeUntil(recognizer, followSet);
  32075. };
  32076. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  32077. // that the current lookahead symbol is consistent with what were expecting
  32078. // at this point in the ATN. You can call this anytime but ANTLR only
  32079. // generates code to check before subrules/loops and each iteration.
  32080. //
  32081. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  32082. // subrules. E.g.,</p>
  32083. //
  32084. // <pre>
  32085. // a : sync ( stuff sync )* ;
  32086. // sync : {consume to what can follow sync} ;
  32087. // </pre>
  32088. //
  32089. // At the start of a sub rule upon error, {@link //sync} performs single
  32090. // token deletion, if possible. If it can't do that, it bails on the current
  32091. // rule and uses the default error recovery, which consumes until the
  32092. // resynchronization set of the current rule.
  32093. //
  32094. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  32095. // with an empty alternative), then the expected set includes what follows
  32096. // the subrule.</p>
  32097. //
  32098. // <p>During loop iteration, it consumes until it sees a token that can start a
  32099. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  32100. // stay in the loop as long as possible.</p>
  32101. //
  32102. // <p><strong>ORIGINS</strong></p>
  32103. //
  32104. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  32105. // A single mismatch token or missing token would force the parser to bail
  32106. // out of the entire rules surrounding the loop. So, for rule</p>
  32107. //
  32108. // <pre>
  32109. // classDef : 'class' ID '{' member* '}'
  32110. // </pre>
  32111. //
  32112. // input with an extra token between members would force the parser to
  32113. // consume until it found the next class definition rather than the next
  32114. // member definition of the current class.
  32115. //
  32116. // <p>This functionality cost a little bit of effort because the parser has to
  32117. // compare token set at the start of the loop and at each iteration. If for
  32118. // some reason speed is suffering for you, you can turn off this
  32119. // functionality by simply overriding this method as a blank { }.</p>
  32120. //
  32121. DefaultErrorStrategy.prototype.sync = function (recognizer) {
  32122. // If already recovering, don't try to sync
  32123. if (this.inErrorRecoveryMode(recognizer)) {
  32124. return;
  32125. }
  32126. var s = recognizer._interp.atn.states[recognizer.state];
  32127. var la = recognizer.getTokenStream().LA(1);
  32128. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  32129. var nextTokens = recognizer.atn.nextTokens(s);
  32130. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  32131. return;
  32132. }
  32133. switch (s.stateType) {
  32134. case ATNState.BLOCK_START:
  32135. case ATNState.STAR_BLOCK_START:
  32136. case ATNState.PLUS_BLOCK_START:
  32137. case ATNState.STAR_LOOP_ENTRY:
  32138. // report error and recover if possible
  32139. if (this.singleTokenDeletion(recognizer) !== null) {
  32140. return;
  32141. } else {
  32142. throw new InputMismatchException(recognizer);
  32143. }
  32144. break;
  32145. case ATNState.PLUS_LOOP_BACK:
  32146. case ATNState.STAR_LOOP_BACK:
  32147. this.reportUnwantedToken(recognizer);
  32148. var expecting = new IntervalSet();
  32149. expecting.addSet(recognizer.getExpectedTokens());
  32150. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  32151. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  32152. break;
  32153. default:
  32154. // do nothing if we can't identify the exact kind of ATN state
  32155. }
  32156. };
  32157. // This is called by {@link //reportError} when the exception is a
  32158. // {@link NoViableAltException}.
  32159. //
  32160. // @see //reportError
  32161. //
  32162. // @param recognizer the parser instance
  32163. // @param e the recognition exception
  32164. //
  32165. DefaultErrorStrategy.prototype.reportNoViableAlternative = function (recognizer, e) {
  32166. var tokens = recognizer.getTokenStream();
  32167. var input;
  32168. if (tokens !== null) {
  32169. if (e.startToken.type === Token.EOF) {
  32170. input = "<EOF>";
  32171. } else {
  32172. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  32173. }
  32174. } else {
  32175. input = "<unknown input>";
  32176. }
  32177. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  32178. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  32179. };
  32180. //
  32181. // This is called by {@link //reportError} when the exception is an
  32182. // {@link InputMismatchException}.
  32183. //
  32184. // @see //reportError
  32185. //
  32186. // @param recognizer the parser instance
  32187. // @param e the recognition exception
  32188. //
  32189. DefaultErrorStrategy.prototype.reportInputMismatch = function (recognizer, e) {
  32190. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) + " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  32191. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  32192. };
  32193. //
  32194. // This is called by {@link //reportError} when the exception is a
  32195. // {@link FailedPredicateException}.
  32196. //
  32197. // @see //reportError
  32198. //
  32199. // @param recognizer the parser instance
  32200. // @param e the recognition exception
  32201. //
  32202. DefaultErrorStrategy.prototype.reportFailedPredicate = function (recognizer, e) {
  32203. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  32204. var msg = "rule " + ruleName + " " + e.message;
  32205. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  32206. };
  32207. // This method is called to report a syntax error which requires the removal
  32208. // of a token from the input stream. At the time this method is called, the
  32209. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  32210. // removed from the input stream. When this method returns,
  32211. // {@code recognizer} is in error recovery mode.
  32212. //
  32213. // <p>This method is called when {@link //singleTokenDeletion} identifies
  32214. // single-token deletion as a viable recovery strategy for a mismatched
  32215. // input error.</p>
  32216. //
  32217. // <p>The default implementation simply returns if the handler is already in
  32218. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  32219. // enter error recovery mode, followed by calling
  32220. // {@link Parser//notifyErrorListeners}.</p>
  32221. //
  32222. // @param recognizer the parser instance
  32223. //
  32224. DefaultErrorStrategy.prototype.reportUnwantedToken = function (recognizer) {
  32225. if (this.inErrorRecoveryMode(recognizer)) {
  32226. return;
  32227. }
  32228. this.beginErrorCondition(recognizer);
  32229. var t = recognizer.getCurrentToken();
  32230. var tokenName = this.getTokenErrorDisplay(t);
  32231. var expecting = this.getExpectedTokens(recognizer);
  32232. var msg = "extraneous input " + tokenName + " expecting " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  32233. recognizer.notifyErrorListeners(msg, t, null);
  32234. };
  32235. // This method is called to report a syntax error which requires the
  32236. // insertion of a missing token into the input stream. At the time this
  32237. // method is called, the missing token has not yet been inserted. When this
  32238. // method returns, {@code recognizer} is in error recovery mode.
  32239. //
  32240. // <p>This method is called when {@link //singleTokenInsertion} identifies
  32241. // single-token insertion as a viable recovery strategy for a mismatched
  32242. // input error.</p>
  32243. //
  32244. // <p>The default implementation simply returns if the handler is already in
  32245. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  32246. // enter error recovery mode, followed by calling
  32247. // {@link Parser//notifyErrorListeners}.</p>
  32248. //
  32249. // @param recognizer the parser instance
  32250. //
  32251. DefaultErrorStrategy.prototype.reportMissingToken = function (recognizer) {
  32252. if (this.inErrorRecoveryMode(recognizer)) {
  32253. return;
  32254. }
  32255. this.beginErrorCondition(recognizer);
  32256. var t = recognizer.getCurrentToken();
  32257. var expecting = this.getExpectedTokens(recognizer);
  32258. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) + " at " + this.getTokenErrorDisplay(t);
  32259. recognizer.notifyErrorListeners(msg, t, null);
  32260. };
  32261. // <p>The default implementation attempts to recover from the mismatched input
  32262. // by using single token insertion and deletion as described below. If the
  32263. // recovery attempt fails, this method throws an
  32264. // {@link InputMismatchException}.</p>
  32265. //
  32266. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  32267. //
  32268. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  32269. // right token, however, then assume {@code LA(1)} is some extra spurious
  32270. // token and delete it. Then consume and return the next token (which was
  32271. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  32272. //
  32273. // <p>This recovery strategy is implemented by {@link
  32274. // //singleTokenDeletion}.</p>
  32275. //
  32276. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  32277. //
  32278. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  32279. // after the expected {@code LA(1)} token, then assume the token is missing
  32280. // and use the parser's {@link TokenFactory} to create it on the fly. The
  32281. // "insertion" is performed by returning the created token as the successful
  32282. // result of the match operation.</p>
  32283. //
  32284. // <p>This recovery strategy is implemented by {@link
  32285. // //singleTokenInsertion}.</p>
  32286. //
  32287. // <p><strong>EXAMPLE</strong></p>
  32288. //
  32289. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  32290. // the parser returns from the nested call to {@code expr}, it will have
  32291. // call chain:</p>
  32292. //
  32293. // <pre>
  32294. // stat &rarr; expr &rarr; atom
  32295. // </pre>
  32296. //
  32297. // and it will be trying to match the {@code ')'} at this point in the
  32298. // derivation:
  32299. //
  32300. // <pre>
  32301. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  32302. // ^
  32303. // </pre>
  32304. //
  32305. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  32306. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  32307. // is in the set of tokens that can follow the {@code ')'} token reference
  32308. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  32309. //
  32310. DefaultErrorStrategy.prototype.recoverInline = function (recognizer) {
  32311. // SINGLE TOKEN DELETION
  32312. var matchedSymbol = this.singleTokenDeletion(recognizer);
  32313. if (matchedSymbol !== null) {
  32314. // we have deleted the extra token.
  32315. // now, move past ttype token as if all were ok
  32316. recognizer.consume();
  32317. return matchedSymbol;
  32318. }
  32319. // SINGLE TOKEN INSERTION
  32320. if (this.singleTokenInsertion(recognizer)) {
  32321. return this.getMissingSymbol(recognizer);
  32322. }
  32323. // even that didn't work; must throw the exception
  32324. throw new InputMismatchException(recognizer);
  32325. };
  32326. //
  32327. // This method implements the single-token insertion inline error recovery
  32328. // strategy. It is called by {@link //recoverInline} if the single-token
  32329. // deletion strategy fails to recover from the mismatched input. If this
  32330. // method returns {@code true}, {@code recognizer} will be in error recovery
  32331. // mode.
  32332. //
  32333. // <p>This method determines whether or not single-token insertion is viable by
  32334. // checking if the {@code LA(1)} input symbol could be successfully matched
  32335. // if it were instead the {@code LA(2)} symbol. If this method returns
  32336. // {@code true}, the caller is responsible for creating and inserting a
  32337. // token with the correct type to produce this behavior.</p>
  32338. //
  32339. // @param recognizer the parser instance
  32340. // @return {@code true} if single-token insertion is a viable recovery
  32341. // strategy for the current mismatched input, otherwise {@code false}
  32342. //
  32343. DefaultErrorStrategy.prototype.singleTokenInsertion = function (recognizer) {
  32344. var currentSymbolType = recognizer.getTokenStream().LA(1);
  32345. // if current token is consistent with what could come after current
  32346. // ATN state, then we know we're missing a token; error recovery
  32347. // is free to conjure up and insert the missing token
  32348. var atn = recognizer._interp.atn;
  32349. var currentState = atn.states[recognizer.state];
  32350. var next = currentState.transitions[0].target;
  32351. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  32352. if (expectingAtLL2.contains(currentSymbolType)) {
  32353. this.reportMissingToken(recognizer);
  32354. return true;
  32355. } else {
  32356. return false;
  32357. }
  32358. };
  32359. // This method implements the single-token deletion inline error recovery
  32360. // strategy. It is called by {@link //recoverInline} to attempt to recover
  32361. // from mismatched input. If this method returns null, the parser and error
  32362. // handler state will not have changed. If this method returns non-null,
  32363. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  32364. // returned token was a successful match.
  32365. //
  32366. // <p>If the single-token deletion is successful, this method calls
  32367. // {@link //reportUnwantedToken} to report the error, followed by
  32368. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  32369. // before returning {@link //reportMatch} is called to signal a successful
  32370. // match.</p>
  32371. //
  32372. // @param recognizer the parser instance
  32373. // @return the successfully matched {@link Token} instance if single-token
  32374. // deletion successfully recovers from the mismatched input, otherwise
  32375. // {@code null}
  32376. //
  32377. DefaultErrorStrategy.prototype.singleTokenDeletion = function (recognizer) {
  32378. var nextTokenType = recognizer.getTokenStream().LA(2);
  32379. var expecting = this.getExpectedTokens(recognizer);
  32380. if (expecting.contains(nextTokenType)) {
  32381. this.reportUnwantedToken(recognizer);
  32382. // print("recoverFromMismatchedToken deleting " \
  32383. // + str(recognizer.getTokenStream().LT(1)) \
  32384. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  32385. // + " is what we want", file=sys.stderr)
  32386. recognizer.consume(); // simply delete extra token
  32387. // we want to return the token we're actually matching
  32388. var matchedSymbol = recognizer.getCurrentToken();
  32389. this.reportMatch(recognizer); // we know current token is correct
  32390. return matchedSymbol;
  32391. } else {
  32392. return null;
  32393. }
  32394. };
  32395. // Conjure up a missing token during error recovery.
  32396. //
  32397. // The recognizer attempts to recover from single missing
  32398. // symbols. But, actions might refer to that missing symbol.
  32399. // For example, x=ID {f($x);}. The action clearly assumes
  32400. // that there has been an identifier matched previously and that
  32401. // $x points at that token. If that token is missing, but
  32402. // the next token in the stream is what we want we assume that
  32403. // this token is missing and we keep going. Because we
  32404. // have to return some token to replace the missing token,
  32405. // we have to conjure one up. This method gives the user control
  32406. // over the tokens returned for missing tokens. Mostly,
  32407. // you will want to create something special for identifier
  32408. // tokens. For literals such as '{' and ',', the default
  32409. // action in the parser or tree parser works. It simply creates
  32410. // a CommonToken of the appropriate type. The text will be the token.
  32411. // If you change what tokens must be created by the lexer,
  32412. // override this method to create the appropriate tokens.
  32413. //
  32414. DefaultErrorStrategy.prototype.getMissingSymbol = function (recognizer) {
  32415. var currentSymbol = recognizer.getCurrentToken();
  32416. var expecting = this.getExpectedTokens(recognizer);
  32417. var expectedTokenType = expecting.first(); // get any element
  32418. var tokenText;
  32419. if (expectedTokenType === Token.EOF) {
  32420. tokenText = "<missing EOF>";
  32421. } else {
  32422. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  32423. }
  32424. var current = currentSymbol;
  32425. var lookback = recognizer.getTokenStream().LT(-1);
  32426. if (current.type === Token.EOF && lookback !== null) {
  32427. current = lookback;
  32428. }
  32429. return recognizer.getTokenFactory().create(current.source, expectedTokenType, tokenText, Token.DEFAULT_CHANNEL, -1, -1, current.line, current.column);
  32430. };
  32431. DefaultErrorStrategy.prototype.getExpectedTokens = function (recognizer) {
  32432. return recognizer.getExpectedTokens();
  32433. };
  32434. // How should a token be displayed in an error message? The default
  32435. // is to display just the text, but during development you might
  32436. // want to have a lot of information spit out. Override in that case
  32437. // to use t.toString() (which, for CommonToken, dumps everything about
  32438. // the token). This is better than forcing you to override a method in
  32439. // your token objects because you don't have to go modify your lexer
  32440. // so that it creates a new Java type.
  32441. //
  32442. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function (t) {
  32443. if (t === null) {
  32444. return "<no token>";
  32445. }
  32446. var s = t.text;
  32447. if (s === null) {
  32448. if (t.type === Token.EOF) {
  32449. s = "<EOF>";
  32450. } else {
  32451. s = "<" + t.type + ">";
  32452. }
  32453. }
  32454. return this.escapeWSAndQuote(s);
  32455. };
  32456. DefaultErrorStrategy.prototype.escapeWSAndQuote = function (s) {
  32457. s = s.replace(/\n/g, "\\n");
  32458. s = s.replace(/\r/g, "\\r");
  32459. s = s.replace(/\t/g, "\\t");
  32460. return "'" + s + "'";
  32461. };
  32462. // Compute the error recovery set for the current rule. During
  32463. // rule invocation, the parser pushes the set of tokens that can
  32464. // follow that rule reference on the stack; this amounts to
  32465. // computing FIRST of what follows the rule reference in the
  32466. // enclosing rule. See LinearApproximator.FIRST().
  32467. // This local follow set only includes tokens
  32468. // from within the rule; i.e., the FIRST computation done by
  32469. // ANTLR stops at the end of a rule.
  32470. //
  32471. // EXAMPLE
  32472. //
  32473. // When you find a "no viable alt exception", the input is not
  32474. // consistent with any of the alternatives for rule r. The best
  32475. // thing to do is to consume tokens until you see something that
  32476. // can legally follow a call to r//or* any rule that called r.
  32477. // You don't want the exact set of viable next tokens because the
  32478. // input might just be missing a token--you might consume the
  32479. // rest of the input looking for one of the missing tokens.
  32480. //
  32481. // Consider grammar:
  32482. //
  32483. // a : '[' b ']'
  32484. // | '(' b ')'
  32485. // ;
  32486. // b : c '^' INT ;
  32487. // c : ID
  32488. // | INT
  32489. // ;
  32490. //
  32491. // At each rule invocation, the set of tokens that could follow
  32492. // that rule is pushed on a stack. Here are the various
  32493. // context-sensitive follow sets:
  32494. //
  32495. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  32496. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  32497. // FOLLOW(c_in_b) = FIRST('^') = '^'
  32498. //
  32499. // Upon erroneous input "[]", the call chain is
  32500. //
  32501. // a -> b -> c
  32502. //
  32503. // and, hence, the follow context stack is:
  32504. //
  32505. // depth follow set start of rule execution
  32506. // 0 <EOF> a (from main())
  32507. // 1 ']' b
  32508. // 2 '^' c
  32509. //
  32510. // Notice that ')' is not included, because b would have to have
  32511. // been called from a different context in rule a for ')' to be
  32512. // included.
  32513. //
  32514. // For error recovery, we cannot consider FOLLOW(c)
  32515. // (context-sensitive or otherwise). We need the combined set of
  32516. // all context-sensitive FOLLOW sets--the set of all tokens that
  32517. // could follow any reference in the call chain. We need to
  32518. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  32519. // we resync'd to that token, we'd consume until EOF. We need to
  32520. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  32521. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  32522. // not consume anything. After printing an error, rule c would
  32523. // return normally. Rule b would not find the required '^' though.
  32524. // At this point, it gets a mismatched token error and throws an
  32525. // exception (since LA(1) is not in the viable following token
  32526. // set). The rule exception handler tries to recover, but finds
  32527. // the same recovery set and doesn't consume anything. Rule b
  32528. // exits normally returning to rule a. Now it finds the ']' (and
  32529. // with the successful match exits errorRecovery mode).
  32530. //
  32531. // So, you can see that the parser walks up the call chain looking
  32532. // for the token that was a member of the recovery set.
  32533. //
  32534. // Errors are not generated in errorRecovery mode.
  32535. //
  32536. // ANTLR's error recovery mechanism is based upon original ideas:
  32537. //
  32538. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  32539. //
  32540. // and
  32541. //
  32542. // "A note on error recovery in recursive descent parsers":
  32543. // http://portal.acm.org/citation.cfm?id=947902.947905
  32544. //
  32545. // Later, Josef Grosch had some good ideas:
  32546. //
  32547. // "Efficient and Comfortable Error Recovery in Recursive Descent
  32548. // Parsers":
  32549. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  32550. //
  32551. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  32552. // at run-time upon error to avoid overhead during parsing.
  32553. //
  32554. DefaultErrorStrategy.prototype.getErrorRecoverySet = function (recognizer) {
  32555. var atn = recognizer._interp.atn;
  32556. var ctx = recognizer._ctx;
  32557. var recoverSet = new IntervalSet();
  32558. while (ctx !== null && ctx.invokingState >= 0) {
  32559. // compute what follows who invoked us
  32560. var invokingState = atn.states[ctx.invokingState];
  32561. var rt = invokingState.transitions[0];
  32562. var follow = atn.nextTokens(rt.followState);
  32563. recoverSet.addSet(follow);
  32564. ctx = ctx.parentCtx;
  32565. }
  32566. recoverSet.removeOne(Token.EPSILON);
  32567. return recoverSet;
  32568. };
  32569. // Consume tokens until one matches the given token set.//
  32570. DefaultErrorStrategy.prototype.consumeUntil = function (recognizer, set) {
  32571. var ttype = recognizer.getTokenStream().LA(1);
  32572. while (ttype !== Token.EOF && !set.contains(ttype)) {
  32573. recognizer.consume();
  32574. ttype = recognizer.getTokenStream().LA(1);
  32575. }
  32576. };
  32577. //
  32578. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  32579. // by immediately canceling the parse operation with a
  32580. // {@link ParseCancellationException}. The implementation ensures that the
  32581. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  32582. // that were not completed prior to encountering the error.
  32583. //
  32584. // <p>
  32585. // This error strategy is useful in the following scenarios.</p>
  32586. //
  32587. // <ul>
  32588. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  32589. // stage of two-stage parsing to immediately terminate if an error is
  32590. // encountered, and immediately fall back to the second stage. In addition to
  32591. // avoiding wasted work by attempting to recover from errors here, the empty
  32592. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  32593. // the first stage.</li>
  32594. // <li><strong>Silent validation:</strong> When syntax errors are not being
  32595. // reported or logged, and the parse result is simply ignored if errors occur,
  32596. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  32597. // when the result will be ignored either way.</li>
  32598. // </ul>
  32599. //
  32600. // <p>
  32601. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  32602. //
  32603. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  32604. //
  32605. function BailErrorStrategy() {
  32606. DefaultErrorStrategy.call(this);
  32607. return this;
  32608. }
  32609. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  32610. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  32611. // Instead of recovering from exception {@code e}, re-throw it wrapped
  32612. // in a {@link ParseCancellationException} so it is not caught by the
  32613. // rule function catches. Use {@link Exception//getCause()} to get the
  32614. // original {@link RecognitionException}.
  32615. //
  32616. BailErrorStrategy.prototype.recover = function (recognizer, e) {
  32617. var context = recognizer._ctx;
  32618. while (context !== null) {
  32619. context.exception = e;
  32620. context = context.parentCtx;
  32621. }
  32622. throw new ParseCancellationException(e);
  32623. };
  32624. // Make sure we don't attempt to recover inline; if the parser
  32625. // successfully recovers, it won't throw an exception.
  32626. //
  32627. BailErrorStrategy.prototype.recoverInline = function (recognizer) {
  32628. this.recover(recognizer, new InputMismatchException(recognizer));
  32629. };
  32630. // Make sure we don't attempt to recover from problems in subrules.//
  32631. BailErrorStrategy.prototype.sync = function (recognizer) {
  32632. // pass
  32633. };
  32634. exports.BailErrorStrategy = BailErrorStrategy;
  32635. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  32636. /***/ }),
  32637. /***/ "./node_modules/antlr4/error/Errors.js":
  32638. /*!*********************************************!*\
  32639. !*** ./node_modules/antlr4/error/Errors.js ***!
  32640. \*********************************************/
  32641. /*! no static exports found */
  32642. /***/ (function(module, exports, __webpack_require__) {
  32643. "use strict";
  32644. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32645. * Use of this file is governed by the BSD 3-clause license that
  32646. * can be found in the LICENSE.txt file in the project root.
  32647. */
  32648. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  32649. // 3 kinds of errors: prediction errors, failed predicate errors, and
  32650. // mismatched input errors. In each case, the parser knows where it is
  32651. // in the input, where it is in the ATN, the rule invocation stack,
  32652. // and what kind of problem occurred.
  32653. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  32654. function RecognitionException(params) {
  32655. Error.call(this);
  32656. if (!!Error.captureStackTrace) {
  32657. Error.captureStackTrace(this, RecognitionException);
  32658. } else {
  32659. var stack = new Error().stack;
  32660. }
  32661. this.message = params.message;
  32662. this.recognizer = params.recognizer;
  32663. this.input = params.input;
  32664. this.ctx = params.ctx;
  32665. // The current {@link Token} when an error occurred. Since not all streams
  32666. // support accessing symbols by index, we have to track the {@link Token}
  32667. // instance itself.
  32668. this.offendingToken = null;
  32669. // Get the ATN state number the parser was in at the time the error
  32670. // occurred. For {@link NoViableAltException} and
  32671. // {@link LexerNoViableAltException} exceptions, this is the
  32672. // {@link DecisionState} number. For others, it is the state whose outgoing
  32673. // edge we couldn't match.
  32674. this.offendingState = -1;
  32675. if (this.recognizer !== null) {
  32676. this.offendingState = this.recognizer.state;
  32677. }
  32678. return this;
  32679. }
  32680. RecognitionException.prototype = Object.create(Error.prototype);
  32681. RecognitionException.prototype.constructor = RecognitionException;
  32682. // <p>If the state number is not known, this method returns -1.</p>
  32683. //
  32684. // Gets the set of input symbols which could potentially follow the
  32685. // previously matched symbol at the time this exception was thrown.
  32686. //
  32687. // <p>If the set of expected tokens is not known and could not be computed,
  32688. // this method returns {@code null}.</p>
  32689. //
  32690. // @return The set of token types that could potentially follow the current
  32691. // state in the ATN, or {@code null} if the information is not available.
  32692. // /
  32693. RecognitionException.prototype.getExpectedTokens = function () {
  32694. if (this.recognizer !== null) {
  32695. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  32696. } else {
  32697. return null;
  32698. }
  32699. };
  32700. RecognitionException.prototype.toString = function () {
  32701. return this.message;
  32702. };
  32703. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  32704. RecognitionException.call(this, { message: "", recognizer: lexer, input: input, ctx: null });
  32705. this.startIndex = startIndex;
  32706. this.deadEndConfigs = deadEndConfigs;
  32707. return this;
  32708. }
  32709. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  32710. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  32711. LexerNoViableAltException.prototype.toString = function () {
  32712. var symbol = "";
  32713. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  32714. symbol = this.input.getText((this.startIndex, this.startIndex));
  32715. }
  32716. return "LexerNoViableAltException" + symbol;
  32717. };
  32718. // Indicates that the parser could not decide which of two or more paths
  32719. // to take based upon the remaining input. It tracks the starting token
  32720. // of the offending input and also knows where the parser was
  32721. // in the various paths when the error. Reported by reportNoViableAlternative()
  32722. //
  32723. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  32724. ctx = ctx || recognizer._ctx;
  32725. offendingToken = offendingToken || recognizer.getCurrentToken();
  32726. startToken = startToken || recognizer.getCurrentToken();
  32727. input = input || recognizer.getInputStream();
  32728. RecognitionException.call(this, { message: "", recognizer: recognizer, input: input, ctx: ctx });
  32729. // Which configurations did we try at input.index() that couldn't match
  32730. // input.LT(1)?//
  32731. this.deadEndConfigs = deadEndConfigs;
  32732. // The token object at the start index; the input stream might
  32733. // not be buffering tokens so get a reference to it. (At the
  32734. // time the error occurred, of course the stream needs to keep a
  32735. // buffer all of the tokens but later we might not have access to those.)
  32736. this.startToken = startToken;
  32737. this.offendingToken = offendingToken;
  32738. }
  32739. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  32740. NoViableAltException.prototype.constructor = NoViableAltException;
  32741. // This signifies any kind of mismatched input exceptions such as
  32742. // when the current input does not match the expected token.
  32743. //
  32744. function InputMismatchException(recognizer) {
  32745. RecognitionException.call(this, { message: "", recognizer: recognizer, input: recognizer.getInputStream(), ctx: recognizer._ctx });
  32746. this.offendingToken = recognizer.getCurrentToken();
  32747. }
  32748. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  32749. InputMismatchException.prototype.constructor = InputMismatchException;
  32750. // A semantic predicate failed during validation. Validation of predicates
  32751. // occurs when normally parsing the alternative just like matching a token.
  32752. // Disambiguating predicate evaluation occurs when we test a predicate during
  32753. // prediction.
  32754. function FailedPredicateException(recognizer, predicate, message) {
  32755. RecognitionException.call(this, { message: this.formatMessage(predicate, message || null), recognizer: recognizer,
  32756. input: recognizer.getInputStream(), ctx: recognizer._ctx });
  32757. var s = recognizer._interp.atn.states[recognizer.state];
  32758. var trans = s.transitions[0];
  32759. if (trans instanceof PredicateTransition) {
  32760. this.ruleIndex = trans.ruleIndex;
  32761. this.predicateIndex = trans.predIndex;
  32762. } else {
  32763. this.ruleIndex = 0;
  32764. this.predicateIndex = 0;
  32765. }
  32766. this.predicate = predicate;
  32767. this.offendingToken = recognizer.getCurrentToken();
  32768. return this;
  32769. }
  32770. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  32771. FailedPredicateException.prototype.constructor = FailedPredicateException;
  32772. FailedPredicateException.prototype.formatMessage = function (predicate, message) {
  32773. if (message !== null) {
  32774. return message;
  32775. } else {
  32776. return "failed predicate: {" + predicate + "}?";
  32777. }
  32778. };
  32779. function ParseCancellationException() {
  32780. Error.call(this);
  32781. Error.captureStackTrace(this, ParseCancellationException);
  32782. return this;
  32783. }
  32784. ParseCancellationException.prototype = Object.create(Error.prototype);
  32785. ParseCancellationException.prototype.constructor = ParseCancellationException;
  32786. exports.RecognitionException = RecognitionException;
  32787. exports.NoViableAltException = NoViableAltException;
  32788. exports.LexerNoViableAltException = LexerNoViableAltException;
  32789. exports.InputMismatchException = InputMismatchException;
  32790. exports.FailedPredicateException = FailedPredicateException;
  32791. exports.ParseCancellationException = ParseCancellationException;
  32792. /***/ }),
  32793. /***/ "./node_modules/antlr4/error/index.js":
  32794. /*!********************************************!*\
  32795. !*** ./node_modules/antlr4/error/index.js ***!
  32796. \********************************************/
  32797. /*! no static exports found */
  32798. /***/ (function(module, exports, __webpack_require__) {
  32799. "use strict";
  32800. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32801. * Use of this file is governed by the BSD 3-clause license that
  32802. * can be found in the LICENSE.txt file in the project root.
  32803. */
  32804. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  32805. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  32806. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  32807. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  32808. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  32809. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  32810. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  32811. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  32812. /***/ }),
  32813. /***/ "./node_modules/antlr4/index.js":
  32814. /*!**************************************!*\
  32815. !*** ./node_modules/antlr4/index.js ***!
  32816. \**************************************/
  32817. /*! no static exports found */
  32818. /***/ (function(module, exports, __webpack_require__) {
  32819. "use strict";
  32820. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32821. * Use of this file is governed by the BSD 3-clause license that
  32822. * can be found in the LICENSE.txt file in the project root.
  32823. */
  32824. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  32825. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  32826. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  32827. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  32828. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  32829. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  32830. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  32831. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  32832. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  32833. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  32834. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  32835. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  32836. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  32837. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  32838. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  32839. exports.PredictionContextCache = pc.PredictionContextCache;
  32840. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  32841. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  32842. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  32843. /***/ }),
  32844. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  32845. /*!******************************************************!*\
  32846. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  32847. \******************************************************/
  32848. /*! no static exports found */
  32849. /***/ (function(module, exports, __webpack_require__) {
  32850. "use strict";
  32851. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  32852. if (!String.prototype.codePointAt) {
  32853. (function () {
  32854. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  32855. var defineProperty = function () {
  32856. // IE 8 only supports `Object.defineProperty` on DOM elements
  32857. try {
  32858. var object = {};
  32859. var $defineProperty = Object.defineProperty;
  32860. var result = $defineProperty(object, object, object) && $defineProperty;
  32861. } catch (error) {}
  32862. return result;
  32863. }();
  32864. var codePointAt = function codePointAt(position) {
  32865. if (this == null) {
  32866. throw TypeError();
  32867. }
  32868. var string = String(this);
  32869. var size = string.length;
  32870. // `ToInteger`
  32871. var index = position ? Number(position) : 0;
  32872. if (index != index) {
  32873. // better `isNaN`
  32874. index = 0;
  32875. }
  32876. // Account for out-of-bounds indices:
  32877. if (index < 0 || index >= size) {
  32878. return undefined;
  32879. }
  32880. // Get the first code unit
  32881. var first = string.charCodeAt(index);
  32882. var second;
  32883. if ( // check if it’s the start of a surrogate pair
  32884. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  32885. size > index + 1 // there is a next code unit
  32886. ) {
  32887. second = string.charCodeAt(index + 1);
  32888. if (second >= 0xDC00 && second <= 0xDFFF) {
  32889. // low surrogate
  32890. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32891. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  32892. }
  32893. }
  32894. return first;
  32895. };
  32896. if (defineProperty) {
  32897. defineProperty(String.prototype, 'codePointAt', {
  32898. 'value': codePointAt,
  32899. 'configurable': true,
  32900. 'writable': true
  32901. });
  32902. } else {
  32903. String.prototype.codePointAt = codePointAt;
  32904. }
  32905. })();
  32906. }
  32907. /***/ }),
  32908. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  32909. /*!********************************************************!*\
  32910. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  32911. \********************************************************/
  32912. /*! no static exports found */
  32913. /***/ (function(module, exports, __webpack_require__) {
  32914. "use strict";
  32915. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  32916. if (!String.fromCodePoint) {
  32917. (function () {
  32918. var defineProperty = function () {
  32919. // IE 8 only supports `Object.defineProperty` on DOM elements
  32920. try {
  32921. var object = {};
  32922. var $defineProperty = Object.defineProperty;
  32923. var result = $defineProperty(object, object, object) && $defineProperty;
  32924. } catch (error) {}
  32925. return result;
  32926. }();
  32927. var stringFromCharCode = String.fromCharCode;
  32928. var floor = Math.floor;
  32929. var fromCodePoint = function fromCodePoint(_) {
  32930. var MAX_SIZE = 0x4000;
  32931. var codeUnits = [];
  32932. var highSurrogate;
  32933. var lowSurrogate;
  32934. var index = -1;
  32935. var length = arguments.length;
  32936. if (!length) {
  32937. return '';
  32938. }
  32939. var result = '';
  32940. while (++index < length) {
  32941. var codePoint = Number(arguments[index]);
  32942. if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  32943. codePoint < 0 || // not a valid Unicode code point
  32944. codePoint > 0x10FFFF || // not a valid Unicode code point
  32945. floor(codePoint) != codePoint // not an integer
  32946. ) {
  32947. throw RangeError('Invalid code point: ' + codePoint);
  32948. }
  32949. if (codePoint <= 0xFFFF) {
  32950. // BMP code point
  32951. codeUnits.push(codePoint);
  32952. } else {
  32953. // Astral code point; split in surrogate halves
  32954. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32955. codePoint -= 0x10000;
  32956. highSurrogate = (codePoint >> 10) + 0xD800;
  32957. lowSurrogate = codePoint % 0x400 + 0xDC00;
  32958. codeUnits.push(highSurrogate, lowSurrogate);
  32959. }
  32960. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  32961. result += stringFromCharCode.apply(null, codeUnits);
  32962. codeUnits.length = 0;
  32963. }
  32964. }
  32965. return result;
  32966. };
  32967. if (defineProperty) {
  32968. defineProperty(String, 'fromCodePoint', {
  32969. 'value': fromCodePoint,
  32970. 'configurable': true,
  32971. 'writable': true
  32972. });
  32973. } else {
  32974. String.fromCodePoint = fromCodePoint;
  32975. }
  32976. })();
  32977. }
  32978. /***/ }),
  32979. /***/ "./node_modules/antlr4/tree/Tree.js":
  32980. /*!******************************************!*\
  32981. !*** ./node_modules/antlr4/tree/Tree.js ***!
  32982. \******************************************/
  32983. /*! no static exports found */
  32984. /***/ (function(module, exports, __webpack_require__) {
  32985. "use strict";
  32986. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32987. * Use of this file is governed by the BSD 3-clause license that
  32988. * can be found in the LICENSE.txt file in the project root.
  32989. */
  32990. ///
  32991. // The basic notion of a tree has a parent, a payload, and a list of children.
  32992. // It is the most abstract interface for all the trees used by ANTLR.
  32993. ///
  32994. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32995. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  32996. var INVALID_INTERVAL = new Interval(-1, -2);
  32997. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  32998. function Tree() {
  32999. return this;
  33000. }
  33001. function SyntaxTree() {
  33002. Tree.call(this);
  33003. return this;
  33004. }
  33005. SyntaxTree.prototype = Object.create(Tree.prototype);
  33006. SyntaxTree.prototype.constructor = SyntaxTree;
  33007. function ParseTree() {
  33008. SyntaxTree.call(this);
  33009. return this;
  33010. }
  33011. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  33012. ParseTree.prototype.constructor = ParseTree;
  33013. function RuleNode() {
  33014. ParseTree.call(this);
  33015. return this;
  33016. }
  33017. RuleNode.prototype = Object.create(ParseTree.prototype);
  33018. RuleNode.prototype.constructor = RuleNode;
  33019. function TerminalNode() {
  33020. ParseTree.call(this);
  33021. return this;
  33022. }
  33023. TerminalNode.prototype = Object.create(ParseTree.prototype);
  33024. TerminalNode.prototype.constructor = TerminalNode;
  33025. function ErrorNode() {
  33026. TerminalNode.call(this);
  33027. return this;
  33028. }
  33029. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  33030. ErrorNode.prototype.constructor = ErrorNode;
  33031. function ParseTreeVisitor() {
  33032. return this;
  33033. }
  33034. ParseTreeVisitor.prototype.visit = function (ctx) {
  33035. if (Array.isArray(ctx)) {
  33036. return ctx.map(function (child) {
  33037. return child.accept(this);
  33038. }, this);
  33039. } else {
  33040. return ctx.accept(this);
  33041. }
  33042. };
  33043. ParseTreeVisitor.prototype.visitChildren = function (ctx) {
  33044. return this.visit(ctx.children);
  33045. };
  33046. ParseTreeVisitor.prototype.visitTerminal = function (node) {};
  33047. ParseTreeVisitor.prototype.visitErrorNode = function (node) {};
  33048. function ParseTreeListener() {
  33049. return this;
  33050. }
  33051. ParseTreeListener.prototype.visitTerminal = function (node) {};
  33052. ParseTreeListener.prototype.visitErrorNode = function (node) {};
  33053. ParseTreeListener.prototype.enterEveryRule = function (node) {};
  33054. ParseTreeListener.prototype.exitEveryRule = function (node) {};
  33055. function TerminalNodeImpl(symbol) {
  33056. TerminalNode.call(this);
  33057. this.parentCtx = null;
  33058. this.symbol = symbol;
  33059. return this;
  33060. }
  33061. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  33062. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  33063. TerminalNodeImpl.prototype.getChild = function (i) {
  33064. return null;
  33065. };
  33066. TerminalNodeImpl.prototype.getSymbol = function () {
  33067. return this.symbol;
  33068. };
  33069. TerminalNodeImpl.prototype.getParent = function () {
  33070. return this.parentCtx;
  33071. };
  33072. TerminalNodeImpl.prototype.getPayload = function () {
  33073. return this.symbol;
  33074. };
  33075. TerminalNodeImpl.prototype.getSourceInterval = function () {
  33076. if (this.symbol === null) {
  33077. return INVALID_INTERVAL;
  33078. }
  33079. var tokenIndex = this.symbol.tokenIndex;
  33080. return new Interval(tokenIndex, tokenIndex);
  33081. };
  33082. TerminalNodeImpl.prototype.getChildCount = function () {
  33083. return 0;
  33084. };
  33085. TerminalNodeImpl.prototype.accept = function (visitor) {
  33086. return visitor.visitTerminal(this);
  33087. };
  33088. TerminalNodeImpl.prototype.getText = function () {
  33089. return this.symbol.text;
  33090. };
  33091. TerminalNodeImpl.prototype.toString = function () {
  33092. if (this.symbol.type === Token.EOF) {
  33093. return "<EOF>";
  33094. } else {
  33095. return this.symbol.text;
  33096. }
  33097. };
  33098. // Represents a token that was consumed during resynchronization
  33099. // rather than during a valid match operation. For example,
  33100. // we will create this kind of a node during single token insertion
  33101. // and deletion as well as during "consume until error recovery set"
  33102. // upon no viable alternative exceptions.
  33103. function ErrorNodeImpl(token) {
  33104. TerminalNodeImpl.call(this, token);
  33105. return this;
  33106. }
  33107. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  33108. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  33109. ErrorNodeImpl.prototype.isErrorNode = function () {
  33110. return true;
  33111. };
  33112. ErrorNodeImpl.prototype.accept = function (visitor) {
  33113. return visitor.visitErrorNode(this);
  33114. };
  33115. function ParseTreeWalker() {
  33116. return this;
  33117. }
  33118. ParseTreeWalker.prototype.walk = function (listener, t) {
  33119. var errorNode = t instanceof ErrorNode || t.isErrorNode !== undefined && t.isErrorNode();
  33120. if (errorNode) {
  33121. listener.visitErrorNode(t);
  33122. } else if (t instanceof TerminalNode) {
  33123. listener.visitTerminal(t);
  33124. } else {
  33125. this.enterRule(listener, t);
  33126. for (var i = 0; i < t.getChildCount(); i++) {
  33127. var child = t.getChild(i);
  33128. this.walk(listener, child);
  33129. }
  33130. this.exitRule(listener, t);
  33131. }
  33132. };
  33133. //
  33134. // The discovery of a rule node, involves sending two events: the generic
  33135. // {@link ParseTreeListener//enterEveryRule} and a
  33136. // {@link RuleContext}-specific event. First we trigger the generic and then
  33137. // the rule specific. We to them in reverse order upon finishing the node.
  33138. //
  33139. ParseTreeWalker.prototype.enterRule = function (listener, r) {
  33140. var ctx = r.getRuleContext();
  33141. listener.enterEveryRule(ctx);
  33142. ctx.enterRule(listener);
  33143. };
  33144. ParseTreeWalker.prototype.exitRule = function (listener, r) {
  33145. var ctx = r.getRuleContext();
  33146. ctx.exitRule(listener);
  33147. listener.exitEveryRule(ctx);
  33148. };
  33149. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  33150. exports.RuleNode = RuleNode;
  33151. exports.ErrorNode = ErrorNode;
  33152. exports.TerminalNode = TerminalNode;
  33153. exports.ErrorNodeImpl = ErrorNodeImpl;
  33154. exports.TerminalNodeImpl = TerminalNodeImpl;
  33155. exports.ParseTreeListener = ParseTreeListener;
  33156. exports.ParseTreeVisitor = ParseTreeVisitor;
  33157. exports.ParseTreeWalker = ParseTreeWalker;
  33158. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  33159. /***/ }),
  33160. /***/ "./node_modules/antlr4/tree/Trees.js":
  33161. /*!*******************************************!*\
  33162. !*** ./node_modules/antlr4/tree/Trees.js ***!
  33163. \*******************************************/
  33164. /*! no static exports found */
  33165. /***/ (function(module, exports, __webpack_require__) {
  33166. "use strict";
  33167. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33168. * Use of this file is governed by the BSD 3-clause license that
  33169. * can be found in the LICENSE.txt file in the project root.
  33170. */
  33171. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  33172. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  33173. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  33174. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  33175. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  33176. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  33177. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  33178. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  33179. /** A set of utility routines useful for all kinds of ANTLR trees. */
  33180. function Trees() {}
  33181. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  33182. // node payloads to get the text for the nodes. Detect
  33183. // parse trees and extract data appropriately.
  33184. Trees.toStringTree = function (tree, ruleNames, recog) {
  33185. ruleNames = ruleNames || null;
  33186. recog = recog || null;
  33187. if (recog !== null) {
  33188. ruleNames = recog.ruleNames;
  33189. }
  33190. var s = Trees.getNodeText(tree, ruleNames);
  33191. s = Utils.escapeWhitespace(s, false);
  33192. var c = tree.getChildCount();
  33193. if (c === 0) {
  33194. return s;
  33195. }
  33196. var res = "(" + s + ' ';
  33197. if (c > 0) {
  33198. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  33199. res = res.concat(s);
  33200. }
  33201. for (var i = 1; i < c; i++) {
  33202. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  33203. res = res.concat(' ' + s);
  33204. }
  33205. res = res.concat(")");
  33206. return res;
  33207. };
  33208. Trees.getNodeText = function (t, ruleNames, recog) {
  33209. ruleNames = ruleNames || null;
  33210. recog = recog || null;
  33211. if (recog !== null) {
  33212. ruleNames = recog.ruleNames;
  33213. }
  33214. if (ruleNames !== null) {
  33215. if (t instanceof RuleContext) {
  33216. var altNumber = t.getAltNumber();
  33217. if (altNumber != INVALID_ALT_NUMBER) {
  33218. return ruleNames[t.ruleIndex] + ":" + altNumber;
  33219. }
  33220. return ruleNames[t.ruleIndex];
  33221. } else if (t instanceof ErrorNode) {
  33222. return t.toString();
  33223. } else if (t instanceof TerminalNode) {
  33224. if (t.symbol !== null) {
  33225. return t.symbol.text;
  33226. }
  33227. }
  33228. }
  33229. // no recog for rule names
  33230. var payload = t.getPayload();
  33231. if (payload instanceof Token) {
  33232. return payload.text;
  33233. }
  33234. return t.getPayload().toString();
  33235. };
  33236. // Return ordered list of all children of this node
  33237. Trees.getChildren = function (t) {
  33238. var list = [];
  33239. for (var i = 0; i < t.getChildCount(); i++) {
  33240. list.push(t.getChild(i));
  33241. }
  33242. return list;
  33243. };
  33244. // Return a list of all ancestors of this node. The first node of
  33245. // list is the root and the last is the parent of this node.
  33246. //
  33247. Trees.getAncestors = function (t) {
  33248. var ancestors = [];
  33249. t = t.getParent();
  33250. while (t !== null) {
  33251. ancestors = [t].concat(ancestors);
  33252. t = t.getParent();
  33253. }
  33254. return ancestors;
  33255. };
  33256. Trees.findAllTokenNodes = function (t, ttype) {
  33257. return Trees.findAllNodes(t, ttype, true);
  33258. };
  33259. Trees.findAllRuleNodes = function (t, ruleIndex) {
  33260. return Trees.findAllNodes(t, ruleIndex, false);
  33261. };
  33262. Trees.findAllNodes = function (t, index, findTokens) {
  33263. var nodes = [];
  33264. Trees._findAllNodes(t, index, findTokens, nodes);
  33265. return nodes;
  33266. };
  33267. Trees._findAllNodes = function (t, index, findTokens, nodes) {
  33268. // check this node (the root) first
  33269. if (findTokens && t instanceof TerminalNode) {
  33270. if (t.symbol.type === index) {
  33271. nodes.push(t);
  33272. }
  33273. } else if (!findTokens && t instanceof ParserRuleContext) {
  33274. if (t.ruleIndex === index) {
  33275. nodes.push(t);
  33276. }
  33277. }
  33278. // check children
  33279. for (var i = 0; i < t.getChildCount(); i++) {
  33280. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  33281. }
  33282. };
  33283. Trees.descendants = function (t) {
  33284. var nodes = [t];
  33285. for (var i = 0; i < t.getChildCount(); i++) {
  33286. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  33287. }
  33288. return nodes;
  33289. };
  33290. exports.Trees = Trees;
  33291. /***/ }),
  33292. /***/ "./node_modules/antlr4/tree/index.js":
  33293. /*!*******************************************!*\
  33294. !*** ./node_modules/antlr4/tree/index.js ***!
  33295. \*******************************************/
  33296. /*! no static exports found */
  33297. /***/ (function(module, exports, __webpack_require__) {
  33298. "use strict";
  33299. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33300. * Use of this file is governed by the BSD 3-clause license that
  33301. * can be found in the LICENSE.txt file in the project root.
  33302. */
  33303. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  33304. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  33305. exports.RuleNode = Tree.RuleNode;
  33306. exports.ParseTreeListener = Tree.ParseTreeListener;
  33307. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  33308. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  33309. /***/ }),
  33310. /***/ "./node_modules/decimal.js/decimal.js":
  33311. /*!********************************************!*\
  33312. !*** ./node_modules/decimal.js/decimal.js ***!
  33313. \********************************************/
  33314. /*! no static exports found */
  33315. /***/ (function(module, exports, __webpack_require__) {
  33316. "use strict";
  33317. var __WEBPACK_AMD_DEFINE_RESULT__;
  33318. 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; };
  33319. /*! decimal.js v10.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
  33320. ;(function (globalScope) {
  33321. 'use strict';
  33322. /*
  33323. * decimal.js v10.0.1
  33324. * An arbitrary-precision Decimal type for JavaScript.
  33325. * https://github.com/MikeMcl/decimal.js
  33326. * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
  33327. * MIT Licence
  33328. */
  33329. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  33330. // The maximum exponent magnitude.
  33331. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  33332. var EXP_LIMIT = 9e15,
  33333. // 0 to 9e15
  33334. // The limit on the value of `precision`, and on the value of the first argument to
  33335. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  33336. MAX_DIGITS = 1e9,
  33337. // 0 to 1e9
  33338. // Base conversion alphabet.
  33339. NUMERALS = '0123456789abcdef',
  33340. // The natural logarithm of 10 (1025 digits).
  33341. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  33342. // Pi (1025 digits).
  33343. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  33344. // The initial configuration properties of the Decimal constructor.
  33345. DEFAULTS = {
  33346. // These values must be integers within the stated ranges (inclusive).
  33347. // Most of these values can be changed at run-time using the `Decimal.config` method.
  33348. // The maximum number of significant digits of the result of a calculation or base conversion.
  33349. // E.g. `Decimal.config({ precision: 20 });`
  33350. precision: 20, // 1 to MAX_DIGITS
  33351. // The rounding mode used when rounding to `precision`.
  33352. //
  33353. // ROUND_UP 0 Away from zero.
  33354. // ROUND_DOWN 1 Towards zero.
  33355. // ROUND_CEIL 2 Towards +Infinity.
  33356. // ROUND_FLOOR 3 Towards -Infinity.
  33357. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  33358. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  33359. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  33360. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  33361. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  33362. //
  33363. // E.g.
  33364. // `Decimal.rounding = 4;`
  33365. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  33366. rounding: 4, // 0 to 8
  33367. // The modulo mode used when calculating the modulus: a mod n.
  33368. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  33369. // The remainder (r) is calculated as: r = a - n * q.
  33370. //
  33371. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  33372. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  33373. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  33374. // HALF_EVEN 6 The IEEE 754 remainder function.
  33375. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  33376. //
  33377. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  33378. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  33379. // be used, but they may not give useful results.
  33380. modulo: 1, // 0 to 9
  33381. // The exponent value at and beneath which `toString` returns exponential notation.
  33382. // JavaScript numbers: -7
  33383. toExpNeg: -7, // 0 to -EXP_LIMIT
  33384. // The exponent value at and above which `toString` returns exponential notation.
  33385. // JavaScript numbers: 21
  33386. toExpPos: 21, // 0 to EXP_LIMIT
  33387. // The minimum exponent value, beneath which underflow to zero occurs.
  33388. // JavaScript numbers: -324 (5e-324)
  33389. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  33390. // The maximum exponent value, above which overflow to Infinity occurs.
  33391. // JavaScript numbers: 308 (1.7976931348623157e+308)
  33392. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  33393. // Whether to use cryptographically-secure random number generation, if available.
  33394. crypto: false // true/false
  33395. },
  33396. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  33397. Decimal,
  33398. inexact,
  33399. noConflict,
  33400. quadrant,
  33401. external = true,
  33402. decimalError = '[DecimalError] ',
  33403. invalidArgument = decimalError + 'Invalid argument: ',
  33404. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  33405. cryptoUnavailable = decimalError + 'crypto unavailable',
  33406. mathfloor = Math.floor,
  33407. mathpow = Math.pow,
  33408. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  33409. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  33410. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  33411. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  33412. BASE = 1e7,
  33413. LOG_BASE = 7,
  33414. MAX_SAFE_INTEGER = 9007199254740991,
  33415. LN10_PRECISION = LN10.length - 1,
  33416. PI_PRECISION = PI.length - 1,
  33417. // Decimal.prototype object
  33418. P = { name: '[object Decimal]' };
  33419. // Decimal prototype methods
  33420. /*
  33421. * absoluteValue abs
  33422. * ceil
  33423. * comparedTo cmp
  33424. * cosine cos
  33425. * cubeRoot cbrt
  33426. * decimalPlaces dp
  33427. * dividedBy div
  33428. * dividedToIntegerBy divToInt
  33429. * equals eq
  33430. * floor
  33431. * greaterThan gt
  33432. * greaterThanOrEqualTo gte
  33433. * hyperbolicCosine cosh
  33434. * hyperbolicSine sinh
  33435. * hyperbolicTangent tanh
  33436. * inverseCosine acos
  33437. * inverseHyperbolicCosine acosh
  33438. * inverseHyperbolicSine asinh
  33439. * inverseHyperbolicTangent atanh
  33440. * inverseSine asin
  33441. * inverseTangent atan
  33442. * isFinite
  33443. * isInteger isInt
  33444. * isNaN
  33445. * isNegative isNeg
  33446. * isPositive isPos
  33447. * isZero
  33448. * lessThan lt
  33449. * lessThanOrEqualTo lte
  33450. * logarithm log
  33451. * [maximum] [max]
  33452. * [minimum] [min]
  33453. * minus sub
  33454. * modulo mod
  33455. * naturalExponential exp
  33456. * naturalLogarithm ln
  33457. * negated neg
  33458. * plus add
  33459. * precision sd
  33460. * round
  33461. * sine sin
  33462. * squareRoot sqrt
  33463. * tangent tan
  33464. * times mul
  33465. * toBinary
  33466. * toDecimalPlaces toDP
  33467. * toExponential
  33468. * toFixed
  33469. * toFraction
  33470. * toHexadecimal toHex
  33471. * toNearest
  33472. * toNumber
  33473. * toOctal
  33474. * toPower pow
  33475. * toPrecision
  33476. * toSignificantDigits toSD
  33477. * toString
  33478. * truncated trunc
  33479. * valueOf toJSON
  33480. */
  33481. /*
  33482. * Return a new Decimal whose value is the absolute value of this Decimal.
  33483. *
  33484. */
  33485. P.absoluteValue = P.abs = function () {
  33486. var x = new this.constructor(this);
  33487. if (x.s < 0) x.s = 1;
  33488. return finalise(x);
  33489. };
  33490. /*
  33491. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  33492. * direction of positive Infinity.
  33493. *
  33494. */
  33495. P.ceil = function () {
  33496. return finalise(new this.constructor(this), this.e + 1, 2);
  33497. };
  33498. /*
  33499. * Return
  33500. * 1 if the value of this Decimal is greater than the value of `y`,
  33501. * -1 if the value of this Decimal is less than the value of `y`,
  33502. * 0 if they have the same value,
  33503. * NaN if the value of either Decimal is NaN.
  33504. *
  33505. */
  33506. P.comparedTo = P.cmp = function (y) {
  33507. var i,
  33508. j,
  33509. xdL,
  33510. ydL,
  33511. x = this,
  33512. xd = x.d,
  33513. yd = (y = new x.constructor(y)).d,
  33514. xs = x.s,
  33515. ys = y.s;
  33516. // Either NaN or ±Infinity?
  33517. if (!xd || !yd) {
  33518. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  33519. }
  33520. // Either zero?
  33521. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  33522. // Signs differ?
  33523. if (xs !== ys) return xs;
  33524. // Compare exponents.
  33525. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  33526. xdL = xd.length;
  33527. ydL = yd.length;
  33528. // Compare digit by digit.
  33529. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  33530. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  33531. }
  33532. // Compare lengths.
  33533. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  33534. };
  33535. /*
  33536. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  33537. *
  33538. * Domain: [-Infinity, Infinity]
  33539. * Range: [-1, 1]
  33540. *
  33541. * cos(0) = 1
  33542. * cos(-0) = 1
  33543. * cos(Infinity) = NaN
  33544. * cos(-Infinity) = NaN
  33545. * cos(NaN) = NaN
  33546. *
  33547. */
  33548. P.cosine = P.cos = function () {
  33549. var pr,
  33550. rm,
  33551. x = this,
  33552. Ctor = x.constructor;
  33553. if (!x.d) return new Ctor(NaN);
  33554. // cos(0) = cos(-0) = 1
  33555. if (!x.d[0]) return new Ctor(1);
  33556. pr = Ctor.precision;
  33557. rm = Ctor.rounding;
  33558. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  33559. Ctor.rounding = 1;
  33560. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  33561. Ctor.precision = pr;
  33562. Ctor.rounding = rm;
  33563. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  33564. };
  33565. /*
  33566. *
  33567. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  33568. * `precision` significant digits using rounding mode `rounding`.
  33569. *
  33570. * cbrt(0) = 0
  33571. * cbrt(-0) = -0
  33572. * cbrt(1) = 1
  33573. * cbrt(-1) = -1
  33574. * cbrt(N) = N
  33575. * cbrt(-I) = -I
  33576. * cbrt(I) = I
  33577. *
  33578. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  33579. *
  33580. */
  33581. P.cubeRoot = P.cbrt = function () {
  33582. var e,
  33583. m,
  33584. n,
  33585. r,
  33586. rep,
  33587. s,
  33588. sd,
  33589. t,
  33590. t3,
  33591. t3plusx,
  33592. x = this,
  33593. Ctor = x.constructor;
  33594. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33595. external = false;
  33596. // Initial estimate.
  33597. s = x.s * Math.pow(x.s * x, 1 / 3);
  33598. // Math.cbrt underflow/overflow?
  33599. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  33600. if (!s || Math.abs(s) == 1 / 0) {
  33601. n = digitsToString(x.d);
  33602. e = x.e;
  33603. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  33604. if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? '0' : '00';
  33605. s = Math.pow(n, 1 / 3);
  33606. // Rarely, e may be one less than the result exponent value.
  33607. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  33608. if (s == 1 / 0) {
  33609. n = '5e' + e;
  33610. } else {
  33611. n = s.toExponential();
  33612. n = n.slice(0, n.indexOf('e') + 1) + e;
  33613. }
  33614. r = new Ctor(n);
  33615. r.s = x.s;
  33616. } else {
  33617. r = new Ctor(s.toString());
  33618. }
  33619. sd = (e = Ctor.precision) + 3;
  33620. // Halley's method.
  33621. // TODO? Compare Newton's method.
  33622. for (;;) {
  33623. t = r;
  33624. t3 = t.times(t).times(t);
  33625. t3plusx = t3.plus(x);
  33626. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  33627. // TODO? Replace with for-loop and checkRoundingDigits.
  33628. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  33629. n = n.slice(sd - 3, sd + 1);
  33630. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  33631. // , i.e. approaching a rounding boundary, continue the iteration.
  33632. if (n == '9999' || !rep && n == '4999') {
  33633. // On the first iteration only, check to see if rounding up gives the exact result as the
  33634. // nines may infinitely repeat.
  33635. if (!rep) {
  33636. finalise(t, e + 1, 0);
  33637. if (t.times(t).times(t).eq(x)) {
  33638. r = t;
  33639. break;
  33640. }
  33641. }
  33642. sd += 4;
  33643. rep = 1;
  33644. } else {
  33645. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  33646. // If not, then there are further digits and m will be truthy.
  33647. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  33648. // Truncate to the first rounding digit.
  33649. finalise(r, e + 1, 1);
  33650. m = !r.times(r).times(r).eq(x);
  33651. }
  33652. break;
  33653. }
  33654. }
  33655. }
  33656. external = true;
  33657. return finalise(r, e, Ctor.rounding, m);
  33658. };
  33659. /*
  33660. * Return the number of decimal places of the value of this Decimal.
  33661. *
  33662. */
  33663. P.decimalPlaces = P.dp = function () {
  33664. var w,
  33665. d = this.d,
  33666. n = NaN;
  33667. if (d) {
  33668. w = d.length - 1;
  33669. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  33670. // Subtract the number of trailing zeros of the last word.
  33671. w = d[w];
  33672. if (w) for (; w % 10 == 0; w /= 10) {
  33673. n--;
  33674. }if (n < 0) n = 0;
  33675. }
  33676. return n;
  33677. };
  33678. /*
  33679. * n / 0 = I
  33680. * n / N = N
  33681. * n / I = 0
  33682. * 0 / n = 0
  33683. * 0 / 0 = N
  33684. * 0 / N = N
  33685. * 0 / I = 0
  33686. * N / n = N
  33687. * N / 0 = N
  33688. * N / N = N
  33689. * N / I = N
  33690. * I / n = I
  33691. * I / 0 = I
  33692. * I / N = N
  33693. * I / I = N
  33694. *
  33695. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  33696. * `precision` significant digits using rounding mode `rounding`.
  33697. *
  33698. */
  33699. P.dividedBy = P.div = function (y) {
  33700. return divide(this, new this.constructor(y));
  33701. };
  33702. /*
  33703. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  33704. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  33705. *
  33706. */
  33707. P.dividedToIntegerBy = P.divToInt = function (y) {
  33708. var x = this,
  33709. Ctor = x.constructor;
  33710. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  33711. };
  33712. /*
  33713. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  33714. *
  33715. */
  33716. P.equals = P.eq = function (y) {
  33717. return this.cmp(y) === 0;
  33718. };
  33719. /*
  33720. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  33721. * direction of negative Infinity.
  33722. *
  33723. */
  33724. P.floor = function () {
  33725. return finalise(new this.constructor(this), this.e + 1, 3);
  33726. };
  33727. /*
  33728. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  33729. * false.
  33730. *
  33731. */
  33732. P.greaterThan = P.gt = function (y) {
  33733. return this.cmp(y) > 0;
  33734. };
  33735. /*
  33736. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  33737. * otherwise return false.
  33738. *
  33739. */
  33740. P.greaterThanOrEqualTo = P.gte = function (y) {
  33741. var k = this.cmp(y);
  33742. return k == 1 || k === 0;
  33743. };
  33744. /*
  33745. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  33746. * Decimal.
  33747. *
  33748. * Domain: [-Infinity, Infinity]
  33749. * Range: [1, Infinity]
  33750. *
  33751. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  33752. *
  33753. * cosh(0) = 1
  33754. * cosh(-0) = 1
  33755. * cosh(Infinity) = Infinity
  33756. * cosh(-Infinity) = Infinity
  33757. * cosh(NaN) = NaN
  33758. *
  33759. * x time taken (ms) result
  33760. * 1000 9 9.8503555700852349694e+433
  33761. * 10000 25 4.4034091128314607936e+4342
  33762. * 100000 171 1.4033316802130615897e+43429
  33763. * 1000000 3817 1.5166076984010437725e+434294
  33764. * 10000000 abandoned after 2 minute wait
  33765. *
  33766. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  33767. *
  33768. */
  33769. P.hyperbolicCosine = P.cosh = function () {
  33770. var k,
  33771. n,
  33772. pr,
  33773. rm,
  33774. len,
  33775. x = this,
  33776. Ctor = x.constructor,
  33777. one = new Ctor(1);
  33778. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  33779. if (x.isZero()) return one;
  33780. pr = Ctor.precision;
  33781. rm = Ctor.rounding;
  33782. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  33783. Ctor.rounding = 1;
  33784. len = x.d.length;
  33785. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  33786. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  33787. // Estimate the optimum number of times to use the argument reduction.
  33788. // TODO? Estimation reused from cosine() and may not be optimal here.
  33789. if (len < 32) {
  33790. k = Math.ceil(len / 3);
  33791. n = Math.pow(4, -k).toString();
  33792. } else {
  33793. k = 16;
  33794. n = '2.3283064365386962890625e-10';
  33795. }
  33796. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  33797. // Reverse argument reduction
  33798. var cosh2_x,
  33799. i = k,
  33800. d8 = new Ctor(8);
  33801. for (; i--;) {
  33802. cosh2_x = x.times(x);
  33803. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  33804. }
  33805. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  33806. };
  33807. /*
  33808. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  33809. * Decimal.
  33810. *
  33811. * Domain: [-Infinity, Infinity]
  33812. * Range: [-Infinity, Infinity]
  33813. *
  33814. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  33815. *
  33816. * sinh(0) = 0
  33817. * sinh(-0) = -0
  33818. * sinh(Infinity) = Infinity
  33819. * sinh(-Infinity) = -Infinity
  33820. * sinh(NaN) = NaN
  33821. *
  33822. * x time taken (ms)
  33823. * 10 2 ms
  33824. * 100 5 ms
  33825. * 1000 14 ms
  33826. * 10000 82 ms
  33827. * 100000 886 ms 1.4033316802130615897e+43429
  33828. * 200000 2613 ms
  33829. * 300000 5407 ms
  33830. * 400000 8824 ms
  33831. * 500000 13026 ms 8.7080643612718084129e+217146
  33832. * 1000000 48543 ms
  33833. *
  33834. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  33835. *
  33836. */
  33837. P.hyperbolicSine = P.sinh = function () {
  33838. var k,
  33839. pr,
  33840. rm,
  33841. len,
  33842. x = this,
  33843. Ctor = x.constructor;
  33844. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33845. pr = Ctor.precision;
  33846. rm = Ctor.rounding;
  33847. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  33848. Ctor.rounding = 1;
  33849. len = x.d.length;
  33850. if (len < 3) {
  33851. x = taylorSeries(Ctor, 2, x, x, true);
  33852. } else {
  33853. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  33854. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  33855. // 3 multiplications and 1 addition
  33856. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  33857. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  33858. // 4 multiplications and 2 additions
  33859. // Estimate the optimum number of times to use the argument reduction.
  33860. k = 1.4 * Math.sqrt(len);
  33861. k = k > 16 ? 16 : k | 0;
  33862. x = x.times(Math.pow(5, -k));
  33863. x = taylorSeries(Ctor, 2, x, x, true);
  33864. // Reverse argument reduction
  33865. var sinh2_x,
  33866. d5 = new Ctor(5),
  33867. d16 = new Ctor(16),
  33868. d20 = new Ctor(20);
  33869. for (; k--;) {
  33870. sinh2_x = x.times(x);
  33871. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  33872. }
  33873. }
  33874. Ctor.precision = pr;
  33875. Ctor.rounding = rm;
  33876. return finalise(x, pr, rm, true);
  33877. };
  33878. /*
  33879. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  33880. * Decimal.
  33881. *
  33882. * Domain: [-Infinity, Infinity]
  33883. * Range: [-1, 1]
  33884. *
  33885. * tanh(x) = sinh(x) / cosh(x)
  33886. *
  33887. * tanh(0) = 0
  33888. * tanh(-0) = -0
  33889. * tanh(Infinity) = 1
  33890. * tanh(-Infinity) = -1
  33891. * tanh(NaN) = NaN
  33892. *
  33893. */
  33894. P.hyperbolicTangent = P.tanh = function () {
  33895. var pr,
  33896. rm,
  33897. x = this,
  33898. Ctor = x.constructor;
  33899. if (!x.isFinite()) return new Ctor(x.s);
  33900. if (x.isZero()) return new Ctor(x);
  33901. pr = Ctor.precision;
  33902. rm = Ctor.rounding;
  33903. Ctor.precision = pr + 7;
  33904. Ctor.rounding = 1;
  33905. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  33906. };
  33907. /*
  33908. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  33909. * this Decimal.
  33910. *
  33911. * Domain: [-1, 1]
  33912. * Range: [0, pi]
  33913. *
  33914. * acos(x) = pi/2 - asin(x)
  33915. *
  33916. * acos(0) = pi/2
  33917. * acos(-0) = pi/2
  33918. * acos(1) = 0
  33919. * acos(-1) = pi
  33920. * acos(1/2) = pi/3
  33921. * acos(-1/2) = 2*pi/3
  33922. * acos(|x| > 1) = NaN
  33923. * acos(NaN) = NaN
  33924. *
  33925. */
  33926. P.inverseCosine = P.acos = function () {
  33927. var halfPi,
  33928. x = this,
  33929. Ctor = x.constructor,
  33930. k = x.abs().cmp(1),
  33931. pr = Ctor.precision,
  33932. rm = Ctor.rounding;
  33933. if (k !== -1) {
  33934. return k === 0
  33935. // |x| is 1
  33936. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  33937. // |x| > 1 or x is NaN
  33938. : new Ctor(NaN);
  33939. }
  33940. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  33941. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  33942. Ctor.precision = pr + 6;
  33943. Ctor.rounding = 1;
  33944. x = x.asin();
  33945. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  33946. Ctor.precision = pr;
  33947. Ctor.rounding = rm;
  33948. return halfPi.minus(x);
  33949. };
  33950. /*
  33951. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  33952. * value of this Decimal.
  33953. *
  33954. * Domain: [1, Infinity]
  33955. * Range: [0, Infinity]
  33956. *
  33957. * acosh(x) = ln(x + sqrt(x^2 - 1))
  33958. *
  33959. * acosh(x < 1) = NaN
  33960. * acosh(NaN) = NaN
  33961. * acosh(Infinity) = Infinity
  33962. * acosh(-Infinity) = NaN
  33963. * acosh(0) = NaN
  33964. * acosh(-0) = NaN
  33965. * acosh(1) = 0
  33966. * acosh(-1) = NaN
  33967. *
  33968. */
  33969. P.inverseHyperbolicCosine = P.acosh = function () {
  33970. var pr,
  33971. rm,
  33972. x = this,
  33973. Ctor = x.constructor;
  33974. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  33975. if (!x.isFinite()) return new Ctor(x);
  33976. pr = Ctor.precision;
  33977. rm = Ctor.rounding;
  33978. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  33979. Ctor.rounding = 1;
  33980. external = false;
  33981. x = x.times(x).minus(1).sqrt().plus(x);
  33982. external = true;
  33983. Ctor.precision = pr;
  33984. Ctor.rounding = rm;
  33985. return x.ln();
  33986. };
  33987. /*
  33988. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  33989. * of this Decimal.
  33990. *
  33991. * Domain: [-Infinity, Infinity]
  33992. * Range: [-Infinity, Infinity]
  33993. *
  33994. * asinh(x) = ln(x + sqrt(x^2 + 1))
  33995. *
  33996. * asinh(NaN) = NaN
  33997. * asinh(Infinity) = Infinity
  33998. * asinh(-Infinity) = -Infinity
  33999. * asinh(0) = 0
  34000. * asinh(-0) = -0
  34001. *
  34002. */
  34003. P.inverseHyperbolicSine = P.asinh = function () {
  34004. var pr,
  34005. rm,
  34006. x = this,
  34007. Ctor = x.constructor;
  34008. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  34009. pr = Ctor.precision;
  34010. rm = Ctor.rounding;
  34011. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  34012. Ctor.rounding = 1;
  34013. external = false;
  34014. x = x.times(x).plus(1).sqrt().plus(x);
  34015. external = true;
  34016. Ctor.precision = pr;
  34017. Ctor.rounding = rm;
  34018. return x.ln();
  34019. };
  34020. /*
  34021. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  34022. * value of this Decimal.
  34023. *
  34024. * Domain: [-1, 1]
  34025. * Range: [-Infinity, Infinity]
  34026. *
  34027. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  34028. *
  34029. * atanh(|x| > 1) = NaN
  34030. * atanh(NaN) = NaN
  34031. * atanh(Infinity) = NaN
  34032. * atanh(-Infinity) = NaN
  34033. * atanh(0) = 0
  34034. * atanh(-0) = -0
  34035. * atanh(1) = Infinity
  34036. * atanh(-1) = -Infinity
  34037. *
  34038. */
  34039. P.inverseHyperbolicTangent = P.atanh = function () {
  34040. var pr,
  34041. rm,
  34042. wpr,
  34043. xsd,
  34044. x = this,
  34045. Ctor = x.constructor;
  34046. if (!x.isFinite()) return new Ctor(NaN);
  34047. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  34048. pr = Ctor.precision;
  34049. rm = Ctor.rounding;
  34050. xsd = x.sd();
  34051. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  34052. Ctor.precision = wpr = xsd - x.e;
  34053. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  34054. Ctor.precision = pr + 4;
  34055. Ctor.rounding = 1;
  34056. x = x.ln();
  34057. Ctor.precision = pr;
  34058. Ctor.rounding = rm;
  34059. return x.times(0.5);
  34060. };
  34061. /*
  34062. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  34063. * Decimal.
  34064. *
  34065. * Domain: [-Infinity, Infinity]
  34066. * Range: [-pi/2, pi/2]
  34067. *
  34068. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  34069. *
  34070. * asin(0) = 0
  34071. * asin(-0) = -0
  34072. * asin(1/2) = pi/6
  34073. * asin(-1/2) = -pi/6
  34074. * asin(1) = pi/2
  34075. * asin(-1) = -pi/2
  34076. * asin(|x| > 1) = NaN
  34077. * asin(NaN) = NaN
  34078. *
  34079. * TODO? Compare performance of Taylor series.
  34080. *
  34081. */
  34082. P.inverseSine = P.asin = function () {
  34083. var halfPi,
  34084. k,
  34085. pr,
  34086. rm,
  34087. x = this,
  34088. Ctor = x.constructor;
  34089. if (x.isZero()) return new Ctor(x);
  34090. k = x.abs().cmp(1);
  34091. pr = Ctor.precision;
  34092. rm = Ctor.rounding;
  34093. if (k !== -1) {
  34094. // |x| is 1
  34095. if (k === 0) {
  34096. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  34097. halfPi.s = x.s;
  34098. return halfPi;
  34099. }
  34100. // |x| > 1 or x is NaN
  34101. return new Ctor(NaN);
  34102. }
  34103. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  34104. Ctor.precision = pr + 6;
  34105. Ctor.rounding = 1;
  34106. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  34107. Ctor.precision = pr;
  34108. Ctor.rounding = rm;
  34109. return x.times(2);
  34110. };
  34111. /*
  34112. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  34113. * of this Decimal.
  34114. *
  34115. * Domain: [-Infinity, Infinity]
  34116. * Range: [-pi/2, pi/2]
  34117. *
  34118. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  34119. *
  34120. * atan(0) = 0
  34121. * atan(-0) = -0
  34122. * atan(1) = pi/4
  34123. * atan(-1) = -pi/4
  34124. * atan(Infinity) = pi/2
  34125. * atan(-Infinity) = -pi/2
  34126. * atan(NaN) = NaN
  34127. *
  34128. */
  34129. P.inverseTangent = P.atan = function () {
  34130. var i,
  34131. j,
  34132. k,
  34133. n,
  34134. px,
  34135. t,
  34136. r,
  34137. wpr,
  34138. x2,
  34139. x = this,
  34140. Ctor = x.constructor,
  34141. pr = Ctor.precision,
  34142. rm = Ctor.rounding;
  34143. if (!x.isFinite()) {
  34144. if (!x.s) return new Ctor(NaN);
  34145. if (pr + 4 <= PI_PRECISION) {
  34146. r = getPi(Ctor, pr + 4, rm).times(0.5);
  34147. r.s = x.s;
  34148. return r;
  34149. }
  34150. } else if (x.isZero()) {
  34151. return new Ctor(x);
  34152. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  34153. r = getPi(Ctor, pr + 4, rm).times(0.25);
  34154. r.s = x.s;
  34155. return r;
  34156. }
  34157. Ctor.precision = wpr = pr + 10;
  34158. Ctor.rounding = 1;
  34159. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  34160. // Argument reduction
  34161. // Ensure |x| < 0.42
  34162. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  34163. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  34164. for (i = k; i; --i) {
  34165. x = x.div(x.times(x).plus(1).sqrt().plus(1));
  34166. }external = false;
  34167. j = Math.ceil(wpr / LOG_BASE);
  34168. n = 1;
  34169. x2 = x.times(x);
  34170. r = new Ctor(x);
  34171. px = x;
  34172. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  34173. for (; i !== -1;) {
  34174. px = px.times(x2);
  34175. t = r.minus(px.div(n += 2));
  34176. px = px.times(x2);
  34177. r = t.plus(px.div(n += 2));
  34178. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;) {}
  34179. }
  34180. if (k) r = r.times(2 << k - 1);
  34181. external = true;
  34182. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  34183. };
  34184. /*
  34185. * Return true if the value of this Decimal is a finite number, otherwise return false.
  34186. *
  34187. */
  34188. P.isFinite = function () {
  34189. return !!this.d;
  34190. };
  34191. /*
  34192. * Return true if the value of this Decimal is an integer, otherwise return false.
  34193. *
  34194. */
  34195. P.isInteger = P.isInt = function () {
  34196. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  34197. };
  34198. /*
  34199. * Return true if the value of this Decimal is NaN, otherwise return false.
  34200. *
  34201. */
  34202. P.isNaN = function () {
  34203. return !this.s;
  34204. };
  34205. /*
  34206. * Return true if the value of this Decimal is negative, otherwise return false.
  34207. *
  34208. */
  34209. P.isNegative = P.isNeg = function () {
  34210. return this.s < 0;
  34211. };
  34212. /*
  34213. * Return true if the value of this Decimal is positive, otherwise return false.
  34214. *
  34215. */
  34216. P.isPositive = P.isPos = function () {
  34217. return this.s > 0;
  34218. };
  34219. /*
  34220. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  34221. *
  34222. */
  34223. P.isZero = function () {
  34224. return !!this.d && this.d[0] === 0;
  34225. };
  34226. /*
  34227. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  34228. *
  34229. */
  34230. P.lessThan = P.lt = function (y) {
  34231. return this.cmp(y) < 0;
  34232. };
  34233. /*
  34234. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  34235. *
  34236. */
  34237. P.lessThanOrEqualTo = P.lte = function (y) {
  34238. return this.cmp(y) < 1;
  34239. };
  34240. /*
  34241. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  34242. * significant digits using rounding mode `rounding`.
  34243. *
  34244. * If no base is specified, return log[10](arg).
  34245. *
  34246. * log[base](arg) = ln(arg) / ln(base)
  34247. *
  34248. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  34249. * otherwise:
  34250. *
  34251. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  34252. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  34253. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  34254. *
  34255. * log[-b](a) = NaN
  34256. * log[0](a) = NaN
  34257. * log[1](a) = NaN
  34258. * log[NaN](a) = NaN
  34259. * log[Infinity](a) = NaN
  34260. * log[b](0) = -Infinity
  34261. * log[b](-0) = -Infinity
  34262. * log[b](-a) = NaN
  34263. * log[b](1) = 0
  34264. * log[b](Infinity) = Infinity
  34265. * log[b](NaN) = NaN
  34266. *
  34267. * [base] {number|string|Decimal} The base of the logarithm.
  34268. *
  34269. */
  34270. P.logarithm = P.log = function (base) {
  34271. var isBase10,
  34272. d,
  34273. denominator,
  34274. k,
  34275. inf,
  34276. num,
  34277. sd,
  34278. r,
  34279. arg = this,
  34280. Ctor = arg.constructor,
  34281. pr = Ctor.precision,
  34282. rm = Ctor.rounding,
  34283. guard = 5;
  34284. // Default base is 10.
  34285. if (base == null) {
  34286. base = new Ctor(10);
  34287. isBase10 = true;
  34288. } else {
  34289. base = new Ctor(base);
  34290. d = base.d;
  34291. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  34292. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  34293. isBase10 = base.eq(10);
  34294. }
  34295. d = arg.d;
  34296. // Is arg negative, non-finite, 0 or 1?
  34297. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  34298. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  34299. }
  34300. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  34301. // integer power of 10.
  34302. if (isBase10) {
  34303. if (d.length > 1) {
  34304. inf = true;
  34305. } else {
  34306. for (k = d[0]; k % 10 === 0;) {
  34307. k /= 10;
  34308. }inf = k !== 1;
  34309. }
  34310. }
  34311. external = false;
  34312. sd = pr + guard;
  34313. num = naturalLogarithm(arg, sd);
  34314. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  34315. // The result will have 5 rounding digits.
  34316. r = divide(num, denominator, sd, 1);
  34317. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  34318. // calculate 10 further digits.
  34319. //
  34320. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  34321. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  34322. // further digits, the last 14 are nines, round up and assume the result is exact.
  34323. // Also assume the result is exact if the last 14 are zero.
  34324. //
  34325. // Example of a result that will be incorrectly rounded:
  34326. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  34327. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  34328. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  34329. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  34330. // place is still 2.6.
  34331. if (checkRoundingDigits(r.d, k = pr, rm)) {
  34332. do {
  34333. sd += 10;
  34334. num = naturalLogarithm(arg, sd);
  34335. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  34336. r = divide(num, denominator, sd, 1);
  34337. if (!inf) {
  34338. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  34339. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  34340. r = finalise(r, pr + 1, 0);
  34341. }
  34342. break;
  34343. }
  34344. } while (checkRoundingDigits(r.d, k += 10, rm));
  34345. }
  34346. external = true;
  34347. return finalise(r, pr, rm);
  34348. };
  34349. /*
  34350. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  34351. *
  34352. * arguments {number|string|Decimal}
  34353. *
  34354. P.max = function () {
  34355. Array.prototype.push.call(arguments, this);
  34356. return maxOrMin(this.constructor, arguments, 'lt');
  34357. };
  34358. */
  34359. /*
  34360. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  34361. *
  34362. * arguments {number|string|Decimal}
  34363. *
  34364. P.min = function () {
  34365. Array.prototype.push.call(arguments, this);
  34366. return maxOrMin(this.constructor, arguments, 'gt');
  34367. };
  34368. */
  34369. /*
  34370. * n - 0 = n
  34371. * n - N = N
  34372. * n - I = -I
  34373. * 0 - n = -n
  34374. * 0 - 0 = 0
  34375. * 0 - N = N
  34376. * 0 - I = -I
  34377. * N - n = N
  34378. * N - 0 = N
  34379. * N - N = N
  34380. * N - I = N
  34381. * I - n = I
  34382. * I - 0 = I
  34383. * I - N = N
  34384. * I - I = N
  34385. *
  34386. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  34387. * significant digits using rounding mode `rounding`.
  34388. *
  34389. */
  34390. P.minus = P.sub = function (y) {
  34391. var d,
  34392. e,
  34393. i,
  34394. j,
  34395. k,
  34396. len,
  34397. pr,
  34398. rm,
  34399. xd,
  34400. xe,
  34401. xLTy,
  34402. yd,
  34403. x = this,
  34404. Ctor = x.constructor;
  34405. y = new Ctor(y);
  34406. // If either is not finite...
  34407. if (!x.d || !y.d) {
  34408. // Return NaN if either is NaN.
  34409. if (!x.s || !y.s) y = new Ctor(NaN);
  34410. // Return y negated if x is finite and y is ±Infinity.
  34411. else if (x.d) y.s = -y.s;
  34412. // Return x if y is finite and x is ±Infinity.
  34413. // Return x if both are ±Infinity with different signs.
  34414. // Return NaN if both are ±Infinity with the same sign.
  34415. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  34416. return y;
  34417. }
  34418. // If signs differ...
  34419. if (x.s != y.s) {
  34420. y.s = -y.s;
  34421. return x.plus(y);
  34422. }
  34423. xd = x.d;
  34424. yd = y.d;
  34425. pr = Ctor.precision;
  34426. rm = Ctor.rounding;
  34427. // If either is zero...
  34428. if (!xd[0] || !yd[0]) {
  34429. // Return y negated if x is zero and y is non-zero.
  34430. if (yd[0]) y.s = -y.s;
  34431. // Return x if y is zero and x is non-zero.
  34432. else if (xd[0]) y = new Ctor(x);
  34433. // Return zero if both are zero.
  34434. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  34435. else return new Ctor(rm === 3 ? -0 : 0);
  34436. return external ? finalise(y, pr, rm) : y;
  34437. }
  34438. // x and y are finite, non-zero numbers with the same sign.
  34439. // Calculate base 1e7 exponents.
  34440. e = mathfloor(y.e / LOG_BASE);
  34441. xe = mathfloor(x.e / LOG_BASE);
  34442. xd = xd.slice();
  34443. k = xe - e;
  34444. // If base 1e7 exponents differ...
  34445. if (k) {
  34446. xLTy = k < 0;
  34447. if (xLTy) {
  34448. d = xd;
  34449. k = -k;
  34450. len = yd.length;
  34451. } else {
  34452. d = yd;
  34453. e = xe;
  34454. len = xd.length;
  34455. }
  34456. // Numbers with massively different exponents would result in a very high number of
  34457. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  34458. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  34459. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  34460. if (k > i) {
  34461. k = i;
  34462. d.length = 1;
  34463. }
  34464. // Prepend zeros to equalise exponents.
  34465. d.reverse();
  34466. for (i = k; i--;) {
  34467. d.push(0);
  34468. }d.reverse();
  34469. // Base 1e7 exponents equal.
  34470. } else {
  34471. // Check digits to determine which is the bigger number.
  34472. i = xd.length;
  34473. len = yd.length;
  34474. xLTy = i < len;
  34475. if (xLTy) len = i;
  34476. for (i = 0; i < len; i++) {
  34477. if (xd[i] != yd[i]) {
  34478. xLTy = xd[i] < yd[i];
  34479. break;
  34480. }
  34481. }
  34482. k = 0;
  34483. }
  34484. if (xLTy) {
  34485. d = xd;
  34486. xd = yd;
  34487. yd = d;
  34488. y.s = -y.s;
  34489. }
  34490. len = xd.length;
  34491. // Append zeros to `xd` if shorter.
  34492. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  34493. for (i = yd.length - len; i > 0; --i) {
  34494. xd[len++] = 0;
  34495. } // Subtract yd from xd.
  34496. for (i = yd.length; i > k;) {
  34497. if (xd[--i] < yd[i]) {
  34498. for (j = i; j && xd[--j] === 0;) {
  34499. xd[j] = BASE - 1;
  34500. }--xd[j];
  34501. xd[i] += BASE;
  34502. }
  34503. xd[i] -= yd[i];
  34504. }
  34505. // Remove trailing zeros.
  34506. for (; xd[--len] === 0;) {
  34507. xd.pop();
  34508. } // Remove leading zeros and adjust exponent accordingly.
  34509. for (; xd[0] === 0; xd.shift()) {
  34510. --e;
  34511. } // Zero?
  34512. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  34513. y.d = xd;
  34514. y.e = getBase10Exponent(xd, e);
  34515. return external ? finalise(y, pr, rm) : y;
  34516. };
  34517. /*
  34518. * n % 0 = N
  34519. * n % N = N
  34520. * n % I = n
  34521. * 0 % n = 0
  34522. * -0 % n = -0
  34523. * 0 % 0 = N
  34524. * 0 % N = N
  34525. * 0 % I = 0
  34526. * N % n = N
  34527. * N % 0 = N
  34528. * N % N = N
  34529. * N % I = N
  34530. * I % n = N
  34531. * I % 0 = N
  34532. * I % N = N
  34533. * I % I = N
  34534. *
  34535. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  34536. * `precision` significant digits using rounding mode `rounding`.
  34537. *
  34538. * The result depends on the modulo mode.
  34539. *
  34540. */
  34541. P.modulo = P.mod = function (y) {
  34542. var q,
  34543. x = this,
  34544. Ctor = x.constructor;
  34545. y = new Ctor(y);
  34546. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  34547. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  34548. // Return x if y is ±Infinity or x is ±0.
  34549. if (!y.d || x.d && !x.d[0]) {
  34550. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  34551. }
  34552. // Prevent rounding of intermediate calculations.
  34553. external = false;
  34554. if (Ctor.modulo == 9) {
  34555. // Euclidian division: q = sign(y) * floor(x / abs(y))
  34556. // result = x - q * y where 0 <= result < abs(y)
  34557. q = divide(x, y.abs(), 0, 3, 1);
  34558. q.s *= y.s;
  34559. } else {
  34560. q = divide(x, y, 0, Ctor.modulo, 1);
  34561. }
  34562. q = q.times(y);
  34563. external = true;
  34564. return x.minus(q);
  34565. };
  34566. /*
  34567. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  34568. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  34569. * significant digits using rounding mode `rounding`.
  34570. *
  34571. */
  34572. P.naturalExponential = P.exp = function () {
  34573. return naturalExponential(this);
  34574. };
  34575. /*
  34576. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  34577. * rounded to `precision` significant digits using rounding mode `rounding`.
  34578. *
  34579. */
  34580. P.naturalLogarithm = P.ln = function () {
  34581. return naturalLogarithm(this);
  34582. };
  34583. /*
  34584. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  34585. * -1.
  34586. *
  34587. */
  34588. P.negated = P.neg = function () {
  34589. var x = new this.constructor(this);
  34590. x.s = -x.s;
  34591. return finalise(x);
  34592. };
  34593. /*
  34594. * n + 0 = n
  34595. * n + N = N
  34596. * n + I = I
  34597. * 0 + n = n
  34598. * 0 + 0 = 0
  34599. * 0 + N = N
  34600. * 0 + I = I
  34601. * N + n = N
  34602. * N + 0 = N
  34603. * N + N = N
  34604. * N + I = N
  34605. * I + n = I
  34606. * I + 0 = I
  34607. * I + N = N
  34608. * I + I = I
  34609. *
  34610. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  34611. * significant digits using rounding mode `rounding`.
  34612. *
  34613. */
  34614. P.plus = P.add = function (y) {
  34615. var carry,
  34616. d,
  34617. e,
  34618. i,
  34619. k,
  34620. len,
  34621. pr,
  34622. rm,
  34623. xd,
  34624. yd,
  34625. x = this,
  34626. Ctor = x.constructor;
  34627. y = new Ctor(y);
  34628. // If either is not finite...
  34629. if (!x.d || !y.d) {
  34630. // Return NaN if either is NaN.
  34631. if (!x.s || !y.s) y = new Ctor(NaN);
  34632. // Return x if y is finite and x is ±Infinity.
  34633. // Return x if both are ±Infinity with the same sign.
  34634. // Return NaN if both are ±Infinity with different signs.
  34635. // Return y if x is finite and y is ±Infinity.
  34636. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  34637. return y;
  34638. }
  34639. // If signs differ...
  34640. if (x.s != y.s) {
  34641. y.s = -y.s;
  34642. return x.minus(y);
  34643. }
  34644. xd = x.d;
  34645. yd = y.d;
  34646. pr = Ctor.precision;
  34647. rm = Ctor.rounding;
  34648. // If either is zero...
  34649. if (!xd[0] || !yd[0]) {
  34650. // Return x if y is zero.
  34651. // Return y if y is non-zero.
  34652. if (!yd[0]) y = new Ctor(x);
  34653. return external ? finalise(y, pr, rm) : y;
  34654. }
  34655. // x and y are finite, non-zero numbers with the same sign.
  34656. // Calculate base 1e7 exponents.
  34657. k = mathfloor(x.e / LOG_BASE);
  34658. e = mathfloor(y.e / LOG_BASE);
  34659. xd = xd.slice();
  34660. i = k - e;
  34661. // If base 1e7 exponents differ...
  34662. if (i) {
  34663. if (i < 0) {
  34664. d = xd;
  34665. i = -i;
  34666. len = yd.length;
  34667. } else {
  34668. d = yd;
  34669. e = k;
  34670. len = xd.length;
  34671. }
  34672. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  34673. k = Math.ceil(pr / LOG_BASE);
  34674. len = k > len ? k + 1 : len + 1;
  34675. if (i > len) {
  34676. i = len;
  34677. d.length = 1;
  34678. }
  34679. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  34680. d.reverse();
  34681. for (; i--;) {
  34682. d.push(0);
  34683. }d.reverse();
  34684. }
  34685. len = xd.length;
  34686. i = yd.length;
  34687. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  34688. if (len - i < 0) {
  34689. i = len;
  34690. d = yd;
  34691. yd = xd;
  34692. xd = d;
  34693. }
  34694. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  34695. for (carry = 0; i;) {
  34696. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  34697. xd[i] %= BASE;
  34698. }
  34699. if (carry) {
  34700. xd.unshift(carry);
  34701. ++e;
  34702. }
  34703. // Remove trailing zeros.
  34704. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  34705. for (len = xd.length; xd[--len] == 0;) {
  34706. xd.pop();
  34707. }y.d = xd;
  34708. y.e = getBase10Exponent(xd, e);
  34709. return external ? finalise(y, pr, rm) : y;
  34710. };
  34711. /*
  34712. * Return the number of significant digits of the value of this Decimal.
  34713. *
  34714. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  34715. *
  34716. */
  34717. P.precision = P.sd = function (z) {
  34718. var k,
  34719. x = this;
  34720. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  34721. if (x.d) {
  34722. k = getPrecision(x.d);
  34723. if (z && x.e + 1 > k) k = x.e + 1;
  34724. } else {
  34725. k = NaN;
  34726. }
  34727. return k;
  34728. };
  34729. /*
  34730. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  34731. * rounding mode `rounding`.
  34732. *
  34733. */
  34734. P.round = function () {
  34735. var x = this,
  34736. Ctor = x.constructor;
  34737. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  34738. };
  34739. /*
  34740. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  34741. *
  34742. * Domain: [-Infinity, Infinity]
  34743. * Range: [-1, 1]
  34744. *
  34745. * sin(x) = x - x^3/3! + x^5/5! - ...
  34746. *
  34747. * sin(0) = 0
  34748. * sin(-0) = -0
  34749. * sin(Infinity) = NaN
  34750. * sin(-Infinity) = NaN
  34751. * sin(NaN) = NaN
  34752. *
  34753. */
  34754. P.sine = P.sin = function () {
  34755. var pr,
  34756. rm,
  34757. x = this,
  34758. Ctor = x.constructor;
  34759. if (!x.isFinite()) return new Ctor(NaN);
  34760. if (x.isZero()) return new Ctor(x);
  34761. pr = Ctor.precision;
  34762. rm = Ctor.rounding;
  34763. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  34764. Ctor.rounding = 1;
  34765. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  34766. Ctor.precision = pr;
  34767. Ctor.rounding = rm;
  34768. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  34769. };
  34770. /*
  34771. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  34772. * significant digits using rounding mode `rounding`.
  34773. *
  34774. * sqrt(-n) = N
  34775. * sqrt(N) = N
  34776. * sqrt(-I) = N
  34777. * sqrt(I) = I
  34778. * sqrt(0) = 0
  34779. * sqrt(-0) = -0
  34780. *
  34781. */
  34782. P.squareRoot = P.sqrt = function () {
  34783. var m,
  34784. n,
  34785. sd,
  34786. r,
  34787. rep,
  34788. t,
  34789. x = this,
  34790. d = x.d,
  34791. e = x.e,
  34792. s = x.s,
  34793. Ctor = x.constructor;
  34794. // Negative/NaN/Infinity/zero?
  34795. if (s !== 1 || !d || !d[0]) {
  34796. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  34797. }
  34798. external = false;
  34799. // Initial estimate.
  34800. s = Math.sqrt(+x);
  34801. // Math.sqrt underflow/overflow?
  34802. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  34803. if (s == 0 || s == 1 / 0) {
  34804. n = digitsToString(d);
  34805. if ((n.length + e) % 2 == 0) n += '0';
  34806. s = Math.sqrt(n);
  34807. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  34808. if (s == 1 / 0) {
  34809. n = '1e' + e;
  34810. } else {
  34811. n = s.toExponential();
  34812. n = n.slice(0, n.indexOf('e') + 1) + e;
  34813. }
  34814. r = new Ctor(n);
  34815. } else {
  34816. r = new Ctor(s.toString());
  34817. }
  34818. sd = (e = Ctor.precision) + 3;
  34819. // Newton-Raphson iteration.
  34820. for (;;) {
  34821. t = r;
  34822. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  34823. // TODO? Replace with for-loop and checkRoundingDigits.
  34824. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  34825. n = n.slice(sd - 3, sd + 1);
  34826. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  34827. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  34828. if (n == '9999' || !rep && n == '4999') {
  34829. // On the first iteration only, check to see if rounding up gives the exact result as the
  34830. // nines may infinitely repeat.
  34831. if (!rep) {
  34832. finalise(t, e + 1, 0);
  34833. if (t.times(t).eq(x)) {
  34834. r = t;
  34835. break;
  34836. }
  34837. }
  34838. sd += 4;
  34839. rep = 1;
  34840. } else {
  34841. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  34842. // If not, then there are further digits and m will be truthy.
  34843. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  34844. // Truncate to the first rounding digit.
  34845. finalise(r, e + 1, 1);
  34846. m = !r.times(r).eq(x);
  34847. }
  34848. break;
  34849. }
  34850. }
  34851. }
  34852. external = true;
  34853. return finalise(r, e, Ctor.rounding, m);
  34854. };
  34855. /*
  34856. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  34857. *
  34858. * Domain: [-Infinity, Infinity]
  34859. * Range: [-Infinity, Infinity]
  34860. *
  34861. * tan(0) = 0
  34862. * tan(-0) = -0
  34863. * tan(Infinity) = NaN
  34864. * tan(-Infinity) = NaN
  34865. * tan(NaN) = NaN
  34866. *
  34867. */
  34868. P.tangent = P.tan = function () {
  34869. var pr,
  34870. rm,
  34871. x = this,
  34872. Ctor = x.constructor;
  34873. if (!x.isFinite()) return new Ctor(NaN);
  34874. if (x.isZero()) return new Ctor(x);
  34875. pr = Ctor.precision;
  34876. rm = Ctor.rounding;
  34877. Ctor.precision = pr + 10;
  34878. Ctor.rounding = 1;
  34879. x = x.sin();
  34880. x.s = 1;
  34881. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  34882. Ctor.precision = pr;
  34883. Ctor.rounding = rm;
  34884. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  34885. };
  34886. /*
  34887. * n * 0 = 0
  34888. * n * N = N
  34889. * n * I = I
  34890. * 0 * n = 0
  34891. * 0 * 0 = 0
  34892. * 0 * N = N
  34893. * 0 * I = N
  34894. * N * n = N
  34895. * N * 0 = N
  34896. * N * N = N
  34897. * N * I = N
  34898. * I * n = I
  34899. * I * 0 = N
  34900. * I * N = N
  34901. * I * I = I
  34902. *
  34903. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  34904. * digits using rounding mode `rounding`.
  34905. *
  34906. */
  34907. P.times = P.mul = function (y) {
  34908. var carry,
  34909. e,
  34910. i,
  34911. k,
  34912. r,
  34913. rL,
  34914. t,
  34915. xdL,
  34916. ydL,
  34917. x = this,
  34918. Ctor = x.constructor,
  34919. xd = x.d,
  34920. yd = (y = new Ctor(y)).d;
  34921. y.s *= x.s;
  34922. // If either is NaN, ±Infinity or ±0...
  34923. if (!xd || !xd[0] || !yd || !yd[0]) {
  34924. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  34925. // Return NaN if either is NaN.
  34926. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  34927. ? NaN
  34928. // Return ±Infinity if either is ±Infinity.
  34929. // Return ±0 if either is ±0.
  34930. : !xd || !yd ? y.s / 0 : y.s * 0);
  34931. }
  34932. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  34933. xdL = xd.length;
  34934. ydL = yd.length;
  34935. // Ensure xd points to the longer array.
  34936. if (xdL < ydL) {
  34937. r = xd;
  34938. xd = yd;
  34939. yd = r;
  34940. rL = xdL;
  34941. xdL = ydL;
  34942. ydL = rL;
  34943. }
  34944. // Initialise the result array with zeros.
  34945. r = [];
  34946. rL = xdL + ydL;
  34947. for (i = rL; i--;) {
  34948. r.push(0);
  34949. } // Multiply!
  34950. for (i = ydL; --i >= 0;) {
  34951. carry = 0;
  34952. for (k = xdL + i; k > i;) {
  34953. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  34954. r[k--] = t % BASE | 0;
  34955. carry = t / BASE | 0;
  34956. }
  34957. r[k] = (r[k] + carry) % BASE | 0;
  34958. }
  34959. // Remove trailing zeros.
  34960. for (; !r[--rL];) {
  34961. r.pop();
  34962. }if (carry) ++e;else r.shift();
  34963. y.d = r;
  34964. y.e = getBase10Exponent(r, e);
  34965. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  34966. };
  34967. /*
  34968. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  34969. * digits using rounding mode `rm`.
  34970. *
  34971. * If the optional `sd` argument is present then return binary exponential notation.
  34972. *
  34973. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34974. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34975. *
  34976. */
  34977. P.toBinary = function (sd, rm) {
  34978. return toStringBinary(this, 2, sd, rm);
  34979. };
  34980. /*
  34981. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  34982. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  34983. *
  34984. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  34985. *
  34986. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34987. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34988. *
  34989. */
  34990. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  34991. var x = this,
  34992. Ctor = x.constructor;
  34993. x = new Ctor(x);
  34994. if (dp === void 0) return x;
  34995. checkInt32(dp, 0, MAX_DIGITS);
  34996. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34997. return finalise(x, dp + x.e + 1, rm);
  34998. };
  34999. /*
  35000. * Return a string representing the value of this Decimal in exponential notation rounded to
  35001. * `dp` fixed decimal places using rounding mode `rounding`.
  35002. *
  35003. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  35004. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  35005. *
  35006. */
  35007. P.toExponential = function (dp, rm) {
  35008. var str,
  35009. x = this,
  35010. Ctor = x.constructor;
  35011. if (dp === void 0) {
  35012. str = finiteToString(x, true);
  35013. } else {
  35014. checkInt32(dp, 0, MAX_DIGITS);
  35015. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  35016. x = finalise(new Ctor(x), dp + 1, rm);
  35017. str = finiteToString(x, true, dp + 1);
  35018. }
  35019. return x.isNeg() && !x.isZero() ? '-' + str : str;
  35020. };
  35021. /*
  35022. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  35023. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  35024. * omitted.
  35025. *
  35026. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  35027. *
  35028. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  35029. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  35030. *
  35031. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  35032. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  35033. * (-0).toFixed(3) is '0.000'.
  35034. * (-0.5).toFixed(0) is '-0'.
  35035. *
  35036. */
  35037. P.toFixed = function (dp, rm) {
  35038. var str,
  35039. y,
  35040. x = this,
  35041. Ctor = x.constructor;
  35042. if (dp === void 0) {
  35043. str = finiteToString(x);
  35044. } else {
  35045. checkInt32(dp, 0, MAX_DIGITS);
  35046. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  35047. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  35048. str = finiteToString(y, false, dp + y.e + 1);
  35049. }
  35050. // To determine whether to add the minus sign look at the value before it was rounded,
  35051. // i.e. look at `x` rather than `y`.
  35052. return x.isNeg() && !x.isZero() ? '-' + str : str;
  35053. };
  35054. /*
  35055. * Return an array representing the value of this Decimal as a simple fraction with an integer
  35056. * numerator and an integer denominator.
  35057. *
  35058. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  35059. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  35060. * value necessary to represent the number exactly.
  35061. *
  35062. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  35063. *
  35064. */
  35065. P.toFraction = function (maxD) {
  35066. var d,
  35067. d0,
  35068. d1,
  35069. d2,
  35070. e,
  35071. k,
  35072. n,
  35073. n0,
  35074. n1,
  35075. pr,
  35076. q,
  35077. r,
  35078. x = this,
  35079. xd = x.d,
  35080. Ctor = x.constructor;
  35081. if (!xd) return new Ctor(x);
  35082. n1 = d0 = new Ctor(1);
  35083. d1 = n0 = new Ctor(0);
  35084. d = new Ctor(d1);
  35085. e = d.e = getPrecision(xd) - x.e - 1;
  35086. k = e % LOG_BASE;
  35087. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  35088. if (maxD == null) {
  35089. // d is 10**e, the minimum max-denominator needed.
  35090. maxD = e > 0 ? d : n1;
  35091. } else {
  35092. n = new Ctor(maxD);
  35093. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  35094. maxD = n.gt(d) ? e > 0 ? d : n1 : n;
  35095. }
  35096. external = false;
  35097. n = new Ctor(digitsToString(xd));
  35098. pr = Ctor.precision;
  35099. Ctor.precision = e = xd.length * LOG_BASE * 2;
  35100. for (;;) {
  35101. q = divide(n, d, 0, 1, 1);
  35102. d2 = d0.plus(q.times(d1));
  35103. if (d2.cmp(maxD) == 1) break;
  35104. d0 = d1;
  35105. d1 = d2;
  35106. d2 = n1;
  35107. n1 = n0.plus(q.times(d2));
  35108. n0 = d2;
  35109. d2 = d;
  35110. d = n.minus(q.times(d2));
  35111. n = d2;
  35112. }
  35113. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  35114. n0 = n0.plus(d2.times(n1));
  35115. d0 = d0.plus(d2.times(d1));
  35116. n0.s = n1.s = x.s;
  35117. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  35118. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
  35119. Ctor.precision = pr;
  35120. external = true;
  35121. return r;
  35122. };
  35123. /*
  35124. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  35125. * digits using rounding mode `rm`.
  35126. *
  35127. * If the optional `sd` argument is present then return binary exponential notation.
  35128. *
  35129. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  35130. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  35131. *
  35132. */
  35133. P.toHexadecimal = P.toHex = function (sd, rm) {
  35134. return toStringBinary(this, 16, sd, rm);
  35135. };
  35136. /*
  35137. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  35138. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  35139. *
  35140. * The return value will always have the same sign as this Decimal, unless either this Decimal
  35141. * or `y` is NaN, in which case the return value will be also be NaN.
  35142. *
  35143. * The return value is not affected by the value of `precision`.
  35144. *
  35145. * y {number|string|Decimal} The magnitude to round to a multiple of.
  35146. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  35147. *
  35148. * 'toNearest() rounding mode not an integer: {rm}'
  35149. * 'toNearest() rounding mode out of range: {rm}'
  35150. *
  35151. */
  35152. P.toNearest = function (y, rm) {
  35153. var x = this,
  35154. Ctor = x.constructor;
  35155. x = new Ctor(x);
  35156. if (y == null) {
  35157. // If x is not finite, return x.
  35158. if (!x.d) return x;
  35159. y = new Ctor(1);
  35160. rm = Ctor.rounding;
  35161. } else {
  35162. y = new Ctor(y);
  35163. if (rm === void 0) {
  35164. rm = Ctor.rounding;
  35165. } else {
  35166. checkInt32(rm, 0, 8);
  35167. }
  35168. // If x is not finite, return x if y is not NaN, else NaN.
  35169. if (!x.d) return y.s ? x : y;
  35170. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  35171. if (!y.d) {
  35172. if (y.s) y.s = x.s;
  35173. return y;
  35174. }
  35175. }
  35176. // If y is not zero, calculate the nearest multiple of y to x.
  35177. if (y.d[0]) {
  35178. external = false;
  35179. x = divide(x, y, 0, rm, 1).times(y);
  35180. external = true;
  35181. finalise(x);
  35182. // If y is zero, return zero with the sign of x.
  35183. } else {
  35184. y.s = x.s;
  35185. x = y;
  35186. }
  35187. return x;
  35188. };
  35189. /*
  35190. * Return the value of this Decimal converted to a number primitive.
  35191. * Zero keeps its sign.
  35192. *
  35193. */
  35194. P.toNumber = function () {
  35195. return +this;
  35196. };
  35197. /*
  35198. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  35199. * digits using rounding mode `rm`.
  35200. *
  35201. * If the optional `sd` argument is present then return binary exponential notation.
  35202. *
  35203. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  35204. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  35205. *
  35206. */
  35207. P.toOctal = function (sd, rm) {
  35208. return toStringBinary(this, 8, sd, rm);
  35209. };
  35210. /*
  35211. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  35212. * to `precision` significant digits using rounding mode `rounding`.
  35213. *
  35214. * ECMAScript compliant.
  35215. *
  35216. * pow(x, NaN) = NaN
  35217. * pow(x, ±0) = 1
  35218. * pow(NaN, non-zero) = NaN
  35219. * pow(abs(x) > 1, +Infinity) = +Infinity
  35220. * pow(abs(x) > 1, -Infinity) = +0
  35221. * pow(abs(x) == 1, ±Infinity) = NaN
  35222. * pow(abs(x) < 1, +Infinity) = +0
  35223. * pow(abs(x) < 1, -Infinity) = +Infinity
  35224. * pow(+Infinity, y > 0) = +Infinity
  35225. * pow(+Infinity, y < 0) = +0
  35226. * pow(-Infinity, odd integer > 0) = -Infinity
  35227. * pow(-Infinity, even integer > 0) = +Infinity
  35228. * pow(-Infinity, odd integer < 0) = -0
  35229. * pow(-Infinity, even integer < 0) = +0
  35230. * pow(+0, y > 0) = +0
  35231. * pow(+0, y < 0) = +Infinity
  35232. * pow(-0, odd integer > 0) = -0
  35233. * pow(-0, even integer > 0) = +0
  35234. * pow(-0, odd integer < 0) = -Infinity
  35235. * pow(-0, even integer < 0) = +Infinity
  35236. * pow(finite x < 0, finite non-integer) = NaN
  35237. *
  35238. * For non-integer or very large exponents pow(x, y) is calculated using
  35239. *
  35240. * x^y = exp(y*ln(x))
  35241. *
  35242. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  35243. * probability of an incorrectly rounded result
  35244. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  35245. * i.e. 1 in 250,000,000,000,000
  35246. *
  35247. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  35248. *
  35249. * y {number|string|Decimal} The power to which to raise this Decimal.
  35250. *
  35251. */
  35252. P.toPower = P.pow = function (y) {
  35253. var e,
  35254. k,
  35255. pr,
  35256. r,
  35257. rm,
  35258. s,
  35259. x = this,
  35260. Ctor = x.constructor,
  35261. yn = +(y = new Ctor(y));
  35262. // Either ±Infinity, NaN or ±0?
  35263. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  35264. x = new Ctor(x);
  35265. if (x.eq(1)) return x;
  35266. pr = Ctor.precision;
  35267. rm = Ctor.rounding;
  35268. if (y.eq(1)) return finalise(x, pr, rm);
  35269. // y exponent
  35270. e = mathfloor(y.e / LOG_BASE);
  35271. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  35272. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  35273. r = intPow(Ctor, x, k, pr);
  35274. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  35275. }
  35276. s = x.s;
  35277. // if x is negative
  35278. if (s < 0) {
  35279. // if y is not an integer
  35280. if (e < y.d.length - 1) return new Ctor(NaN);
  35281. // Result is positive if x is negative and the last digit of integer y is even.
  35282. if ((y.d[e] & 1) == 0) s = 1;
  35283. // if x.eq(-1)
  35284. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  35285. x.s = s;
  35286. return x;
  35287. }
  35288. }
  35289. // Estimate result exponent.
  35290. // x^y = 10^e, where e = y * log10(x)
  35291. // log10(x) = log10(x_significand) + x_exponent
  35292. // log10(x_significand) = ln(x_significand) / ln(10)
  35293. k = mathpow(+x, yn);
  35294. e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + '').e;
  35295. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  35296. // Overflow/underflow?
  35297. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  35298. external = false;
  35299. Ctor.rounding = x.s = 1;
  35300. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  35301. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  35302. // new Decimal(2.32456).pow('2087987436534566.46411')
  35303. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  35304. k = Math.min(12, (e + '').length);
  35305. // r = x^y = exp(y*ln(x))
  35306. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  35307. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  35308. if (r.d) {
  35309. // Truncate to the required precision plus five rounding digits.
  35310. r = finalise(r, pr + 5, 1);
  35311. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  35312. // the result.
  35313. if (checkRoundingDigits(r.d, pr, rm)) {
  35314. e = pr + 10;
  35315. // Truncate to the increased precision plus five rounding digits.
  35316. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  35317. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  35318. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  35319. r = finalise(r, pr + 1, 0);
  35320. }
  35321. }
  35322. }
  35323. r.s = s;
  35324. external = true;
  35325. Ctor.rounding = rm;
  35326. return finalise(r, pr, rm);
  35327. };
  35328. /*
  35329. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  35330. * using rounding mode `rounding`.
  35331. *
  35332. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  35333. * the integer part of the value in normal notation.
  35334. *
  35335. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  35336. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  35337. *
  35338. */
  35339. P.toPrecision = function (sd, rm) {
  35340. var str,
  35341. x = this,
  35342. Ctor = x.constructor;
  35343. if (sd === void 0) {
  35344. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  35345. } else {
  35346. checkInt32(sd, 1, MAX_DIGITS);
  35347. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  35348. x = finalise(new Ctor(x), sd, rm);
  35349. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  35350. }
  35351. return x.isNeg() && !x.isZero() ? '-' + str : str;
  35352. };
  35353. /*
  35354. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  35355. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  35356. * omitted.
  35357. *
  35358. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  35359. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  35360. *
  35361. * 'toSD() digits out of range: {sd}'
  35362. * 'toSD() digits not an integer: {sd}'
  35363. * 'toSD() rounding mode not an integer: {rm}'
  35364. * 'toSD() rounding mode out of range: {rm}'
  35365. *
  35366. */
  35367. P.toSignificantDigits = P.toSD = function (sd, rm) {
  35368. var x = this,
  35369. Ctor = x.constructor;
  35370. if (sd === void 0) {
  35371. sd = Ctor.precision;
  35372. rm = Ctor.rounding;
  35373. } else {
  35374. checkInt32(sd, 1, MAX_DIGITS);
  35375. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  35376. }
  35377. return finalise(new Ctor(x), sd, rm);
  35378. };
  35379. /*
  35380. * Return a string representing the value of this Decimal.
  35381. *
  35382. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  35383. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  35384. *
  35385. */
  35386. P.toString = function () {
  35387. var x = this,
  35388. Ctor = x.constructor,
  35389. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  35390. return x.isNeg() && !x.isZero() ? '-' + str : str;
  35391. };
  35392. /*
  35393. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  35394. *
  35395. */
  35396. P.truncated = P.trunc = function () {
  35397. return finalise(new this.constructor(this), this.e + 1, 1);
  35398. };
  35399. /*
  35400. * Return a string representing the value of this Decimal.
  35401. * Unlike `toString`, negative zero will include the minus sign.
  35402. *
  35403. */
  35404. P.valueOf = P.toJSON = function () {
  35405. var x = this,
  35406. Ctor = x.constructor,
  35407. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  35408. return x.isNeg() ? '-' + str : str;
  35409. };
  35410. /*
  35411. // Add aliases to match BigDecimal method names.
  35412. // P.add = P.plus;
  35413. P.subtract = P.minus;
  35414. P.multiply = P.times;
  35415. P.divide = P.div;
  35416. P.remainder = P.mod;
  35417. P.compareTo = P.cmp;
  35418. P.negate = P.neg;
  35419. */
  35420. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  35421. /*
  35422. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  35423. * finiteToString, naturalExponential, naturalLogarithm
  35424. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  35425. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  35426. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  35427. * convertBase toStringBinary, parseOther
  35428. * cos P.cos
  35429. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  35430. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  35431. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  35432. * taylorSeries, atan2, parseOther
  35433. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  35434. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  35435. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  35436. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  35437. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  35438. * P.truncated, divide, getLn10, getPi, naturalExponential,
  35439. * naturalLogarithm, ceil, floor, round, trunc
  35440. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  35441. * toStringBinary
  35442. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  35443. * getLn10 P.logarithm, naturalLogarithm
  35444. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  35445. * getPrecision P.precision, P.toFraction
  35446. * getZeroString digitsToString, finiteToString
  35447. * intPow P.toPower, parseOther
  35448. * isOdd toLessThanHalfPi
  35449. * maxOrMin max, min
  35450. * naturalExponential P.naturalExponential, P.toPower
  35451. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  35452. * P.toPower, naturalExponential
  35453. * nonFiniteToString finiteToString, toStringBinary
  35454. * parseDecimal Decimal
  35455. * parseOther Decimal
  35456. * sin P.sin
  35457. * taylorSeries P.cosh, P.sinh, cos, sin
  35458. * toLessThanHalfPi P.cos, P.sin
  35459. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  35460. * truncate intPow
  35461. *
  35462. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  35463. * naturalLogarithm, config, parseOther, random, Decimal
  35464. */
  35465. function digitsToString(d) {
  35466. var i,
  35467. k,
  35468. ws,
  35469. indexOfLastWord = d.length - 1,
  35470. str = '',
  35471. w = d[0];
  35472. if (indexOfLastWord > 0) {
  35473. str += w;
  35474. for (i = 1; i < indexOfLastWord; i++) {
  35475. ws = d[i] + '';
  35476. k = LOG_BASE - ws.length;
  35477. if (k) str += getZeroString(k);
  35478. str += ws;
  35479. }
  35480. w = d[i];
  35481. ws = w + '';
  35482. k = LOG_BASE - ws.length;
  35483. if (k) str += getZeroString(k);
  35484. } else if (w === 0) {
  35485. return '0';
  35486. }
  35487. // Remove trailing zeros of last w.
  35488. for (; w % 10 === 0;) {
  35489. w /= 10;
  35490. }return str + w;
  35491. }
  35492. function checkInt32(i, min, max) {
  35493. if (i !== ~~i || i < min || i > max) {
  35494. throw Error(invalidArgument + i);
  35495. }
  35496. }
  35497. /*
  35498. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  35499. * `repeating == null` if caller is `log` or `pow`,
  35500. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  35501. */
  35502. function checkRoundingDigits(d, i, rm, repeating) {
  35503. var di, k, r, rd;
  35504. // Get the length of the first word of the array d.
  35505. for (k = d[0]; k >= 10; k /= 10) {
  35506. --i;
  35507. } // Is the rounding digit in the first word of d?
  35508. if (--i < 0) {
  35509. i += LOG_BASE;
  35510. di = 0;
  35511. } else {
  35512. di = Math.ceil((i + 1) / LOG_BASE);
  35513. i %= LOG_BASE;
  35514. }
  35515. // i is the index (0 - 6) of the rounding digit.
  35516. // E.g. if within the word 3487563 the first rounding digit is 5,
  35517. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  35518. k = mathpow(10, LOG_BASE - i);
  35519. rd = d[di] % k | 0;
  35520. if (repeating == null) {
  35521. if (i < 3) {
  35522. if (i == 0) rd = rd / 100 | 0;else if (i == 1) rd = rd / 10 | 0;
  35523. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  35524. } else {
  35525. 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;
  35526. }
  35527. } else {
  35528. if (i < 4) {
  35529. if (i == 0) rd = rd / 1000 | 0;else if (i == 1) rd = rd / 100 | 0;else if (i == 2) rd = rd / 10 | 0;
  35530. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  35531. } else {
  35532. 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;
  35533. }
  35534. }
  35535. return r;
  35536. }
  35537. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  35538. // Eg. convertBase('255', 10, 16) returns [15, 15].
  35539. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  35540. function convertBase(str, baseIn, baseOut) {
  35541. var j,
  35542. arr = [0],
  35543. arrL,
  35544. i = 0,
  35545. strL = str.length;
  35546. for (; i < strL;) {
  35547. for (arrL = arr.length; arrL--;) {
  35548. arr[arrL] *= baseIn;
  35549. }arr[0] += NUMERALS.indexOf(str.charAt(i++));
  35550. for (j = 0; j < arr.length; j++) {
  35551. if (arr[j] > baseOut - 1) {
  35552. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  35553. arr[j + 1] += arr[j] / baseOut | 0;
  35554. arr[j] %= baseOut;
  35555. }
  35556. }
  35557. }
  35558. return arr.reverse();
  35559. }
  35560. /*
  35561. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  35562. * |x| < pi/2
  35563. *
  35564. */
  35565. function cosine(Ctor, x) {
  35566. var k,
  35567. y,
  35568. len = x.d.length;
  35569. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  35570. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  35571. // Estimate the optimum number of times to use the argument reduction.
  35572. if (len < 32) {
  35573. k = Math.ceil(len / 3);
  35574. y = Math.pow(4, -k).toString();
  35575. } else {
  35576. k = 16;
  35577. y = '2.3283064365386962890625e-10';
  35578. }
  35579. Ctor.precision += k;
  35580. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  35581. // Reverse argument reduction
  35582. for (var i = k; i--;) {
  35583. var cos2x = x.times(x);
  35584. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  35585. }
  35586. Ctor.precision -= k;
  35587. return x;
  35588. }
  35589. /*
  35590. * Perform division in the specified base.
  35591. */
  35592. var divide = function () {
  35593. // Assumes non-zero x and k, and hence non-zero result.
  35594. function multiplyInteger(x, k, base) {
  35595. var temp,
  35596. carry = 0,
  35597. i = x.length;
  35598. for (x = x.slice(); i--;) {
  35599. temp = x[i] * k + carry;
  35600. x[i] = temp % base | 0;
  35601. carry = temp / base | 0;
  35602. }
  35603. if (carry) x.unshift(carry);
  35604. return x;
  35605. }
  35606. function compare(a, b, aL, bL) {
  35607. var i, r;
  35608. if (aL != bL) {
  35609. r = aL > bL ? 1 : -1;
  35610. } else {
  35611. for (i = r = 0; i < aL; i++) {
  35612. if (a[i] != b[i]) {
  35613. r = a[i] > b[i] ? 1 : -1;
  35614. break;
  35615. }
  35616. }
  35617. }
  35618. return r;
  35619. }
  35620. function subtract(a, b, aL, base) {
  35621. var i = 0;
  35622. // Subtract b from a.
  35623. for (; aL--;) {
  35624. a[aL] -= i;
  35625. i = a[aL] < b[aL] ? 1 : 0;
  35626. a[aL] = i * base + a[aL] - b[aL];
  35627. }
  35628. // Remove leading zeros.
  35629. for (; !a[0] && a.length > 1;) {
  35630. a.shift();
  35631. }
  35632. }
  35633. return function (x, y, pr, rm, dp, base) {
  35634. var cmp,
  35635. e,
  35636. i,
  35637. k,
  35638. logBase,
  35639. more,
  35640. prod,
  35641. prodL,
  35642. q,
  35643. qd,
  35644. rem,
  35645. remL,
  35646. rem0,
  35647. sd,
  35648. t,
  35649. xi,
  35650. xL,
  35651. yd0,
  35652. yL,
  35653. yz,
  35654. Ctor = x.constructor,
  35655. sign = x.s == y.s ? 1 : -1,
  35656. xd = x.d,
  35657. yd = y.d;
  35658. // Either NaN, Infinity or 0?
  35659. if (!xd || !xd[0] || !yd || !yd[0]) {
  35660. return new Ctor( // Return NaN if either NaN, or both Infinity or 0.
  35661. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  35662. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  35663. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  35664. }
  35665. if (base) {
  35666. logBase = 1;
  35667. e = x.e - y.e;
  35668. } else {
  35669. base = BASE;
  35670. logBase = LOG_BASE;
  35671. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  35672. }
  35673. yL = yd.length;
  35674. xL = xd.length;
  35675. q = new Ctor(sign);
  35676. qd = q.d = [];
  35677. // Result exponent may be one less than e.
  35678. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  35679. for (i = 0; yd[i] == (xd[i] || 0); i++) {}
  35680. if (yd[i] > (xd[i] || 0)) e--;
  35681. if (pr == null) {
  35682. sd = pr = Ctor.precision;
  35683. rm = Ctor.rounding;
  35684. } else if (dp) {
  35685. sd = pr + (x.e - y.e) + 1;
  35686. } else {
  35687. sd = pr;
  35688. }
  35689. if (sd < 0) {
  35690. qd.push(1);
  35691. more = true;
  35692. } else {
  35693. // Convert precision in number of base 10 digits to base 1e7 digits.
  35694. sd = sd / logBase + 2 | 0;
  35695. i = 0;
  35696. // divisor < 1e7
  35697. if (yL == 1) {
  35698. k = 0;
  35699. yd = yd[0];
  35700. sd++;
  35701. // k is the carry.
  35702. for (; (i < xL || k) && sd--; i++) {
  35703. t = k * base + (xd[i] || 0);
  35704. qd[i] = t / yd | 0;
  35705. k = t % yd | 0;
  35706. }
  35707. more = k || i < xL;
  35708. // divisor >= 1e7
  35709. } else {
  35710. // Normalise xd and yd so highest order digit of yd is >= base/2
  35711. k = base / (yd[0] + 1) | 0;
  35712. if (k > 1) {
  35713. yd = multiplyInteger(yd, k, base);
  35714. xd = multiplyInteger(xd, k, base);
  35715. yL = yd.length;
  35716. xL = xd.length;
  35717. }
  35718. xi = yL;
  35719. rem = xd.slice(0, yL);
  35720. remL = rem.length;
  35721. // Add zeros to make remainder as long as divisor.
  35722. for (; remL < yL;) {
  35723. rem[remL++] = 0;
  35724. }yz = yd.slice();
  35725. yz.unshift(0);
  35726. yd0 = yd[0];
  35727. if (yd[1] >= base / 2) ++yd0;
  35728. do {
  35729. k = 0;
  35730. // Compare divisor and remainder.
  35731. cmp = compare(yd, rem, yL, remL);
  35732. // If divisor < remainder.
  35733. if (cmp < 0) {
  35734. // Calculate trial digit, k.
  35735. rem0 = rem[0];
  35736. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  35737. // k will be how many times the divisor goes into the current remainder.
  35738. k = rem0 / yd0 | 0;
  35739. // Algorithm:
  35740. // 1. product = divisor * trial digit (k)
  35741. // 2. if product > remainder: product -= divisor, k--
  35742. // 3. remainder -= product
  35743. // 4. if product was < remainder at 2:
  35744. // 5. compare new remainder and divisor
  35745. // 6. If remainder > divisor: remainder -= divisor, k++
  35746. if (k > 1) {
  35747. if (k >= base) k = base - 1;
  35748. // product = divisor * trial digit.
  35749. prod = multiplyInteger(yd, k, base);
  35750. prodL = prod.length;
  35751. remL = rem.length;
  35752. // Compare product and remainder.
  35753. cmp = compare(prod, rem, prodL, remL);
  35754. // product > remainder.
  35755. if (cmp == 1) {
  35756. k--;
  35757. // Subtract divisor from product.
  35758. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  35759. }
  35760. } else {
  35761. // cmp is -1.
  35762. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  35763. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  35764. if (k == 0) cmp = k = 1;
  35765. prod = yd.slice();
  35766. }
  35767. prodL = prod.length;
  35768. if (prodL < remL) prod.unshift(0);
  35769. // Subtract product from remainder.
  35770. subtract(rem, prod, remL, base);
  35771. // If product was < previous remainder.
  35772. if (cmp == -1) {
  35773. remL = rem.length;
  35774. // Compare divisor and new remainder.
  35775. cmp = compare(yd, rem, yL, remL);
  35776. // If divisor < new remainder, subtract divisor from remainder.
  35777. if (cmp < 1) {
  35778. k++;
  35779. // Subtract divisor from remainder.
  35780. subtract(rem, yL < remL ? yz : yd, remL, base);
  35781. }
  35782. }
  35783. remL = rem.length;
  35784. } else if (cmp === 0) {
  35785. k++;
  35786. rem = [0];
  35787. } // if cmp === 1, k will be 0
  35788. // Add the next digit, k, to the result array.
  35789. qd[i++] = k;
  35790. // Update the remainder.
  35791. if (cmp && rem[0]) {
  35792. rem[remL++] = xd[xi] || 0;
  35793. } else {
  35794. rem = [xd[xi]];
  35795. remL = 1;
  35796. }
  35797. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  35798. more = rem[0] !== void 0;
  35799. }
  35800. // Leading zero?
  35801. if (!qd[0]) qd.shift();
  35802. }
  35803. // logBase is 1 when divide is being used for base conversion.
  35804. if (logBase == 1) {
  35805. q.e = e;
  35806. inexact = more;
  35807. } else {
  35808. // To calculate q.e, first get the number of digits of qd[0].
  35809. for (i = 1, k = qd[0]; k >= 10; k /= 10) {
  35810. i++;
  35811. }q.e = i + e * logBase - 1;
  35812. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  35813. }
  35814. return q;
  35815. };
  35816. }();
  35817. /*
  35818. * Round `x` to `sd` significant digits using rounding mode `rm`.
  35819. * Check for over/under-flow.
  35820. */
  35821. function finalise(x, sd, rm, isTruncated) {
  35822. var digits,
  35823. i,
  35824. j,
  35825. k,
  35826. rd,
  35827. roundUp,
  35828. w,
  35829. xd,
  35830. xdi,
  35831. Ctor = x.constructor;
  35832. // Don't round if sd is null or undefined.
  35833. out: if (sd != null) {
  35834. xd = x.d;
  35835. // Infinity/NaN.
  35836. if (!xd) return x;
  35837. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  35838. // w: the word of xd containing rd, a base 1e7 number.
  35839. // xdi: the index of w within xd.
  35840. // digits: the number of digits of w.
  35841. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  35842. // they had leading zeros)
  35843. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  35844. // Get the length of the first word of the digits array xd.
  35845. for (digits = 1, k = xd[0]; k >= 10; k /= 10) {
  35846. digits++;
  35847. }i = sd - digits;
  35848. // Is the rounding digit in the first word of xd?
  35849. if (i < 0) {
  35850. i += LOG_BASE;
  35851. j = sd;
  35852. w = xd[xdi = 0];
  35853. // Get the rounding digit at index j of w.
  35854. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  35855. } else {
  35856. xdi = Math.ceil((i + 1) / LOG_BASE);
  35857. k = xd.length;
  35858. if (xdi >= k) {
  35859. if (isTruncated) {
  35860. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  35861. for (; k++ <= xdi;) {
  35862. xd.push(0);
  35863. }w = rd = 0;
  35864. digits = 1;
  35865. i %= LOG_BASE;
  35866. j = i - LOG_BASE + 1;
  35867. } else {
  35868. break out;
  35869. }
  35870. } else {
  35871. w = k = xd[xdi];
  35872. // Get the number of digits of w.
  35873. for (digits = 1; k >= 10; k /= 10) {
  35874. digits++;
  35875. } // Get the index of rd within w.
  35876. i %= LOG_BASE;
  35877. // Get the index of rd within w, adjusted for leading zeros.
  35878. // The number of leading zeros of w is given by LOG_BASE - digits.
  35879. j = i - LOG_BASE + digits;
  35880. // Get the rounding digit at index j of w.
  35881. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  35882. }
  35883. }
  35884. // Are there any non-zero digits after the rounding digit?
  35885. isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  35886. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  35887. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  35888. // will give 714.
  35889. roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  35890. // Check whether the digit to the left of the rounding digit is odd.
  35891. (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
  35892. if (sd < 1 || !xd[0]) {
  35893. xd.length = 0;
  35894. if (roundUp) {
  35895. // Convert sd to decimal places.
  35896. sd -= x.e + 1;
  35897. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  35898. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  35899. x.e = -sd || 0;
  35900. } else {
  35901. // Zero.
  35902. xd[0] = x.e = 0;
  35903. }
  35904. return x;
  35905. }
  35906. // Remove excess digits.
  35907. if (i == 0) {
  35908. xd.length = xdi;
  35909. k = 1;
  35910. xdi--;
  35911. } else {
  35912. xd.length = xdi + 1;
  35913. k = mathpow(10, LOG_BASE - i);
  35914. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  35915. // j > 0 means i > number of leading zeros of w.
  35916. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  35917. }
  35918. if (roundUp) {
  35919. for (;;) {
  35920. // Is the digit to be rounded up in the first word of xd?
  35921. if (xdi == 0) {
  35922. // i will be the length of xd[0] before k is added.
  35923. for (i = 1, j = xd[0]; j >= 10; j /= 10) {
  35924. i++;
  35925. }j = xd[0] += k;
  35926. for (k = 1; j >= 10; j /= 10) {
  35927. k++;
  35928. } // if i != k the length has increased.
  35929. if (i != k) {
  35930. x.e++;
  35931. if (xd[0] == BASE) xd[0] = 1;
  35932. }
  35933. break;
  35934. } else {
  35935. xd[xdi] += k;
  35936. if (xd[xdi] != BASE) break;
  35937. xd[xdi--] = 0;
  35938. k = 1;
  35939. }
  35940. }
  35941. }
  35942. // Remove trailing zeros.
  35943. for (i = xd.length; xd[--i] === 0;) {
  35944. xd.pop();
  35945. }
  35946. }
  35947. if (external) {
  35948. // Overflow?
  35949. if (x.e > Ctor.maxE) {
  35950. // Infinity.
  35951. x.d = null;
  35952. x.e = NaN;
  35953. // Underflow?
  35954. } else if (x.e < Ctor.minE) {
  35955. // Zero.
  35956. x.e = 0;
  35957. x.d = [0];
  35958. // Ctor.underflow = true;
  35959. } // else Ctor.underflow = false;
  35960. }
  35961. return x;
  35962. }
  35963. function finiteToString(x, isExp, sd) {
  35964. if (!x.isFinite()) return nonFiniteToString(x);
  35965. var k,
  35966. e = x.e,
  35967. str = digitsToString(x.d),
  35968. len = str.length;
  35969. if (isExp) {
  35970. if (sd && (k = sd - len) > 0) {
  35971. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  35972. } else if (len > 1) {
  35973. str = str.charAt(0) + '.' + str.slice(1);
  35974. }
  35975. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  35976. } else if (e < 0) {
  35977. str = '0.' + getZeroString(-e - 1) + str;
  35978. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  35979. } else if (e >= len) {
  35980. str += getZeroString(e + 1 - len);
  35981. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  35982. } else {
  35983. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  35984. if (sd && (k = sd - len) > 0) {
  35985. if (e + 1 === len) str += '.';
  35986. str += getZeroString(k);
  35987. }
  35988. }
  35989. return str;
  35990. }
  35991. // Calculate the base 10 exponent from the base 1e7 exponent.
  35992. function getBase10Exponent(digits, e) {
  35993. var w = digits[0];
  35994. // Add the number of digits of the first word of the digits array.
  35995. for (e *= LOG_BASE; w >= 10; w /= 10) {
  35996. e++;
  35997. }return e;
  35998. }
  35999. function getLn10(Ctor, sd, pr) {
  36000. if (sd > LN10_PRECISION) {
  36001. // Reset global state in case the exception is caught.
  36002. external = true;
  36003. if (pr) Ctor.precision = pr;
  36004. throw Error(precisionLimitExceeded);
  36005. }
  36006. return finalise(new Ctor(LN10), sd, 1, true);
  36007. }
  36008. function getPi(Ctor, sd, rm) {
  36009. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  36010. return finalise(new Ctor(PI), sd, rm, true);
  36011. }
  36012. function getPrecision(digits) {
  36013. var w = digits.length - 1,
  36014. len = w * LOG_BASE + 1;
  36015. w = digits[w];
  36016. // If non-zero...
  36017. if (w) {
  36018. // Subtract the number of trailing zeros of the last word.
  36019. for (; w % 10 == 0; w /= 10) {
  36020. len--;
  36021. } // Add the number of digits of the first word.
  36022. for (w = digits[0]; w >= 10; w /= 10) {
  36023. len++;
  36024. }
  36025. }
  36026. return len;
  36027. }
  36028. function getZeroString(k) {
  36029. var zs = '';
  36030. for (; k--;) {
  36031. zs += '0';
  36032. }return zs;
  36033. }
  36034. /*
  36035. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  36036. * integer of type number.
  36037. *
  36038. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  36039. *
  36040. */
  36041. function intPow(Ctor, x, n, pr) {
  36042. var isTruncated,
  36043. r = new Ctor(1),
  36044. // Max n of 9007199254740991 takes 53 loop iterations.
  36045. // Maximum digits array length; leaves [28, 34] guard digits.
  36046. k = Math.ceil(pr / LOG_BASE + 4);
  36047. external = false;
  36048. for (;;) {
  36049. if (n % 2) {
  36050. r = r.times(x);
  36051. if (truncate(r.d, k)) isTruncated = true;
  36052. }
  36053. n = mathfloor(n / 2);
  36054. if (n === 0) {
  36055. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  36056. n = r.d.length - 1;
  36057. if (isTruncated && r.d[n] === 0) ++r.d[n];
  36058. break;
  36059. }
  36060. x = x.times(x);
  36061. truncate(x.d, k);
  36062. }
  36063. external = true;
  36064. return r;
  36065. }
  36066. function isOdd(n) {
  36067. return n.d[n.d.length - 1] & 1;
  36068. }
  36069. /*
  36070. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  36071. */
  36072. function maxOrMin(Ctor, args, ltgt) {
  36073. var y,
  36074. x = new Ctor(args[0]),
  36075. i = 0;
  36076. for (; ++i < args.length;) {
  36077. y = new Ctor(args[i]);
  36078. if (!y.s) {
  36079. x = y;
  36080. break;
  36081. } else if (x[ltgt](y)) {
  36082. x = y;
  36083. }
  36084. }
  36085. return x;
  36086. }
  36087. /*
  36088. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  36089. * digits.
  36090. *
  36091. * Taylor/Maclaurin series.
  36092. *
  36093. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  36094. *
  36095. * Argument reduction:
  36096. * Repeat x = x / 32, k += 5, until |x| < 0.1
  36097. * exp(x) = exp(x / 2^k)^(2^k)
  36098. *
  36099. * Previously, the argument was initially reduced by
  36100. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  36101. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  36102. * found to be slower than just dividing repeatedly by 32 as above.
  36103. *
  36104. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  36105. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  36106. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  36107. *
  36108. * exp(Infinity) = Infinity
  36109. * exp(-Infinity) = 0
  36110. * exp(NaN) = NaN
  36111. * exp(±0) = 1
  36112. *
  36113. * exp(x) is non-terminating for any finite, non-zero x.
  36114. *
  36115. * The result will always be correctly rounded.
  36116. *
  36117. */
  36118. function naturalExponential(x, sd) {
  36119. var denominator,
  36120. guard,
  36121. j,
  36122. pow,
  36123. sum,
  36124. t,
  36125. wpr,
  36126. rep = 0,
  36127. i = 0,
  36128. k = 0,
  36129. Ctor = x.constructor,
  36130. rm = Ctor.rounding,
  36131. pr = Ctor.precision;
  36132. // 0/NaN/Infinity?
  36133. if (!x.d || !x.d[0] || x.e > 17) {
  36134. return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  36135. }
  36136. if (sd == null) {
  36137. external = false;
  36138. wpr = pr;
  36139. } else {
  36140. wpr = sd;
  36141. }
  36142. t = new Ctor(0.03125);
  36143. // while abs(x) >= 0.1
  36144. while (x.e > -2) {
  36145. // x = x / 2^5
  36146. x = x.times(t);
  36147. k += 5;
  36148. }
  36149. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  36150. // necessary to ensure the first 4 rounding digits are correct.
  36151. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  36152. wpr += guard;
  36153. denominator = pow = sum = new Ctor(1);
  36154. Ctor.precision = wpr;
  36155. for (;;) {
  36156. pow = finalise(pow.times(x), wpr, 1);
  36157. denominator = denominator.times(++i);
  36158. t = sum.plus(divide(pow, denominator, wpr, 1));
  36159. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  36160. j = k;
  36161. while (j--) {
  36162. sum = finalise(sum.times(sum), wpr, 1);
  36163. } // Check to see if the first 4 rounding digits are [49]999.
  36164. // If so, repeat the summation with a higher precision, otherwise
  36165. // e.g. with precision: 18, rounding: 1
  36166. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  36167. // `wpr - guard` is the index of first rounding digit.
  36168. if (sd == null) {
  36169. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  36170. Ctor.precision = wpr += 10;
  36171. denominator = pow = t = new Ctor(1);
  36172. i = 0;
  36173. rep++;
  36174. } else {
  36175. return finalise(sum, Ctor.precision = pr, rm, external = true);
  36176. }
  36177. } else {
  36178. Ctor.precision = pr;
  36179. return sum;
  36180. }
  36181. }
  36182. sum = t;
  36183. }
  36184. }
  36185. /*
  36186. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  36187. * digits.
  36188. *
  36189. * ln(-n) = NaN
  36190. * ln(0) = -Infinity
  36191. * ln(-0) = -Infinity
  36192. * ln(1) = 0
  36193. * ln(Infinity) = Infinity
  36194. * ln(-Infinity) = NaN
  36195. * ln(NaN) = NaN
  36196. *
  36197. * ln(n) (n != 1) is non-terminating.
  36198. *
  36199. */
  36200. function naturalLogarithm(y, sd) {
  36201. var c,
  36202. c0,
  36203. denominator,
  36204. e,
  36205. numerator,
  36206. rep,
  36207. sum,
  36208. t,
  36209. wpr,
  36210. x1,
  36211. x2,
  36212. n = 1,
  36213. guard = 10,
  36214. x = y,
  36215. xd = x.d,
  36216. Ctor = x.constructor,
  36217. rm = Ctor.rounding,
  36218. pr = Ctor.precision;
  36219. // Is x negative or Infinity, NaN, 0 or 1?
  36220. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  36221. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  36222. }
  36223. if (sd == null) {
  36224. external = false;
  36225. wpr = pr;
  36226. } else {
  36227. wpr = sd;
  36228. }
  36229. Ctor.precision = wpr += guard;
  36230. c = digitsToString(xd);
  36231. c0 = c.charAt(0);
  36232. if (Math.abs(e = x.e) < 1.5e15) {
  36233. // Argument reduction.
  36234. // The series converges faster the closer the argument is to 1, so using
  36235. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  36236. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  36237. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  36238. // later be divided by this number, then separate out the power of 10 using
  36239. // ln(a*10^b) = ln(a) + b*ln(10).
  36240. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  36241. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  36242. // max n is 6 (gives 0.7 - 1.3)
  36243. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  36244. x = x.times(y);
  36245. c = digitsToString(x.d);
  36246. c0 = c.charAt(0);
  36247. n++;
  36248. }
  36249. e = x.e;
  36250. if (c0 > 1) {
  36251. x = new Ctor('0.' + c);
  36252. e++;
  36253. } else {
  36254. x = new Ctor(c0 + '.' + c.slice(1));
  36255. }
  36256. } else {
  36257. // The argument reduction method above may result in overflow if the argument y is a massive
  36258. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  36259. // function using ln(x*10^e) = ln(x) + e*ln(10).
  36260. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  36261. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  36262. Ctor.precision = pr;
  36263. return sd == null ? finalise(x, pr, rm, external = true) : x;
  36264. }
  36265. // x1 is x reduced to a value near 1.
  36266. x1 = x;
  36267. // Taylor series.
  36268. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  36269. // where x = (y - 1)/(y + 1) (|x| < 1)
  36270. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  36271. x2 = finalise(x.times(x), wpr, 1);
  36272. denominator = 3;
  36273. for (;;) {
  36274. numerator = finalise(numerator.times(x2), wpr, 1);
  36275. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  36276. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  36277. sum = sum.times(2);
  36278. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  36279. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  36280. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  36281. sum = divide(sum, new Ctor(n), wpr, 1);
  36282. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  36283. // been repeated previously) and the first 4 rounding digits 9999?
  36284. // If so, restart the summation with a higher precision, otherwise
  36285. // e.g. with precision: 12, rounding: 1
  36286. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  36287. // `wpr - guard` is the index of first rounding digit.
  36288. if (sd == null) {
  36289. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  36290. Ctor.precision = wpr += guard;
  36291. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  36292. x2 = finalise(x.times(x), wpr, 1);
  36293. denominator = rep = 1;
  36294. } else {
  36295. return finalise(sum, Ctor.precision = pr, rm, external = true);
  36296. }
  36297. } else {
  36298. Ctor.precision = pr;
  36299. return sum;
  36300. }
  36301. }
  36302. sum = t;
  36303. denominator += 2;
  36304. }
  36305. }
  36306. // ±Infinity, NaN.
  36307. function nonFiniteToString(x) {
  36308. // Unsigned.
  36309. return String(x.s * x.s / 0);
  36310. }
  36311. /*
  36312. * Parse the value of a new Decimal `x` from string `str`.
  36313. */
  36314. function parseDecimal(x, str) {
  36315. var e, i, len;
  36316. // Decimal point?
  36317. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  36318. // Exponential form?
  36319. if ((i = str.search(/e/i)) > 0) {
  36320. // Determine exponent.
  36321. if (e < 0) e = i;
  36322. e += +str.slice(i + 1);
  36323. str = str.substring(0, i);
  36324. } else if (e < 0) {
  36325. // Integer.
  36326. e = str.length;
  36327. }
  36328. // Determine leading zeros.
  36329. for (i = 0; str.charCodeAt(i) === 48; i++) {}
  36330. // Determine trailing zeros.
  36331. for (len = str.length; str.charCodeAt(len - 1) === 48; --len) {}
  36332. str = str.slice(i, len);
  36333. if (str) {
  36334. len -= i;
  36335. x.e = e = e - i - 1;
  36336. x.d = [];
  36337. // Transform base
  36338. // e is the base 10 exponent.
  36339. // i is where to slice str to get the first word of the digits array.
  36340. i = (e + 1) % LOG_BASE;
  36341. if (e < 0) i += LOG_BASE;
  36342. if (i < len) {
  36343. if (i) x.d.push(+str.slice(0, i));
  36344. for (len -= LOG_BASE; i < len;) {
  36345. x.d.push(+str.slice(i, i += LOG_BASE));
  36346. }str = str.slice(i);
  36347. i = LOG_BASE - str.length;
  36348. } else {
  36349. i -= len;
  36350. }
  36351. for (; i--;) {
  36352. str += '0';
  36353. }x.d.push(+str);
  36354. if (external) {
  36355. // Overflow?
  36356. if (x.e > x.constructor.maxE) {
  36357. // Infinity.
  36358. x.d = null;
  36359. x.e = NaN;
  36360. // Underflow?
  36361. } else if (x.e < x.constructor.minE) {
  36362. // Zero.
  36363. x.e = 0;
  36364. x.d = [0];
  36365. // x.constructor.underflow = true;
  36366. } // else x.constructor.underflow = false;
  36367. }
  36368. } else {
  36369. // Zero.
  36370. x.e = 0;
  36371. x.d = [0];
  36372. }
  36373. return x;
  36374. }
  36375. /*
  36376. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  36377. */
  36378. function parseOther(x, str) {
  36379. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  36380. if (str === 'Infinity' || str === 'NaN') {
  36381. if (!+str) x.s = NaN;
  36382. x.e = NaN;
  36383. x.d = null;
  36384. return x;
  36385. }
  36386. if (isHex.test(str)) {
  36387. base = 16;
  36388. str = str.toLowerCase();
  36389. } else if (isBinary.test(str)) {
  36390. base = 2;
  36391. } else if (isOctal.test(str)) {
  36392. base = 8;
  36393. } else {
  36394. throw Error(invalidArgument + str);
  36395. }
  36396. // Is there a binary exponent part?
  36397. i = str.search(/p/i);
  36398. if (i > 0) {
  36399. p = +str.slice(i + 1);
  36400. str = str.substring(2, i);
  36401. } else {
  36402. str = str.slice(2);
  36403. }
  36404. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  36405. // fraction part will be restored.
  36406. i = str.indexOf('.');
  36407. isFloat = i >= 0;
  36408. Ctor = x.constructor;
  36409. if (isFloat) {
  36410. str = str.replace('.', '');
  36411. len = str.length;
  36412. i = len - i;
  36413. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  36414. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  36415. }
  36416. xd = convertBase(str, base, BASE);
  36417. xe = xd.length - 1;
  36418. // Remove trailing zeros.
  36419. for (i = xe; xd[i] === 0; --i) {
  36420. xd.pop();
  36421. }if (i < 0) return new Ctor(x.s * 0);
  36422. x.e = getBase10Exponent(xd, xe);
  36423. x.d = xd;
  36424. external = false;
  36425. // At what precision to perform the division to ensure exact conversion?
  36426. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  36427. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  36428. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  36429. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  36430. // Therefore using 4 * the number of digits of str will always be enough.
  36431. if (isFloat) x = divide(x, divisor, len * 4);
  36432. // Multiply by the binary exponent part if present.
  36433. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  36434. external = true;
  36435. return x;
  36436. }
  36437. /*
  36438. * sin(x) = x - x^3/3! + x^5/5! - ...
  36439. * |x| < pi/2
  36440. *
  36441. */
  36442. function sine(Ctor, x) {
  36443. var k,
  36444. len = x.d.length;
  36445. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  36446. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  36447. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  36448. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  36449. // Estimate the optimum number of times to use the argument reduction.
  36450. k = 1.4 * Math.sqrt(len);
  36451. k = k > 16 ? 16 : k | 0;
  36452. // Max k before Math.pow precision loss is 22
  36453. x = x.times(Math.pow(5, -k));
  36454. x = taylorSeries(Ctor, 2, x, x);
  36455. // Reverse argument reduction
  36456. var sin2_x,
  36457. d5 = new Ctor(5),
  36458. d16 = new Ctor(16),
  36459. d20 = new Ctor(20);
  36460. for (; k--;) {
  36461. sin2_x = x.times(x);
  36462. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  36463. }
  36464. return x;
  36465. }
  36466. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  36467. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  36468. var j,
  36469. t,
  36470. u,
  36471. x2,
  36472. i = 1,
  36473. pr = Ctor.precision,
  36474. k = Math.ceil(pr / LOG_BASE);
  36475. external = false;
  36476. x2 = x.times(x);
  36477. u = new Ctor(y);
  36478. for (;;) {
  36479. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  36480. u = isHyperbolic ? y.plus(t) : y.minus(t);
  36481. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  36482. t = u.plus(y);
  36483. if (t.d[k] !== void 0) {
  36484. for (j = k; t.d[j] === u.d[j] && j--;) {}
  36485. if (j == -1) break;
  36486. }
  36487. j = u;
  36488. u = y;
  36489. y = t;
  36490. t = j;
  36491. i++;
  36492. }
  36493. external = true;
  36494. t.d.length = k + 1;
  36495. return t;
  36496. }
  36497. // Return the absolute value of `x` reduced to less than or equal to half pi.
  36498. function toLessThanHalfPi(Ctor, x) {
  36499. var t,
  36500. isNeg = x.s < 0,
  36501. pi = getPi(Ctor, Ctor.precision, 1),
  36502. halfPi = pi.times(0.5);
  36503. x = x.abs();
  36504. if (x.lte(halfPi)) {
  36505. quadrant = isNeg ? 4 : 1;
  36506. return x;
  36507. }
  36508. t = x.divToInt(pi);
  36509. if (t.isZero()) {
  36510. quadrant = isNeg ? 3 : 2;
  36511. } else {
  36512. x = x.minus(t.times(pi));
  36513. // 0 <= x < pi
  36514. if (x.lte(halfPi)) {
  36515. quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1;
  36516. return x;
  36517. }
  36518. quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2;
  36519. }
  36520. return x.minus(pi).abs();
  36521. }
  36522. /*
  36523. * Return the value of Decimal `x` as a string in base `baseOut`.
  36524. *
  36525. * If the optional `sd` argument is present include a binary exponent suffix.
  36526. */
  36527. function toStringBinary(x, baseOut, sd, rm) {
  36528. var base,
  36529. e,
  36530. i,
  36531. k,
  36532. len,
  36533. roundUp,
  36534. str,
  36535. xd,
  36536. y,
  36537. Ctor = x.constructor,
  36538. isExp = sd !== void 0;
  36539. if (isExp) {
  36540. checkInt32(sd, 1, MAX_DIGITS);
  36541. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  36542. } else {
  36543. sd = Ctor.precision;
  36544. rm = Ctor.rounding;
  36545. }
  36546. if (!x.isFinite()) {
  36547. str = nonFiniteToString(x);
  36548. } else {
  36549. str = finiteToString(x);
  36550. i = str.indexOf('.');
  36551. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  36552. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  36553. // minBinaryExponent = floor(decimalExponent * log[2](10))
  36554. // log[2](10) = 3.321928094887362347870319429489390175864
  36555. if (isExp) {
  36556. base = 2;
  36557. if (baseOut == 16) {
  36558. sd = sd * 4 - 3;
  36559. } else if (baseOut == 8) {
  36560. sd = sd * 3 - 2;
  36561. }
  36562. } else {
  36563. base = baseOut;
  36564. }
  36565. // Convert the number as an integer then divide the result by its base raised to a power such
  36566. // that the fraction part will be restored.
  36567. // Non-integer.
  36568. if (i >= 0) {
  36569. str = str.replace('.', '');
  36570. y = new Ctor(1);
  36571. y.e = str.length - i;
  36572. y.d = convertBase(finiteToString(y), 10, base);
  36573. y.e = y.d.length;
  36574. }
  36575. xd = convertBase(str, 10, base);
  36576. e = len = xd.length;
  36577. // Remove trailing zeros.
  36578. for (; xd[--len] == 0;) {
  36579. xd.pop();
  36580. }if (!xd[0]) {
  36581. str = isExp ? '0p+0' : '0';
  36582. } else {
  36583. if (i < 0) {
  36584. e--;
  36585. } else {
  36586. x = new Ctor(x);
  36587. x.d = xd;
  36588. x.e = e;
  36589. x = divide(x, y, sd, rm, 0, base);
  36590. xd = x.d;
  36591. e = x.e;
  36592. roundUp = inexact;
  36593. }
  36594. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  36595. i = xd[sd];
  36596. k = base / 2;
  36597. roundUp = roundUp || xd[sd + 1] !== void 0;
  36598. 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));
  36599. xd.length = sd;
  36600. if (roundUp) {
  36601. // Rounding up may mean the previous digit has to be rounded up and so on.
  36602. for (; ++xd[--sd] > base - 1;) {
  36603. xd[sd] = 0;
  36604. if (!sd) {
  36605. ++e;
  36606. xd.unshift(1);
  36607. }
  36608. }
  36609. }
  36610. // Determine trailing zeros.
  36611. for (len = xd.length; !xd[len - 1]; --len) {}
  36612. // E.g. [4, 11, 15] becomes 4bf.
  36613. for (i = 0, str = ''; i < len; i++) {
  36614. str += NUMERALS.charAt(xd[i]);
  36615. } // Add binary exponent suffix?
  36616. if (isExp) {
  36617. if (len > 1) {
  36618. if (baseOut == 16 || baseOut == 8) {
  36619. i = baseOut == 16 ? 4 : 3;
  36620. for (--len; len % i; len++) {
  36621. str += '0';
  36622. }xd = convertBase(str, base, baseOut);
  36623. for (len = xd.length; !xd[len - 1]; --len) {}
  36624. // xd[0] will always be be 1
  36625. for (i = 1, str = '1.'; i < len; i++) {
  36626. str += NUMERALS.charAt(xd[i]);
  36627. }
  36628. } else {
  36629. str = str.charAt(0) + '.' + str.slice(1);
  36630. }
  36631. }
  36632. str = str + (e < 0 ? 'p' : 'p+') + e;
  36633. } else if (e < 0) {
  36634. for (; ++e;) {
  36635. str = '0' + str;
  36636. }str = '0.' + str;
  36637. } else {
  36638. if (++e > len) for (e -= len; e--;) {
  36639. str += '0';
  36640. } else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  36641. }
  36642. }
  36643. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  36644. }
  36645. return x.s < 0 ? '-' + str : str;
  36646. }
  36647. // Does not strip trailing zeros.
  36648. function truncate(arr, len) {
  36649. if (arr.length > len) {
  36650. arr.length = len;
  36651. return true;
  36652. }
  36653. }
  36654. // Decimal methods
  36655. /*
  36656. * abs
  36657. * acos
  36658. * acosh
  36659. * add
  36660. * asin
  36661. * asinh
  36662. * atan
  36663. * atanh
  36664. * atan2
  36665. * cbrt
  36666. * ceil
  36667. * clone
  36668. * config
  36669. * cos
  36670. * cosh
  36671. * div
  36672. * exp
  36673. * floor
  36674. * hypot
  36675. * ln
  36676. * log
  36677. * log2
  36678. * log10
  36679. * max
  36680. * min
  36681. * mod
  36682. * mul
  36683. * pow
  36684. * random
  36685. * round
  36686. * set
  36687. * sign
  36688. * sin
  36689. * sinh
  36690. * sqrt
  36691. * sub
  36692. * tan
  36693. * tanh
  36694. * trunc
  36695. */
  36696. /*
  36697. * Return a new Decimal whose value is the absolute value of `x`.
  36698. *
  36699. * x {number|string|Decimal}
  36700. *
  36701. */
  36702. function abs(x) {
  36703. return new this(x).abs();
  36704. }
  36705. /*
  36706. * Return a new Decimal whose value is the arccosine in radians of `x`.
  36707. *
  36708. * x {number|string|Decimal}
  36709. *
  36710. */
  36711. function acos(x) {
  36712. return new this(x).acos();
  36713. }
  36714. /*
  36715. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  36716. * `precision` significant digits using rounding mode `rounding`.
  36717. *
  36718. * x {number|string|Decimal} A value in radians.
  36719. *
  36720. */
  36721. function acosh(x) {
  36722. return new this(x).acosh();
  36723. }
  36724. /*
  36725. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  36726. * digits using rounding mode `rounding`.
  36727. *
  36728. * x {number|string|Decimal}
  36729. * y {number|string|Decimal}
  36730. *
  36731. */
  36732. function add(x, y) {
  36733. return new this(x).plus(y);
  36734. }
  36735. /*
  36736. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  36737. * significant digits using rounding mode `rounding`.
  36738. *
  36739. * x {number|string|Decimal}
  36740. *
  36741. */
  36742. function asin(x) {
  36743. return new this(x).asin();
  36744. }
  36745. /*
  36746. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  36747. * `precision` significant digits using rounding mode `rounding`.
  36748. *
  36749. * x {number|string|Decimal} A value in radians.
  36750. *
  36751. */
  36752. function asinh(x) {
  36753. return new this(x).asinh();
  36754. }
  36755. /*
  36756. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  36757. * significant digits using rounding mode `rounding`.
  36758. *
  36759. * x {number|string|Decimal}
  36760. *
  36761. */
  36762. function atan(x) {
  36763. return new this(x).atan();
  36764. }
  36765. /*
  36766. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  36767. * `precision` significant digits using rounding mode `rounding`.
  36768. *
  36769. * x {number|string|Decimal} A value in radians.
  36770. *
  36771. */
  36772. function atanh(x) {
  36773. return new this(x).atanh();
  36774. }
  36775. /*
  36776. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  36777. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  36778. *
  36779. * Domain: [-Infinity, Infinity]
  36780. * Range: [-pi, pi]
  36781. *
  36782. * y {number|string|Decimal} The y-coordinate.
  36783. * x {number|string|Decimal} The x-coordinate.
  36784. *
  36785. * atan2(±0, -0) = ±pi
  36786. * atan2(±0, +0) = ±0
  36787. * atan2(±0, -x) = ±pi for x > 0
  36788. * atan2(±0, x) = ±0 for x > 0
  36789. * atan2(-y, ±0) = -pi/2 for y > 0
  36790. * atan2(y, ±0) = pi/2 for y > 0
  36791. * atan2(±y, -Infinity) = ±pi for finite y > 0
  36792. * atan2(±y, +Infinity) = ±0 for finite y > 0
  36793. * atan2(±Infinity, x) = ±pi/2 for finite x
  36794. * atan2(±Infinity, -Infinity) = ±3*pi/4
  36795. * atan2(±Infinity, +Infinity) = ±pi/4
  36796. * atan2(NaN, x) = NaN
  36797. * atan2(y, NaN) = NaN
  36798. *
  36799. */
  36800. function atan2(y, x) {
  36801. y = new this(y);
  36802. x = new this(x);
  36803. var r,
  36804. pr = this.precision,
  36805. rm = this.rounding,
  36806. wpr = pr + 4;
  36807. // Either NaN
  36808. if (!y.s || !x.s) {
  36809. r = new this(NaN);
  36810. // Both ±Infinity
  36811. } else if (!y.d && !x.d) {
  36812. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  36813. r.s = y.s;
  36814. // x is ±Infinity or y is ±0
  36815. } else if (!x.d || y.isZero()) {
  36816. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  36817. r.s = y.s;
  36818. // y is ±Infinity or x is ±0
  36819. } else if (!y.d || x.isZero()) {
  36820. r = getPi(this, wpr, 1).times(0.5);
  36821. r.s = y.s;
  36822. // Both non-zero and finite
  36823. } else if (x.s < 0) {
  36824. this.precision = wpr;
  36825. this.rounding = 1;
  36826. r = this.atan(divide(y, x, wpr, 1));
  36827. x = getPi(this, wpr, 1);
  36828. this.precision = pr;
  36829. this.rounding = rm;
  36830. r = y.s < 0 ? r.minus(x) : r.plus(x);
  36831. } else {
  36832. r = this.atan(divide(y, x, wpr, 1));
  36833. }
  36834. return r;
  36835. }
  36836. /*
  36837. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  36838. * digits using rounding mode `rounding`.
  36839. *
  36840. * x {number|string|Decimal}
  36841. *
  36842. */
  36843. function cbrt(x) {
  36844. return new this(x).cbrt();
  36845. }
  36846. /*
  36847. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  36848. *
  36849. * x {number|string|Decimal}
  36850. *
  36851. */
  36852. function ceil(x) {
  36853. return finalise(x = new this(x), x.e + 1, 2);
  36854. }
  36855. /*
  36856. * Configure global settings for a Decimal constructor.
  36857. *
  36858. * `obj` is an object with one or more of the following properties,
  36859. *
  36860. * precision {number}
  36861. * rounding {number}
  36862. * toExpNeg {number}
  36863. * toExpPos {number}
  36864. * maxE {number}
  36865. * minE {number}
  36866. * modulo {number}
  36867. * crypto {boolean|number}
  36868. * defaults {true}
  36869. *
  36870. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  36871. *
  36872. */
  36873. function config(obj) {
  36874. if (!obj || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') throw Error(decimalError + 'Object expected');
  36875. var i,
  36876. p,
  36877. v,
  36878. useDefaults = obj.defaults === true,
  36879. 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];
  36880. for (i = 0; i < ps.length; i += 3) {
  36881. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  36882. if ((v = obj[p]) !== void 0) {
  36883. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;else throw Error(invalidArgument + p + ': ' + v);
  36884. }
  36885. }
  36886. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  36887. if ((v = obj[p]) !== void 0) {
  36888. if (v === true || v === false || v === 0 || v === 1) {
  36889. if (v) {
  36890. if (typeof crypto != 'undefined' && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
  36891. this[p] = true;
  36892. } else {
  36893. throw Error(cryptoUnavailable);
  36894. }
  36895. } else {
  36896. this[p] = false;
  36897. }
  36898. } else {
  36899. throw Error(invalidArgument + p + ': ' + v);
  36900. }
  36901. }
  36902. return this;
  36903. }
  36904. /*
  36905. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  36906. * digits using rounding mode `rounding`.
  36907. *
  36908. * x {number|string|Decimal} A value in radians.
  36909. *
  36910. */
  36911. function cos(x) {
  36912. return new this(x).cos();
  36913. }
  36914. /*
  36915. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  36916. * significant digits using rounding mode `rounding`.
  36917. *
  36918. * x {number|string|Decimal} A value in radians.
  36919. *
  36920. */
  36921. function cosh(x) {
  36922. return new this(x).cosh();
  36923. }
  36924. /*
  36925. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  36926. * constructor.
  36927. *
  36928. */
  36929. function clone(obj) {
  36930. var i, p, ps;
  36931. /*
  36932. * The Decimal constructor and exported function.
  36933. * Return a new Decimal instance.
  36934. *
  36935. * v {number|string|Decimal} A numeric value.
  36936. *
  36937. */
  36938. function Decimal(v) {
  36939. var e,
  36940. i,
  36941. t,
  36942. x = this;
  36943. // Decimal called without new.
  36944. if (!(x instanceof Decimal)) return new Decimal(v);
  36945. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  36946. // which points to Object.
  36947. x.constructor = Decimal;
  36948. // Duplicate.
  36949. if (v instanceof Decimal) {
  36950. x.s = v.s;
  36951. x.e = v.e;
  36952. x.d = (v = v.d) ? v.slice() : v;
  36953. return;
  36954. }
  36955. t = typeof v === 'undefined' ? 'undefined' : _typeof(v);
  36956. if (t === 'number') {
  36957. if (v === 0) {
  36958. x.s = 1 / v < 0 ? -1 : 1;
  36959. x.e = 0;
  36960. x.d = [0];
  36961. return;
  36962. }
  36963. if (v < 0) {
  36964. v = -v;
  36965. x.s = -1;
  36966. } else {
  36967. x.s = 1;
  36968. }
  36969. // Fast path for small integers.
  36970. if (v === ~~v && v < 1e7) {
  36971. for (e = 0, i = v; i >= 10; i /= 10) {
  36972. e++;
  36973. }x.e = e;
  36974. x.d = [v];
  36975. return;
  36976. // Infinity, NaN.
  36977. } else if (v * 0 !== 0) {
  36978. if (!v) x.s = NaN;
  36979. x.e = NaN;
  36980. x.d = null;
  36981. return;
  36982. }
  36983. return parseDecimal(x, v.toString());
  36984. } else if (t !== 'string') {
  36985. throw Error(invalidArgument + v);
  36986. }
  36987. // Minus sign?
  36988. if (v.charCodeAt(0) === 45) {
  36989. v = v.slice(1);
  36990. x.s = -1;
  36991. } else {
  36992. x.s = 1;
  36993. }
  36994. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  36995. }
  36996. Decimal.prototype = P;
  36997. Decimal.ROUND_UP = 0;
  36998. Decimal.ROUND_DOWN = 1;
  36999. Decimal.ROUND_CEIL = 2;
  37000. Decimal.ROUND_FLOOR = 3;
  37001. Decimal.ROUND_HALF_UP = 4;
  37002. Decimal.ROUND_HALF_DOWN = 5;
  37003. Decimal.ROUND_HALF_EVEN = 6;
  37004. Decimal.ROUND_HALF_CEIL = 7;
  37005. Decimal.ROUND_HALF_FLOOR = 8;
  37006. Decimal.EUCLID = 9;
  37007. Decimal.config = Decimal.set = config;
  37008. Decimal.clone = clone;
  37009. Decimal.isDecimal = isDecimalInstance;
  37010. Decimal.abs = abs;
  37011. Decimal.acos = acos;
  37012. Decimal.acosh = acosh; // ES6
  37013. Decimal.add = add;
  37014. Decimal.asin = asin;
  37015. Decimal.asinh = asinh; // ES6
  37016. Decimal.atan = atan;
  37017. Decimal.atanh = atanh; // ES6
  37018. Decimal.atan2 = atan2;
  37019. Decimal.cbrt = cbrt; // ES6
  37020. Decimal.ceil = ceil;
  37021. Decimal.cos = cos;
  37022. Decimal.cosh = cosh; // ES6
  37023. Decimal.div = div;
  37024. Decimal.exp = exp;
  37025. Decimal.floor = floor;
  37026. Decimal.hypot = hypot; // ES6
  37027. Decimal.ln = ln;
  37028. Decimal.log = log;
  37029. Decimal.log10 = log10; // ES6
  37030. Decimal.log2 = log2; // ES6
  37031. Decimal.max = max;
  37032. Decimal.min = min;
  37033. Decimal.mod = mod;
  37034. Decimal.mul = mul;
  37035. Decimal.pow = pow;
  37036. Decimal.random = random;
  37037. Decimal.round = round;
  37038. Decimal.sign = sign; // ES6
  37039. Decimal.sin = sin;
  37040. Decimal.sinh = sinh; // ES6
  37041. Decimal.sqrt = sqrt;
  37042. Decimal.sub = sub;
  37043. Decimal.tan = tan;
  37044. Decimal.tanh = tanh; // ES6
  37045. Decimal.trunc = trunc; // ES6
  37046. if (obj === void 0) obj = {};
  37047. if (obj) {
  37048. if (obj.defaults !== true) {
  37049. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  37050. for (i = 0; i < ps.length;) {
  37051. if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  37052. }
  37053. }
  37054. }
  37055. Decimal.config(obj);
  37056. return Decimal;
  37057. }
  37058. /*
  37059. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  37060. * digits using rounding mode `rounding`.
  37061. *
  37062. * x {number|string|Decimal}
  37063. * y {number|string|Decimal}
  37064. *
  37065. */
  37066. function div(x, y) {
  37067. return new this(x).div(y);
  37068. }
  37069. /*
  37070. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  37071. * significant digits using rounding mode `rounding`.
  37072. *
  37073. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  37074. *
  37075. */
  37076. function exp(x) {
  37077. return new this(x).exp();
  37078. }
  37079. /*
  37080. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  37081. *
  37082. * x {number|string|Decimal}
  37083. *
  37084. */
  37085. function floor(x) {
  37086. return finalise(x = new this(x), x.e + 1, 3);
  37087. }
  37088. /*
  37089. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  37090. * rounded to `precision` significant digits using rounding mode `rounding`.
  37091. *
  37092. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  37093. *
  37094. */
  37095. function hypot() {
  37096. var i,
  37097. n,
  37098. t = new this(0);
  37099. external = false;
  37100. for (i = 0; i < arguments.length;) {
  37101. n = new this(arguments[i++]);
  37102. if (!n.d) {
  37103. if (n.s) {
  37104. external = true;
  37105. return new this(1 / 0);
  37106. }
  37107. t = n;
  37108. } else if (t.d) {
  37109. t = t.plus(n.times(n));
  37110. }
  37111. }
  37112. external = true;
  37113. return t.sqrt();
  37114. }
  37115. /*
  37116. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  37117. * otherwise return false.
  37118. *
  37119. */
  37120. function isDecimalInstance(obj) {
  37121. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  37122. }
  37123. /*
  37124. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  37125. * significant digits using rounding mode `rounding`.
  37126. *
  37127. * x {number|string|Decimal}
  37128. *
  37129. */
  37130. function ln(x) {
  37131. return new this(x).ln();
  37132. }
  37133. /*
  37134. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  37135. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  37136. *
  37137. * log[y](x)
  37138. *
  37139. * x {number|string|Decimal} The argument of the logarithm.
  37140. * y {number|string|Decimal} The base of the logarithm.
  37141. *
  37142. */
  37143. function log(x, y) {
  37144. return new this(x).log(y);
  37145. }
  37146. /*
  37147. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  37148. * significant digits using rounding mode `rounding`.
  37149. *
  37150. * x {number|string|Decimal}
  37151. *
  37152. */
  37153. function log2(x) {
  37154. return new this(x).log(2);
  37155. }
  37156. /*
  37157. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  37158. * significant digits using rounding mode `rounding`.
  37159. *
  37160. * x {number|string|Decimal}
  37161. *
  37162. */
  37163. function log10(x) {
  37164. return new this(x).log(10);
  37165. }
  37166. /*
  37167. * Return a new Decimal whose value is the maximum of the arguments.
  37168. *
  37169. * arguments {number|string|Decimal}
  37170. *
  37171. */
  37172. function max() {
  37173. return maxOrMin(this, arguments, 'lt');
  37174. }
  37175. /*
  37176. * Return a new Decimal whose value is the minimum of the arguments.
  37177. *
  37178. * arguments {number|string|Decimal}
  37179. *
  37180. */
  37181. function min() {
  37182. return maxOrMin(this, arguments, 'gt');
  37183. }
  37184. /*
  37185. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  37186. * using rounding mode `rounding`.
  37187. *
  37188. * x {number|string|Decimal}
  37189. * y {number|string|Decimal}
  37190. *
  37191. */
  37192. function mod(x, y) {
  37193. return new this(x).mod(y);
  37194. }
  37195. /*
  37196. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  37197. * digits using rounding mode `rounding`.
  37198. *
  37199. * x {number|string|Decimal}
  37200. * y {number|string|Decimal}
  37201. *
  37202. */
  37203. function mul(x, y) {
  37204. return new this(x).mul(y);
  37205. }
  37206. /*
  37207. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  37208. * significant digits using rounding mode `rounding`.
  37209. *
  37210. * x {number|string|Decimal} The base.
  37211. * y {number|string|Decimal} The exponent.
  37212. *
  37213. */
  37214. function pow(x, y) {
  37215. return new this(x).pow(y);
  37216. }
  37217. /*
  37218. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  37219. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  37220. * are produced).
  37221. *
  37222. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  37223. *
  37224. */
  37225. function random(sd) {
  37226. var d,
  37227. e,
  37228. k,
  37229. n,
  37230. i = 0,
  37231. r = new this(1),
  37232. rd = [];
  37233. if (sd === void 0) sd = this.precision;else checkInt32(sd, 1, MAX_DIGITS);
  37234. k = Math.ceil(sd / LOG_BASE);
  37235. if (!this.crypto) {
  37236. for (; i < k;) {
  37237. rd[i++] = Math.random() * 1e7 | 0;
  37238. } // Browsers supporting crypto.getRandomValues.
  37239. } else if (crypto.getRandomValues) {
  37240. d = crypto.getRandomValues(new Uint32Array(k));
  37241. for (; i < k;) {
  37242. n = d[i];
  37243. // 0 <= n < 4294967296
  37244. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  37245. if (n >= 4.29e9) {
  37246. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  37247. } else {
  37248. // 0 <= n <= 4289999999
  37249. // 0 <= (n % 1e7) <= 9999999
  37250. rd[i++] = n % 1e7;
  37251. }
  37252. }
  37253. // Node.js supporting crypto.randomBytes.
  37254. } else if (crypto.randomBytes) {
  37255. // buffer
  37256. d = crypto.randomBytes(k *= 4);
  37257. for (; i < k;) {
  37258. // 0 <= n < 2147483648
  37259. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  37260. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  37261. if (n >= 2.14e9) {
  37262. crypto.randomBytes(4).copy(d, i);
  37263. } else {
  37264. // 0 <= n <= 2139999999
  37265. // 0 <= (n % 1e7) <= 9999999
  37266. rd.push(n % 1e7);
  37267. i += 4;
  37268. }
  37269. }
  37270. i = k / 4;
  37271. } else {
  37272. throw Error(cryptoUnavailable);
  37273. }
  37274. k = rd[--i];
  37275. sd %= LOG_BASE;
  37276. // Convert trailing digits to zeros according to sd.
  37277. if (k && sd) {
  37278. n = mathpow(10, LOG_BASE - sd);
  37279. rd[i] = (k / n | 0) * n;
  37280. }
  37281. // Remove trailing words which are zero.
  37282. for (; rd[i] === 0; i--) {
  37283. rd.pop();
  37284. } // Zero?
  37285. if (i < 0) {
  37286. e = 0;
  37287. rd = [0];
  37288. } else {
  37289. e = -1;
  37290. // Remove leading words which are zero and adjust exponent accordingly.
  37291. for (; rd[0] === 0; e -= LOG_BASE) {
  37292. rd.shift();
  37293. } // Count the digits of the first word of rd to determine leading zeros.
  37294. for (k = 1, n = rd[0]; n >= 10; n /= 10) {
  37295. k++;
  37296. } // Adjust the exponent for leading zeros of the first word of rd.
  37297. if (k < LOG_BASE) e -= LOG_BASE - k;
  37298. }
  37299. r.e = e;
  37300. r.d = rd;
  37301. return r;
  37302. }
  37303. /*
  37304. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  37305. *
  37306. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  37307. *
  37308. * x {number|string|Decimal}
  37309. *
  37310. */
  37311. function round(x) {
  37312. return finalise(x = new this(x), x.e + 1, this.rounding);
  37313. }
  37314. /*
  37315. * Return
  37316. * 1 if x > 0,
  37317. * -1 if x < 0,
  37318. * 0 if x is 0,
  37319. * -0 if x is -0,
  37320. * NaN otherwise
  37321. *
  37322. */
  37323. function sign(x) {
  37324. x = new this(x);
  37325. return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN;
  37326. }
  37327. /*
  37328. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  37329. * using rounding mode `rounding`.
  37330. *
  37331. * x {number|string|Decimal} A value in radians.
  37332. *
  37333. */
  37334. function sin(x) {
  37335. return new this(x).sin();
  37336. }
  37337. /*
  37338. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  37339. * significant digits using rounding mode `rounding`.
  37340. *
  37341. * x {number|string|Decimal} A value in radians.
  37342. *
  37343. */
  37344. function sinh(x) {
  37345. return new this(x).sinh();
  37346. }
  37347. /*
  37348. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  37349. * digits using rounding mode `rounding`.
  37350. *
  37351. * x {number|string|Decimal}
  37352. *
  37353. */
  37354. function sqrt(x) {
  37355. return new this(x).sqrt();
  37356. }
  37357. /*
  37358. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  37359. * using rounding mode `rounding`.
  37360. *
  37361. * x {number|string|Decimal}
  37362. * y {number|string|Decimal}
  37363. *
  37364. */
  37365. function sub(x, y) {
  37366. return new this(x).sub(y);
  37367. }
  37368. /*
  37369. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  37370. * digits using rounding mode `rounding`.
  37371. *
  37372. * x {number|string|Decimal} A value in radians.
  37373. *
  37374. */
  37375. function tan(x) {
  37376. return new this(x).tan();
  37377. }
  37378. /*
  37379. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  37380. * significant digits using rounding mode `rounding`.
  37381. *
  37382. * x {number|string|Decimal} A value in radians.
  37383. *
  37384. */
  37385. function tanh(x) {
  37386. return new this(x).tanh();
  37387. }
  37388. /*
  37389. * Return a new Decimal whose value is `x` truncated to an integer.
  37390. *
  37391. * x {number|string|Decimal}
  37392. *
  37393. */
  37394. function trunc(x) {
  37395. return finalise(x = new this(x), x.e + 1, 1);
  37396. }
  37397. // Create and configure initial Decimal constructor.
  37398. Decimal = clone(DEFAULTS);
  37399. Decimal['default'] = Decimal.Decimal = Decimal;
  37400. // Create the internal constants from their string values.
  37401. LN10 = new Decimal(LN10);
  37402. PI = new Decimal(PI);
  37403. // Export.
  37404. // AMD.
  37405. if (true) {
  37406. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  37407. return Decimal;
  37408. }).call(exports, __webpack_require__, exports, module),
  37409. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  37410. // Node and other environments that support module.exports.
  37411. } else {}
  37412. })(undefined);
  37413. /***/ }),
  37414. /***/ "./node_modules/jquery/dist/jquery.js":
  37415. /*!********************************************!*\
  37416. !*** ./node_modules/jquery/dist/jquery.js ***!
  37417. \********************************************/
  37418. /*! no static exports found */
  37419. /***/ (function(module, exports, __webpack_require__) {
  37420. "use strict";
  37421. /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  37422. 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; };
  37423. /*!
  37424. * jQuery JavaScript Library v3.3.1
  37425. * https://jquery.com/
  37426. *
  37427. * Includes Sizzle.js
  37428. * https://sizzlejs.com/
  37429. *
  37430. * Copyright JS Foundation and other contributors
  37431. * Released under the MIT license
  37432. * https://jquery.org/license
  37433. *
  37434. * Date: 2018-01-20T17:24Z
  37435. */
  37436. (function (global, factory) {
  37437. "use strict";
  37438. if (( false ? undefined : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
  37439. // For CommonJS and CommonJS-like environments where a proper `window`
  37440. // is present, execute the factory and get jQuery.
  37441. // For environments that do not have a `window` with a `document`
  37442. // (such as Node.js), expose a factory as module.exports.
  37443. // This accentuates the need for the creation of a real `window`.
  37444. // e.g. var jQuery = require("jquery")(window);
  37445. // See ticket #14549 for more info.
  37446. module.exports = global.document ? factory(global, true) : function (w) {
  37447. if (!w.document) {
  37448. throw new Error("jQuery requires a window with a document");
  37449. }
  37450. return factory(w);
  37451. };
  37452. } else {
  37453. factory(global);
  37454. }
  37455. // Pass this if window is not defined yet
  37456. })(typeof window !== "undefined" ? window : undefined, function (window, noGlobal) {
  37457. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  37458. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  37459. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  37460. // enough that all such attempts are guarded in a try block.
  37461. "use strict";
  37462. var arr = [];
  37463. var document = window.document;
  37464. var getProto = Object.getPrototypeOf;
  37465. var _slice = arr.slice;
  37466. var concat = arr.concat;
  37467. var push = arr.push;
  37468. var indexOf = arr.indexOf;
  37469. var class2type = {};
  37470. var toString = class2type.toString;
  37471. var hasOwn = class2type.hasOwnProperty;
  37472. var fnToString = hasOwn.toString;
  37473. var ObjectFunctionString = fnToString.call(Object);
  37474. var support = {};
  37475. var isFunction = function isFunction(obj) {
  37476. // Support: Chrome <=57, Firefox <=52
  37477. // In some browsers, typeof returns "function" for HTML <object> elements
  37478. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  37479. // We don't want to classify *any* DOM node as a function.
  37480. return typeof obj === "function" && typeof obj.nodeType !== "number";
  37481. };
  37482. var isWindow = function isWindow(obj) {
  37483. return obj != null && obj === obj.window;
  37484. };
  37485. var preservedScriptAttributes = {
  37486. type: true,
  37487. src: true,
  37488. noModule: true
  37489. };
  37490. function DOMEval(code, doc, node) {
  37491. doc = doc || document;
  37492. var i,
  37493. script = doc.createElement("script");
  37494. script.text = code;
  37495. if (node) {
  37496. for (i in preservedScriptAttributes) {
  37497. if (node[i]) {
  37498. script[i] = node[i];
  37499. }
  37500. }
  37501. }
  37502. doc.head.appendChild(script).parentNode.removeChild(script);
  37503. }
  37504. function toType(obj) {
  37505. if (obj == null) {
  37506. return obj + "";
  37507. }
  37508. // Support: Android <=2.3 only (functionish RegExp)
  37509. return (typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  37510. }
  37511. /* global Symbol */
  37512. // Defining this global in .eslintrc.json would create a danger of using the global
  37513. // unguarded in another place, it seems safer to define global only for this module
  37514. var version = "3.3.1",
  37515. // Define a local copy of jQuery
  37516. jQuery = function jQuery(selector, context) {
  37517. // The jQuery object is actually just the init constructor 'enhanced'
  37518. // Need init if jQuery is called (just allow error to be thrown if not included)
  37519. return new jQuery.fn.init(selector, context);
  37520. },
  37521. // Support: Android <=4.0 only
  37522. // Make sure we trim BOM and NBSP
  37523. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  37524. jQuery.fn = jQuery.prototype = {
  37525. // The current version of jQuery being used
  37526. jquery: version,
  37527. constructor: jQuery,
  37528. // The default length of a jQuery object is 0
  37529. length: 0,
  37530. toArray: function toArray() {
  37531. return _slice.call(this);
  37532. },
  37533. // Get the Nth element in the matched element set OR
  37534. // Get the whole matched element set as a clean array
  37535. get: function get(num) {
  37536. // Return all the elements in a clean array
  37537. if (num == null) {
  37538. return _slice.call(this);
  37539. }
  37540. // Return just the one element from the set
  37541. return num < 0 ? this[num + this.length] : this[num];
  37542. },
  37543. // Take an array of elements and push it onto the stack
  37544. // (returning the new matched element set)
  37545. pushStack: function pushStack(elems) {
  37546. // Build a new jQuery matched element set
  37547. var ret = jQuery.merge(this.constructor(), elems);
  37548. // Add the old object onto the stack (as a reference)
  37549. ret.prevObject = this;
  37550. // Return the newly-formed element set
  37551. return ret;
  37552. },
  37553. // Execute a callback for every element in the matched set.
  37554. each: function each(callback) {
  37555. return jQuery.each(this, callback);
  37556. },
  37557. map: function map(callback) {
  37558. return this.pushStack(jQuery.map(this, function (elem, i) {
  37559. return callback.call(elem, i, elem);
  37560. }));
  37561. },
  37562. slice: function slice() {
  37563. return this.pushStack(_slice.apply(this, arguments));
  37564. },
  37565. first: function first() {
  37566. return this.eq(0);
  37567. },
  37568. last: function last() {
  37569. return this.eq(-1);
  37570. },
  37571. eq: function eq(i) {
  37572. var len = this.length,
  37573. j = +i + (i < 0 ? len : 0);
  37574. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  37575. },
  37576. end: function end() {
  37577. return this.prevObject || this.constructor();
  37578. },
  37579. // For internal use only.
  37580. // Behaves like an Array's method, not like a jQuery method.
  37581. push: push,
  37582. sort: arr.sort,
  37583. splice: arr.splice
  37584. };
  37585. jQuery.extend = jQuery.fn.extend = function () {
  37586. var options,
  37587. name,
  37588. src,
  37589. copy,
  37590. copyIsArray,
  37591. clone,
  37592. target = arguments[0] || {},
  37593. i = 1,
  37594. length = arguments.length,
  37595. deep = false;
  37596. // Handle a deep copy situation
  37597. if (typeof target === "boolean") {
  37598. deep = target;
  37599. // Skip the boolean and the target
  37600. target = arguments[i] || {};
  37601. i++;
  37602. }
  37603. // Handle case when target is a string or something (possible in deep copy)
  37604. if ((typeof target === "undefined" ? "undefined" : _typeof(target)) !== "object" && !isFunction(target)) {
  37605. target = {};
  37606. }
  37607. // Extend jQuery itself if only one argument is passed
  37608. if (i === length) {
  37609. target = this;
  37610. i--;
  37611. }
  37612. for (; i < length; i++) {
  37613. // Only deal with non-null/undefined values
  37614. if ((options = arguments[i]) != null) {
  37615. // Extend the base object
  37616. for (name in options) {
  37617. src = target[name];
  37618. copy = options[name];
  37619. // Prevent never-ending loop
  37620. if (target === copy) {
  37621. continue;
  37622. }
  37623. // Recurse if we're merging plain objects or arrays
  37624. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
  37625. if (copyIsArray) {
  37626. copyIsArray = false;
  37627. clone = src && Array.isArray(src) ? src : [];
  37628. } else {
  37629. clone = src && jQuery.isPlainObject(src) ? src : {};
  37630. }
  37631. // Never move original objects, clone them
  37632. target[name] = jQuery.extend(deep, clone, copy);
  37633. // Don't bring in undefined values
  37634. } else if (copy !== undefined) {
  37635. target[name] = copy;
  37636. }
  37637. }
  37638. }
  37639. }
  37640. // Return the modified object
  37641. return target;
  37642. };
  37643. jQuery.extend({
  37644. // Unique for each copy of jQuery on the page
  37645. expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
  37646. // Assume jQuery is ready without the ready module
  37647. isReady: true,
  37648. error: function error(msg) {
  37649. throw new Error(msg);
  37650. },
  37651. noop: function noop() {},
  37652. isPlainObject: function isPlainObject(obj) {
  37653. var proto, Ctor;
  37654. // Detect obvious negatives
  37655. // Use toString instead of jQuery.type to catch host objects
  37656. if (!obj || toString.call(obj) !== "[object Object]") {
  37657. return false;
  37658. }
  37659. proto = getProto(obj);
  37660. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  37661. if (!proto) {
  37662. return true;
  37663. }
  37664. // Objects with prototype are plain iff they were constructed by a global Object function
  37665. Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
  37666. return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
  37667. },
  37668. isEmptyObject: function isEmptyObject(obj) {
  37669. /* eslint-disable no-unused-vars */
  37670. // See https://github.com/eslint/eslint/issues/6125
  37671. var name;
  37672. for (name in obj) {
  37673. return false;
  37674. }
  37675. return true;
  37676. },
  37677. // Evaluates a script in a global context
  37678. globalEval: function globalEval(code) {
  37679. DOMEval(code);
  37680. },
  37681. each: function each(obj, callback) {
  37682. var length,
  37683. i = 0;
  37684. if (isArrayLike(obj)) {
  37685. length = obj.length;
  37686. for (; i < length; i++) {
  37687. if (callback.call(obj[i], i, obj[i]) === false) {
  37688. break;
  37689. }
  37690. }
  37691. } else {
  37692. for (i in obj) {
  37693. if (callback.call(obj[i], i, obj[i]) === false) {
  37694. break;
  37695. }
  37696. }
  37697. }
  37698. return obj;
  37699. },
  37700. // Support: Android <=4.0 only
  37701. trim: function trim(text) {
  37702. return text == null ? "" : (text + "").replace(rtrim, "");
  37703. },
  37704. // results is for internal usage only
  37705. makeArray: function makeArray(arr, results) {
  37706. var ret = results || [];
  37707. if (arr != null) {
  37708. if (isArrayLike(Object(arr))) {
  37709. jQuery.merge(ret, typeof arr === "string" ? [arr] : arr);
  37710. } else {
  37711. push.call(ret, arr);
  37712. }
  37713. }
  37714. return ret;
  37715. },
  37716. inArray: function inArray(elem, arr, i) {
  37717. return arr == null ? -1 : indexOf.call(arr, elem, i);
  37718. },
  37719. // Support: Android <=4.0 only, PhantomJS 1 only
  37720. // push.apply(_, arraylike) throws on ancient WebKit
  37721. merge: function merge(first, second) {
  37722. var len = +second.length,
  37723. j = 0,
  37724. i = first.length;
  37725. for (; j < len; j++) {
  37726. first[i++] = second[j];
  37727. }
  37728. first.length = i;
  37729. return first;
  37730. },
  37731. grep: function grep(elems, callback, invert) {
  37732. var callbackInverse,
  37733. matches = [],
  37734. i = 0,
  37735. length = elems.length,
  37736. callbackExpect = !invert;
  37737. // Go through the array, only saving the items
  37738. // that pass the validator function
  37739. for (; i < length; i++) {
  37740. callbackInverse = !callback(elems[i], i);
  37741. if (callbackInverse !== callbackExpect) {
  37742. matches.push(elems[i]);
  37743. }
  37744. }
  37745. return matches;
  37746. },
  37747. // arg is for internal usage only
  37748. map: function map(elems, callback, arg) {
  37749. var length,
  37750. value,
  37751. i = 0,
  37752. ret = [];
  37753. // Go through the array, translating each of the items to their new values
  37754. if (isArrayLike(elems)) {
  37755. length = elems.length;
  37756. for (; i < length; i++) {
  37757. value = callback(elems[i], i, arg);
  37758. if (value != null) {
  37759. ret.push(value);
  37760. }
  37761. }
  37762. // Go through every key on the object,
  37763. } else {
  37764. for (i in elems) {
  37765. value = callback(elems[i], i, arg);
  37766. if (value != null) {
  37767. ret.push(value);
  37768. }
  37769. }
  37770. }
  37771. // Flatten any nested arrays
  37772. return concat.apply([], ret);
  37773. },
  37774. // A global GUID counter for objects
  37775. guid: 1,
  37776. // jQuery.support is not used in Core but other projects attach their
  37777. // properties to it so it needs to exist.
  37778. support: support
  37779. });
  37780. if (typeof Symbol === "function") {
  37781. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  37782. }
  37783. // Populate the class2type map
  37784. jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (i, name) {
  37785. class2type["[object " + name + "]"] = name.toLowerCase();
  37786. });
  37787. function isArrayLike(obj) {
  37788. // Support: real iOS 8.2 only (not reproducible in simulator)
  37789. // `in` check used to prevent JIT error (gh-2145)
  37790. // hasOwn isn't used here due to false negatives
  37791. // regarding Nodelist length in IE
  37792. var length = !!obj && "length" in obj && obj.length,
  37793. type = toType(obj);
  37794. if (isFunction(obj) || isWindow(obj)) {
  37795. return false;
  37796. }
  37797. return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  37798. }
  37799. var Sizzle =
  37800. /*!
  37801. * Sizzle CSS Selector Engine v2.3.3
  37802. * https://sizzlejs.com/
  37803. *
  37804. * Copyright jQuery Foundation and other contributors
  37805. * Released under the MIT license
  37806. * http://jquery.org/license
  37807. *
  37808. * Date: 2016-08-08
  37809. */
  37810. function (window) {
  37811. var i,
  37812. support,
  37813. Expr,
  37814. getText,
  37815. isXML,
  37816. tokenize,
  37817. compile,
  37818. select,
  37819. outermostContext,
  37820. sortInput,
  37821. hasDuplicate,
  37822. // Local document vars
  37823. setDocument,
  37824. document,
  37825. docElem,
  37826. documentIsHTML,
  37827. rbuggyQSA,
  37828. rbuggyMatches,
  37829. matches,
  37830. contains,
  37831. // Instance-specific data
  37832. expando = "sizzle" + 1 * new Date(),
  37833. preferredDoc = window.document,
  37834. dirruns = 0,
  37835. done = 0,
  37836. classCache = createCache(),
  37837. tokenCache = createCache(),
  37838. compilerCache = createCache(),
  37839. sortOrder = function sortOrder(a, b) {
  37840. if (a === b) {
  37841. hasDuplicate = true;
  37842. }
  37843. return 0;
  37844. },
  37845. // Instance methods
  37846. hasOwn = {}.hasOwnProperty,
  37847. arr = [],
  37848. pop = arr.pop,
  37849. push_native = arr.push,
  37850. push = arr.push,
  37851. slice = arr.slice,
  37852. // Use a stripped-down indexOf as it's faster than native
  37853. // https://jsperf.com/thor-indexof-vs-for/5
  37854. indexOf = function indexOf(list, elem) {
  37855. var i = 0,
  37856. len = list.length;
  37857. for (; i < len; i++) {
  37858. if (list[i] === elem) {
  37859. return i;
  37860. }
  37861. }
  37862. return -1;
  37863. },
  37864. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  37865. // Regular expressions
  37866. // http://www.w3.org/TR/css3-selectors/#whitespace
  37867. whitespace = "[\\x20\\t\\r\\n\\f]",
  37868. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  37869. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  37870. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  37871. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  37872. // Operator (capture 2)
  37873. "*([*^$|!~]?=)" + whitespace +
  37874. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  37875. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
  37876. pseudos = ":(" + identifier + ")(?:\\((" +
  37877. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  37878. // 1. quoted (capture 3; capture 4 or capture 5)
  37879. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  37880. // 2. simple (capture 6)
  37881. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  37882. // 3. anything else (capture 2)
  37883. ".*" + ")\\)|)",
  37884. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  37885. rwhitespace = new RegExp(whitespace + "+", "g"),
  37886. rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
  37887. rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
  37888. rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
  37889. rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
  37890. rpseudo = new RegExp(pseudos),
  37891. ridentifier = new RegExp("^" + identifier + "$"),
  37892. matchExpr = {
  37893. "ID": new RegExp("^#(" + identifier + ")"),
  37894. "CLASS": new RegExp("^\\.(" + identifier + ")"),
  37895. "TAG": new RegExp("^(" + identifier + "|[*])"),
  37896. "ATTR": new RegExp("^" + attributes),
  37897. "PSEUDO": new RegExp("^" + pseudos),
  37898. "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
  37899. "bool": new RegExp("^(?:" + booleans + ")$", "i"),
  37900. // For use in libraries implementing .is()
  37901. // We use this for POS matching in `select`
  37902. "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  37903. },
  37904. rinputs = /^(?:input|select|textarea|button)$/i,
  37905. rheader = /^h\d$/i,
  37906. rnative = /^[^{]+\{\s*\[native \w/,
  37907. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  37908. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  37909. rsibling = /[+~]/,
  37910. // CSS escapes
  37911. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  37912. runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
  37913. funescape = function funescape(_, escaped, escapedWhitespace) {
  37914. var high = "0x" + escaped - 0x10000;
  37915. // NaN means non-codepoint
  37916. // Support: Firefox<24
  37917. // Workaround erroneous numeric interpretation of +"0x"
  37918. return high !== high || escapedWhitespace ? escaped : high < 0 ?
  37919. // BMP codepoint
  37920. String.fromCharCode(high + 0x10000) :
  37921. // Supplemental Plane codepoint (surrogate pair)
  37922. String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
  37923. },
  37924. // CSS string/identifier serialization
  37925. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  37926. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  37927. fcssescape = function fcssescape(ch, asCodePoint) {
  37928. if (asCodePoint) {
  37929. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  37930. if (ch === "\0") {
  37931. return "\uFFFD";
  37932. }
  37933. // Control characters and (dependent upon position) numbers get escaped as code points
  37934. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  37935. }
  37936. // Other potentially-special ASCII characters get backslash-escaped
  37937. return "\\" + ch;
  37938. },
  37939. // Used for iframes
  37940. // See setDocument()
  37941. // Removing the function wrapper causes a "Permission Denied"
  37942. // error in IE
  37943. unloadHandler = function unloadHandler() {
  37944. setDocument();
  37945. },
  37946. disabledAncestor = addCombinator(function (elem) {
  37947. return elem.disabled === true && ("form" in elem || "label" in elem);
  37948. }, { dir: "parentNode", next: "legend" });
  37949. // Optimize for push.apply( _, NodeList )
  37950. try {
  37951. push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);
  37952. // Support: Android<4.0
  37953. // Detect silently failing push.apply
  37954. arr[preferredDoc.childNodes.length].nodeType;
  37955. } catch (e) {
  37956. push = { apply: arr.length ?
  37957. // Leverage slice if possible
  37958. function (target, els) {
  37959. push_native.apply(target, slice.call(els));
  37960. } :
  37961. // Support: IE<9
  37962. // Otherwise append directly
  37963. function (target, els) {
  37964. var j = target.length,
  37965. i = 0;
  37966. // Can't trust NodeList.length
  37967. while (target[j++] = els[i++]) {}
  37968. target.length = j - 1;
  37969. }
  37970. };
  37971. }
  37972. function Sizzle(selector, context, results, seed) {
  37973. var m,
  37974. i,
  37975. elem,
  37976. nid,
  37977. match,
  37978. groups,
  37979. newSelector,
  37980. newContext = context && context.ownerDocument,
  37981. // nodeType defaults to 9, since context defaults to document
  37982. nodeType = context ? context.nodeType : 9;
  37983. results = results || [];
  37984. // Return early from calls with invalid selector or context
  37985. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  37986. return results;
  37987. }
  37988. // Try to shortcut find operations (as opposed to filters) in HTML documents
  37989. if (!seed) {
  37990. if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
  37991. setDocument(context);
  37992. }
  37993. context = context || document;
  37994. if (documentIsHTML) {
  37995. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  37996. // (excepting DocumentFragment context, where the methods don't exist)
  37997. if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
  37998. // ID selector
  37999. if (m = match[1]) {
  38000. // Document context
  38001. if (nodeType === 9) {
  38002. if (elem = context.getElementById(m)) {
  38003. // Support: IE, Opera, Webkit
  38004. // TODO: identify versions
  38005. // getElementById can match elements by name instead of ID
  38006. if (elem.id === m) {
  38007. results.push(elem);
  38008. return results;
  38009. }
  38010. } else {
  38011. return results;
  38012. }
  38013. // Element context
  38014. } else {
  38015. // Support: IE, Opera, Webkit
  38016. // TODO: identify versions
  38017. // getElementById can match elements by name instead of ID
  38018. if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {
  38019. results.push(elem);
  38020. return results;
  38021. }
  38022. }
  38023. // Type selector
  38024. } else if (match[2]) {
  38025. push.apply(results, context.getElementsByTagName(selector));
  38026. return results;
  38027. // Class selector
  38028. } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {
  38029. push.apply(results, context.getElementsByClassName(m));
  38030. return results;
  38031. }
  38032. }
  38033. // Take advantage of querySelectorAll
  38034. if (support.qsa && !compilerCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  38035. if (nodeType !== 1) {
  38036. newContext = context;
  38037. newSelector = selector;
  38038. // qSA looks outside Element context, which is not what we want
  38039. // Thanks to Andrew Dupont for this workaround technique
  38040. // Support: IE <=8
  38041. // Exclude object elements
  38042. } else if (context.nodeName.toLowerCase() !== "object") {
  38043. // Capture the context ID, setting it first if necessary
  38044. if (nid = context.getAttribute("id")) {
  38045. nid = nid.replace(rcssescape, fcssescape);
  38046. } else {
  38047. context.setAttribute("id", nid = expando);
  38048. }
  38049. // Prefix every selector in the list
  38050. groups = tokenize(selector);
  38051. i = groups.length;
  38052. while (i--) {
  38053. groups[i] = "#" + nid + " " + toSelector(groups[i]);
  38054. }
  38055. newSelector = groups.join(",");
  38056. // Expand context for sibling selectors
  38057. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  38058. }
  38059. if (newSelector) {
  38060. try {
  38061. push.apply(results, newContext.querySelectorAll(newSelector));
  38062. return results;
  38063. } catch (qsaError) {} finally {
  38064. if (nid === expando) {
  38065. context.removeAttribute("id");
  38066. }
  38067. }
  38068. }
  38069. }
  38070. }
  38071. }
  38072. // All others
  38073. return select(selector.replace(rtrim, "$1"), context, results, seed);
  38074. }
  38075. /**
  38076. * Create key-value caches of limited size
  38077. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  38078. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  38079. * deleting the oldest entry
  38080. */
  38081. function createCache() {
  38082. var keys = [];
  38083. function cache(key, value) {
  38084. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  38085. if (keys.push(key + " ") > Expr.cacheLength) {
  38086. // Only keep the most recent entries
  38087. delete cache[keys.shift()];
  38088. }
  38089. return cache[key + " "] = value;
  38090. }
  38091. return cache;
  38092. }
  38093. /**
  38094. * Mark a function for special use by Sizzle
  38095. * @param {Function} fn The function to mark
  38096. */
  38097. function markFunction(fn) {
  38098. fn[expando] = true;
  38099. return fn;
  38100. }
  38101. /**
  38102. * Support testing using an element
  38103. * @param {Function} fn Passed the created element and returns a boolean result
  38104. */
  38105. function assert(fn) {
  38106. var el = document.createElement("fieldset");
  38107. try {
  38108. return !!fn(el);
  38109. } catch (e) {
  38110. return false;
  38111. } finally {
  38112. // Remove from its parent by default
  38113. if (el.parentNode) {
  38114. el.parentNode.removeChild(el);
  38115. }
  38116. // release memory in IE
  38117. el = null;
  38118. }
  38119. }
  38120. /**
  38121. * Adds the same handler for all of the specified attrs
  38122. * @param {String} attrs Pipe-separated list of attributes
  38123. * @param {Function} handler The method that will be applied
  38124. */
  38125. function addHandle(attrs, handler) {
  38126. var arr = attrs.split("|"),
  38127. i = arr.length;
  38128. while (i--) {
  38129. Expr.attrHandle[arr[i]] = handler;
  38130. }
  38131. }
  38132. /**
  38133. * Checks document order of two siblings
  38134. * @param {Element} a
  38135. * @param {Element} b
  38136. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  38137. */
  38138. function siblingCheck(a, b) {
  38139. var cur = b && a,
  38140. diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex;
  38141. // Use IE sourceIndex if available on both nodes
  38142. if (diff) {
  38143. return diff;
  38144. }
  38145. // Check if b follows a
  38146. if (cur) {
  38147. while (cur = cur.nextSibling) {
  38148. if (cur === b) {
  38149. return -1;
  38150. }
  38151. }
  38152. }
  38153. return a ? 1 : -1;
  38154. }
  38155. /**
  38156. * Returns a function to use in pseudos for input types
  38157. * @param {String} type
  38158. */
  38159. function createInputPseudo(type) {
  38160. return function (elem) {
  38161. var name = elem.nodeName.toLowerCase();
  38162. return name === "input" && elem.type === type;
  38163. };
  38164. }
  38165. /**
  38166. * Returns a function to use in pseudos for buttons
  38167. * @param {String} type
  38168. */
  38169. function createButtonPseudo(type) {
  38170. return function (elem) {
  38171. var name = elem.nodeName.toLowerCase();
  38172. return (name === "input" || name === "button") && elem.type === type;
  38173. };
  38174. }
  38175. /**
  38176. * Returns a function to use in pseudos for :enabled/:disabled
  38177. * @param {Boolean} disabled true for :disabled; false for :enabled
  38178. */
  38179. function createDisabledPseudo(disabled) {
  38180. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  38181. return function (elem) {
  38182. // Only certain elements can match :enabled or :disabled
  38183. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  38184. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  38185. if ("form" in elem) {
  38186. // Check for inherited disabledness on relevant non-disabled elements:
  38187. // * listed form-associated elements in a disabled fieldset
  38188. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  38189. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  38190. // * option elements in a disabled optgroup
  38191. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  38192. // All such elements have a "form" property.
  38193. if (elem.parentNode && elem.disabled === false) {
  38194. // Option elements defer to a parent optgroup if present
  38195. if ("label" in elem) {
  38196. if ("label" in elem.parentNode) {
  38197. return elem.parentNode.disabled === disabled;
  38198. } else {
  38199. return elem.disabled === disabled;
  38200. }
  38201. }
  38202. // Support: IE 6 - 11
  38203. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  38204. return elem.isDisabled === disabled ||
  38205. // Where there is no isDisabled, check manually
  38206. /* jshint -W018 */
  38207. elem.isDisabled !== !disabled && disabledAncestor(elem) === disabled;
  38208. }
  38209. return elem.disabled === disabled;
  38210. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  38211. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  38212. // even exist on them, let alone have a boolean value.
  38213. } else if ("label" in elem) {
  38214. return elem.disabled === disabled;
  38215. }
  38216. // Remaining elements are neither :enabled nor :disabled
  38217. return false;
  38218. };
  38219. }
  38220. /**
  38221. * Returns a function to use in pseudos for positionals
  38222. * @param {Function} fn
  38223. */
  38224. function createPositionalPseudo(fn) {
  38225. return markFunction(function (argument) {
  38226. argument = +argument;
  38227. return markFunction(function (seed, matches) {
  38228. var j,
  38229. matchIndexes = fn([], seed.length, argument),
  38230. i = matchIndexes.length;
  38231. // Match elements found at the specified indexes
  38232. while (i--) {
  38233. if (seed[j = matchIndexes[i]]) {
  38234. seed[j] = !(matches[j] = seed[j]);
  38235. }
  38236. }
  38237. });
  38238. });
  38239. }
  38240. /**
  38241. * Checks a node for validity as a Sizzle context
  38242. * @param {Element|Object=} context
  38243. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  38244. */
  38245. function testContext(context) {
  38246. return context && typeof context.getElementsByTagName !== "undefined" && context;
  38247. }
  38248. // Expose support vars for convenience
  38249. support = Sizzle.support = {};
  38250. /**
  38251. * Detects XML nodes
  38252. * @param {Element|Object} elem An element or a document
  38253. * @returns {Boolean} True iff elem is a non-HTML XML node
  38254. */
  38255. isXML = Sizzle.isXML = function (elem) {
  38256. // documentElement is verified for cases where it doesn't yet exist
  38257. // (such as loading iframes in IE - #4833)
  38258. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  38259. return documentElement ? documentElement.nodeName !== "HTML" : false;
  38260. };
  38261. /**
  38262. * Sets document-related variables once based on the current document
  38263. * @param {Element|Object} [doc] An element or document object to use to set the document
  38264. * @returns {Object} Returns the current document
  38265. */
  38266. setDocument = Sizzle.setDocument = function (node) {
  38267. var hasCompare,
  38268. subWindow,
  38269. doc = node ? node.ownerDocument || node : preferredDoc;
  38270. // Return early if doc is invalid or already selected
  38271. if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
  38272. return document;
  38273. }
  38274. // Update global variables
  38275. document = doc;
  38276. docElem = document.documentElement;
  38277. documentIsHTML = !isXML(document);
  38278. // Support: IE 9-11, Edge
  38279. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  38280. if (preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {
  38281. // Support: IE 11, Edge
  38282. if (subWindow.addEventListener) {
  38283. subWindow.addEventListener("unload", unloadHandler, false);
  38284. // Support: IE 9 - 10 only
  38285. } else if (subWindow.attachEvent) {
  38286. subWindow.attachEvent("onunload", unloadHandler);
  38287. }
  38288. }
  38289. /* Attributes
  38290. ---------------------------------------------------------------------- */
  38291. // Support: IE<8
  38292. // Verify that getAttribute really returns attributes and not properties
  38293. // (excepting IE8 booleans)
  38294. support.attributes = assert(function (el) {
  38295. el.className = "i";
  38296. return !el.getAttribute("className");
  38297. });
  38298. /* getElement(s)By*
  38299. ---------------------------------------------------------------------- */
  38300. // Check if getElementsByTagName("*") returns only elements
  38301. support.getElementsByTagName = assert(function (el) {
  38302. el.appendChild(document.createComment(""));
  38303. return !el.getElementsByTagName("*").length;
  38304. });
  38305. // Support: IE<9
  38306. support.getElementsByClassName = rnative.test(document.getElementsByClassName);
  38307. // Support: IE<10
  38308. // Check if getElementById returns elements by name
  38309. // The broken getElementById methods don't pick up programmatically-set names,
  38310. // so use a roundabout getElementsByName test
  38311. support.getById = assert(function (el) {
  38312. docElem.appendChild(el).id = expando;
  38313. return !document.getElementsByName || !document.getElementsByName(expando).length;
  38314. });
  38315. // ID filter and find
  38316. if (support.getById) {
  38317. Expr.filter["ID"] = function (id) {
  38318. var attrId = id.replace(runescape, funescape);
  38319. return function (elem) {
  38320. return elem.getAttribute("id") === attrId;
  38321. };
  38322. };
  38323. Expr.find["ID"] = function (id, context) {
  38324. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  38325. var elem = context.getElementById(id);
  38326. return elem ? [elem] : [];
  38327. }
  38328. };
  38329. } else {
  38330. Expr.filter["ID"] = function (id) {
  38331. var attrId = id.replace(runescape, funescape);
  38332. return function (elem) {
  38333. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  38334. return node && node.value === attrId;
  38335. };
  38336. };
  38337. // Support: IE 6 - 7 only
  38338. // getElementById is not reliable as a find shortcut
  38339. Expr.find["ID"] = function (id, context) {
  38340. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  38341. var node,
  38342. i,
  38343. elems,
  38344. elem = context.getElementById(id);
  38345. if (elem) {
  38346. // Verify the id attribute
  38347. node = elem.getAttributeNode("id");
  38348. if (node && node.value === id) {
  38349. return [elem];
  38350. }
  38351. // Fall back on getElementsByName
  38352. elems = context.getElementsByName(id);
  38353. i = 0;
  38354. while (elem = elems[i++]) {
  38355. node = elem.getAttributeNode("id");
  38356. if (node && node.value === id) {
  38357. return [elem];
  38358. }
  38359. }
  38360. }
  38361. return [];
  38362. }
  38363. };
  38364. }
  38365. // Tag
  38366. Expr.find["TAG"] = support.getElementsByTagName ? function (tag, context) {
  38367. if (typeof context.getElementsByTagName !== "undefined") {
  38368. return context.getElementsByTagName(tag);
  38369. // DocumentFragment nodes don't have gEBTN
  38370. } else if (support.qsa) {
  38371. return context.querySelectorAll(tag);
  38372. }
  38373. } : function (tag, context) {
  38374. var elem,
  38375. tmp = [],
  38376. i = 0,
  38377. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  38378. results = context.getElementsByTagName(tag);
  38379. // Filter out possible comments
  38380. if (tag === "*") {
  38381. while (elem = results[i++]) {
  38382. if (elem.nodeType === 1) {
  38383. tmp.push(elem);
  38384. }
  38385. }
  38386. return tmp;
  38387. }
  38388. return results;
  38389. };
  38390. // Class
  38391. Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
  38392. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  38393. return context.getElementsByClassName(className);
  38394. }
  38395. };
  38396. /* QSA/matchesSelector
  38397. ---------------------------------------------------------------------- */
  38398. // QSA and matchesSelector support
  38399. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  38400. rbuggyMatches = [];
  38401. // qSa(:focus) reports false when true (Chrome 21)
  38402. // We allow this because of a bug in IE8/9 that throws an error
  38403. // whenever `document.activeElement` is accessed on an iframe
  38404. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  38405. // See https://bugs.jquery.com/ticket/13378
  38406. rbuggyQSA = [];
  38407. if (support.qsa = rnative.test(document.querySelectorAll)) {
  38408. // Build QSA regex
  38409. // Regex strategy adopted from Diego Perini
  38410. assert(function (el) {
  38411. // Select is set to empty string on purpose
  38412. // This is to test IE's treatment of not explicitly
  38413. // setting a boolean content attribute,
  38414. // since its presence should be enough
  38415. // https://bugs.jquery.com/ticket/12359
  38416. docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>";
  38417. // Support: IE8, Opera 11-12.16
  38418. // Nothing should be selected when empty strings follow ^= or $= or *=
  38419. // The test attribute must be unknown in Opera but "safe" for WinRT
  38420. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  38421. if (el.querySelectorAll("[msallowcapture^='']").length) {
  38422. rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
  38423. }
  38424. // Support: IE8
  38425. // Boolean attributes and "value" are not treated correctly
  38426. if (!el.querySelectorAll("[selected]").length) {
  38427. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  38428. }
  38429. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  38430. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  38431. rbuggyQSA.push("~=");
  38432. }
  38433. // Webkit/Opera - :checked should return selected option elements
  38434. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  38435. // IE8 throws error here and will not see later tests
  38436. if (!el.querySelectorAll(":checked").length) {
  38437. rbuggyQSA.push(":checked");
  38438. }
  38439. // Support: Safari 8+, iOS 8+
  38440. // https://bugs.webkit.org/show_bug.cgi?id=136851
  38441. // In-page `selector#id sibling-combinator selector` fails
  38442. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  38443. rbuggyQSA.push(".#.+[+~]");
  38444. }
  38445. });
  38446. assert(function (el) {
  38447. el.innerHTML = "<a href='' disabled='disabled'></a>" + "<select disabled='disabled'><option/></select>";
  38448. // Support: Windows 8 Native Apps
  38449. // The type and name attributes are restricted during .innerHTML assignment
  38450. var input = document.createElement("input");
  38451. input.setAttribute("type", "hidden");
  38452. el.appendChild(input).setAttribute("name", "D");
  38453. // Support: IE8
  38454. // Enforce case-sensitivity of name attribute
  38455. if (el.querySelectorAll("[name=d]").length) {
  38456. rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
  38457. }
  38458. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  38459. // IE8 throws error here and will not see later tests
  38460. if (el.querySelectorAll(":enabled").length !== 2) {
  38461. rbuggyQSA.push(":enabled", ":disabled");
  38462. }
  38463. // Support: IE9-11+
  38464. // IE's :disabled selector does not pick up the children of disabled fieldsets
  38465. docElem.appendChild(el).disabled = true;
  38466. if (el.querySelectorAll(":disabled").length !== 2) {
  38467. rbuggyQSA.push(":enabled", ":disabled");
  38468. }
  38469. // Opera 10-11 does not throw on post-comma invalid pseudos
  38470. el.querySelectorAll("*,:x");
  38471. rbuggyQSA.push(",.*:");
  38472. });
  38473. }
  38474. if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) {
  38475. assert(function (el) {
  38476. // Check to see if it's possible to do matchesSelector
  38477. // on a disconnected node (IE 9)
  38478. support.disconnectedMatch = matches.call(el, "*");
  38479. // This should fail with an exception
  38480. // Gecko does not error, returns false instead
  38481. matches.call(el, "[s!='']:x");
  38482. rbuggyMatches.push("!=", pseudos);
  38483. });
  38484. }
  38485. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  38486. rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
  38487. /* Contains
  38488. ---------------------------------------------------------------------- */
  38489. hasCompare = rnative.test(docElem.compareDocumentPosition);
  38490. // Element contains another
  38491. // Purposefully self-exclusive
  38492. // As in, an element does not contain itself
  38493. contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {
  38494. var adown = a.nodeType === 9 ? a.documentElement : a,
  38495. bup = b && b.parentNode;
  38496. return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  38497. } : function (a, b) {
  38498. if (b) {
  38499. while (b = b.parentNode) {
  38500. if (b === a) {
  38501. return true;
  38502. }
  38503. }
  38504. }
  38505. return false;
  38506. };
  38507. /* Sorting
  38508. ---------------------------------------------------------------------- */
  38509. // Document order sorting
  38510. sortOrder = hasCompare ? function (a, b) {
  38511. // Flag for duplicate removal
  38512. if (a === b) {
  38513. hasDuplicate = true;
  38514. return 0;
  38515. }
  38516. // Sort on method existence if only one input has compareDocumentPosition
  38517. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  38518. if (compare) {
  38519. return compare;
  38520. }
  38521. // Calculate position if both inputs belong to the same document
  38522. compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) :
  38523. // Otherwise we know they are disconnected
  38524. 1;
  38525. // Disconnected nodes
  38526. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  38527. // Choose the first element that is related to our preferred document
  38528. if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
  38529. return -1;
  38530. }
  38531. if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
  38532. return 1;
  38533. }
  38534. // Maintain original order
  38535. return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  38536. }
  38537. return compare & 4 ? -1 : 1;
  38538. } : function (a, b) {
  38539. // Exit early if the nodes are identical
  38540. if (a === b) {
  38541. hasDuplicate = true;
  38542. return 0;
  38543. }
  38544. var cur,
  38545. i = 0,
  38546. aup = a.parentNode,
  38547. bup = b.parentNode,
  38548. ap = [a],
  38549. bp = [b];
  38550. // Parentless nodes are either documents or disconnected
  38551. if (!aup || !bup) {
  38552. return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  38553. // If the nodes are siblings, we can do a quick check
  38554. } else if (aup === bup) {
  38555. return siblingCheck(a, b);
  38556. }
  38557. // Otherwise we need full lists of their ancestors for comparison
  38558. cur = a;
  38559. while (cur = cur.parentNode) {
  38560. ap.unshift(cur);
  38561. }
  38562. cur = b;
  38563. while (cur = cur.parentNode) {
  38564. bp.unshift(cur);
  38565. }
  38566. // Walk down the tree looking for a discrepancy
  38567. while (ap[i] === bp[i]) {
  38568. i++;
  38569. }
  38570. return i ?
  38571. // Do a sibling check if the nodes have a common ancestor
  38572. siblingCheck(ap[i], bp[i]) :
  38573. // Otherwise nodes in our document sort first
  38574. ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
  38575. };
  38576. return document;
  38577. };
  38578. Sizzle.matches = function (expr, elements) {
  38579. return Sizzle(expr, null, null, elements);
  38580. };
  38581. Sizzle.matchesSelector = function (elem, expr) {
  38582. // Set document vars if needed
  38583. if ((elem.ownerDocument || elem) !== document) {
  38584. setDocument(elem);
  38585. }
  38586. // Make sure that attribute selectors are quoted
  38587. expr = expr.replace(rattributeQuotes, "='$1']");
  38588. if (support.matchesSelector && documentIsHTML && !compilerCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  38589. try {
  38590. var ret = matches.call(elem, expr);
  38591. // IE 9's matchesSelector returns false on disconnected nodes
  38592. if (ret || support.disconnectedMatch ||
  38593. // As well, disconnected nodes are said to be in a document
  38594. // fragment in IE 9
  38595. elem.document && elem.document.nodeType !== 11) {
  38596. return ret;
  38597. }
  38598. } catch (e) {}
  38599. }
  38600. return Sizzle(expr, document, null, [elem]).length > 0;
  38601. };
  38602. Sizzle.contains = function (context, elem) {
  38603. // Set document vars if needed
  38604. if ((context.ownerDocument || context) !== document) {
  38605. setDocument(context);
  38606. }
  38607. return contains(context, elem);
  38608. };
  38609. Sizzle.attr = function (elem, name) {
  38610. // Set document vars if needed
  38611. if ((elem.ownerDocument || elem) !== document) {
  38612. setDocument(elem);
  38613. }
  38614. var fn = Expr.attrHandle[name.toLowerCase()],
  38615. // Don't get fooled by Object.prototype properties (jQuery #13807)
  38616. val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
  38617. return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  38618. };
  38619. Sizzle.escape = function (sel) {
  38620. return (sel + "").replace(rcssescape, fcssescape);
  38621. };
  38622. Sizzle.error = function (msg) {
  38623. throw new Error("Syntax error, unrecognized expression: " + msg);
  38624. };
  38625. /**
  38626. * Document sorting and removing duplicates
  38627. * @param {ArrayLike} results
  38628. */
  38629. Sizzle.uniqueSort = function (results) {
  38630. var elem,
  38631. duplicates = [],
  38632. j = 0,
  38633. i = 0;
  38634. // Unless we *know* we can detect duplicates, assume their presence
  38635. hasDuplicate = !support.detectDuplicates;
  38636. sortInput = !support.sortStable && results.slice(0);
  38637. results.sort(sortOrder);
  38638. if (hasDuplicate) {
  38639. while (elem = results[i++]) {
  38640. if (elem === results[i]) {
  38641. j = duplicates.push(i);
  38642. }
  38643. }
  38644. while (j--) {
  38645. results.splice(duplicates[j], 1);
  38646. }
  38647. }
  38648. // Clear input after sorting to release objects
  38649. // See https://github.com/jquery/sizzle/pull/225
  38650. sortInput = null;
  38651. return results;
  38652. };
  38653. /**
  38654. * Utility function for retrieving the text value of an array of DOM nodes
  38655. * @param {Array|Element} elem
  38656. */
  38657. getText = Sizzle.getText = function (elem) {
  38658. var node,
  38659. ret = "",
  38660. i = 0,
  38661. nodeType = elem.nodeType;
  38662. if (!nodeType) {
  38663. // If no nodeType, this is expected to be an array
  38664. while (node = elem[i++]) {
  38665. // Do not traverse comment nodes
  38666. ret += getText(node);
  38667. }
  38668. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  38669. // Use textContent for elements
  38670. // innerText usage removed for consistency of new lines (jQuery #11153)
  38671. if (typeof elem.textContent === "string") {
  38672. return elem.textContent;
  38673. } else {
  38674. // Traverse its children
  38675. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  38676. ret += getText(elem);
  38677. }
  38678. }
  38679. } else if (nodeType === 3 || nodeType === 4) {
  38680. return elem.nodeValue;
  38681. }
  38682. // Do not include comment or processing instruction nodes
  38683. return ret;
  38684. };
  38685. Expr = Sizzle.selectors = {
  38686. // Can be adjusted by the user
  38687. cacheLength: 50,
  38688. createPseudo: markFunction,
  38689. match: matchExpr,
  38690. attrHandle: {},
  38691. find: {},
  38692. relative: {
  38693. ">": { dir: "parentNode", first: true },
  38694. " ": { dir: "parentNode" },
  38695. "+": { dir: "previousSibling", first: true },
  38696. "~": { dir: "previousSibling" }
  38697. },
  38698. preFilter: {
  38699. "ATTR": function ATTR(match) {
  38700. match[1] = match[1].replace(runescape, funescape);
  38701. // Move the given value to match[3] whether quoted or unquoted
  38702. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  38703. if (match[2] === "~=") {
  38704. match[3] = " " + match[3] + " ";
  38705. }
  38706. return match.slice(0, 4);
  38707. },
  38708. "CHILD": function CHILD(match) {
  38709. /* matches from matchExpr["CHILD"]
  38710. 1 type (only|nth|...)
  38711. 2 what (child|of-type)
  38712. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  38713. 4 xn-component of xn+y argument ([+-]?\d*n|)
  38714. 5 sign of xn-component
  38715. 6 x of xn-component
  38716. 7 sign of y-component
  38717. 8 y of y-component
  38718. */
  38719. match[1] = match[1].toLowerCase();
  38720. if (match[1].slice(0, 3) === "nth") {
  38721. // nth-* requires argument
  38722. if (!match[3]) {
  38723. Sizzle.error(match[0]);
  38724. }
  38725. // numeric x and y parameters for Expr.filter.CHILD
  38726. // remember that false/true cast respectively to 0/1
  38727. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  38728. match[5] = +(match[7] + match[8] || match[3] === "odd");
  38729. // other types prohibit arguments
  38730. } else if (match[3]) {
  38731. Sizzle.error(match[0]);
  38732. }
  38733. return match;
  38734. },
  38735. "PSEUDO": function PSEUDO(match) {
  38736. var excess,
  38737. unquoted = !match[6] && match[2];
  38738. if (matchExpr["CHILD"].test(match[0])) {
  38739. return null;
  38740. }
  38741. // Accept quoted arguments as-is
  38742. if (match[3]) {
  38743. match[2] = match[4] || match[5] || "";
  38744. // Strip excess characters from unquoted arguments
  38745. } else if (unquoted && rpseudo.test(unquoted) && (
  38746. // Get excess from tokenize (recursively)
  38747. excess = tokenize(unquoted, true)) && (
  38748. // advance to the next closing parenthesis
  38749. excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  38750. // excess is a negative index
  38751. match[0] = match[0].slice(0, excess);
  38752. match[2] = unquoted.slice(0, excess);
  38753. }
  38754. // Return only captures needed by the pseudo filter method (type and argument)
  38755. return match.slice(0, 3);
  38756. }
  38757. },
  38758. filter: {
  38759. "TAG": function TAG(nodeNameSelector) {
  38760. var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  38761. return nodeNameSelector === "*" ? function () {
  38762. return true;
  38763. } : function (elem) {
  38764. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  38765. };
  38766. },
  38767. "CLASS": function CLASS(className) {
  38768. var pattern = classCache[className + " "];
  38769. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) {
  38770. return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
  38771. });
  38772. },
  38773. "ATTR": function ATTR(name, operator, check) {
  38774. return function (elem) {
  38775. var result = Sizzle.attr(elem, name);
  38776. if (result == null) {
  38777. return operator === "!=";
  38778. }
  38779. if (!operator) {
  38780. return true;
  38781. }
  38782. result += "";
  38783. 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;
  38784. };
  38785. },
  38786. "CHILD": function CHILD(type, what, argument, first, last) {
  38787. var simple = type.slice(0, 3) !== "nth",
  38788. forward = type.slice(-4) !== "last",
  38789. ofType = what === "of-type";
  38790. return first === 1 && last === 0 ?
  38791. // Shortcut for :nth-*(n)
  38792. function (elem) {
  38793. return !!elem.parentNode;
  38794. } : function (elem, context, xml) {
  38795. var cache,
  38796. uniqueCache,
  38797. outerCache,
  38798. node,
  38799. nodeIndex,
  38800. start,
  38801. dir = simple !== forward ? "nextSibling" : "previousSibling",
  38802. parent = elem.parentNode,
  38803. name = ofType && elem.nodeName.toLowerCase(),
  38804. useCache = !xml && !ofType,
  38805. diff = false;
  38806. if (parent) {
  38807. // :(first|last|only)-(child|of-type)
  38808. if (simple) {
  38809. while (dir) {
  38810. node = elem;
  38811. while (node = node[dir]) {
  38812. if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
  38813. return false;
  38814. }
  38815. }
  38816. // Reverse direction for :only-* (if we haven't yet done so)
  38817. start = dir = type === "only" && !start && "nextSibling";
  38818. }
  38819. return true;
  38820. }
  38821. start = [forward ? parent.firstChild : parent.lastChild];
  38822. // non-xml :nth-child(...) stores cache data on `parent`
  38823. if (forward && useCache) {
  38824. // Seek `elem` from a previously-cached index
  38825. // ...in a gzip-friendly way
  38826. node = parent;
  38827. outerCache = node[expando] || (node[expando] = {});
  38828. // Support: IE <9 only
  38829. // Defend against cloned attroperties (jQuery gh-1709)
  38830. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38831. cache = uniqueCache[type] || [];
  38832. nodeIndex = cache[0] === dirruns && cache[1];
  38833. diff = nodeIndex && cache[2];
  38834. node = nodeIndex && parent.childNodes[nodeIndex];
  38835. while (node = ++nodeIndex && node && node[dir] || (
  38836. // Fallback to seeking `elem` from the start
  38837. diff = nodeIndex = 0) || start.pop()) {
  38838. // When found, cache indexes on `parent` and break
  38839. if (node.nodeType === 1 && ++diff && node === elem) {
  38840. uniqueCache[type] = [dirruns, nodeIndex, diff];
  38841. break;
  38842. }
  38843. }
  38844. } else {
  38845. // Use previously-cached element index if available
  38846. if (useCache) {
  38847. // ...in a gzip-friendly way
  38848. node = elem;
  38849. outerCache = node[expando] || (node[expando] = {});
  38850. // Support: IE <9 only
  38851. // Defend against cloned attroperties (jQuery gh-1709)
  38852. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38853. cache = uniqueCache[type] || [];
  38854. nodeIndex = cache[0] === dirruns && cache[1];
  38855. diff = nodeIndex;
  38856. }
  38857. // xml :nth-child(...)
  38858. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  38859. if (diff === false) {
  38860. // Use the same loop as above to seek `elem` from the start
  38861. while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
  38862. if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
  38863. // Cache the index of each encountered element
  38864. if (useCache) {
  38865. outerCache = node[expando] || (node[expando] = {});
  38866. // Support: IE <9 only
  38867. // Defend against cloned attroperties (jQuery gh-1709)
  38868. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38869. uniqueCache[type] = [dirruns, diff];
  38870. }
  38871. if (node === elem) {
  38872. break;
  38873. }
  38874. }
  38875. }
  38876. }
  38877. }
  38878. // Incorporate the offset, then check against cycle size
  38879. diff -= last;
  38880. return diff === first || diff % first === 0 && diff / first >= 0;
  38881. }
  38882. };
  38883. },
  38884. "PSEUDO": function PSEUDO(pseudo, argument) {
  38885. // pseudo-class names are case-insensitive
  38886. // http://www.w3.org/TR/selectors/#pseudo-classes
  38887. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  38888. // Remember that setFilters inherits from pseudos
  38889. var args,
  38890. fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
  38891. // The user may use createPseudo to indicate that
  38892. // arguments are needed to create the filter function
  38893. // just as Sizzle does
  38894. if (fn[expando]) {
  38895. return fn(argument);
  38896. }
  38897. // But maintain support for old signatures
  38898. if (fn.length > 1) {
  38899. args = [pseudo, pseudo, "", argument];
  38900. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
  38901. var idx,
  38902. matched = fn(seed, argument),
  38903. i = matched.length;
  38904. while (i--) {
  38905. idx = indexOf(seed, matched[i]);
  38906. seed[idx] = !(matches[idx] = matched[i]);
  38907. }
  38908. }) : function (elem) {
  38909. return fn(elem, 0, args);
  38910. };
  38911. }
  38912. return fn;
  38913. }
  38914. },
  38915. pseudos: {
  38916. // Potentially complex pseudos
  38917. "not": markFunction(function (selector) {
  38918. // Trim the selector passed to compile
  38919. // to avoid treating leading and trailing
  38920. // spaces as combinators
  38921. var input = [],
  38922. results = [],
  38923. matcher = compile(selector.replace(rtrim, "$1"));
  38924. return matcher[expando] ? markFunction(function (seed, matches, context, xml) {
  38925. var elem,
  38926. unmatched = matcher(seed, null, xml, []),
  38927. i = seed.length;
  38928. // Match elements unmatched by `matcher`
  38929. while (i--) {
  38930. if (elem = unmatched[i]) {
  38931. seed[i] = !(matches[i] = elem);
  38932. }
  38933. }
  38934. }) : function (elem, context, xml) {
  38935. input[0] = elem;
  38936. matcher(input, null, xml, results);
  38937. // Don't keep the element (issue #299)
  38938. input[0] = null;
  38939. return !results.pop();
  38940. };
  38941. }),
  38942. "has": markFunction(function (selector) {
  38943. return function (elem) {
  38944. return Sizzle(selector, elem).length > 0;
  38945. };
  38946. }),
  38947. "contains": markFunction(function (text) {
  38948. text = text.replace(runescape, funescape);
  38949. return function (elem) {
  38950. return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
  38951. };
  38952. }),
  38953. // "Whether an element is represented by a :lang() selector
  38954. // is based solely on the element's language value
  38955. // being equal to the identifier C,
  38956. // or beginning with the identifier C immediately followed by "-".
  38957. // The matching of C against the element's language value is performed case-insensitively.
  38958. // The identifier C does not have to be a valid language name."
  38959. // http://www.w3.org/TR/selectors/#lang-pseudo
  38960. "lang": markFunction(function (lang) {
  38961. // lang value must be a valid identifier
  38962. if (!ridentifier.test(lang || "")) {
  38963. Sizzle.error("unsupported lang: " + lang);
  38964. }
  38965. lang = lang.replace(runescape, funescape).toLowerCase();
  38966. return function (elem) {
  38967. var elemLang;
  38968. do {
  38969. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
  38970. elemLang = elemLang.toLowerCase();
  38971. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  38972. }
  38973. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  38974. return false;
  38975. };
  38976. }),
  38977. // Miscellaneous
  38978. "target": function target(elem) {
  38979. var hash = window.location && window.location.hash;
  38980. return hash && hash.slice(1) === elem.id;
  38981. },
  38982. "root": function root(elem) {
  38983. return elem === docElem;
  38984. },
  38985. "focus": function focus(elem) {
  38986. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  38987. },
  38988. // Boolean properties
  38989. "enabled": createDisabledPseudo(false),
  38990. "disabled": createDisabledPseudo(true),
  38991. "checked": function checked(elem) {
  38992. // In CSS3, :checked should return both checked and selected elements
  38993. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  38994. var nodeName = elem.nodeName.toLowerCase();
  38995. return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected;
  38996. },
  38997. "selected": function selected(elem) {
  38998. // Accessing this property makes selected-by-default
  38999. // options in Safari work properly
  39000. if (elem.parentNode) {
  39001. elem.parentNode.selectedIndex;
  39002. }
  39003. return elem.selected === true;
  39004. },
  39005. // Contents
  39006. "empty": function empty(elem) {
  39007. // http://www.w3.org/TR/selectors/#empty-pseudo
  39008. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  39009. // but not by others (comment: 8; processing instruction: 7; etc.)
  39010. // nodeType < 6 works because attributes (2) do not appear as children
  39011. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  39012. if (elem.nodeType < 6) {
  39013. return false;
  39014. }
  39015. }
  39016. return true;
  39017. },
  39018. "parent": function parent(elem) {
  39019. return !Expr.pseudos["empty"](elem);
  39020. },
  39021. // Element/input types
  39022. "header": function header(elem) {
  39023. return rheader.test(elem.nodeName);
  39024. },
  39025. "input": function input(elem) {
  39026. return rinputs.test(elem.nodeName);
  39027. },
  39028. "button": function button(elem) {
  39029. var name = elem.nodeName.toLowerCase();
  39030. return name === "input" && elem.type === "button" || name === "button";
  39031. },
  39032. "text": function text(elem) {
  39033. var attr;
  39034. return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && (
  39035. // Support: IE<8
  39036. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  39037. (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  39038. },
  39039. // Position-in-collection
  39040. "first": createPositionalPseudo(function () {
  39041. return [0];
  39042. }),
  39043. "last": createPositionalPseudo(function (matchIndexes, length) {
  39044. return [length - 1];
  39045. }),
  39046. "eq": createPositionalPseudo(function (matchIndexes, length, argument) {
  39047. return [argument < 0 ? argument + length : argument];
  39048. }),
  39049. "even": createPositionalPseudo(function (matchIndexes, length) {
  39050. var i = 0;
  39051. for (; i < length; i += 2) {
  39052. matchIndexes.push(i);
  39053. }
  39054. return matchIndexes;
  39055. }),
  39056. "odd": createPositionalPseudo(function (matchIndexes, length) {
  39057. var i = 1;
  39058. for (; i < length; i += 2) {
  39059. matchIndexes.push(i);
  39060. }
  39061. return matchIndexes;
  39062. }),
  39063. "lt": createPositionalPseudo(function (matchIndexes, length, argument) {
  39064. var i = argument < 0 ? argument + length : argument;
  39065. for (; --i >= 0;) {
  39066. matchIndexes.push(i);
  39067. }
  39068. return matchIndexes;
  39069. }),
  39070. "gt": createPositionalPseudo(function (matchIndexes, length, argument) {
  39071. var i = argument < 0 ? argument + length : argument;
  39072. for (; ++i < length;) {
  39073. matchIndexes.push(i);
  39074. }
  39075. return matchIndexes;
  39076. })
  39077. }
  39078. };
  39079. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  39080. // Add button/input type pseudos
  39081. for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  39082. Expr.pseudos[i] = createInputPseudo(i);
  39083. }
  39084. for (i in { submit: true, reset: true }) {
  39085. Expr.pseudos[i] = createButtonPseudo(i);
  39086. }
  39087. // Easy API for creating new setFilters
  39088. function setFilters() {}
  39089. setFilters.prototype = Expr.filters = Expr.pseudos;
  39090. Expr.setFilters = new setFilters();
  39091. tokenize = Sizzle.tokenize = function (selector, parseOnly) {
  39092. var matched,
  39093. match,
  39094. tokens,
  39095. type,
  39096. soFar,
  39097. groups,
  39098. preFilters,
  39099. cached = tokenCache[selector + " "];
  39100. if (cached) {
  39101. return parseOnly ? 0 : cached.slice(0);
  39102. }
  39103. soFar = selector;
  39104. groups = [];
  39105. preFilters = Expr.preFilter;
  39106. while (soFar) {
  39107. // Comma and first run
  39108. if (!matched || (match = rcomma.exec(soFar))) {
  39109. if (match) {
  39110. // Don't consume trailing commas as valid
  39111. soFar = soFar.slice(match[0].length) || soFar;
  39112. }
  39113. groups.push(tokens = []);
  39114. }
  39115. matched = false;
  39116. // Combinators
  39117. if (match = rcombinators.exec(soFar)) {
  39118. matched = match.shift();
  39119. tokens.push({
  39120. value: matched,
  39121. // Cast descendant combinators to space
  39122. type: match[0].replace(rtrim, " ")
  39123. });
  39124. soFar = soFar.slice(matched.length);
  39125. }
  39126. // Filters
  39127. for (type in Expr.filter) {
  39128. if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
  39129. matched = match.shift();
  39130. tokens.push({
  39131. value: matched,
  39132. type: type,
  39133. matches: match
  39134. });
  39135. soFar = soFar.slice(matched.length);
  39136. }
  39137. }
  39138. if (!matched) {
  39139. break;
  39140. }
  39141. }
  39142. // Return the length of the invalid excess
  39143. // if we're just parsing
  39144. // Otherwise, throw an error or return tokens
  39145. return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) :
  39146. // Cache the tokens
  39147. tokenCache(selector, groups).slice(0);
  39148. };
  39149. function toSelector(tokens) {
  39150. var i = 0,
  39151. len = tokens.length,
  39152. selector = "";
  39153. for (; i < len; i++) {
  39154. selector += tokens[i].value;
  39155. }
  39156. return selector;
  39157. }
  39158. function addCombinator(matcher, combinator, base) {
  39159. var dir = combinator.dir,
  39160. skip = combinator.next,
  39161. key = skip || dir,
  39162. checkNonElements = base && key === "parentNode",
  39163. doneName = done++;
  39164. return combinator.first ?
  39165. // Check against closest ancestor/preceding element
  39166. function (elem, context, xml) {
  39167. while (elem = elem[dir]) {
  39168. if (elem.nodeType === 1 || checkNonElements) {
  39169. return matcher(elem, context, xml);
  39170. }
  39171. }
  39172. return false;
  39173. } :
  39174. // Check against all ancestor/preceding elements
  39175. function (elem, context, xml) {
  39176. var oldCache,
  39177. uniqueCache,
  39178. outerCache,
  39179. newCache = [dirruns, doneName];
  39180. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  39181. if (xml) {
  39182. while (elem = elem[dir]) {
  39183. if (elem.nodeType === 1 || checkNonElements) {
  39184. if (matcher(elem, context, xml)) {
  39185. return true;
  39186. }
  39187. }
  39188. }
  39189. } else {
  39190. while (elem = elem[dir]) {
  39191. if (elem.nodeType === 1 || checkNonElements) {
  39192. outerCache = elem[expando] || (elem[expando] = {});
  39193. // Support: IE <9 only
  39194. // Defend against cloned attroperties (jQuery gh-1709)
  39195. uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});
  39196. if (skip && skip === elem.nodeName.toLowerCase()) {
  39197. elem = elem[dir] || elem;
  39198. } else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  39199. // Assign to newCache so results back-propagate to previous elements
  39200. return newCache[2] = oldCache[2];
  39201. } else {
  39202. // Reuse newcache so results back-propagate to previous elements
  39203. uniqueCache[key] = newCache;
  39204. // A match means we're done; a fail means we have to keep checking
  39205. if (newCache[2] = matcher(elem, context, xml)) {
  39206. return true;
  39207. }
  39208. }
  39209. }
  39210. }
  39211. }
  39212. return false;
  39213. };
  39214. }
  39215. function elementMatcher(matchers) {
  39216. return matchers.length > 1 ? function (elem, context, xml) {
  39217. var i = matchers.length;
  39218. while (i--) {
  39219. if (!matchers[i](elem, context, xml)) {
  39220. return false;
  39221. }
  39222. }
  39223. return true;
  39224. } : matchers[0];
  39225. }
  39226. function multipleContexts(selector, contexts, results) {
  39227. var i = 0,
  39228. len = contexts.length;
  39229. for (; i < len; i++) {
  39230. Sizzle(selector, contexts[i], results);
  39231. }
  39232. return results;
  39233. }
  39234. function condense(unmatched, map, filter, context, xml) {
  39235. var elem,
  39236. newUnmatched = [],
  39237. i = 0,
  39238. len = unmatched.length,
  39239. mapped = map != null;
  39240. for (; i < len; i++) {
  39241. if (elem = unmatched[i]) {
  39242. if (!filter || filter(elem, context, xml)) {
  39243. newUnmatched.push(elem);
  39244. if (mapped) {
  39245. map.push(i);
  39246. }
  39247. }
  39248. }
  39249. }
  39250. return newUnmatched;
  39251. }
  39252. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  39253. if (postFilter && !postFilter[expando]) {
  39254. postFilter = setMatcher(postFilter);
  39255. }
  39256. if (postFinder && !postFinder[expando]) {
  39257. postFinder = setMatcher(postFinder, postSelector);
  39258. }
  39259. return markFunction(function (seed, results, context, xml) {
  39260. var temp,
  39261. i,
  39262. elem,
  39263. preMap = [],
  39264. postMap = [],
  39265. preexisting = results.length,
  39266. // Get initial elements from seed or context
  39267. elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
  39268. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  39269. matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
  39270. matcherOut = matcher ?
  39271. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  39272. postFinder || (seed ? preFilter : preexisting || postFilter) ?
  39273. // ...intermediate processing is necessary
  39274. [] :
  39275. // ...otherwise use results directly
  39276. results : matcherIn;
  39277. // Find primary matches
  39278. if (matcher) {
  39279. matcher(matcherIn, matcherOut, context, xml);
  39280. }
  39281. // Apply postFilter
  39282. if (postFilter) {
  39283. temp = condense(matcherOut, postMap);
  39284. postFilter(temp, [], context, xml);
  39285. // Un-match failing elements by moving them back to matcherIn
  39286. i = temp.length;
  39287. while (i--) {
  39288. if (elem = temp[i]) {
  39289. matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
  39290. }
  39291. }
  39292. }
  39293. if (seed) {
  39294. if (postFinder || preFilter) {
  39295. if (postFinder) {
  39296. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  39297. temp = [];
  39298. i = matcherOut.length;
  39299. while (i--) {
  39300. if (elem = matcherOut[i]) {
  39301. // Restore matcherIn since elem is not yet a final match
  39302. temp.push(matcherIn[i] = elem);
  39303. }
  39304. }
  39305. postFinder(null, matcherOut = [], temp, xml);
  39306. }
  39307. // Move matched elements from seed to results to keep them synchronized
  39308. i = matcherOut.length;
  39309. while (i--) {
  39310. if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
  39311. seed[temp] = !(results[temp] = elem);
  39312. }
  39313. }
  39314. }
  39315. // Add elements to results, through postFinder if defined
  39316. } else {
  39317. matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
  39318. if (postFinder) {
  39319. postFinder(null, results, matcherOut, xml);
  39320. } else {
  39321. push.apply(results, matcherOut);
  39322. }
  39323. }
  39324. });
  39325. }
  39326. function matcherFromTokens(tokens) {
  39327. var checkContext,
  39328. matcher,
  39329. j,
  39330. len = tokens.length,
  39331. leadingRelative = Expr.relative[tokens[0].type],
  39332. implicitRelative = leadingRelative || Expr.relative[" "],
  39333. i = leadingRelative ? 1 : 0,
  39334. // The foundational matcher ensures that elements are reachable from top-level context(s)
  39335. matchContext = addCombinator(function (elem) {
  39336. return elem === checkContext;
  39337. }, implicitRelative, true),
  39338. matchAnyContext = addCombinator(function (elem) {
  39339. return indexOf(checkContext, elem) > -1;
  39340. }, implicitRelative, true),
  39341. matchers = [function (elem, context, xml) {
  39342. var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  39343. // Avoid hanging onto element (issue #299)
  39344. checkContext = null;
  39345. return ret;
  39346. }];
  39347. for (; i < len; i++) {
  39348. if (matcher = Expr.relative[tokens[i].type]) {
  39349. matchers = [addCombinator(elementMatcher(matchers), matcher)];
  39350. } else {
  39351. matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
  39352. // Return special upon seeing a positional matcher
  39353. if (matcher[expando]) {
  39354. // Find the next relative operator (if any) for proper handling
  39355. j = ++i;
  39356. for (; j < len; j++) {
  39357. if (Expr.relative[tokens[j].type]) {
  39358. break;
  39359. }
  39360. }
  39361. return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(
  39362. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  39363. 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));
  39364. }
  39365. matchers.push(matcher);
  39366. }
  39367. }
  39368. return elementMatcher(matchers);
  39369. }
  39370. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  39371. var bySet = setMatchers.length > 0,
  39372. byElement = elementMatchers.length > 0,
  39373. superMatcher = function superMatcher(seed, context, xml, results, outermost) {
  39374. var elem,
  39375. j,
  39376. matcher,
  39377. matchedCount = 0,
  39378. i = "0",
  39379. unmatched = seed && [],
  39380. setMatched = [],
  39381. contextBackup = outermostContext,
  39382. // We must always have either seed elements or outermost context
  39383. elems = seed || byElement && Expr.find["TAG"]("*", outermost),
  39384. // Use integer dirruns iff this is the outermost matcher
  39385. dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,
  39386. len = elems.length;
  39387. if (outermost) {
  39388. outermostContext = context === document || context || outermost;
  39389. }
  39390. // Add elements passing elementMatchers directly to results
  39391. // Support: IE<9, Safari
  39392. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  39393. for (; i !== len && (elem = elems[i]) != null; i++) {
  39394. if (byElement && elem) {
  39395. j = 0;
  39396. if (!context && elem.ownerDocument !== document) {
  39397. setDocument(elem);
  39398. xml = !documentIsHTML;
  39399. }
  39400. while (matcher = elementMatchers[j++]) {
  39401. if (matcher(elem, context || document, xml)) {
  39402. results.push(elem);
  39403. break;
  39404. }
  39405. }
  39406. if (outermost) {
  39407. dirruns = dirrunsUnique;
  39408. }
  39409. }
  39410. // Track unmatched elements for set filters
  39411. if (bySet) {
  39412. // They will have gone through all possible matchers
  39413. if (elem = !matcher && elem) {
  39414. matchedCount--;
  39415. }
  39416. // Lengthen the array for every element, matched or not
  39417. if (seed) {
  39418. unmatched.push(elem);
  39419. }
  39420. }
  39421. }
  39422. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  39423. // makes the latter nonnegative.
  39424. matchedCount += i;
  39425. // Apply set filters to unmatched elements
  39426. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  39427. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  39428. // no element matchers and no seed.
  39429. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  39430. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  39431. // numerically zero.
  39432. if (bySet && i !== matchedCount) {
  39433. j = 0;
  39434. while (matcher = setMatchers[j++]) {
  39435. matcher(unmatched, setMatched, context, xml);
  39436. }
  39437. if (seed) {
  39438. // Reintegrate element matches to eliminate the need for sorting
  39439. if (matchedCount > 0) {
  39440. while (i--) {
  39441. if (!(unmatched[i] || setMatched[i])) {
  39442. setMatched[i] = pop.call(results);
  39443. }
  39444. }
  39445. }
  39446. // Discard index placeholder values to get only actual matches
  39447. setMatched = condense(setMatched);
  39448. }
  39449. // Add matches to results
  39450. push.apply(results, setMatched);
  39451. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  39452. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  39453. Sizzle.uniqueSort(results);
  39454. }
  39455. }
  39456. // Override manipulation of globals by nested matchers
  39457. if (outermost) {
  39458. dirruns = dirrunsUnique;
  39459. outermostContext = contextBackup;
  39460. }
  39461. return unmatched;
  39462. };
  39463. return bySet ? markFunction(superMatcher) : superMatcher;
  39464. }
  39465. compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
  39466. var i,
  39467. setMatchers = [],
  39468. elementMatchers = [],
  39469. cached = compilerCache[selector + " "];
  39470. if (!cached) {
  39471. // Generate a function of recursive functions that can be used to check each element
  39472. if (!match) {
  39473. match = tokenize(selector);
  39474. }
  39475. i = match.length;
  39476. while (i--) {
  39477. cached = matcherFromTokens(match[i]);
  39478. if (cached[expando]) {
  39479. setMatchers.push(cached);
  39480. } else {
  39481. elementMatchers.push(cached);
  39482. }
  39483. }
  39484. // Cache the compiled function
  39485. cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
  39486. // Save selector and tokenization
  39487. cached.selector = selector;
  39488. }
  39489. return cached;
  39490. };
  39491. /**
  39492. * A low-level selection function that works with Sizzle's compiled
  39493. * selector functions
  39494. * @param {String|Function} selector A selector or a pre-compiled
  39495. * selector function built with Sizzle.compile
  39496. * @param {Element} context
  39497. * @param {Array} [results]
  39498. * @param {Array} [seed] A set of elements to match against
  39499. */
  39500. select = Sizzle.select = function (selector, context, results, seed) {
  39501. var i,
  39502. tokens,
  39503. token,
  39504. type,
  39505. find,
  39506. compiled = typeof selector === "function" && selector,
  39507. match = !seed && tokenize(selector = compiled.selector || selector);
  39508. results = results || [];
  39509. // Try to minimize operations if there is only one selector in the list and no seed
  39510. // (the latter of which guarantees us context)
  39511. if (match.length === 1) {
  39512. // Reduce context if the leading compound selector is an ID
  39513. tokens = match[0] = match[0].slice(0);
  39514. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  39515. context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
  39516. if (!context) {
  39517. return results;
  39518. // Precompiled matchers will still verify ancestry, so step up a level
  39519. } else if (compiled) {
  39520. context = context.parentNode;
  39521. }
  39522. selector = selector.slice(tokens.shift().value.length);
  39523. }
  39524. // Fetch a seed set for right-to-left matching
  39525. i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
  39526. while (i--) {
  39527. token = tokens[i];
  39528. // Abort if we hit a combinator
  39529. if (Expr.relative[type = token.type]) {
  39530. break;
  39531. }
  39532. if (find = Expr.find[type]) {
  39533. // Search, expanding context for leading sibling combinators
  39534. if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
  39535. // If seed is empty or no tokens remain, we can return early
  39536. tokens.splice(i, 1);
  39537. selector = seed.length && toSelector(tokens);
  39538. if (!selector) {
  39539. push.apply(results, seed);
  39540. return results;
  39541. }
  39542. break;
  39543. }
  39544. }
  39545. }
  39546. }
  39547. // Compile and execute a filtering function if one is not provided
  39548. // Provide `match` to avoid retokenization if we modified the selector above
  39549. (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
  39550. return results;
  39551. };
  39552. // One-time assignments
  39553. // Sort stability
  39554. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  39555. // Support: Chrome 14-35+
  39556. // Always assume duplicates if they aren't passed to the comparison function
  39557. support.detectDuplicates = !!hasDuplicate;
  39558. // Initialize against the default document
  39559. setDocument();
  39560. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  39561. // Detached nodes confoundingly follow *each other*
  39562. support.sortDetached = assert(function (el) {
  39563. // Should return 1, but returns 4 (following)
  39564. return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
  39565. });
  39566. // Support: IE<8
  39567. // Prevent attribute/property "interpolation"
  39568. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  39569. if (!assert(function (el) {
  39570. el.innerHTML = "<a href='#'></a>";
  39571. return el.firstChild.getAttribute("href") === "#";
  39572. })) {
  39573. addHandle("type|href|height|width", function (elem, name, isXML) {
  39574. if (!isXML) {
  39575. return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
  39576. }
  39577. });
  39578. }
  39579. // Support: IE<9
  39580. // Use defaultValue in place of getAttribute("value")
  39581. if (!support.attributes || !assert(function (el) {
  39582. el.innerHTML = "<input/>";
  39583. el.firstChild.setAttribute("value", "");
  39584. return el.firstChild.getAttribute("value") === "";
  39585. })) {
  39586. addHandle("value", function (elem, name, isXML) {
  39587. if (!isXML && elem.nodeName.toLowerCase() === "input") {
  39588. return elem.defaultValue;
  39589. }
  39590. });
  39591. }
  39592. // Support: IE<9
  39593. // Use getAttributeNode to fetch booleans when getAttribute lies
  39594. if (!assert(function (el) {
  39595. return el.getAttribute("disabled") == null;
  39596. })) {
  39597. addHandle(booleans, function (elem, name, isXML) {
  39598. var val;
  39599. if (!isXML) {
  39600. return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  39601. }
  39602. });
  39603. }
  39604. return Sizzle;
  39605. }(window);
  39606. jQuery.find = Sizzle;
  39607. jQuery.expr = Sizzle.selectors;
  39608. // Deprecated
  39609. jQuery.expr[":"] = jQuery.expr.pseudos;
  39610. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  39611. jQuery.text = Sizzle.getText;
  39612. jQuery.isXMLDoc = Sizzle.isXML;
  39613. jQuery.contains = Sizzle.contains;
  39614. jQuery.escapeSelector = Sizzle.escape;
  39615. var dir = function dir(elem, _dir, until) {
  39616. var matched = [],
  39617. truncate = until !== undefined;
  39618. while ((elem = elem[_dir]) && elem.nodeType !== 9) {
  39619. if (elem.nodeType === 1) {
  39620. if (truncate && jQuery(elem).is(until)) {
  39621. break;
  39622. }
  39623. matched.push(elem);
  39624. }
  39625. }
  39626. return matched;
  39627. };
  39628. var _siblings = function _siblings(n, elem) {
  39629. var matched = [];
  39630. for (; n; n = n.nextSibling) {
  39631. if (n.nodeType === 1 && n !== elem) {
  39632. matched.push(n);
  39633. }
  39634. }
  39635. return matched;
  39636. };
  39637. var rneedsContext = jQuery.expr.match.needsContext;
  39638. function nodeName(elem, name) {
  39639. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  39640. };
  39641. var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
  39642. // Implement the identical functionality for filter and not
  39643. function winnow(elements, qualifier, not) {
  39644. if (isFunction(qualifier)) {
  39645. return jQuery.grep(elements, function (elem, i) {
  39646. return !!qualifier.call(elem, i, elem) !== not;
  39647. });
  39648. }
  39649. // Single element
  39650. if (qualifier.nodeType) {
  39651. return jQuery.grep(elements, function (elem) {
  39652. return elem === qualifier !== not;
  39653. });
  39654. }
  39655. // Arraylike of elements (jQuery, arguments, Array)
  39656. if (typeof qualifier !== "string") {
  39657. return jQuery.grep(elements, function (elem) {
  39658. return indexOf.call(qualifier, elem) > -1 !== not;
  39659. });
  39660. }
  39661. // Filtered directly for both simple and complex selectors
  39662. return jQuery.filter(qualifier, elements, not);
  39663. }
  39664. jQuery.filter = function (expr, elems, not) {
  39665. var elem = elems[0];
  39666. if (not) {
  39667. expr = ":not(" + expr + ")";
  39668. }
  39669. if (elems.length === 1 && elem.nodeType === 1) {
  39670. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  39671. }
  39672. return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
  39673. return elem.nodeType === 1;
  39674. }));
  39675. };
  39676. jQuery.fn.extend({
  39677. find: function find(selector) {
  39678. var i,
  39679. ret,
  39680. len = this.length,
  39681. self = this;
  39682. if (typeof selector !== "string") {
  39683. return this.pushStack(jQuery(selector).filter(function () {
  39684. for (i = 0; i < len; i++) {
  39685. if (jQuery.contains(self[i], this)) {
  39686. return true;
  39687. }
  39688. }
  39689. }));
  39690. }
  39691. ret = this.pushStack([]);
  39692. for (i = 0; i < len; i++) {
  39693. jQuery.find(selector, self[i], ret);
  39694. }
  39695. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  39696. },
  39697. filter: function filter(selector) {
  39698. return this.pushStack(winnow(this, selector || [], false));
  39699. },
  39700. not: function not(selector) {
  39701. return this.pushStack(winnow(this, selector || [], true));
  39702. },
  39703. is: function is(selector) {
  39704. return !!winnow(this,
  39705. // If this is a positional/relative selector, check membership in the returned set
  39706. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  39707. typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;
  39708. }
  39709. });
  39710. // Initialize a jQuery object
  39711. // A central reference to the root jQuery(document)
  39712. var rootjQuery,
  39713. // A simple way to check for HTML strings
  39714. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  39715. // Strict HTML recognition (#11290: must start with <)
  39716. // Shortcut simple #id case for speed
  39717. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  39718. init = jQuery.fn.init = function (selector, context, root) {
  39719. var match, elem;
  39720. // HANDLE: $(""), $(null), $(undefined), $(false)
  39721. if (!selector) {
  39722. return this;
  39723. }
  39724. // Method init() accepts an alternate rootjQuery
  39725. // so migrate can support jQuery.sub (gh-2101)
  39726. root = root || rootjQuery;
  39727. // Handle HTML strings
  39728. if (typeof selector === "string") {
  39729. if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
  39730. // Assume that strings that start and end with <> are HTML and skip the regex check
  39731. match = [null, selector, null];
  39732. } else {
  39733. match = rquickExpr.exec(selector);
  39734. }
  39735. // Match html or make sure no context is specified for #id
  39736. if (match && (match[1] || !context)) {
  39737. // HANDLE: $(html) -> $(array)
  39738. if (match[1]) {
  39739. context = context instanceof jQuery ? context[0] : context;
  39740. // Option to run scripts is true for back-compat
  39741. // Intentionally let the error be thrown if parseHTML is not present
  39742. jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
  39743. // HANDLE: $(html, props)
  39744. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  39745. for (match in context) {
  39746. // Properties of context are called as methods if possible
  39747. if (isFunction(this[match])) {
  39748. this[match](context[match]);
  39749. // ...and otherwise set as attributes
  39750. } else {
  39751. this.attr(match, context[match]);
  39752. }
  39753. }
  39754. }
  39755. return this;
  39756. // HANDLE: $(#id)
  39757. } else {
  39758. elem = document.getElementById(match[2]);
  39759. if (elem) {
  39760. // Inject the element directly into the jQuery object
  39761. this[0] = elem;
  39762. this.length = 1;
  39763. }
  39764. return this;
  39765. }
  39766. // HANDLE: $(expr, $(...))
  39767. } else if (!context || context.jquery) {
  39768. return (context || root).find(selector);
  39769. // HANDLE: $(expr, context)
  39770. // (which is just equivalent to: $(context).find(expr)
  39771. } else {
  39772. return this.constructor(context).find(selector);
  39773. }
  39774. // HANDLE: $(DOMElement)
  39775. } else if (selector.nodeType) {
  39776. this[0] = selector;
  39777. this.length = 1;
  39778. return this;
  39779. // HANDLE: $(function)
  39780. // Shortcut for document ready
  39781. } else if (isFunction(selector)) {
  39782. return root.ready !== undefined ? root.ready(selector) :
  39783. // Execute immediately if ready is not present
  39784. selector(jQuery);
  39785. }
  39786. return jQuery.makeArray(selector, this);
  39787. };
  39788. // Give the init function the jQuery prototype for later instantiation
  39789. init.prototype = jQuery.fn;
  39790. // Initialize central reference
  39791. rootjQuery = jQuery(document);
  39792. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  39793. // Methods guaranteed to produce a unique set when starting from a unique set
  39794. guaranteedUnique = {
  39795. children: true,
  39796. contents: true,
  39797. next: true,
  39798. prev: true
  39799. };
  39800. jQuery.fn.extend({
  39801. has: function has(target) {
  39802. var targets = jQuery(target, this),
  39803. l = targets.length;
  39804. return this.filter(function () {
  39805. var i = 0;
  39806. for (; i < l; i++) {
  39807. if (jQuery.contains(this, targets[i])) {
  39808. return true;
  39809. }
  39810. }
  39811. });
  39812. },
  39813. closest: function closest(selectors, context) {
  39814. var cur,
  39815. i = 0,
  39816. l = this.length,
  39817. matched = [],
  39818. targets = typeof selectors !== "string" && jQuery(selectors);
  39819. // Positional selectors never match, since there's no _selection_ context
  39820. if (!rneedsContext.test(selectors)) {
  39821. for (; i < l; i++) {
  39822. for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
  39823. // Always skip document fragments
  39824. if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 :
  39825. // Don't pass non-elements to Sizzle
  39826. cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  39827. matched.push(cur);
  39828. break;
  39829. }
  39830. }
  39831. }
  39832. }
  39833. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  39834. },
  39835. // Determine the position of an element within the set
  39836. index: function index(elem) {
  39837. // No argument, return index in parent
  39838. if (!elem) {
  39839. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  39840. }
  39841. // Index in selector
  39842. if (typeof elem === "string") {
  39843. return indexOf.call(jQuery(elem), this[0]);
  39844. }
  39845. // Locate the position of the desired element
  39846. return indexOf.call(this,
  39847. // If it receives a jQuery object, the first element is used
  39848. elem.jquery ? elem[0] : elem);
  39849. },
  39850. add: function add(selector, context) {
  39851. return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
  39852. },
  39853. addBack: function addBack(selector) {
  39854. return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
  39855. }
  39856. });
  39857. function sibling(cur, dir) {
  39858. while ((cur = cur[dir]) && cur.nodeType !== 1) {}
  39859. return cur;
  39860. }
  39861. jQuery.each({
  39862. parent: function parent(elem) {
  39863. var parent = elem.parentNode;
  39864. return parent && parent.nodeType !== 11 ? parent : null;
  39865. },
  39866. parents: function parents(elem) {
  39867. return dir(elem, "parentNode");
  39868. },
  39869. parentsUntil: function parentsUntil(elem, i, until) {
  39870. return dir(elem, "parentNode", until);
  39871. },
  39872. next: function next(elem) {
  39873. return sibling(elem, "nextSibling");
  39874. },
  39875. prev: function prev(elem) {
  39876. return sibling(elem, "previousSibling");
  39877. },
  39878. nextAll: function nextAll(elem) {
  39879. return dir(elem, "nextSibling");
  39880. },
  39881. prevAll: function prevAll(elem) {
  39882. return dir(elem, "previousSibling");
  39883. },
  39884. nextUntil: function nextUntil(elem, i, until) {
  39885. return dir(elem, "nextSibling", until);
  39886. },
  39887. prevUntil: function prevUntil(elem, i, until) {
  39888. return dir(elem, "previousSibling", until);
  39889. },
  39890. siblings: function siblings(elem) {
  39891. return _siblings((elem.parentNode || {}).firstChild, elem);
  39892. },
  39893. children: function children(elem) {
  39894. return _siblings(elem.firstChild);
  39895. },
  39896. contents: function contents(elem) {
  39897. if (nodeName(elem, "iframe")) {
  39898. return elem.contentDocument;
  39899. }
  39900. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  39901. // Treat the template element as a regular one in browsers that
  39902. // don't support it.
  39903. if (nodeName(elem, "template")) {
  39904. elem = elem.content || elem;
  39905. }
  39906. return jQuery.merge([], elem.childNodes);
  39907. }
  39908. }, function (name, fn) {
  39909. jQuery.fn[name] = function (until, selector) {
  39910. var matched = jQuery.map(this, fn, until);
  39911. if (name.slice(-5) !== "Until") {
  39912. selector = until;
  39913. }
  39914. if (selector && typeof selector === "string") {
  39915. matched = jQuery.filter(selector, matched);
  39916. }
  39917. if (this.length > 1) {
  39918. // Remove duplicates
  39919. if (!guaranteedUnique[name]) {
  39920. jQuery.uniqueSort(matched);
  39921. }
  39922. // Reverse order for parents* and prev-derivatives
  39923. if (rparentsprev.test(name)) {
  39924. matched.reverse();
  39925. }
  39926. }
  39927. return this.pushStack(matched);
  39928. };
  39929. });
  39930. var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
  39931. // Convert String-formatted options into Object-formatted ones
  39932. function createOptions(options) {
  39933. var object = {};
  39934. jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
  39935. object[flag] = true;
  39936. });
  39937. return object;
  39938. }
  39939. /*
  39940. * Create a callback list using the following parameters:
  39941. *
  39942. * options: an optional list of space-separated options that will change how
  39943. * the callback list behaves or a more traditional option object
  39944. *
  39945. * By default a callback list will act like an event callback list and can be
  39946. * "fired" multiple times.
  39947. *
  39948. * Possible options:
  39949. *
  39950. * once: will ensure the callback list can only be fired once (like a Deferred)
  39951. *
  39952. * memory: will keep track of previous values and will call any callback added
  39953. * after the list has been fired right away with the latest "memorized"
  39954. * values (like a Deferred)
  39955. *
  39956. * unique: will ensure a callback can only be added once (no duplicate in the list)
  39957. *
  39958. * stopOnFalse: interrupt callings when a callback returns false
  39959. *
  39960. */
  39961. jQuery.Callbacks = function (options) {
  39962. // Convert options from String-formatted to Object-formatted if needed
  39963. // (we check in cache first)
  39964. options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options);
  39965. var // Flag to know if list is currently firing
  39966. firing,
  39967. // Last fire value for non-forgettable lists
  39968. memory,
  39969. // Flag to know if list was already fired
  39970. _fired,
  39971. // Flag to prevent firing
  39972. _locked,
  39973. // Actual callback list
  39974. list = [],
  39975. // Queue of execution data for repeatable lists
  39976. queue = [],
  39977. // Index of currently firing callback (modified by add/remove as needed)
  39978. firingIndex = -1,
  39979. // Fire callbacks
  39980. fire = function fire() {
  39981. // Enforce single-firing
  39982. _locked = _locked || options.once;
  39983. // Execute callbacks for all pending executions,
  39984. // respecting firingIndex overrides and runtime changes
  39985. _fired = firing = true;
  39986. for (; queue.length; firingIndex = -1) {
  39987. memory = queue.shift();
  39988. while (++firingIndex < list.length) {
  39989. // Run callback and check for early termination
  39990. if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {
  39991. // Jump to end and forget the data so .add doesn't re-fire
  39992. firingIndex = list.length;
  39993. memory = false;
  39994. }
  39995. }
  39996. }
  39997. // Forget the data if we're done with it
  39998. if (!options.memory) {
  39999. memory = false;
  40000. }
  40001. firing = false;
  40002. // Clean up if we're done firing for good
  40003. if (_locked) {
  40004. // Keep an empty list if we have data for future add calls
  40005. if (memory) {
  40006. list = [];
  40007. // Otherwise, this object is spent
  40008. } else {
  40009. list = "";
  40010. }
  40011. }
  40012. },
  40013. // Actual Callbacks object
  40014. self = {
  40015. // Add a callback or a collection of callbacks to the list
  40016. add: function add() {
  40017. if (list) {
  40018. // If we have memory from a past run, we should fire after adding
  40019. if (memory && !firing) {
  40020. firingIndex = list.length - 1;
  40021. queue.push(memory);
  40022. }
  40023. (function add(args) {
  40024. jQuery.each(args, function (_, arg) {
  40025. if (isFunction(arg)) {
  40026. if (!options.unique || !self.has(arg)) {
  40027. list.push(arg);
  40028. }
  40029. } else if (arg && arg.length && toType(arg) !== "string") {
  40030. // Inspect recursively
  40031. add(arg);
  40032. }
  40033. });
  40034. })(arguments);
  40035. if (memory && !firing) {
  40036. fire();
  40037. }
  40038. }
  40039. return this;
  40040. },
  40041. // Remove a callback from the list
  40042. remove: function remove() {
  40043. jQuery.each(arguments, function (_, arg) {
  40044. var index;
  40045. while ((index = jQuery.inArray(arg, list, index)) > -1) {
  40046. list.splice(index, 1);
  40047. // Handle firing indexes
  40048. if (index <= firingIndex) {
  40049. firingIndex--;
  40050. }
  40051. }
  40052. });
  40053. return this;
  40054. },
  40055. // Check if a given callback is in the list.
  40056. // If no argument is given, return whether or not list has callbacks attached.
  40057. has: function has(fn) {
  40058. return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
  40059. },
  40060. // Remove all callbacks from the list
  40061. empty: function empty() {
  40062. if (list) {
  40063. list = [];
  40064. }
  40065. return this;
  40066. },
  40067. // Disable .fire and .add
  40068. // Abort any current/pending executions
  40069. // Clear all callbacks and values
  40070. disable: function disable() {
  40071. _locked = queue = [];
  40072. list = memory = "";
  40073. return this;
  40074. },
  40075. disabled: function disabled() {
  40076. return !list;
  40077. },
  40078. // Disable .fire
  40079. // Also disable .add unless we have memory (since it would have no effect)
  40080. // Abort any pending executions
  40081. lock: function lock() {
  40082. _locked = queue = [];
  40083. if (!memory && !firing) {
  40084. list = memory = "";
  40085. }
  40086. return this;
  40087. },
  40088. locked: function locked() {
  40089. return !!_locked;
  40090. },
  40091. // Call all callbacks with the given context and arguments
  40092. fireWith: function fireWith(context, args) {
  40093. if (!_locked) {
  40094. args = args || [];
  40095. args = [context, args.slice ? args.slice() : args];
  40096. queue.push(args);
  40097. if (!firing) {
  40098. fire();
  40099. }
  40100. }
  40101. return this;
  40102. },
  40103. // Call all the callbacks with the given arguments
  40104. fire: function fire() {
  40105. self.fireWith(this, arguments);
  40106. return this;
  40107. },
  40108. // To know if the callbacks have already been called at least once
  40109. fired: function fired() {
  40110. return !!_fired;
  40111. }
  40112. };
  40113. return self;
  40114. };
  40115. function Identity(v) {
  40116. return v;
  40117. }
  40118. function Thrower(ex) {
  40119. throw ex;
  40120. }
  40121. function adoptValue(value, resolve, reject, noValue) {
  40122. var method;
  40123. try {
  40124. // Check for promise aspect first to privilege synchronous behavior
  40125. if (value && isFunction(method = value.promise)) {
  40126. method.call(value).done(resolve).fail(reject);
  40127. // Other thenables
  40128. } else if (value && isFunction(method = value.then)) {
  40129. method.call(value, resolve, reject);
  40130. // Other non-thenables
  40131. } else {
  40132. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  40133. // * false: [ value ].slice( 0 ) => resolve( value )
  40134. // * true: [ value ].slice( 1 ) => resolve()
  40135. resolve.apply(undefined, [value].slice(noValue));
  40136. }
  40137. // For Promises/A+, convert exceptions into rejections
  40138. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  40139. // Deferred#then to conditionally suppress rejection.
  40140. } catch (value) {
  40141. // Support: Android 4.0 only
  40142. // Strict mode functions invoked without .call/.apply get global-object context
  40143. reject.apply(undefined, [value]);
  40144. }
  40145. }
  40146. jQuery.extend({
  40147. Deferred: function Deferred(func) {
  40148. var tuples = [
  40149. // action, add listener, callbacks,
  40150. // ... .then handlers, argument index, [final state]
  40151. ["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"]],
  40152. _state = "pending",
  40153. _promise = {
  40154. state: function state() {
  40155. return _state;
  40156. },
  40157. always: function always() {
  40158. deferred.done(arguments).fail(arguments);
  40159. return this;
  40160. },
  40161. "catch": function _catch(fn) {
  40162. return _promise.then(null, fn);
  40163. },
  40164. // Keep pipe for back-compat
  40165. pipe: function pipe() /* fnDone, fnFail, fnProgress */{
  40166. var fns = arguments;
  40167. return jQuery.Deferred(function (newDefer) {
  40168. jQuery.each(tuples, function (i, tuple) {
  40169. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  40170. var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
  40171. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  40172. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  40173. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  40174. deferred[tuple[1]](function () {
  40175. var returned = fn && fn.apply(this, arguments);
  40176. if (returned && isFunction(returned.promise)) {
  40177. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  40178. } else {
  40179. newDefer[tuple[0] + "With"](this, fn ? [returned] : arguments);
  40180. }
  40181. });
  40182. });
  40183. fns = null;
  40184. }).promise();
  40185. },
  40186. then: function then(onFulfilled, onRejected, onProgress) {
  40187. var maxDepth = 0;
  40188. function resolve(depth, deferred, handler, special) {
  40189. return function () {
  40190. var that = this,
  40191. args = arguments,
  40192. mightThrow = function mightThrow() {
  40193. var returned, then;
  40194. // Support: Promises/A+ section 2.3.3.3.3
  40195. // https://promisesaplus.com/#point-59
  40196. // Ignore double-resolution attempts
  40197. if (depth < maxDepth) {
  40198. return;
  40199. }
  40200. returned = handler.apply(that, args);
  40201. // Support: Promises/A+ section 2.3.1
  40202. // https://promisesaplus.com/#point-48
  40203. if (returned === deferred.promise()) {
  40204. throw new TypeError("Thenable self-resolution");
  40205. }
  40206. // Support: Promises/A+ sections 2.3.3.1, 3.5
  40207. // https://promisesaplus.com/#point-54
  40208. // https://promisesaplus.com/#point-75
  40209. // Retrieve `then` only once
  40210. then = returned && (
  40211. // Support: Promises/A+ section 2.3.4
  40212. // https://promisesaplus.com/#point-64
  40213. // Only check objects and functions for thenability
  40214. (typeof returned === "undefined" ? "undefined" : _typeof(returned)) === "object" || typeof returned === "function") && returned.then;
  40215. // Handle a returned thenable
  40216. if (isFunction(then)) {
  40217. // Special processors (notify) just wait for resolution
  40218. if (special) {
  40219. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));
  40220. // Normal processors (resolve) also hook into progress
  40221. } else {
  40222. // ...and disregard older resolution values
  40223. maxDepth++;
  40224. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));
  40225. }
  40226. // Handle all other returned values
  40227. } else {
  40228. // Only substitute handlers pass on context
  40229. // and multiple values (non-spec behavior)
  40230. if (handler !== Identity) {
  40231. that = undefined;
  40232. args = [returned];
  40233. }
  40234. // Process the value(s)
  40235. // Default process is resolve
  40236. (special || deferred.resolveWith)(that, args);
  40237. }
  40238. },
  40239. // Only normal processors (resolve) catch and reject exceptions
  40240. process = special ? mightThrow : function () {
  40241. try {
  40242. mightThrow();
  40243. } catch (e) {
  40244. if (jQuery.Deferred.exceptionHook) {
  40245. jQuery.Deferred.exceptionHook(e, process.stackTrace);
  40246. }
  40247. // Support: Promises/A+ section 2.3.3.3.4.1
  40248. // https://promisesaplus.com/#point-61
  40249. // Ignore post-resolution exceptions
  40250. if (depth + 1 >= maxDepth) {
  40251. // Only substitute handlers pass on context
  40252. // and multiple values (non-spec behavior)
  40253. if (handler !== Thrower) {
  40254. that = undefined;
  40255. args = [e];
  40256. }
  40257. deferred.rejectWith(that, args);
  40258. }
  40259. }
  40260. };
  40261. // Support: Promises/A+ section 2.3.3.3.1
  40262. // https://promisesaplus.com/#point-57
  40263. // Re-resolve promises immediately to dodge false rejection from
  40264. // subsequent errors
  40265. if (depth) {
  40266. process();
  40267. } else {
  40268. // Call an optional hook to record the stack, in case of exception
  40269. // since it's otherwise lost when execution goes async
  40270. if (jQuery.Deferred.getStackHook) {
  40271. process.stackTrace = jQuery.Deferred.getStackHook();
  40272. }
  40273. window.setTimeout(process);
  40274. }
  40275. };
  40276. }
  40277. return jQuery.Deferred(function (newDefer) {
  40278. // progress_handlers.add( ... )
  40279. tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith));
  40280. // fulfilled_handlers.add( ... )
  40281. tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity));
  40282. // rejected_handlers.add( ... )
  40283. tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));
  40284. }).promise();
  40285. },
  40286. // Get a promise for this deferred
  40287. // If obj is provided, the promise aspect is added to the object
  40288. promise: function promise(obj) {
  40289. return obj != null ? jQuery.extend(obj, _promise) : _promise;
  40290. }
  40291. },
  40292. deferred = {};
  40293. // Add list-specific methods
  40294. jQuery.each(tuples, function (i, tuple) {
  40295. var list = tuple[2],
  40296. stateString = tuple[5];
  40297. // promise.progress = list.add
  40298. // promise.done = list.add
  40299. // promise.fail = list.add
  40300. _promise[tuple[1]] = list.add;
  40301. // Handle state
  40302. if (stateString) {
  40303. list.add(function () {
  40304. // state = "resolved" (i.e., fulfilled)
  40305. // state = "rejected"
  40306. _state = stateString;
  40307. },
  40308. // rejected_callbacks.disable
  40309. // fulfilled_callbacks.disable
  40310. tuples[3 - i][2].disable,
  40311. // rejected_handlers.disable
  40312. // fulfilled_handlers.disable
  40313. tuples[3 - i][3].disable,
  40314. // progress_callbacks.lock
  40315. tuples[0][2].lock,
  40316. // progress_handlers.lock
  40317. tuples[0][3].lock);
  40318. }
  40319. // progress_handlers.fire
  40320. // fulfilled_handlers.fire
  40321. // rejected_handlers.fire
  40322. list.add(tuple[3].fire);
  40323. // deferred.notify = function() { deferred.notifyWith(...) }
  40324. // deferred.resolve = function() { deferred.resolveWith(...) }
  40325. // deferred.reject = function() { deferred.rejectWith(...) }
  40326. deferred[tuple[0]] = function () {
  40327. deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
  40328. return this;
  40329. };
  40330. // deferred.notifyWith = list.fireWith
  40331. // deferred.resolveWith = list.fireWith
  40332. // deferred.rejectWith = list.fireWith
  40333. deferred[tuple[0] + "With"] = list.fireWith;
  40334. });
  40335. // Make the deferred a promise
  40336. _promise.promise(deferred);
  40337. // Call given func if any
  40338. if (func) {
  40339. func.call(deferred, deferred);
  40340. }
  40341. // All done!
  40342. return deferred;
  40343. },
  40344. // Deferred helper
  40345. when: function when(singleValue) {
  40346. var
  40347. // count of uncompleted subordinates
  40348. remaining = arguments.length,
  40349. // count of unprocessed arguments
  40350. i = remaining,
  40351. // subordinate fulfillment data
  40352. resolveContexts = Array(i),
  40353. resolveValues = _slice.call(arguments),
  40354. // the master Deferred
  40355. master = jQuery.Deferred(),
  40356. // subordinate callback factory
  40357. updateFunc = function updateFunc(i) {
  40358. return function (value) {
  40359. resolveContexts[i] = this;
  40360. resolveValues[i] = arguments.length > 1 ? _slice.call(arguments) : value;
  40361. if (! --remaining) {
  40362. master.resolveWith(resolveContexts, resolveValues);
  40363. }
  40364. };
  40365. };
  40366. // Single- and empty arguments are adopted like Promise.resolve
  40367. if (remaining <= 1) {
  40368. adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining);
  40369. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  40370. if (master.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) {
  40371. return master.then();
  40372. }
  40373. }
  40374. // Multiple arguments are aggregated like Promise.all array elements
  40375. while (i--) {
  40376. adoptValue(resolveValues[i], updateFunc(i), master.reject);
  40377. }
  40378. return master.promise();
  40379. }
  40380. });
  40381. // These usually indicate a programmer mistake during development,
  40382. // warn about them ASAP rather than swallowing them by default.
  40383. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  40384. jQuery.Deferred.exceptionHook = function (error, stack) {
  40385. // Support: IE 8 - 9 only
  40386. // Console exists when dev tools are open, which can happen at any time
  40387. if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
  40388. window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
  40389. }
  40390. };
  40391. jQuery.readyException = function (error) {
  40392. window.setTimeout(function () {
  40393. throw error;
  40394. });
  40395. };
  40396. // The deferred used on DOM ready
  40397. var readyList = jQuery.Deferred();
  40398. jQuery.fn.ready = function (fn) {
  40399. readyList.then(fn)
  40400. // Wrap jQuery.readyException in a function so that the lookup
  40401. // happens at the time of error handling instead of callback
  40402. // registration.
  40403. .catch(function (error) {
  40404. jQuery.readyException(error);
  40405. });
  40406. return this;
  40407. };
  40408. jQuery.extend({
  40409. // Is the DOM ready to be used? Set to true once it occurs.
  40410. isReady: false,
  40411. // A counter to track how many items to wait for before
  40412. // the ready event fires. See #6781
  40413. readyWait: 1,
  40414. // Handle when the DOM is ready
  40415. ready: function ready(wait) {
  40416. // Abort if there are pending holds or we're already ready
  40417. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  40418. return;
  40419. }
  40420. // Remember that the DOM is ready
  40421. jQuery.isReady = true;
  40422. // If a normal DOM Ready event fired, decrement, and wait if need be
  40423. if (wait !== true && --jQuery.readyWait > 0) {
  40424. return;
  40425. }
  40426. // If there are functions bound, to execute
  40427. readyList.resolveWith(document, [jQuery]);
  40428. }
  40429. });
  40430. jQuery.ready.then = readyList.then;
  40431. // The ready event handler and self cleanup method
  40432. function completed() {
  40433. document.removeEventListener("DOMContentLoaded", completed);
  40434. window.removeEventListener("load", completed);
  40435. jQuery.ready();
  40436. }
  40437. // Catch cases where $(document).ready() is called
  40438. // after the browser event has already occurred.
  40439. // Support: IE <=9 - 10 only
  40440. // Older IE sometimes signals "interactive" too soon
  40441. if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) {
  40442. // Handle it asynchronously to allow scripts the opportunity to delay ready
  40443. window.setTimeout(jQuery.ready);
  40444. } else {
  40445. // Use the handy event callback
  40446. document.addEventListener("DOMContentLoaded", completed);
  40447. // A fallback to window.onload, that will always work
  40448. window.addEventListener("load", completed);
  40449. }
  40450. // Multifunctional method to get and set values of a collection
  40451. // The value/s can optionally be executed if it's a function
  40452. var access = function access(elems, fn, key, value, chainable, emptyGet, raw) {
  40453. var i = 0,
  40454. len = elems.length,
  40455. bulk = key == null;
  40456. // Sets many values
  40457. if (toType(key) === "object") {
  40458. chainable = true;
  40459. for (i in key) {
  40460. access(elems, fn, i, key[i], true, emptyGet, raw);
  40461. }
  40462. // Sets one value
  40463. } else if (value !== undefined) {
  40464. chainable = true;
  40465. if (!isFunction(value)) {
  40466. raw = true;
  40467. }
  40468. if (bulk) {
  40469. // Bulk operations run against the entire set
  40470. if (raw) {
  40471. fn.call(elems, value);
  40472. fn = null;
  40473. // ...except when executing function values
  40474. } else {
  40475. bulk = fn;
  40476. fn = function fn(elem, key, value) {
  40477. return bulk.call(jQuery(elem), value);
  40478. };
  40479. }
  40480. }
  40481. if (fn) {
  40482. for (; i < len; i++) {
  40483. fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
  40484. }
  40485. }
  40486. }
  40487. if (chainable) {
  40488. return elems;
  40489. }
  40490. // Gets
  40491. if (bulk) {
  40492. return fn.call(elems);
  40493. }
  40494. return len ? fn(elems[0], key) : emptyGet;
  40495. };
  40496. // Matches dashed string for camelizing
  40497. var rmsPrefix = /^-ms-/,
  40498. rdashAlpha = /-([a-z])/g;
  40499. // Used by camelCase as callback to replace()
  40500. function fcamelCase(all, letter) {
  40501. return letter.toUpperCase();
  40502. }
  40503. // Convert dashed to camelCase; used by the css and data modules
  40504. // Support: IE <=9 - 11, Edge 12 - 15
  40505. // Microsoft forgot to hump their vendor prefix (#9572)
  40506. function camelCase(string) {
  40507. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  40508. }
  40509. var acceptData = function acceptData(owner) {
  40510. // Accepts only:
  40511. // - Node
  40512. // - Node.ELEMENT_NODE
  40513. // - Node.DOCUMENT_NODE
  40514. // - Object
  40515. // - Any
  40516. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  40517. };
  40518. function Data() {
  40519. this.expando = jQuery.expando + Data.uid++;
  40520. }
  40521. Data.uid = 1;
  40522. Data.prototype = {
  40523. cache: function cache(owner) {
  40524. // Check if the owner object already has a cache
  40525. var value = owner[this.expando];
  40526. // If not, create one
  40527. if (!value) {
  40528. value = {};
  40529. // We can accept data for non-element nodes in modern browsers,
  40530. // but we should not, see #8335.
  40531. // Always return an empty object.
  40532. if (acceptData(owner)) {
  40533. // If it is a node unlikely to be stringify-ed or looped over
  40534. // use plain assignment
  40535. if (owner.nodeType) {
  40536. owner[this.expando] = value;
  40537. // Otherwise secure it in a non-enumerable property
  40538. // configurable must be true to allow the property to be
  40539. // deleted when data is removed
  40540. } else {
  40541. Object.defineProperty(owner, this.expando, {
  40542. value: value,
  40543. configurable: true
  40544. });
  40545. }
  40546. }
  40547. }
  40548. return value;
  40549. },
  40550. set: function set(owner, data, value) {
  40551. var prop,
  40552. cache = this.cache(owner);
  40553. // Handle: [ owner, key, value ] args
  40554. // Always use camelCase key (gh-2257)
  40555. if (typeof data === "string") {
  40556. cache[camelCase(data)] = value;
  40557. // Handle: [ owner, { properties } ] args
  40558. } else {
  40559. // Copy the properties one-by-one to the cache object
  40560. for (prop in data) {
  40561. cache[camelCase(prop)] = data[prop];
  40562. }
  40563. }
  40564. return cache;
  40565. },
  40566. get: function get(owner, key) {
  40567. return key === undefined ? this.cache(owner) :
  40568. // Always use camelCase key (gh-2257)
  40569. owner[this.expando] && owner[this.expando][camelCase(key)];
  40570. },
  40571. access: function access(owner, key, value) {
  40572. // In cases where either:
  40573. //
  40574. // 1. No key was specified
  40575. // 2. A string key was specified, but no value provided
  40576. //
  40577. // Take the "read" path and allow the get method to determine
  40578. // which value to return, respectively either:
  40579. //
  40580. // 1. The entire cache object
  40581. // 2. The data stored at the key
  40582. //
  40583. if (key === undefined || key && typeof key === "string" && value === undefined) {
  40584. return this.get(owner, key);
  40585. }
  40586. // When the key is not a string, or both a key and value
  40587. // are specified, set or extend (existing objects) with either:
  40588. //
  40589. // 1. An object of properties
  40590. // 2. A key and value
  40591. //
  40592. this.set(owner, key, value);
  40593. // Since the "set" path can have two possible entry points
  40594. // return the expected data based on which path was taken[*]
  40595. return value !== undefined ? value : key;
  40596. },
  40597. remove: function remove(owner, key) {
  40598. var i,
  40599. cache = owner[this.expando];
  40600. if (cache === undefined) {
  40601. return;
  40602. }
  40603. if (key !== undefined) {
  40604. // Support array or space separated string of keys
  40605. if (Array.isArray(key)) {
  40606. // If key is an array of keys...
  40607. // We always set camelCase keys, so remove that.
  40608. key = key.map(camelCase);
  40609. } else {
  40610. key = camelCase(key);
  40611. // If a key with the spaces exists, use it.
  40612. // Otherwise, create an array by matching non-whitespace
  40613. key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
  40614. }
  40615. i = key.length;
  40616. while (i--) {
  40617. delete cache[key[i]];
  40618. }
  40619. }
  40620. // Remove the expando if there's no more data
  40621. if (key === undefined || jQuery.isEmptyObject(cache)) {
  40622. // Support: Chrome <=35 - 45
  40623. // Webkit & Blink performance suffers when deleting properties
  40624. // from DOM nodes, so set to undefined instead
  40625. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  40626. if (owner.nodeType) {
  40627. owner[this.expando] = undefined;
  40628. } else {
  40629. delete owner[this.expando];
  40630. }
  40631. }
  40632. },
  40633. hasData: function hasData(owner) {
  40634. var cache = owner[this.expando];
  40635. return cache !== undefined && !jQuery.isEmptyObject(cache);
  40636. }
  40637. };
  40638. var dataPriv = new Data();
  40639. var dataUser = new Data();
  40640. // Implementation Summary
  40641. //
  40642. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  40643. // 2. Improve the module's maintainability by reducing the storage
  40644. // paths to a single mechanism.
  40645. // 3. Use the same single mechanism to support "private" and "user" data.
  40646. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  40647. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  40648. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  40649. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  40650. rmultiDash = /[A-Z]/g;
  40651. function getData(data) {
  40652. if (data === "true") {
  40653. return true;
  40654. }
  40655. if (data === "false") {
  40656. return false;
  40657. }
  40658. if (data === "null") {
  40659. return null;
  40660. }
  40661. // Only convert to a number if it doesn't change the string
  40662. if (data === +data + "") {
  40663. return +data;
  40664. }
  40665. if (rbrace.test(data)) {
  40666. return JSON.parse(data);
  40667. }
  40668. return data;
  40669. }
  40670. function dataAttr(elem, key, data) {
  40671. var name;
  40672. // If nothing was found internally, try to fetch any
  40673. // data from the HTML5 data-* attribute
  40674. if (data === undefined && elem.nodeType === 1) {
  40675. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  40676. data = elem.getAttribute(name);
  40677. if (typeof data === "string") {
  40678. try {
  40679. data = getData(data);
  40680. } catch (e) {}
  40681. // Make sure we set the data so it isn't changed later
  40682. dataUser.set(elem, key, data);
  40683. } else {
  40684. data = undefined;
  40685. }
  40686. }
  40687. return data;
  40688. }
  40689. jQuery.extend({
  40690. hasData: function hasData(elem) {
  40691. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  40692. },
  40693. data: function data(elem, name, _data) {
  40694. return dataUser.access(elem, name, _data);
  40695. },
  40696. removeData: function removeData(elem, name) {
  40697. dataUser.remove(elem, name);
  40698. },
  40699. // TODO: Now that all calls to _data and _removeData have been replaced
  40700. // with direct calls to dataPriv methods, these can be deprecated.
  40701. _data: function _data(elem, name, data) {
  40702. return dataPriv.access(elem, name, data);
  40703. },
  40704. _removeData: function _removeData(elem, name) {
  40705. dataPriv.remove(elem, name);
  40706. }
  40707. });
  40708. jQuery.fn.extend({
  40709. data: function data(key, value) {
  40710. var i,
  40711. name,
  40712. data,
  40713. elem = this[0],
  40714. attrs = elem && elem.attributes;
  40715. // Gets all values
  40716. if (key === undefined) {
  40717. if (this.length) {
  40718. data = dataUser.get(elem);
  40719. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  40720. i = attrs.length;
  40721. while (i--) {
  40722. // Support: IE 11 only
  40723. // The attrs elements can be null (#14894)
  40724. if (attrs[i]) {
  40725. name = attrs[i].name;
  40726. if (name.indexOf("data-") === 0) {
  40727. name = camelCase(name.slice(5));
  40728. dataAttr(elem, name, data[name]);
  40729. }
  40730. }
  40731. }
  40732. dataPriv.set(elem, "hasDataAttrs", true);
  40733. }
  40734. }
  40735. return data;
  40736. }
  40737. // Sets multiple values
  40738. if ((typeof key === "undefined" ? "undefined" : _typeof(key)) === "object") {
  40739. return this.each(function () {
  40740. dataUser.set(this, key);
  40741. });
  40742. }
  40743. return access(this, function (value) {
  40744. var data;
  40745. // The calling jQuery object (element matches) is not empty
  40746. // (and therefore has an element appears at this[ 0 ]) and the
  40747. // `value` parameter was not undefined. An empty jQuery object
  40748. // will result in `undefined` for elem = this[ 0 ] which will
  40749. // throw an exception if an attempt to read a data cache is made.
  40750. if (elem && value === undefined) {
  40751. // Attempt to get data from the cache
  40752. // The key will always be camelCased in Data
  40753. data = dataUser.get(elem, key);
  40754. if (data !== undefined) {
  40755. return data;
  40756. }
  40757. // Attempt to "discover" the data in
  40758. // HTML5 custom data-* attrs
  40759. data = dataAttr(elem, key);
  40760. if (data !== undefined) {
  40761. return data;
  40762. }
  40763. // We tried really hard, but the data doesn't exist.
  40764. return;
  40765. }
  40766. // Set the data...
  40767. this.each(function () {
  40768. // We always store the camelCased key
  40769. dataUser.set(this, key, value);
  40770. });
  40771. }, null, value, arguments.length > 1, null, true);
  40772. },
  40773. removeData: function removeData(key) {
  40774. return this.each(function () {
  40775. dataUser.remove(this, key);
  40776. });
  40777. }
  40778. });
  40779. jQuery.extend({
  40780. queue: function queue(elem, type, data) {
  40781. var queue;
  40782. if (elem) {
  40783. type = (type || "fx") + "queue";
  40784. queue = dataPriv.get(elem, type);
  40785. // Speed up dequeue by getting out quickly if this is just a lookup
  40786. if (data) {
  40787. if (!queue || Array.isArray(data)) {
  40788. queue = dataPriv.access(elem, type, jQuery.makeArray(data));
  40789. } else {
  40790. queue.push(data);
  40791. }
  40792. }
  40793. return queue || [];
  40794. }
  40795. },
  40796. dequeue: function dequeue(elem, type) {
  40797. type = type || "fx";
  40798. var queue = jQuery.queue(elem, type),
  40799. startLength = queue.length,
  40800. fn = queue.shift(),
  40801. hooks = jQuery._queueHooks(elem, type),
  40802. next = function next() {
  40803. jQuery.dequeue(elem, type);
  40804. };
  40805. // If the fx queue is dequeued, always remove the progress sentinel
  40806. if (fn === "inprogress") {
  40807. fn = queue.shift();
  40808. startLength--;
  40809. }
  40810. if (fn) {
  40811. // Add a progress sentinel to prevent the fx queue from being
  40812. // automatically dequeued
  40813. if (type === "fx") {
  40814. queue.unshift("inprogress");
  40815. }
  40816. // Clear up the last queue stop function
  40817. delete hooks.stop;
  40818. fn.call(elem, next, hooks);
  40819. }
  40820. if (!startLength && hooks) {
  40821. hooks.empty.fire();
  40822. }
  40823. },
  40824. // Not public - generate a queueHooks object, or return the current one
  40825. _queueHooks: function _queueHooks(elem, type) {
  40826. var key = type + "queueHooks";
  40827. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  40828. empty: jQuery.Callbacks("once memory").add(function () {
  40829. dataPriv.remove(elem, [type + "queue", key]);
  40830. })
  40831. });
  40832. }
  40833. });
  40834. jQuery.fn.extend({
  40835. queue: function queue(type, data) {
  40836. var setter = 2;
  40837. if (typeof type !== "string") {
  40838. data = type;
  40839. type = "fx";
  40840. setter--;
  40841. }
  40842. if (arguments.length < setter) {
  40843. return jQuery.queue(this[0], type);
  40844. }
  40845. return data === undefined ? this : this.each(function () {
  40846. var queue = jQuery.queue(this, type, data);
  40847. // Ensure a hooks for this queue
  40848. jQuery._queueHooks(this, type);
  40849. if (type === "fx" && queue[0] !== "inprogress") {
  40850. jQuery.dequeue(this, type);
  40851. }
  40852. });
  40853. },
  40854. dequeue: function dequeue(type) {
  40855. return this.each(function () {
  40856. jQuery.dequeue(this, type);
  40857. });
  40858. },
  40859. clearQueue: function clearQueue(type) {
  40860. return this.queue(type || "fx", []);
  40861. },
  40862. // Get a promise resolved when queues of a certain type
  40863. // are emptied (fx is the type by default)
  40864. promise: function promise(type, obj) {
  40865. var tmp,
  40866. count = 1,
  40867. defer = jQuery.Deferred(),
  40868. elements = this,
  40869. i = this.length,
  40870. resolve = function resolve() {
  40871. if (! --count) {
  40872. defer.resolveWith(elements, [elements]);
  40873. }
  40874. };
  40875. if (typeof type !== "string") {
  40876. obj = type;
  40877. type = undefined;
  40878. }
  40879. type = type || "fx";
  40880. while (i--) {
  40881. tmp = dataPriv.get(elements[i], type + "queueHooks");
  40882. if (tmp && tmp.empty) {
  40883. count++;
  40884. tmp.empty.add(resolve);
  40885. }
  40886. }
  40887. resolve();
  40888. return defer.promise(obj);
  40889. }
  40890. });
  40891. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  40892. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  40893. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  40894. var isHiddenWithinTree = function isHiddenWithinTree(elem, el) {
  40895. // isHiddenWithinTree might be called from jQuery#filter function;
  40896. // in that case, element will be second argument
  40897. elem = el || elem;
  40898. // Inline style trumps all
  40899. return elem.style.display === "none" || elem.style.display === "" &&
  40900. // Otherwise, check computed style
  40901. // Support: Firefox <=43 - 45
  40902. // Disconnected elements can have computed display: none, so first confirm that elem is
  40903. // in the document.
  40904. jQuery.contains(elem.ownerDocument, elem) && jQuery.css(elem, "display") === "none";
  40905. };
  40906. var swap = function swap(elem, options, callback, args) {
  40907. var ret,
  40908. name,
  40909. old = {};
  40910. // Remember the old values, and insert the new ones
  40911. for (name in options) {
  40912. old[name] = elem.style[name];
  40913. elem.style[name] = options[name];
  40914. }
  40915. ret = callback.apply(elem, args || []);
  40916. // Revert the old values
  40917. for (name in options) {
  40918. elem.style[name] = old[name];
  40919. }
  40920. return ret;
  40921. };
  40922. function adjustCSS(elem, prop, valueParts, tween) {
  40923. var adjusted,
  40924. scale,
  40925. maxIterations = 20,
  40926. currentValue = tween ? function () {
  40927. return tween.cur();
  40928. } : function () {
  40929. return jQuery.css(elem, prop, "");
  40930. },
  40931. initial = currentValue(),
  40932. unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
  40933. // Starting value computation is required for potential unit mismatches
  40934. initialInUnit = (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
  40935. if (initialInUnit && initialInUnit[3] !== unit) {
  40936. // Support: Firefox <=54
  40937. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  40938. initial = initial / 2;
  40939. // Trust units reported by jQuery.css
  40940. unit = unit || initialInUnit[3];
  40941. // Iteratively approximate from a nonzero starting point
  40942. initialInUnit = +initial || 1;
  40943. while (maxIterations--) {
  40944. // Evaluate and update our best guess (doubling guesses that zero out).
  40945. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  40946. jQuery.style(elem, prop, initialInUnit + unit);
  40947. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  40948. maxIterations = 0;
  40949. }
  40950. initialInUnit = initialInUnit / scale;
  40951. }
  40952. initialInUnit = initialInUnit * 2;
  40953. jQuery.style(elem, prop, initialInUnit + unit);
  40954. // Make sure we update the tween properties later on
  40955. valueParts = valueParts || [];
  40956. }
  40957. if (valueParts) {
  40958. initialInUnit = +initialInUnit || +initial || 0;
  40959. // Apply relative offset (+=/-=) if specified
  40960. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  40961. if (tween) {
  40962. tween.unit = unit;
  40963. tween.start = initialInUnit;
  40964. tween.end = adjusted;
  40965. }
  40966. }
  40967. return adjusted;
  40968. }
  40969. var defaultDisplayMap = {};
  40970. function getDefaultDisplay(elem) {
  40971. var temp,
  40972. doc = elem.ownerDocument,
  40973. nodeName = elem.nodeName,
  40974. display = defaultDisplayMap[nodeName];
  40975. if (display) {
  40976. return display;
  40977. }
  40978. temp = doc.body.appendChild(doc.createElement(nodeName));
  40979. display = jQuery.css(temp, "display");
  40980. temp.parentNode.removeChild(temp);
  40981. if (display === "none") {
  40982. display = "block";
  40983. }
  40984. defaultDisplayMap[nodeName] = display;
  40985. return display;
  40986. }
  40987. function showHide(elements, show) {
  40988. var display,
  40989. elem,
  40990. values = [],
  40991. index = 0,
  40992. length = elements.length;
  40993. // Determine new display value for elements that need to change
  40994. for (; index < length; index++) {
  40995. elem = elements[index];
  40996. if (!elem.style) {
  40997. continue;
  40998. }
  40999. display = elem.style.display;
  41000. if (show) {
  41001. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  41002. // check is required in this first loop unless we have a nonempty display value (either
  41003. // inline or about-to-be-restored)
  41004. if (display === "none") {
  41005. values[index] = dataPriv.get(elem, "display") || null;
  41006. if (!values[index]) {
  41007. elem.style.display = "";
  41008. }
  41009. }
  41010. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  41011. values[index] = getDefaultDisplay(elem);
  41012. }
  41013. } else {
  41014. if (display !== "none") {
  41015. values[index] = "none";
  41016. // Remember what we're overwriting
  41017. dataPriv.set(elem, "display", display);
  41018. }
  41019. }
  41020. }
  41021. // Set the display of the elements in a second loop to avoid constant reflow
  41022. for (index = 0; index < length; index++) {
  41023. if (values[index] != null) {
  41024. elements[index].style.display = values[index];
  41025. }
  41026. }
  41027. return elements;
  41028. }
  41029. jQuery.fn.extend({
  41030. show: function show() {
  41031. return showHide(this, true);
  41032. },
  41033. hide: function hide() {
  41034. return showHide(this);
  41035. },
  41036. toggle: function toggle(state) {
  41037. if (typeof state === "boolean") {
  41038. return state ? this.show() : this.hide();
  41039. }
  41040. return this.each(function () {
  41041. if (isHiddenWithinTree(this)) {
  41042. jQuery(this).show();
  41043. } else {
  41044. jQuery(this).hide();
  41045. }
  41046. });
  41047. }
  41048. });
  41049. var rcheckableType = /^(?:checkbox|radio)$/i;
  41050. var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i;
  41051. var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  41052. // We have to close these tags to support XHTML (#13200)
  41053. var wrapMap = {
  41054. // Support: IE <=9 only
  41055. option: [1, "<select multiple='multiple'>", "</select>"],
  41056. // XHTML parsers do not magically insert elements in the
  41057. // same way that tag soup parsers do. So we cannot shorten
  41058. // this by omitting <tbody> or other required elements.
  41059. thead: [1, "<table>", "</table>"],
  41060. col: [2, "<table><colgroup>", "</colgroup></table>"],
  41061. tr: [2, "<table><tbody>", "</tbody></table>"],
  41062. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  41063. _default: [0, "", ""]
  41064. };
  41065. // Support: IE <=9 only
  41066. wrapMap.optgroup = wrapMap.option;
  41067. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  41068. wrapMap.th = wrapMap.td;
  41069. function getAll(context, tag) {
  41070. // Support: IE <=9 - 11 only
  41071. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  41072. var ret;
  41073. if (typeof context.getElementsByTagName !== "undefined") {
  41074. ret = context.getElementsByTagName(tag || "*");
  41075. } else if (typeof context.querySelectorAll !== "undefined") {
  41076. ret = context.querySelectorAll(tag || "*");
  41077. } else {
  41078. ret = [];
  41079. }
  41080. if (tag === undefined || tag && nodeName(context, tag)) {
  41081. return jQuery.merge([context], ret);
  41082. }
  41083. return ret;
  41084. }
  41085. // Mark scripts as having already been evaluated
  41086. function setGlobalEval(elems, refElements) {
  41087. var i = 0,
  41088. l = elems.length;
  41089. for (; i < l; i++) {
  41090. dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval"));
  41091. }
  41092. }
  41093. var rhtml = /<|&#?\w+;/;
  41094. function buildFragment(elems, context, scripts, selection, ignored) {
  41095. var elem,
  41096. tmp,
  41097. tag,
  41098. wrap,
  41099. contains,
  41100. j,
  41101. fragment = context.createDocumentFragment(),
  41102. nodes = [],
  41103. i = 0,
  41104. l = elems.length;
  41105. for (; i < l; i++) {
  41106. elem = elems[i];
  41107. if (elem || elem === 0) {
  41108. // Add nodes directly
  41109. if (toType(elem) === "object") {
  41110. // Support: Android <=4.0 only, PhantomJS 1 only
  41111. // push.apply(_, arraylike) throws on ancient WebKit
  41112. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  41113. // Convert non-html into a text node
  41114. } else if (!rhtml.test(elem)) {
  41115. nodes.push(context.createTextNode(elem));
  41116. // Convert html into DOM nodes
  41117. } else {
  41118. tmp = tmp || fragment.appendChild(context.createElement("div"));
  41119. // Deserialize a standard representation
  41120. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  41121. wrap = wrapMap[tag] || wrapMap._default;
  41122. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  41123. // Descend through wrappers to the right content
  41124. j = wrap[0];
  41125. while (j--) {
  41126. tmp = tmp.lastChild;
  41127. }
  41128. // Support: Android <=4.0 only, PhantomJS 1 only
  41129. // push.apply(_, arraylike) throws on ancient WebKit
  41130. jQuery.merge(nodes, tmp.childNodes);
  41131. // Remember the top-level container
  41132. tmp = fragment.firstChild;
  41133. // Ensure the created nodes are orphaned (#12392)
  41134. tmp.textContent = "";
  41135. }
  41136. }
  41137. }
  41138. // Remove wrapper from fragment
  41139. fragment.textContent = "";
  41140. i = 0;
  41141. while (elem = nodes[i++]) {
  41142. // Skip elements already in the context collection (trac-4087)
  41143. if (selection && jQuery.inArray(elem, selection) > -1) {
  41144. if (ignored) {
  41145. ignored.push(elem);
  41146. }
  41147. continue;
  41148. }
  41149. contains = jQuery.contains(elem.ownerDocument, elem);
  41150. // Append to fragment
  41151. tmp = getAll(fragment.appendChild(elem), "script");
  41152. // Preserve script evaluation history
  41153. if (contains) {
  41154. setGlobalEval(tmp);
  41155. }
  41156. // Capture executables
  41157. if (scripts) {
  41158. j = 0;
  41159. while (elem = tmp[j++]) {
  41160. if (rscriptType.test(elem.type || "")) {
  41161. scripts.push(elem);
  41162. }
  41163. }
  41164. }
  41165. }
  41166. return fragment;
  41167. }
  41168. (function () {
  41169. var fragment = document.createDocumentFragment(),
  41170. div = fragment.appendChild(document.createElement("div")),
  41171. input = document.createElement("input");
  41172. // Support: Android 4.0 - 4.3 only
  41173. // Check state lost if the name is set (#11217)
  41174. // Support: Windows Web Apps (WWA)
  41175. // `name` and `type` must use .setAttribute for WWA (#14901)
  41176. input.setAttribute("type", "radio");
  41177. input.setAttribute("checked", "checked");
  41178. input.setAttribute("name", "t");
  41179. div.appendChild(input);
  41180. // Support: Android <=4.1 only
  41181. // Older WebKit doesn't clone checked state correctly in fragments
  41182. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  41183. // Support: IE <=11 only
  41184. // Make sure textarea (and checkbox) defaultValue is properly cloned
  41185. div.innerHTML = "<textarea>x</textarea>";
  41186. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  41187. })();
  41188. var documentElement = document.documentElement;
  41189. var rkeyEvent = /^key/,
  41190. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  41191. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  41192. function returnTrue() {
  41193. return true;
  41194. }
  41195. function returnFalse() {
  41196. return false;
  41197. }
  41198. // Support: IE <=9 only
  41199. // See #13393 for more info
  41200. function safeActiveElement() {
  41201. try {
  41202. return document.activeElement;
  41203. } catch (err) {}
  41204. }
  41205. function _on(elem, types, selector, data, fn, one) {
  41206. var origFn, type;
  41207. // Types can be a map of types/handlers
  41208. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  41209. // ( types-Object, selector, data )
  41210. if (typeof selector !== "string") {
  41211. // ( types-Object, data )
  41212. data = data || selector;
  41213. selector = undefined;
  41214. }
  41215. for (type in types) {
  41216. _on(elem, type, selector, data, types[type], one);
  41217. }
  41218. return elem;
  41219. }
  41220. if (data == null && fn == null) {
  41221. // ( types, fn )
  41222. fn = selector;
  41223. data = selector = undefined;
  41224. } else if (fn == null) {
  41225. if (typeof selector === "string") {
  41226. // ( types, selector, fn )
  41227. fn = data;
  41228. data = undefined;
  41229. } else {
  41230. // ( types, data, fn )
  41231. fn = data;
  41232. data = selector;
  41233. selector = undefined;
  41234. }
  41235. }
  41236. if (fn === false) {
  41237. fn = returnFalse;
  41238. } else if (!fn) {
  41239. return elem;
  41240. }
  41241. if (one === 1) {
  41242. origFn = fn;
  41243. fn = function fn(event) {
  41244. // Can use an empty set, since event contains the info
  41245. jQuery().off(event);
  41246. return origFn.apply(this, arguments);
  41247. };
  41248. // Use same guid so caller can remove using origFn
  41249. fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  41250. }
  41251. return elem.each(function () {
  41252. jQuery.event.add(this, types, fn, data, selector);
  41253. });
  41254. }
  41255. /*
  41256. * Helper functions for managing events -- not part of the public interface.
  41257. * Props to Dean Edwards' addEvent library for many of the ideas.
  41258. */
  41259. jQuery.event = {
  41260. global: {},
  41261. add: function add(elem, types, handler, data, selector) {
  41262. var handleObjIn,
  41263. eventHandle,
  41264. tmp,
  41265. events,
  41266. t,
  41267. handleObj,
  41268. special,
  41269. handlers,
  41270. type,
  41271. namespaces,
  41272. origType,
  41273. elemData = dataPriv.get(elem);
  41274. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  41275. if (!elemData) {
  41276. return;
  41277. }
  41278. // Caller can pass in an object of custom data in lieu of the handler
  41279. if (handler.handler) {
  41280. handleObjIn = handler;
  41281. handler = handleObjIn.handler;
  41282. selector = handleObjIn.selector;
  41283. }
  41284. // Ensure that invalid selectors throw exceptions at attach time
  41285. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  41286. if (selector) {
  41287. jQuery.find.matchesSelector(documentElement, selector);
  41288. }
  41289. // Make sure that the handler has a unique ID, used to find/remove it later
  41290. if (!handler.guid) {
  41291. handler.guid = jQuery.guid++;
  41292. }
  41293. // Init the element's event structure and main handler, if this is the first
  41294. if (!(events = elemData.events)) {
  41295. events = elemData.events = {};
  41296. }
  41297. if (!(eventHandle = elemData.handle)) {
  41298. eventHandle = elemData.handle = function (e) {
  41299. // Discard the second event of a jQuery.event.trigger() and
  41300. // when an event is called after a page has unloaded
  41301. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;
  41302. };
  41303. }
  41304. // Handle multiple events separated by a space
  41305. types = (types || "").match(rnothtmlwhite) || [""];
  41306. t = types.length;
  41307. while (t--) {
  41308. tmp = rtypenamespace.exec(types[t]) || [];
  41309. type = origType = tmp[1];
  41310. namespaces = (tmp[2] || "").split(".").sort();
  41311. // There *must* be a type, no attaching namespace-only handlers
  41312. if (!type) {
  41313. continue;
  41314. }
  41315. // If event changes its type, use the special event handlers for the changed type
  41316. special = jQuery.event.special[type] || {};
  41317. // If selector defined, determine special event api type, otherwise given type
  41318. type = (selector ? special.delegateType : special.bindType) || type;
  41319. // Update special based on newly reset type
  41320. special = jQuery.event.special[type] || {};
  41321. // handleObj is passed to all event handlers
  41322. handleObj = jQuery.extend({
  41323. type: type,
  41324. origType: origType,
  41325. data: data,
  41326. handler: handler,
  41327. guid: handler.guid,
  41328. selector: selector,
  41329. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  41330. namespace: namespaces.join(".")
  41331. }, handleObjIn);
  41332. // Init the event handler queue if we're the first
  41333. if (!(handlers = events[type])) {
  41334. handlers = events[type] = [];
  41335. handlers.delegateCount = 0;
  41336. // Only use addEventListener if the special events handler returns false
  41337. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  41338. if (elem.addEventListener) {
  41339. elem.addEventListener(type, eventHandle);
  41340. }
  41341. }
  41342. }
  41343. if (special.add) {
  41344. special.add.call(elem, handleObj);
  41345. if (!handleObj.handler.guid) {
  41346. handleObj.handler.guid = handler.guid;
  41347. }
  41348. }
  41349. // Add to the element's handler list, delegates in front
  41350. if (selector) {
  41351. handlers.splice(handlers.delegateCount++, 0, handleObj);
  41352. } else {
  41353. handlers.push(handleObj);
  41354. }
  41355. // Keep track of which events have ever been used, for event optimization
  41356. jQuery.event.global[type] = true;
  41357. }
  41358. },
  41359. // Detach an event or set of events from an element
  41360. remove: function remove(elem, types, handler, selector, mappedTypes) {
  41361. var j,
  41362. origCount,
  41363. tmp,
  41364. events,
  41365. t,
  41366. handleObj,
  41367. special,
  41368. handlers,
  41369. type,
  41370. namespaces,
  41371. origType,
  41372. elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  41373. if (!elemData || !(events = elemData.events)) {
  41374. return;
  41375. }
  41376. // Once for each type.namespace in types; type may be omitted
  41377. types = (types || "").match(rnothtmlwhite) || [""];
  41378. t = types.length;
  41379. while (t--) {
  41380. tmp = rtypenamespace.exec(types[t]) || [];
  41381. type = origType = tmp[1];
  41382. namespaces = (tmp[2] || "").split(".").sort();
  41383. // Unbind all events (on this namespace, if provided) for the element
  41384. if (!type) {
  41385. for (type in events) {
  41386. jQuery.event.remove(elem, type + types[t], handler, selector, true);
  41387. }
  41388. continue;
  41389. }
  41390. special = jQuery.event.special[type] || {};
  41391. type = (selector ? special.delegateType : special.bindType) || type;
  41392. handlers = events[type] || [];
  41393. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  41394. // Remove matching events
  41395. origCount = j = handlers.length;
  41396. while (j--) {
  41397. handleObj = handlers[j];
  41398. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  41399. handlers.splice(j, 1);
  41400. if (handleObj.selector) {
  41401. handlers.delegateCount--;
  41402. }
  41403. if (special.remove) {
  41404. special.remove.call(elem, handleObj);
  41405. }
  41406. }
  41407. }
  41408. // Remove generic event handler if we removed something and no more handlers exist
  41409. // (avoids potential for endless recursion during removal of special event handlers)
  41410. if (origCount && !handlers.length) {
  41411. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  41412. jQuery.removeEvent(elem, type, elemData.handle);
  41413. }
  41414. delete events[type];
  41415. }
  41416. }
  41417. // Remove data and the expando if it's no longer used
  41418. if (jQuery.isEmptyObject(events)) {
  41419. dataPriv.remove(elem, "handle events");
  41420. }
  41421. },
  41422. dispatch: function dispatch(nativeEvent) {
  41423. // Make a writable jQuery.Event from the native event object
  41424. var event = jQuery.event.fix(nativeEvent);
  41425. var i,
  41426. j,
  41427. ret,
  41428. matched,
  41429. handleObj,
  41430. handlerQueue,
  41431. args = new Array(arguments.length),
  41432. handlers = (dataPriv.get(this, "events") || {})[event.type] || [],
  41433. special = jQuery.event.special[event.type] || {};
  41434. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  41435. args[0] = event;
  41436. for (i = 1; i < arguments.length; i++) {
  41437. args[i] = arguments[i];
  41438. }
  41439. event.delegateTarget = this;
  41440. // Call the preDispatch hook for the mapped type, and let it bail if desired
  41441. if (special.preDispatch && special.preDispatch.call(this, event) === false) {
  41442. return;
  41443. }
  41444. // Determine handlers
  41445. handlerQueue = jQuery.event.handlers.call(this, event, handlers);
  41446. // Run delegates first; they may want to stop propagation beneath us
  41447. i = 0;
  41448. while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
  41449. event.currentTarget = matched.elem;
  41450. j = 0;
  41451. while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
  41452. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  41453. // a subset or equal to those in the bound event (both can have no namespace).
  41454. if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {
  41455. event.handleObj = handleObj;
  41456. event.data = handleObj.data;
  41457. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  41458. if (ret !== undefined) {
  41459. if ((event.result = ret) === false) {
  41460. event.preventDefault();
  41461. event.stopPropagation();
  41462. }
  41463. }
  41464. }
  41465. }
  41466. }
  41467. // Call the postDispatch hook for the mapped type
  41468. if (special.postDispatch) {
  41469. special.postDispatch.call(this, event);
  41470. }
  41471. return event.result;
  41472. },
  41473. handlers: function handlers(event, _handlers) {
  41474. var i,
  41475. handleObj,
  41476. sel,
  41477. matchedHandlers,
  41478. matchedSelectors,
  41479. handlerQueue = [],
  41480. delegateCount = _handlers.delegateCount,
  41481. cur = event.target;
  41482. // Find delegate handlers
  41483. if (delegateCount &&
  41484. // Support: IE <=9
  41485. // Black-hole SVG <use> instance trees (trac-13180)
  41486. cur.nodeType &&
  41487. // Support: Firefox <=42
  41488. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  41489. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  41490. // Support: IE 11 only
  41491. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  41492. !(event.type === "click" && event.button >= 1)) {
  41493. for (; cur !== this; cur = cur.parentNode || this) {
  41494. // Don't check non-elements (#13208)
  41495. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  41496. if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
  41497. matchedHandlers = [];
  41498. matchedSelectors = {};
  41499. for (i = 0; i < delegateCount; i++) {
  41500. handleObj = _handlers[i];
  41501. // Don't conflict with Object.prototype properties (#13203)
  41502. sel = handleObj.selector + " ";
  41503. if (matchedSelectors[sel] === undefined) {
  41504. matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  41505. }
  41506. if (matchedSelectors[sel]) {
  41507. matchedHandlers.push(handleObj);
  41508. }
  41509. }
  41510. if (matchedHandlers.length) {
  41511. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  41512. }
  41513. }
  41514. }
  41515. }
  41516. // Add the remaining (directly-bound) handlers
  41517. cur = this;
  41518. if (delegateCount < _handlers.length) {
  41519. handlerQueue.push({ elem: cur, handlers: _handlers.slice(delegateCount) });
  41520. }
  41521. return handlerQueue;
  41522. },
  41523. addProp: function addProp(name, hook) {
  41524. Object.defineProperty(jQuery.Event.prototype, name, {
  41525. enumerable: true,
  41526. configurable: true,
  41527. get: isFunction(hook) ? function () {
  41528. if (this.originalEvent) {
  41529. return hook(this.originalEvent);
  41530. }
  41531. } : function () {
  41532. if (this.originalEvent) {
  41533. return this.originalEvent[name];
  41534. }
  41535. },
  41536. set: function set(value) {
  41537. Object.defineProperty(this, name, {
  41538. enumerable: true,
  41539. configurable: true,
  41540. writable: true,
  41541. value: value
  41542. });
  41543. }
  41544. });
  41545. },
  41546. fix: function fix(originalEvent) {
  41547. return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
  41548. },
  41549. special: {
  41550. load: {
  41551. // Prevent triggered image.load events from bubbling to window.load
  41552. noBubble: true
  41553. },
  41554. focus: {
  41555. // Fire native event if possible so blur/focus sequence is correct
  41556. trigger: function trigger() {
  41557. if (this !== safeActiveElement() && this.focus) {
  41558. this.focus();
  41559. return false;
  41560. }
  41561. },
  41562. delegateType: "focusin"
  41563. },
  41564. blur: {
  41565. trigger: function trigger() {
  41566. if (this === safeActiveElement() && this.blur) {
  41567. this.blur();
  41568. return false;
  41569. }
  41570. },
  41571. delegateType: "focusout"
  41572. },
  41573. click: {
  41574. // For checkbox, fire native event so checked state will be right
  41575. trigger: function trigger() {
  41576. if (this.type === "checkbox" && this.click && nodeName(this, "input")) {
  41577. this.click();
  41578. return false;
  41579. }
  41580. },
  41581. // For cross-browser consistency, don't fire native .click() on links
  41582. _default: function _default(event) {
  41583. return nodeName(event.target, "a");
  41584. }
  41585. },
  41586. beforeunload: {
  41587. postDispatch: function postDispatch(event) {
  41588. // Support: Firefox 20+
  41589. // Firefox doesn't alert if the returnValue field is not set.
  41590. if (event.result !== undefined && event.originalEvent) {
  41591. event.originalEvent.returnValue = event.result;
  41592. }
  41593. }
  41594. }
  41595. }
  41596. };
  41597. jQuery.removeEvent = function (elem, type, handle) {
  41598. // This "if" is needed for plain objects
  41599. if (elem.removeEventListener) {
  41600. elem.removeEventListener(type, handle);
  41601. }
  41602. };
  41603. jQuery.Event = function (src, props) {
  41604. // Allow instantiation without the 'new' keyword
  41605. if (!(this instanceof jQuery.Event)) {
  41606. return new jQuery.Event(src, props);
  41607. }
  41608. // Event object
  41609. if (src && src.type) {
  41610. this.originalEvent = src;
  41611. this.type = src.type;
  41612. // Events bubbling up the document may have been marked as prevented
  41613. // by a handler lower down the tree; reflect the correct value.
  41614. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&
  41615. // Support: Android <=2.3 only
  41616. src.returnValue === false ? returnTrue : returnFalse;
  41617. // Create target properties
  41618. // Support: Safari <=6 - 7 only
  41619. // Target should not be a text node (#504, #13143)
  41620. this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
  41621. this.currentTarget = src.currentTarget;
  41622. this.relatedTarget = src.relatedTarget;
  41623. // Event type
  41624. } else {
  41625. this.type = src;
  41626. }
  41627. // Put explicitly provided properties onto the event object
  41628. if (props) {
  41629. jQuery.extend(this, props);
  41630. }
  41631. // Create a timestamp if incoming event doesn't have one
  41632. this.timeStamp = src && src.timeStamp || Date.now();
  41633. // Mark it as fixed
  41634. this[jQuery.expando] = true;
  41635. };
  41636. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  41637. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  41638. jQuery.Event.prototype = {
  41639. constructor: jQuery.Event,
  41640. isDefaultPrevented: returnFalse,
  41641. isPropagationStopped: returnFalse,
  41642. isImmediatePropagationStopped: returnFalse,
  41643. isSimulated: false,
  41644. preventDefault: function preventDefault() {
  41645. var e = this.originalEvent;
  41646. this.isDefaultPrevented = returnTrue;
  41647. if (e && !this.isSimulated) {
  41648. e.preventDefault();
  41649. }
  41650. },
  41651. stopPropagation: function stopPropagation() {
  41652. var e = this.originalEvent;
  41653. this.isPropagationStopped = returnTrue;
  41654. if (e && !this.isSimulated) {
  41655. e.stopPropagation();
  41656. }
  41657. },
  41658. stopImmediatePropagation: function stopImmediatePropagation() {
  41659. var e = this.originalEvent;
  41660. this.isImmediatePropagationStopped = returnTrue;
  41661. if (e && !this.isSimulated) {
  41662. e.stopImmediatePropagation();
  41663. }
  41664. this.stopPropagation();
  41665. }
  41666. };
  41667. // Includes all common event props including KeyEvent and MouseEvent specific props
  41668. jQuery.each({
  41669. altKey: true,
  41670. bubbles: true,
  41671. cancelable: true,
  41672. changedTouches: true,
  41673. ctrlKey: true,
  41674. detail: true,
  41675. eventPhase: true,
  41676. metaKey: true,
  41677. pageX: true,
  41678. pageY: true,
  41679. shiftKey: true,
  41680. view: true,
  41681. "char": true,
  41682. charCode: true,
  41683. key: true,
  41684. keyCode: true,
  41685. button: true,
  41686. buttons: true,
  41687. clientX: true,
  41688. clientY: true,
  41689. offsetX: true,
  41690. offsetY: true,
  41691. pointerId: true,
  41692. pointerType: true,
  41693. screenX: true,
  41694. screenY: true,
  41695. targetTouches: true,
  41696. toElement: true,
  41697. touches: true,
  41698. which: function which(event) {
  41699. var button = event.button;
  41700. // Add which for key events
  41701. if (event.which == null && rkeyEvent.test(event.type)) {
  41702. return event.charCode != null ? event.charCode : event.keyCode;
  41703. }
  41704. // Add which for click: 1 === left; 2 === middle; 3 === right
  41705. if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {
  41706. if (button & 1) {
  41707. return 1;
  41708. }
  41709. if (button & 2) {
  41710. return 3;
  41711. }
  41712. if (button & 4) {
  41713. return 2;
  41714. }
  41715. return 0;
  41716. }
  41717. return event.which;
  41718. }
  41719. }, jQuery.event.addProp);
  41720. // Create mouseenter/leave events using mouseover/out and event-time checks
  41721. // so that event delegation works in jQuery.
  41722. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  41723. //
  41724. // Support: Safari 7 only
  41725. // Safari sends mouseenter too often; see:
  41726. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  41727. // for the description of the bug (it existed in older Chrome versions as well).
  41728. jQuery.each({
  41729. mouseenter: "mouseover",
  41730. mouseleave: "mouseout",
  41731. pointerenter: "pointerover",
  41732. pointerleave: "pointerout"
  41733. }, function (orig, fix) {
  41734. jQuery.event.special[orig] = {
  41735. delegateType: fix,
  41736. bindType: fix,
  41737. handle: function handle(event) {
  41738. var ret,
  41739. target = this,
  41740. related = event.relatedTarget,
  41741. handleObj = event.handleObj;
  41742. // For mouseenter/leave call the handler if related is outside the target.
  41743. // NB: No relatedTarget if the mouse left/entered the browser window
  41744. if (!related || related !== target && !jQuery.contains(target, related)) {
  41745. event.type = handleObj.origType;
  41746. ret = handleObj.handler.apply(this, arguments);
  41747. event.type = fix;
  41748. }
  41749. return ret;
  41750. }
  41751. };
  41752. });
  41753. jQuery.fn.extend({
  41754. on: function on(types, selector, data, fn) {
  41755. return _on(this, types, selector, data, fn);
  41756. },
  41757. one: function one(types, selector, data, fn) {
  41758. return _on(this, types, selector, data, fn, 1);
  41759. },
  41760. off: function off(types, selector, fn) {
  41761. var handleObj, type;
  41762. if (types && types.preventDefault && types.handleObj) {
  41763. // ( event ) dispatched jQuery.Event
  41764. handleObj = types.handleObj;
  41765. jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
  41766. return this;
  41767. }
  41768. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  41769. // ( types-object [, selector] )
  41770. for (type in types) {
  41771. this.off(type, selector, types[type]);
  41772. }
  41773. return this;
  41774. }
  41775. if (selector === false || typeof selector === "function") {
  41776. // ( types [, fn] )
  41777. fn = selector;
  41778. selector = undefined;
  41779. }
  41780. if (fn === false) {
  41781. fn = returnFalse;
  41782. }
  41783. return this.each(function () {
  41784. jQuery.event.remove(this, types, fn, selector);
  41785. });
  41786. }
  41787. });
  41788. var
  41789. /* eslint-disable max-len */
  41790. // See https://github.com/eslint/eslint/issues/3229
  41791. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  41792. /* eslint-enable */
  41793. // Support: IE <=10 - 11, Edge 12 - 13 only
  41794. // In IE/Edge using regex groups here causes severe slowdowns.
  41795. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  41796. rnoInnerhtml = /<script|<style|<link/i,
  41797. // checked="checked" or checked
  41798. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  41799. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  41800. // Prefer a tbody over its parent table for containing new rows
  41801. function manipulationTarget(elem, content) {
  41802. if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  41803. return jQuery(elem).children("tbody")[0] || elem;
  41804. }
  41805. return elem;
  41806. }
  41807. // Replace/restore the type attribute of script elements for safe DOM manipulation
  41808. function disableScript(elem) {
  41809. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  41810. return elem;
  41811. }
  41812. function restoreScript(elem) {
  41813. if ((elem.type || "").slice(0, 5) === "true/") {
  41814. elem.type = elem.type.slice(5);
  41815. } else {
  41816. elem.removeAttribute("type");
  41817. }
  41818. return elem;
  41819. }
  41820. function cloneCopyEvent(src, dest) {
  41821. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  41822. if (dest.nodeType !== 1) {
  41823. return;
  41824. }
  41825. // 1. Copy private data: events, handlers, etc.
  41826. if (dataPriv.hasData(src)) {
  41827. pdataOld = dataPriv.access(src);
  41828. pdataCur = dataPriv.set(dest, pdataOld);
  41829. events = pdataOld.events;
  41830. if (events) {
  41831. delete pdataCur.handle;
  41832. pdataCur.events = {};
  41833. for (type in events) {
  41834. for (i = 0, l = events[type].length; i < l; i++) {
  41835. jQuery.event.add(dest, type, events[type][i]);
  41836. }
  41837. }
  41838. }
  41839. }
  41840. // 2. Copy user data
  41841. if (dataUser.hasData(src)) {
  41842. udataOld = dataUser.access(src);
  41843. udataCur = jQuery.extend({}, udataOld);
  41844. dataUser.set(dest, udataCur);
  41845. }
  41846. }
  41847. // Fix IE bugs, see support tests
  41848. function fixInput(src, dest) {
  41849. var nodeName = dest.nodeName.toLowerCase();
  41850. // Fails to persist the checked state of a cloned checkbox or radio button.
  41851. if (nodeName === "input" && rcheckableType.test(src.type)) {
  41852. dest.checked = src.checked;
  41853. // Fails to return the selected option to the default selected state when cloning options
  41854. } else if (nodeName === "input" || nodeName === "textarea") {
  41855. dest.defaultValue = src.defaultValue;
  41856. }
  41857. }
  41858. function domManip(collection, args, callback, ignored) {
  41859. // Flatten any nested arrays
  41860. args = concat.apply([], args);
  41861. var fragment,
  41862. first,
  41863. scripts,
  41864. hasScripts,
  41865. node,
  41866. doc,
  41867. i = 0,
  41868. l = collection.length,
  41869. iNoClone = l - 1,
  41870. value = args[0],
  41871. valueIsFunction = isFunction(value);
  41872. // We can't cloneNode fragments that contain checked, in WebKit
  41873. if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
  41874. return collection.each(function (index) {
  41875. var self = collection.eq(index);
  41876. if (valueIsFunction) {
  41877. args[0] = value.call(this, index, self.html());
  41878. }
  41879. domManip(self, args, callback, ignored);
  41880. });
  41881. }
  41882. if (l) {
  41883. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  41884. first = fragment.firstChild;
  41885. if (fragment.childNodes.length === 1) {
  41886. fragment = first;
  41887. }
  41888. // Require either new content or an interest in ignored elements to invoke the callback
  41889. if (first || ignored) {
  41890. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  41891. hasScripts = scripts.length;
  41892. // Use the original fragment for the last item
  41893. // instead of the first because it can end up
  41894. // being emptied incorrectly in certain situations (#8070).
  41895. for (; i < l; i++) {
  41896. node = fragment;
  41897. if (i !== iNoClone) {
  41898. node = jQuery.clone(node, true, true);
  41899. // Keep references to cloned scripts for later restoration
  41900. if (hasScripts) {
  41901. // Support: Android <=4.0 only, PhantomJS 1 only
  41902. // push.apply(_, arraylike) throws on ancient WebKit
  41903. jQuery.merge(scripts, getAll(node, "script"));
  41904. }
  41905. }
  41906. callback.call(collection[i], node, i);
  41907. }
  41908. if (hasScripts) {
  41909. doc = scripts[scripts.length - 1].ownerDocument;
  41910. // Reenable scripts
  41911. jQuery.map(scripts, restoreScript);
  41912. // Evaluate executable scripts on first document insertion
  41913. for (i = 0; i < hasScripts; i++) {
  41914. node = scripts[i];
  41915. if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
  41916. if (node.src && (node.type || "").toLowerCase() !== "module") {
  41917. // Optional AJAX dependency, but won't run scripts if not present
  41918. if (jQuery._evalUrl) {
  41919. jQuery._evalUrl(node.src);
  41920. }
  41921. } else {
  41922. DOMEval(node.textContent.replace(rcleanScript, ""), doc, node);
  41923. }
  41924. }
  41925. }
  41926. }
  41927. }
  41928. }
  41929. return collection;
  41930. }
  41931. function _remove(elem, selector, keepData) {
  41932. var node,
  41933. nodes = selector ? jQuery.filter(selector, elem) : elem,
  41934. i = 0;
  41935. for (; (node = nodes[i]) != null; i++) {
  41936. if (!keepData && node.nodeType === 1) {
  41937. jQuery.cleanData(getAll(node));
  41938. }
  41939. if (node.parentNode) {
  41940. if (keepData && jQuery.contains(node.ownerDocument, node)) {
  41941. setGlobalEval(getAll(node, "script"));
  41942. }
  41943. node.parentNode.removeChild(node);
  41944. }
  41945. }
  41946. return elem;
  41947. }
  41948. jQuery.extend({
  41949. htmlPrefilter: function htmlPrefilter(html) {
  41950. return html.replace(rxhtmlTag, "<$1></$2>");
  41951. },
  41952. clone: function clone(elem, dataAndEvents, deepDataAndEvents) {
  41953. var i,
  41954. l,
  41955. srcElements,
  41956. destElements,
  41957. clone = elem.cloneNode(true),
  41958. inPage = jQuery.contains(elem.ownerDocument, elem);
  41959. // Fix IE cloning issues
  41960. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  41961. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  41962. destElements = getAll(clone);
  41963. srcElements = getAll(elem);
  41964. for (i = 0, l = srcElements.length; i < l; i++) {
  41965. fixInput(srcElements[i], destElements[i]);
  41966. }
  41967. }
  41968. // Copy the events from the original to the clone
  41969. if (dataAndEvents) {
  41970. if (deepDataAndEvents) {
  41971. srcElements = srcElements || getAll(elem);
  41972. destElements = destElements || getAll(clone);
  41973. for (i = 0, l = srcElements.length; i < l; i++) {
  41974. cloneCopyEvent(srcElements[i], destElements[i]);
  41975. }
  41976. } else {
  41977. cloneCopyEvent(elem, clone);
  41978. }
  41979. }
  41980. // Preserve script evaluation history
  41981. destElements = getAll(clone, "script");
  41982. if (destElements.length > 0) {
  41983. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  41984. }
  41985. // Return the cloned set
  41986. return clone;
  41987. },
  41988. cleanData: function cleanData(elems) {
  41989. var data,
  41990. elem,
  41991. type,
  41992. special = jQuery.event.special,
  41993. i = 0;
  41994. for (; (elem = elems[i]) !== undefined; i++) {
  41995. if (acceptData(elem)) {
  41996. if (data = elem[dataPriv.expando]) {
  41997. if (data.events) {
  41998. for (type in data.events) {
  41999. if (special[type]) {
  42000. jQuery.event.remove(elem, type);
  42001. // This is a shortcut to avoid jQuery.event.remove's overhead
  42002. } else {
  42003. jQuery.removeEvent(elem, type, data.handle);
  42004. }
  42005. }
  42006. }
  42007. // Support: Chrome <=35 - 45+
  42008. // Assign undefined instead of using delete, see Data#remove
  42009. elem[dataPriv.expando] = undefined;
  42010. }
  42011. if (elem[dataUser.expando]) {
  42012. // Support: Chrome <=35 - 45+
  42013. // Assign undefined instead of using delete, see Data#remove
  42014. elem[dataUser.expando] = undefined;
  42015. }
  42016. }
  42017. }
  42018. }
  42019. });
  42020. jQuery.fn.extend({
  42021. detach: function detach(selector) {
  42022. return _remove(this, selector, true);
  42023. },
  42024. remove: function remove(selector) {
  42025. return _remove(this, selector);
  42026. },
  42027. text: function text(value) {
  42028. return access(this, function (value) {
  42029. return value === undefined ? jQuery.text(this) : this.empty().each(function () {
  42030. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  42031. this.textContent = value;
  42032. }
  42033. });
  42034. }, null, value, arguments.length);
  42035. },
  42036. append: function append() {
  42037. return domManip(this, arguments, function (elem) {
  42038. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  42039. var target = manipulationTarget(this, elem);
  42040. target.appendChild(elem);
  42041. }
  42042. });
  42043. },
  42044. prepend: function prepend() {
  42045. return domManip(this, arguments, function (elem) {
  42046. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  42047. var target = manipulationTarget(this, elem);
  42048. target.insertBefore(elem, target.firstChild);
  42049. }
  42050. });
  42051. },
  42052. before: function before() {
  42053. return domManip(this, arguments, function (elem) {
  42054. if (this.parentNode) {
  42055. this.parentNode.insertBefore(elem, this);
  42056. }
  42057. });
  42058. },
  42059. after: function after() {
  42060. return domManip(this, arguments, function (elem) {
  42061. if (this.parentNode) {
  42062. this.parentNode.insertBefore(elem, this.nextSibling);
  42063. }
  42064. });
  42065. },
  42066. empty: function empty() {
  42067. var elem,
  42068. i = 0;
  42069. for (; (elem = this[i]) != null; i++) {
  42070. if (elem.nodeType === 1) {
  42071. // Prevent memory leaks
  42072. jQuery.cleanData(getAll(elem, false));
  42073. // Remove any remaining nodes
  42074. elem.textContent = "";
  42075. }
  42076. }
  42077. return this;
  42078. },
  42079. clone: function clone(dataAndEvents, deepDataAndEvents) {
  42080. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  42081. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  42082. return this.map(function () {
  42083. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  42084. });
  42085. },
  42086. html: function html(value) {
  42087. return access(this, function (value) {
  42088. var elem = this[0] || {},
  42089. i = 0,
  42090. l = this.length;
  42091. if (value === undefined && elem.nodeType === 1) {
  42092. return elem.innerHTML;
  42093. }
  42094. // See if we can take a shortcut and just use innerHTML
  42095. if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
  42096. value = jQuery.htmlPrefilter(value);
  42097. try {
  42098. for (; i < l; i++) {
  42099. elem = this[i] || {};
  42100. // Remove element nodes and prevent memory leaks
  42101. if (elem.nodeType === 1) {
  42102. jQuery.cleanData(getAll(elem, false));
  42103. elem.innerHTML = value;
  42104. }
  42105. }
  42106. elem = 0;
  42107. // If using innerHTML throws an exception, use the fallback method
  42108. } catch (e) {}
  42109. }
  42110. if (elem) {
  42111. this.empty().append(value);
  42112. }
  42113. }, null, value, arguments.length);
  42114. },
  42115. replaceWith: function replaceWith() {
  42116. var ignored = [];
  42117. // Make the changes, replacing each non-ignored context element with the new content
  42118. return domManip(this, arguments, function (elem) {
  42119. var parent = this.parentNode;
  42120. if (jQuery.inArray(this, ignored) < 0) {
  42121. jQuery.cleanData(getAll(this));
  42122. if (parent) {
  42123. parent.replaceChild(elem, this);
  42124. }
  42125. }
  42126. // Force callback invocation
  42127. }, ignored);
  42128. }
  42129. });
  42130. jQuery.each({
  42131. appendTo: "append",
  42132. prependTo: "prepend",
  42133. insertBefore: "before",
  42134. insertAfter: "after",
  42135. replaceAll: "replaceWith"
  42136. }, function (name, original) {
  42137. jQuery.fn[name] = function (selector) {
  42138. var elems,
  42139. ret = [],
  42140. insert = jQuery(selector),
  42141. last = insert.length - 1,
  42142. i = 0;
  42143. for (; i <= last; i++) {
  42144. elems = i === last ? this : this.clone(true);
  42145. jQuery(insert[i])[original](elems);
  42146. // Support: Android <=4.0 only, PhantomJS 1 only
  42147. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  42148. push.apply(ret, elems.get());
  42149. }
  42150. return this.pushStack(ret);
  42151. };
  42152. });
  42153. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  42154. var getStyles = function getStyles(elem) {
  42155. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  42156. // IE throws on elements created in popups
  42157. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  42158. var view = elem.ownerDocument.defaultView;
  42159. if (!view || !view.opener) {
  42160. view = window;
  42161. }
  42162. return view.getComputedStyle(elem);
  42163. };
  42164. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  42165. (function () {
  42166. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  42167. // so they're executed at the same time to save the second computation.
  42168. function computeStyleTests() {
  42169. // This is a singleton, we need to execute it only once
  42170. if (!div) {
  42171. return;
  42172. }
  42173. container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0";
  42174. div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%";
  42175. documentElement.appendChild(container).appendChild(div);
  42176. var divStyle = window.getComputedStyle(div);
  42177. pixelPositionVal = divStyle.top !== "1%";
  42178. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  42179. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  42180. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  42181. // Some styles come back with percentage values, even though they shouldn't
  42182. div.style.right = "60%";
  42183. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  42184. // Support: IE 9 - 11 only
  42185. // Detect misreporting of content dimensions for box-sizing:border-box elements
  42186. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  42187. // Support: IE 9 only
  42188. // Detect overflow:scroll screwiness (gh-3699)
  42189. div.style.position = "absolute";
  42190. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  42191. documentElement.removeChild(container);
  42192. // Nullify the div so it wouldn't be stored in the memory and
  42193. // it will also be a sign that checks already performed
  42194. div = null;
  42195. }
  42196. function roundPixelMeasures(measure) {
  42197. return Math.round(parseFloat(measure));
  42198. }
  42199. var pixelPositionVal,
  42200. boxSizingReliableVal,
  42201. scrollboxSizeVal,
  42202. pixelBoxStylesVal,
  42203. reliableMarginLeftVal,
  42204. container = document.createElement("div"),
  42205. div = document.createElement("div");
  42206. // Finish early in limited (non-browser) environments
  42207. if (!div.style) {
  42208. return;
  42209. }
  42210. // Support: IE <=9 - 11 only
  42211. // Style of cloned element affects source element cloned (#8908)
  42212. div.style.backgroundClip = "content-box";
  42213. div.cloneNode(true).style.backgroundClip = "";
  42214. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  42215. jQuery.extend(support, {
  42216. boxSizingReliable: function boxSizingReliable() {
  42217. computeStyleTests();
  42218. return boxSizingReliableVal;
  42219. },
  42220. pixelBoxStyles: function pixelBoxStyles() {
  42221. computeStyleTests();
  42222. return pixelBoxStylesVal;
  42223. },
  42224. pixelPosition: function pixelPosition() {
  42225. computeStyleTests();
  42226. return pixelPositionVal;
  42227. },
  42228. reliableMarginLeft: function reliableMarginLeft() {
  42229. computeStyleTests();
  42230. return reliableMarginLeftVal;
  42231. },
  42232. scrollboxSize: function scrollboxSize() {
  42233. computeStyleTests();
  42234. return scrollboxSizeVal;
  42235. }
  42236. });
  42237. })();
  42238. function curCSS(elem, name, computed) {
  42239. var width,
  42240. minWidth,
  42241. maxWidth,
  42242. ret,
  42243. // Support: Firefox 51+
  42244. // Retrieving style before computed somehow
  42245. // fixes an issue with getting wrong values
  42246. // on detached elements
  42247. style = elem.style;
  42248. computed = computed || getStyles(elem);
  42249. // getPropertyValue is needed for:
  42250. // .css('filter') (IE 9 only, #12537)
  42251. // .css('--customProperty) (#3144)
  42252. if (computed) {
  42253. ret = computed.getPropertyValue(name) || computed[name];
  42254. if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
  42255. ret = jQuery.style(elem, name);
  42256. }
  42257. // A tribute to the "awesome hack by Dean Edwards"
  42258. // Android Browser returns percentage for some values,
  42259. // but width seems to be reliably pixels.
  42260. // This is against the CSSOM draft spec:
  42261. // https://drafts.csswg.org/cssom/#resolved-values
  42262. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  42263. // Remember the original values
  42264. width = style.width;
  42265. minWidth = style.minWidth;
  42266. maxWidth = style.maxWidth;
  42267. // Put in the new values to get a computed value out
  42268. style.minWidth = style.maxWidth = style.width = ret;
  42269. ret = computed.width;
  42270. // Revert the changed values
  42271. style.width = width;
  42272. style.minWidth = minWidth;
  42273. style.maxWidth = maxWidth;
  42274. }
  42275. }
  42276. return ret !== undefined ?
  42277. // Support: IE <=9 - 11 only
  42278. // IE returns zIndex value as an integer.
  42279. ret + "" : ret;
  42280. }
  42281. function addGetHookIf(conditionFn, hookFn) {
  42282. // Define the hook, we'll check on the first run if it's really needed.
  42283. return {
  42284. get: function get() {
  42285. if (conditionFn()) {
  42286. // Hook not needed (or it's not possible to use it due
  42287. // to missing dependency), remove it.
  42288. delete this.get;
  42289. return;
  42290. }
  42291. // Hook needed; redefine it so that the support test is not executed again.
  42292. return (this.get = hookFn).apply(this, arguments);
  42293. }
  42294. };
  42295. }
  42296. var
  42297. // Swappable if display is none or starts with table
  42298. // except "table", "table-cell", or "table-caption"
  42299. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  42300. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  42301. rcustomProp = /^--/,
  42302. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  42303. cssNormalTransform = {
  42304. letterSpacing: "0",
  42305. fontWeight: "400"
  42306. },
  42307. cssPrefixes = ["Webkit", "Moz", "ms"],
  42308. emptyStyle = document.createElement("div").style;
  42309. // Return a css property mapped to a potentially vendor prefixed property
  42310. function vendorPropName(name) {
  42311. // Shortcut for names that are not vendor prefixed
  42312. if (name in emptyStyle) {
  42313. return name;
  42314. }
  42315. // Check for vendor prefixed names
  42316. var capName = name[0].toUpperCase() + name.slice(1),
  42317. i = cssPrefixes.length;
  42318. while (i--) {
  42319. name = cssPrefixes[i] + capName;
  42320. if (name in emptyStyle) {
  42321. return name;
  42322. }
  42323. }
  42324. }
  42325. // Return a property mapped along what jQuery.cssProps suggests or to
  42326. // a vendor prefixed property.
  42327. function finalPropName(name) {
  42328. var ret = jQuery.cssProps[name];
  42329. if (!ret) {
  42330. ret = jQuery.cssProps[name] = vendorPropName(name) || name;
  42331. }
  42332. return ret;
  42333. }
  42334. function setPositiveNumber(elem, value, subtract) {
  42335. // Any relative (+/-) values have already been
  42336. // normalized at this point
  42337. var matches = rcssNum.exec(value);
  42338. return matches ?
  42339. // Guard against undefined "subtract", e.g., when used as in cssHooks
  42340. Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  42341. }
  42342. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  42343. var i = dimension === "width" ? 1 : 0,
  42344. extra = 0,
  42345. delta = 0;
  42346. // Adjustment may not be necessary
  42347. if (box === (isBorderBox ? "border" : "content")) {
  42348. return 0;
  42349. }
  42350. for (; i < 4; i += 2) {
  42351. // Both box models exclude margin
  42352. if (box === "margin") {
  42353. delta += jQuery.css(elem, box + cssExpand[i], true, styles);
  42354. }
  42355. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  42356. if (!isBorderBox) {
  42357. // Add padding
  42358. delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  42359. // For "border" or "margin", add border
  42360. if (box !== "padding") {
  42361. delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  42362. // But still keep track of it otherwise
  42363. } else {
  42364. extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  42365. }
  42366. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  42367. // "padding" or "margin"
  42368. } else {
  42369. // For "content", subtract padding
  42370. if (box === "content") {
  42371. delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  42372. }
  42373. // For "content" or "padding", subtract border
  42374. if (box !== "margin") {
  42375. delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  42376. }
  42377. }
  42378. }
  42379. // Account for positive content-box scroll gutter when requested by providing computedVal
  42380. if (!isBorderBox && computedVal >= 0) {
  42381. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  42382. // Assuming integer scroll gutter, subtract the rest and round down
  42383. delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5));
  42384. }
  42385. return delta;
  42386. }
  42387. function getWidthOrHeight(elem, dimension, extra) {
  42388. // Start with computed style
  42389. var styles = getStyles(elem),
  42390. val = curCSS(elem, dimension, styles),
  42391. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  42392. valueIsBorderBox = isBorderBox;
  42393. // Support: Firefox <=54
  42394. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  42395. if (rnumnonpx.test(val)) {
  42396. if (!extra) {
  42397. return val;
  42398. }
  42399. val = "auto";
  42400. }
  42401. // Check for style in case a browser which returns unreliable values
  42402. // for getComputedStyle silently falls back to the reliable elem.style
  42403. valueIsBorderBox = valueIsBorderBox && (support.boxSizingReliable() || val === elem.style[dimension]);
  42404. // Fall back to offsetWidth/offsetHeight when value is "auto"
  42405. // This happens for inline elements with no explicit setting (gh-3571)
  42406. // Support: Android <=4.1 - 4.3 only
  42407. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  42408. if (val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") {
  42409. val = elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)];
  42410. // offsetWidth/offsetHeight provide border-box values
  42411. valueIsBorderBox = true;
  42412. }
  42413. // Normalize "" and auto
  42414. val = parseFloat(val) || 0;
  42415. // Adjust for the element's box model
  42416. return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles,
  42417. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  42418. val) + "px";
  42419. }
  42420. jQuery.extend({
  42421. // Add in style property hooks for overriding the default
  42422. // behavior of getting and setting a style property
  42423. cssHooks: {
  42424. opacity: {
  42425. get: function get(elem, computed) {
  42426. if (computed) {
  42427. // We should always get a number back from opacity
  42428. var ret = curCSS(elem, "opacity");
  42429. return ret === "" ? "1" : ret;
  42430. }
  42431. }
  42432. }
  42433. },
  42434. // Don't automatically add "px" to these possibly-unitless properties
  42435. cssNumber: {
  42436. "animationIterationCount": true,
  42437. "columnCount": true,
  42438. "fillOpacity": true,
  42439. "flexGrow": true,
  42440. "flexShrink": true,
  42441. "fontWeight": true,
  42442. "lineHeight": true,
  42443. "opacity": true,
  42444. "order": true,
  42445. "orphans": true,
  42446. "widows": true,
  42447. "zIndex": true,
  42448. "zoom": true
  42449. },
  42450. // Add in properties whose names you wish to fix before
  42451. // setting or getting the value
  42452. cssProps: {},
  42453. // Get and set the style property on a DOM Node
  42454. style: function style(elem, name, value, extra) {
  42455. // Don't set styles on text and comment nodes
  42456. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  42457. return;
  42458. }
  42459. // Make sure that we're working with the right name
  42460. var ret,
  42461. type,
  42462. hooks,
  42463. origName = camelCase(name),
  42464. isCustomProp = rcustomProp.test(name),
  42465. style = elem.style;
  42466. // Make sure that we're working with the right name. We don't
  42467. // want to query the value if it is a CSS custom property
  42468. // since they are user-defined.
  42469. if (!isCustomProp) {
  42470. name = finalPropName(origName);
  42471. }
  42472. // Gets hook for the prefixed version, then unprefixed version
  42473. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  42474. // Check if we're setting a value
  42475. if (value !== undefined) {
  42476. type = typeof value === "undefined" ? "undefined" : _typeof(value);
  42477. // Convert "+=" or "-=" to relative numbers (#7345)
  42478. if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  42479. value = adjustCSS(elem, name, ret);
  42480. // Fixes bug #9237
  42481. type = "number";
  42482. }
  42483. // Make sure that null and NaN values aren't set (#7116)
  42484. if (value == null || value !== value) {
  42485. return;
  42486. }
  42487. // If a number was passed in, add the unit (except for certain CSS properties)
  42488. if (type === "number") {
  42489. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  42490. }
  42491. // background-* props affect original clone's values
  42492. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  42493. style[name] = "inherit";
  42494. }
  42495. // If a hook was provided, use that value, otherwise just set the specified value
  42496. if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
  42497. if (isCustomProp) {
  42498. style.setProperty(name, value);
  42499. } else {
  42500. style[name] = value;
  42501. }
  42502. }
  42503. } else {
  42504. // If a hook was provided get the non-computed value from there
  42505. if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
  42506. return ret;
  42507. }
  42508. // Otherwise just get the value from the style object
  42509. return style[name];
  42510. }
  42511. },
  42512. css: function css(elem, name, extra, styles) {
  42513. var val,
  42514. num,
  42515. hooks,
  42516. origName = camelCase(name),
  42517. isCustomProp = rcustomProp.test(name);
  42518. // Make sure that we're working with the right name. We don't
  42519. // want to modify the value if it is a CSS custom property
  42520. // since they are user-defined.
  42521. if (!isCustomProp) {
  42522. name = finalPropName(origName);
  42523. }
  42524. // Try prefixed name followed by the unprefixed name
  42525. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  42526. // If a hook was provided get the computed value from there
  42527. if (hooks && "get" in hooks) {
  42528. val = hooks.get(elem, true, extra);
  42529. }
  42530. // Otherwise, if a way to get the computed value exists, use that
  42531. if (val === undefined) {
  42532. val = curCSS(elem, name, styles);
  42533. }
  42534. // Convert "normal" to computed value
  42535. if (val === "normal" && name in cssNormalTransform) {
  42536. val = cssNormalTransform[name];
  42537. }
  42538. // Make numeric if forced or a qualifier was provided and val looks numeric
  42539. if (extra === "" || extra) {
  42540. num = parseFloat(val);
  42541. return extra === true || isFinite(num) ? num || 0 : val;
  42542. }
  42543. return val;
  42544. }
  42545. });
  42546. jQuery.each(["height", "width"], function (i, dimension) {
  42547. jQuery.cssHooks[dimension] = {
  42548. get: function get(elem, computed, extra) {
  42549. if (computed) {
  42550. // Certain elements can have dimension info if we invisibly show them
  42551. // but it must have a current display style that would benefit
  42552. return rdisplayswap.test(jQuery.css(elem, "display")) && (
  42553. // Support: Safari 8+
  42554. // Table columns in Safari have non-zero offsetWidth & zero
  42555. // getBoundingClientRect().width unless display is changed.
  42556. // Support: IE <=11 only
  42557. // Running getBoundingClientRect on a disconnected node
  42558. // in IE throws an error.
  42559. !elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {
  42560. return getWidthOrHeight(elem, dimension, extra);
  42561. }) : getWidthOrHeight(elem, dimension, extra);
  42562. }
  42563. },
  42564. set: function set(elem, value, extra) {
  42565. var matches,
  42566. styles = getStyles(elem),
  42567. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  42568. subtract = extra && boxModelAdjustment(elem, dimension, extra, isBorderBox, styles);
  42569. // Account for unreliable border-box dimensions by comparing offset* to computed and
  42570. // faking a content-box to get border and padding (gh-3699)
  42571. if (isBorderBox && support.scrollboxSize() === styles.position) {
  42572. subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5);
  42573. }
  42574. // Convert to pixels if value adjustment is needed
  42575. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
  42576. elem.style[dimension] = value;
  42577. value = jQuery.css(elem, dimension);
  42578. }
  42579. return setPositiveNumber(elem, value, subtract);
  42580. }
  42581. };
  42582. });
  42583. jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {
  42584. if (computed) {
  42585. return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function () {
  42586. return elem.getBoundingClientRect().left;
  42587. })) + "px";
  42588. }
  42589. });
  42590. // These hooks are used by animate to expand properties
  42591. jQuery.each({
  42592. margin: "",
  42593. padding: "",
  42594. border: "Width"
  42595. }, function (prefix, suffix) {
  42596. jQuery.cssHooks[prefix + suffix] = {
  42597. expand: function expand(value) {
  42598. var i = 0,
  42599. expanded = {},
  42600. // Assumes a single number if not a string
  42601. parts = typeof value === "string" ? value.split(" ") : [value];
  42602. for (; i < 4; i++) {
  42603. expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
  42604. }
  42605. return expanded;
  42606. }
  42607. };
  42608. if (prefix !== "margin") {
  42609. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  42610. }
  42611. });
  42612. jQuery.fn.extend({
  42613. css: function css(name, value) {
  42614. return access(this, function (elem, name, value) {
  42615. var styles,
  42616. len,
  42617. map = {},
  42618. i = 0;
  42619. if (Array.isArray(name)) {
  42620. styles = getStyles(elem);
  42621. len = name.length;
  42622. for (; i < len; i++) {
  42623. map[name[i]] = jQuery.css(elem, name[i], false, styles);
  42624. }
  42625. return map;
  42626. }
  42627. return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
  42628. }, name, value, arguments.length > 1);
  42629. }
  42630. });
  42631. function Tween(elem, options, prop, end, easing) {
  42632. return new Tween.prototype.init(elem, options, prop, end, easing);
  42633. }
  42634. jQuery.Tween = Tween;
  42635. Tween.prototype = {
  42636. constructor: Tween,
  42637. init: function init(elem, options, prop, end, easing, unit) {
  42638. this.elem = elem;
  42639. this.prop = prop;
  42640. this.easing = easing || jQuery.easing._default;
  42641. this.options = options;
  42642. this.start = this.now = this.cur();
  42643. this.end = end;
  42644. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  42645. },
  42646. cur: function cur() {
  42647. var hooks = Tween.propHooks[this.prop];
  42648. return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
  42649. },
  42650. run: function run(percent) {
  42651. var eased,
  42652. hooks = Tween.propHooks[this.prop];
  42653. if (this.options.duration) {
  42654. this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);
  42655. } else {
  42656. this.pos = eased = percent;
  42657. }
  42658. this.now = (this.end - this.start) * eased + this.start;
  42659. if (this.options.step) {
  42660. this.options.step.call(this.elem, this.now, this);
  42661. }
  42662. if (hooks && hooks.set) {
  42663. hooks.set(this);
  42664. } else {
  42665. Tween.propHooks._default.set(this);
  42666. }
  42667. return this;
  42668. }
  42669. };
  42670. Tween.prototype.init.prototype = Tween.prototype;
  42671. Tween.propHooks = {
  42672. _default: {
  42673. get: function get(tween) {
  42674. var result;
  42675. // Use a property on the element directly when it is not a DOM element,
  42676. // or when there is no matching style property that exists.
  42677. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  42678. return tween.elem[tween.prop];
  42679. }
  42680. // Passing an empty string as a 3rd parameter to .css will automatically
  42681. // attempt a parseFloat and fallback to a string if the parse fails.
  42682. // Simple values such as "10px" are parsed to Float;
  42683. // complex values such as "rotate(1rad)" are returned as-is.
  42684. result = jQuery.css(tween.elem, tween.prop, "");
  42685. // Empty strings, null, undefined and "auto" are converted to 0.
  42686. return !result || result === "auto" ? 0 : result;
  42687. },
  42688. set: function set(tween) {
  42689. // Use step hook for back compat.
  42690. // Use cssHook if its there.
  42691. // Use .style if available and use plain properties where available.
  42692. if (jQuery.fx.step[tween.prop]) {
  42693. jQuery.fx.step[tween.prop](tween);
  42694. } else if (tween.elem.nodeType === 1 && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
  42695. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  42696. } else {
  42697. tween.elem[tween.prop] = tween.now;
  42698. }
  42699. }
  42700. }
  42701. };
  42702. // Support: IE <=9 only
  42703. // Panic based approach to setting things on disconnected nodes
  42704. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  42705. set: function set(tween) {
  42706. if (tween.elem.nodeType && tween.elem.parentNode) {
  42707. tween.elem[tween.prop] = tween.now;
  42708. }
  42709. }
  42710. };
  42711. jQuery.easing = {
  42712. linear: function linear(p) {
  42713. return p;
  42714. },
  42715. swing: function swing(p) {
  42716. return 0.5 - Math.cos(p * Math.PI) / 2;
  42717. },
  42718. _default: "swing"
  42719. };
  42720. jQuery.fx = Tween.prototype.init;
  42721. // Back compat <1.8 extension point
  42722. jQuery.fx.step = {};
  42723. var fxNow,
  42724. inProgress,
  42725. rfxtypes = /^(?:toggle|show|hide)$/,
  42726. rrun = /queueHooks$/;
  42727. function schedule() {
  42728. if (inProgress) {
  42729. if (document.hidden === false && window.requestAnimationFrame) {
  42730. window.requestAnimationFrame(schedule);
  42731. } else {
  42732. window.setTimeout(schedule, jQuery.fx.interval);
  42733. }
  42734. jQuery.fx.tick();
  42735. }
  42736. }
  42737. // Animations created synchronously will run synchronously
  42738. function createFxNow() {
  42739. window.setTimeout(function () {
  42740. fxNow = undefined;
  42741. });
  42742. return fxNow = Date.now();
  42743. }
  42744. // Generate parameters to create a standard animation
  42745. function genFx(type, includeWidth) {
  42746. var which,
  42747. i = 0,
  42748. attrs = { height: type };
  42749. // If we include width, step value is 1 to do all cssExpand values,
  42750. // otherwise step value is 2 to skip over Left and Right
  42751. includeWidth = includeWidth ? 1 : 0;
  42752. for (; i < 4; i += 2 - includeWidth) {
  42753. which = cssExpand[i];
  42754. attrs["margin" + which] = attrs["padding" + which] = type;
  42755. }
  42756. if (includeWidth) {
  42757. attrs.opacity = attrs.width = type;
  42758. }
  42759. return attrs;
  42760. }
  42761. function createTween(value, prop, animation) {
  42762. var tween,
  42763. collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
  42764. index = 0,
  42765. length = collection.length;
  42766. for (; index < length; index++) {
  42767. if (tween = collection[index].call(animation, prop, value)) {
  42768. // We're done with this property
  42769. return tween;
  42770. }
  42771. }
  42772. }
  42773. function defaultPrefilter(elem, props, opts) {
  42774. var prop,
  42775. value,
  42776. toggle,
  42777. hooks,
  42778. oldfire,
  42779. propTween,
  42780. restoreDisplay,
  42781. display,
  42782. isBox = "width" in props || "height" in props,
  42783. anim = this,
  42784. orig = {},
  42785. style = elem.style,
  42786. hidden = elem.nodeType && isHiddenWithinTree(elem),
  42787. dataShow = dataPriv.get(elem, "fxshow");
  42788. // Queue-skipping animations hijack the fx hooks
  42789. if (!opts.queue) {
  42790. hooks = jQuery._queueHooks(elem, "fx");
  42791. if (hooks.unqueued == null) {
  42792. hooks.unqueued = 0;
  42793. oldfire = hooks.empty.fire;
  42794. hooks.empty.fire = function () {
  42795. if (!hooks.unqueued) {
  42796. oldfire();
  42797. }
  42798. };
  42799. }
  42800. hooks.unqueued++;
  42801. anim.always(function () {
  42802. // Ensure the complete handler is called before this completes
  42803. anim.always(function () {
  42804. hooks.unqueued--;
  42805. if (!jQuery.queue(elem, "fx").length) {
  42806. hooks.empty.fire();
  42807. }
  42808. });
  42809. });
  42810. }
  42811. // Detect show/hide animations
  42812. for (prop in props) {
  42813. value = props[prop];
  42814. if (rfxtypes.test(value)) {
  42815. delete props[prop];
  42816. toggle = toggle || value === "toggle";
  42817. if (value === (hidden ? "hide" : "show")) {
  42818. // Pretend to be hidden if this is a "show" and
  42819. // there is still data from a stopped show/hide
  42820. if (value === "show" && dataShow && dataShow[prop] !== undefined) {
  42821. hidden = true;
  42822. // Ignore all other no-op show/hide data
  42823. } else {
  42824. continue;
  42825. }
  42826. }
  42827. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  42828. }
  42829. }
  42830. // Bail out if this is a no-op like .hide().hide()
  42831. propTween = !jQuery.isEmptyObject(props);
  42832. if (!propTween && jQuery.isEmptyObject(orig)) {
  42833. return;
  42834. }
  42835. // Restrict "overflow" and "display" styles during box animations
  42836. if (isBox && elem.nodeType === 1) {
  42837. // Support: IE <=9 - 11, Edge 12 - 15
  42838. // Record all 3 overflow attributes because IE does not infer the shorthand
  42839. // from identically-valued overflowX and overflowY and Edge just mirrors
  42840. // the overflowX value there.
  42841. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  42842. // Identify a display type, preferring old show/hide data over the CSS cascade
  42843. restoreDisplay = dataShow && dataShow.display;
  42844. if (restoreDisplay == null) {
  42845. restoreDisplay = dataPriv.get(elem, "display");
  42846. }
  42847. display = jQuery.css(elem, "display");
  42848. if (display === "none") {
  42849. if (restoreDisplay) {
  42850. display = restoreDisplay;
  42851. } else {
  42852. // Get nonempty value(s) by temporarily forcing visibility
  42853. showHide([elem], true);
  42854. restoreDisplay = elem.style.display || restoreDisplay;
  42855. display = jQuery.css(elem, "display");
  42856. showHide([elem]);
  42857. }
  42858. }
  42859. // Animate inline elements as inline-block
  42860. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  42861. if (jQuery.css(elem, "float") === "none") {
  42862. // Restore the original display value at the end of pure show/hide animations
  42863. if (!propTween) {
  42864. anim.done(function () {
  42865. style.display = restoreDisplay;
  42866. });
  42867. if (restoreDisplay == null) {
  42868. display = style.display;
  42869. restoreDisplay = display === "none" ? "" : display;
  42870. }
  42871. }
  42872. style.display = "inline-block";
  42873. }
  42874. }
  42875. }
  42876. if (opts.overflow) {
  42877. style.overflow = "hidden";
  42878. anim.always(function () {
  42879. style.overflow = opts.overflow[0];
  42880. style.overflowX = opts.overflow[1];
  42881. style.overflowY = opts.overflow[2];
  42882. });
  42883. }
  42884. // Implement show/hide animations
  42885. propTween = false;
  42886. for (prop in orig) {
  42887. // General show/hide setup for this element animation
  42888. if (!propTween) {
  42889. if (dataShow) {
  42890. if ("hidden" in dataShow) {
  42891. hidden = dataShow.hidden;
  42892. }
  42893. } else {
  42894. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  42895. }
  42896. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  42897. if (toggle) {
  42898. dataShow.hidden = !hidden;
  42899. }
  42900. // Show elements before animating them
  42901. if (hidden) {
  42902. showHide([elem], true);
  42903. }
  42904. /* eslint-disable no-loop-func */
  42905. anim.done(function () {
  42906. /* eslint-enable no-loop-func */
  42907. // The final step of a "hide" animation is actually hiding the element
  42908. if (!hidden) {
  42909. showHide([elem]);
  42910. }
  42911. dataPriv.remove(elem, "fxshow");
  42912. for (prop in orig) {
  42913. jQuery.style(elem, prop, orig[prop]);
  42914. }
  42915. });
  42916. }
  42917. // Per-property setup
  42918. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  42919. if (!(prop in dataShow)) {
  42920. dataShow[prop] = propTween.start;
  42921. if (hidden) {
  42922. propTween.end = propTween.start;
  42923. propTween.start = 0;
  42924. }
  42925. }
  42926. }
  42927. }
  42928. function propFilter(props, specialEasing) {
  42929. var index, name, easing, value, hooks;
  42930. // camelCase, specialEasing and expand cssHook pass
  42931. for (index in props) {
  42932. name = camelCase(index);
  42933. easing = specialEasing[name];
  42934. value = props[index];
  42935. if (Array.isArray(value)) {
  42936. easing = value[1];
  42937. value = props[index] = value[0];
  42938. }
  42939. if (index !== name) {
  42940. props[name] = value;
  42941. delete props[index];
  42942. }
  42943. hooks = jQuery.cssHooks[name];
  42944. if (hooks && "expand" in hooks) {
  42945. value = hooks.expand(value);
  42946. delete props[name];
  42947. // Not quite $.extend, this won't overwrite existing keys.
  42948. // Reusing 'index' because we have the correct "name"
  42949. for (index in value) {
  42950. if (!(index in props)) {
  42951. props[index] = value[index];
  42952. specialEasing[index] = easing;
  42953. }
  42954. }
  42955. } else {
  42956. specialEasing[name] = easing;
  42957. }
  42958. }
  42959. }
  42960. function Animation(elem, properties, options) {
  42961. var result,
  42962. stopped,
  42963. index = 0,
  42964. length = Animation.prefilters.length,
  42965. deferred = jQuery.Deferred().always(function () {
  42966. // Don't match elem in the :animated selector
  42967. delete tick.elem;
  42968. }),
  42969. tick = function tick() {
  42970. if (stopped) {
  42971. return false;
  42972. }
  42973. var currentTime = fxNow || createFxNow(),
  42974. remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
  42975. // Support: Android 2.3 only
  42976. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  42977. temp = remaining / animation.duration || 0,
  42978. percent = 1 - temp,
  42979. index = 0,
  42980. length = animation.tweens.length;
  42981. for (; index < length; index++) {
  42982. animation.tweens[index].run(percent);
  42983. }
  42984. deferred.notifyWith(elem, [animation, percent, remaining]);
  42985. // If there's more to do, yield
  42986. if (percent < 1 && length) {
  42987. return remaining;
  42988. }
  42989. // If this was an empty animation, synthesize a final progress notification
  42990. if (!length) {
  42991. deferred.notifyWith(elem, [animation, 1, 0]);
  42992. }
  42993. // Resolve the animation and report its conclusion
  42994. deferred.resolveWith(elem, [animation]);
  42995. return false;
  42996. },
  42997. animation = deferred.promise({
  42998. elem: elem,
  42999. props: jQuery.extend({}, properties),
  43000. opts: jQuery.extend(true, {
  43001. specialEasing: {},
  43002. easing: jQuery.easing._default
  43003. }, options),
  43004. originalProperties: properties,
  43005. originalOptions: options,
  43006. startTime: fxNow || createFxNow(),
  43007. duration: options.duration,
  43008. tweens: [],
  43009. createTween: function createTween(prop, end) {
  43010. var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
  43011. animation.tweens.push(tween);
  43012. return tween;
  43013. },
  43014. stop: function stop(gotoEnd) {
  43015. var index = 0,
  43016. // If we are going to the end, we want to run all the tweens
  43017. // otherwise we skip this part
  43018. length = gotoEnd ? animation.tweens.length : 0;
  43019. if (stopped) {
  43020. return this;
  43021. }
  43022. stopped = true;
  43023. for (; index < length; index++) {
  43024. animation.tweens[index].run(1);
  43025. }
  43026. // Resolve when we played the last frame; otherwise, reject
  43027. if (gotoEnd) {
  43028. deferred.notifyWith(elem, [animation, 1, 0]);
  43029. deferred.resolveWith(elem, [animation, gotoEnd]);
  43030. } else {
  43031. deferred.rejectWith(elem, [animation, gotoEnd]);
  43032. }
  43033. return this;
  43034. }
  43035. }),
  43036. props = animation.props;
  43037. propFilter(props, animation.opts.specialEasing);
  43038. for (; index < length; index++) {
  43039. result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
  43040. if (result) {
  43041. if (isFunction(result.stop)) {
  43042. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
  43043. }
  43044. return result;
  43045. }
  43046. }
  43047. jQuery.map(props, createTween, animation);
  43048. if (isFunction(animation.opts.start)) {
  43049. animation.opts.start.call(elem, animation);
  43050. }
  43051. // Attach callbacks from options
  43052. animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  43053. jQuery.fx.timer(jQuery.extend(tick, {
  43054. elem: elem,
  43055. anim: animation,
  43056. queue: animation.opts.queue
  43057. }));
  43058. return animation;
  43059. }
  43060. jQuery.Animation = jQuery.extend(Animation, {
  43061. tweeners: {
  43062. "*": [function (prop, value) {
  43063. var tween = this.createTween(prop, value);
  43064. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  43065. return tween;
  43066. }]
  43067. },
  43068. tweener: function tweener(props, callback) {
  43069. if (isFunction(props)) {
  43070. callback = props;
  43071. props = ["*"];
  43072. } else {
  43073. props = props.match(rnothtmlwhite);
  43074. }
  43075. var prop,
  43076. index = 0,
  43077. length = props.length;
  43078. for (; index < length; index++) {
  43079. prop = props[index];
  43080. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  43081. Animation.tweeners[prop].unshift(callback);
  43082. }
  43083. },
  43084. prefilters: [defaultPrefilter],
  43085. prefilter: function prefilter(callback, prepend) {
  43086. if (prepend) {
  43087. Animation.prefilters.unshift(callback);
  43088. } else {
  43089. Animation.prefilters.push(callback);
  43090. }
  43091. }
  43092. });
  43093. jQuery.speed = function (speed, easing, fn) {
  43094. var opt = speed && (typeof speed === "undefined" ? "undefined" : _typeof(speed)) === "object" ? jQuery.extend({}, speed) : {
  43095. complete: fn || !fn && easing || isFunction(speed) && speed,
  43096. duration: speed,
  43097. easing: fn && easing || easing && !isFunction(easing) && easing
  43098. };
  43099. // Go to the end state if fx are off
  43100. if (jQuery.fx.off) {
  43101. opt.duration = 0;
  43102. } else {
  43103. if (typeof opt.duration !== "number") {
  43104. if (opt.duration in jQuery.fx.speeds) {
  43105. opt.duration = jQuery.fx.speeds[opt.duration];
  43106. } else {
  43107. opt.duration = jQuery.fx.speeds._default;
  43108. }
  43109. }
  43110. }
  43111. // Normalize opt.queue - true/undefined/null -> "fx"
  43112. if (opt.queue == null || opt.queue === true) {
  43113. opt.queue = "fx";
  43114. }
  43115. // Queueing
  43116. opt.old = opt.complete;
  43117. opt.complete = function () {
  43118. if (isFunction(opt.old)) {
  43119. opt.old.call(this);
  43120. }
  43121. if (opt.queue) {
  43122. jQuery.dequeue(this, opt.queue);
  43123. }
  43124. };
  43125. return opt;
  43126. };
  43127. jQuery.fn.extend({
  43128. fadeTo: function fadeTo(speed, to, easing, callback) {
  43129. // Show any hidden elements after setting opacity to 0
  43130. return this.filter(isHiddenWithinTree).css("opacity", 0).show()
  43131. // Animate to the value specified
  43132. .end().animate({ opacity: to }, speed, easing, callback);
  43133. },
  43134. animate: function animate(prop, speed, easing, callback) {
  43135. var empty = jQuery.isEmptyObject(prop),
  43136. optall = jQuery.speed(speed, easing, callback),
  43137. doAnimation = function doAnimation() {
  43138. // Operate on a copy of prop so per-property easing won't be lost
  43139. var anim = Animation(this, jQuery.extend({}, prop), optall);
  43140. // Empty animations, or finishing resolves immediately
  43141. if (empty || dataPriv.get(this, "finish")) {
  43142. anim.stop(true);
  43143. }
  43144. };
  43145. doAnimation.finish = doAnimation;
  43146. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  43147. },
  43148. stop: function stop(type, clearQueue, gotoEnd) {
  43149. var stopQueue = function stopQueue(hooks) {
  43150. var stop = hooks.stop;
  43151. delete hooks.stop;
  43152. stop(gotoEnd);
  43153. };
  43154. if (typeof type !== "string") {
  43155. gotoEnd = clearQueue;
  43156. clearQueue = type;
  43157. type = undefined;
  43158. }
  43159. if (clearQueue && type !== false) {
  43160. this.queue(type || "fx", []);
  43161. }
  43162. return this.each(function () {
  43163. var dequeue = true,
  43164. index = type != null && type + "queueHooks",
  43165. timers = jQuery.timers,
  43166. data = dataPriv.get(this);
  43167. if (index) {
  43168. if (data[index] && data[index].stop) {
  43169. stopQueue(data[index]);
  43170. }
  43171. } else {
  43172. for (index in data) {
  43173. if (data[index] && data[index].stop && rrun.test(index)) {
  43174. stopQueue(data[index]);
  43175. }
  43176. }
  43177. }
  43178. for (index = timers.length; index--;) {
  43179. if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
  43180. timers[index].anim.stop(gotoEnd);
  43181. dequeue = false;
  43182. timers.splice(index, 1);
  43183. }
  43184. }
  43185. // Start the next in the queue if the last step wasn't forced.
  43186. // Timers currently will call their complete callbacks, which
  43187. // will dequeue but only if they were gotoEnd.
  43188. if (dequeue || !gotoEnd) {
  43189. jQuery.dequeue(this, type);
  43190. }
  43191. });
  43192. },
  43193. finish: function finish(type) {
  43194. if (type !== false) {
  43195. type = type || "fx";
  43196. }
  43197. return this.each(function () {
  43198. var index,
  43199. data = dataPriv.get(this),
  43200. queue = data[type + "queue"],
  43201. hooks = data[type + "queueHooks"],
  43202. timers = jQuery.timers,
  43203. length = queue ? queue.length : 0;
  43204. // Enable finishing flag on private data
  43205. data.finish = true;
  43206. // Empty the queue first
  43207. jQuery.queue(this, type, []);
  43208. if (hooks && hooks.stop) {
  43209. hooks.stop.call(this, true);
  43210. }
  43211. // Look for any active animations, and finish them
  43212. for (index = timers.length; index--;) {
  43213. if (timers[index].elem === this && timers[index].queue === type) {
  43214. timers[index].anim.stop(true);
  43215. timers.splice(index, 1);
  43216. }
  43217. }
  43218. // Look for any animations in the old queue and finish them
  43219. for (index = 0; index < length; index++) {
  43220. if (queue[index] && queue[index].finish) {
  43221. queue[index].finish.call(this);
  43222. }
  43223. }
  43224. // Turn off finishing flag
  43225. delete data.finish;
  43226. });
  43227. }
  43228. });
  43229. jQuery.each(["toggle", "show", "hide"], function (i, name) {
  43230. var cssFn = jQuery.fn[name];
  43231. jQuery.fn[name] = function (speed, easing, callback) {
  43232. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
  43233. };
  43234. });
  43235. // Generate shortcuts for custom animations
  43236. jQuery.each({
  43237. slideDown: genFx("show"),
  43238. slideUp: genFx("hide"),
  43239. slideToggle: genFx("toggle"),
  43240. fadeIn: { opacity: "show" },
  43241. fadeOut: { opacity: "hide" },
  43242. fadeToggle: { opacity: "toggle" }
  43243. }, function (name, props) {
  43244. jQuery.fn[name] = function (speed, easing, callback) {
  43245. return this.animate(props, speed, easing, callback);
  43246. };
  43247. });
  43248. jQuery.timers = [];
  43249. jQuery.fx.tick = function () {
  43250. var timer,
  43251. i = 0,
  43252. timers = jQuery.timers;
  43253. fxNow = Date.now();
  43254. for (; i < timers.length; i++) {
  43255. timer = timers[i];
  43256. // Run the timer and safely remove it when done (allowing for external removal)
  43257. if (!timer() && timers[i] === timer) {
  43258. timers.splice(i--, 1);
  43259. }
  43260. }
  43261. if (!timers.length) {
  43262. jQuery.fx.stop();
  43263. }
  43264. fxNow = undefined;
  43265. };
  43266. jQuery.fx.timer = function (timer) {
  43267. jQuery.timers.push(timer);
  43268. jQuery.fx.start();
  43269. };
  43270. jQuery.fx.interval = 13;
  43271. jQuery.fx.start = function () {
  43272. if (inProgress) {
  43273. return;
  43274. }
  43275. inProgress = true;
  43276. schedule();
  43277. };
  43278. jQuery.fx.stop = function () {
  43279. inProgress = null;
  43280. };
  43281. jQuery.fx.speeds = {
  43282. slow: 600,
  43283. fast: 200,
  43284. // Default speed
  43285. _default: 400
  43286. };
  43287. // Based off of the plugin by Clint Helfers, with permission.
  43288. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  43289. jQuery.fn.delay = function (time, type) {
  43290. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  43291. type = type || "fx";
  43292. return this.queue(type, function (next, hooks) {
  43293. var timeout = window.setTimeout(next, time);
  43294. hooks.stop = function () {
  43295. window.clearTimeout(timeout);
  43296. };
  43297. });
  43298. };
  43299. (function () {
  43300. var input = document.createElement("input"),
  43301. select = document.createElement("select"),
  43302. opt = select.appendChild(document.createElement("option"));
  43303. input.type = "checkbox";
  43304. // Support: Android <=4.3 only
  43305. // Default value for a checkbox should be "on"
  43306. support.checkOn = input.value !== "";
  43307. // Support: IE <=11 only
  43308. // Must access selectedIndex to make default options select
  43309. support.optSelected = opt.selected;
  43310. // Support: IE <=11 only
  43311. // An input loses its value after becoming a radio
  43312. input = document.createElement("input");
  43313. input.value = "t";
  43314. input.type = "radio";
  43315. support.radioValue = input.value === "t";
  43316. })();
  43317. var boolHook,
  43318. attrHandle = jQuery.expr.attrHandle;
  43319. jQuery.fn.extend({
  43320. attr: function attr(name, value) {
  43321. return access(this, jQuery.attr, name, value, arguments.length > 1);
  43322. },
  43323. removeAttr: function removeAttr(name) {
  43324. return this.each(function () {
  43325. jQuery.removeAttr(this, name);
  43326. });
  43327. }
  43328. });
  43329. jQuery.extend({
  43330. attr: function attr(elem, name, value) {
  43331. var ret,
  43332. hooks,
  43333. nType = elem.nodeType;
  43334. // Don't get/set attributes on text, comment and attribute nodes
  43335. if (nType === 3 || nType === 8 || nType === 2) {
  43336. return;
  43337. }
  43338. // Fallback to prop when attributes are not supported
  43339. if (typeof elem.getAttribute === "undefined") {
  43340. return jQuery.prop(elem, name, value);
  43341. }
  43342. // Attribute hooks are determined by the lowercase version
  43343. // Grab necessary hook if one is defined
  43344. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  43345. hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
  43346. }
  43347. if (value !== undefined) {
  43348. if (value === null) {
  43349. jQuery.removeAttr(elem, name);
  43350. return;
  43351. }
  43352. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  43353. return ret;
  43354. }
  43355. elem.setAttribute(name, value + "");
  43356. return value;
  43357. }
  43358. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  43359. return ret;
  43360. }
  43361. ret = jQuery.find.attr(elem, name);
  43362. // Non-existent attributes return null, we normalize to undefined
  43363. return ret == null ? undefined : ret;
  43364. },
  43365. attrHooks: {
  43366. type: {
  43367. set: function set(elem, value) {
  43368. if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
  43369. var val = elem.value;
  43370. elem.setAttribute("type", value);
  43371. if (val) {
  43372. elem.value = val;
  43373. }
  43374. return value;
  43375. }
  43376. }
  43377. }
  43378. },
  43379. removeAttr: function removeAttr(elem, value) {
  43380. var name,
  43381. i = 0,
  43382. // Attribute names can contain non-HTML whitespace characters
  43383. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  43384. attrNames = value && value.match(rnothtmlwhite);
  43385. if (attrNames && elem.nodeType === 1) {
  43386. while (name = attrNames[i++]) {
  43387. elem.removeAttribute(name);
  43388. }
  43389. }
  43390. }
  43391. });
  43392. // Hooks for boolean attributes
  43393. boolHook = {
  43394. set: function set(elem, value, name) {
  43395. if (value === false) {
  43396. // Remove boolean attributes when set to false
  43397. jQuery.removeAttr(elem, name);
  43398. } else {
  43399. elem.setAttribute(name, name);
  43400. }
  43401. return name;
  43402. }
  43403. };
  43404. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
  43405. var getter = attrHandle[name] || jQuery.find.attr;
  43406. attrHandle[name] = function (elem, name, isXML) {
  43407. var ret,
  43408. handle,
  43409. lowercaseName = name.toLowerCase();
  43410. if (!isXML) {
  43411. // Avoid an infinite loop by temporarily removing this function from the getter
  43412. handle = attrHandle[lowercaseName];
  43413. attrHandle[lowercaseName] = ret;
  43414. ret = getter(elem, name, isXML) != null ? lowercaseName : null;
  43415. attrHandle[lowercaseName] = handle;
  43416. }
  43417. return ret;
  43418. };
  43419. });
  43420. var rfocusable = /^(?:input|select|textarea|button)$/i,
  43421. rclickable = /^(?:a|area)$/i;
  43422. jQuery.fn.extend({
  43423. prop: function prop(name, value) {
  43424. return access(this, jQuery.prop, name, value, arguments.length > 1);
  43425. },
  43426. removeProp: function removeProp(name) {
  43427. return this.each(function () {
  43428. delete this[jQuery.propFix[name] || name];
  43429. });
  43430. }
  43431. });
  43432. jQuery.extend({
  43433. prop: function prop(elem, name, value) {
  43434. var ret,
  43435. hooks,
  43436. nType = elem.nodeType;
  43437. // Don't get/set properties on text, comment and attribute nodes
  43438. if (nType === 3 || nType === 8 || nType === 2) {
  43439. return;
  43440. }
  43441. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  43442. // Fix name and attach hooks
  43443. name = jQuery.propFix[name] || name;
  43444. hooks = jQuery.propHooks[name];
  43445. }
  43446. if (value !== undefined) {
  43447. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  43448. return ret;
  43449. }
  43450. return elem[name] = value;
  43451. }
  43452. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  43453. return ret;
  43454. }
  43455. return elem[name];
  43456. },
  43457. propHooks: {
  43458. tabIndex: {
  43459. get: function get(elem) {
  43460. // Support: IE <=9 - 11 only
  43461. // elem.tabIndex doesn't always return the
  43462. // correct value when it hasn't been explicitly set
  43463. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  43464. // Use proper attribute retrieval(#12072)
  43465. var tabindex = jQuery.find.attr(elem, "tabindex");
  43466. if (tabindex) {
  43467. return parseInt(tabindex, 10);
  43468. }
  43469. if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
  43470. return 0;
  43471. }
  43472. return -1;
  43473. }
  43474. }
  43475. },
  43476. propFix: {
  43477. "for": "htmlFor",
  43478. "class": "className"
  43479. }
  43480. });
  43481. // Support: IE <=11 only
  43482. // Accessing the selectedIndex property
  43483. // forces the browser to respect setting selected
  43484. // on the option
  43485. // The getter ensures a default option is selected
  43486. // when in an optgroup
  43487. // eslint rule "no-unused-expressions" is disabled for this code
  43488. // since it considers such accessions noop
  43489. if (!support.optSelected) {
  43490. jQuery.propHooks.selected = {
  43491. get: function get(elem) {
  43492. /* eslint no-unused-expressions: "off" */
  43493. var parent = elem.parentNode;
  43494. if (parent && parent.parentNode) {
  43495. parent.parentNode.selectedIndex;
  43496. }
  43497. return null;
  43498. },
  43499. set: function set(elem) {
  43500. /* eslint no-unused-expressions: "off" */
  43501. var parent = elem.parentNode;
  43502. if (parent) {
  43503. parent.selectedIndex;
  43504. if (parent.parentNode) {
  43505. parent.parentNode.selectedIndex;
  43506. }
  43507. }
  43508. }
  43509. };
  43510. }
  43511. jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
  43512. jQuery.propFix[this.toLowerCase()] = this;
  43513. });
  43514. // Strip and collapse whitespace according to HTML spec
  43515. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  43516. function stripAndCollapse(value) {
  43517. var tokens = value.match(rnothtmlwhite) || [];
  43518. return tokens.join(" ");
  43519. }
  43520. function getClass(elem) {
  43521. return elem.getAttribute && elem.getAttribute("class") || "";
  43522. }
  43523. function classesToArray(value) {
  43524. if (Array.isArray(value)) {
  43525. return value;
  43526. }
  43527. if (typeof value === "string") {
  43528. return value.match(rnothtmlwhite) || [];
  43529. }
  43530. return [];
  43531. }
  43532. jQuery.fn.extend({
  43533. addClass: function addClass(value) {
  43534. var classes,
  43535. elem,
  43536. cur,
  43537. curValue,
  43538. clazz,
  43539. j,
  43540. finalValue,
  43541. i = 0;
  43542. if (isFunction(value)) {
  43543. return this.each(function (j) {
  43544. jQuery(this).addClass(value.call(this, j, getClass(this)));
  43545. });
  43546. }
  43547. classes = classesToArray(value);
  43548. if (classes.length) {
  43549. while (elem = this[i++]) {
  43550. curValue = getClass(elem);
  43551. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  43552. if (cur) {
  43553. j = 0;
  43554. while (clazz = classes[j++]) {
  43555. if (cur.indexOf(" " + clazz + " ") < 0) {
  43556. cur += clazz + " ";
  43557. }
  43558. }
  43559. // Only assign if different to avoid unneeded rendering.
  43560. finalValue = stripAndCollapse(cur);
  43561. if (curValue !== finalValue) {
  43562. elem.setAttribute("class", finalValue);
  43563. }
  43564. }
  43565. }
  43566. }
  43567. return this;
  43568. },
  43569. removeClass: function removeClass(value) {
  43570. var classes,
  43571. elem,
  43572. cur,
  43573. curValue,
  43574. clazz,
  43575. j,
  43576. finalValue,
  43577. i = 0;
  43578. if (isFunction(value)) {
  43579. return this.each(function (j) {
  43580. jQuery(this).removeClass(value.call(this, j, getClass(this)));
  43581. });
  43582. }
  43583. if (!arguments.length) {
  43584. return this.attr("class", "");
  43585. }
  43586. classes = classesToArray(value);
  43587. if (classes.length) {
  43588. while (elem = this[i++]) {
  43589. curValue = getClass(elem);
  43590. // This expression is here for better compressibility (see addClass)
  43591. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  43592. if (cur) {
  43593. j = 0;
  43594. while (clazz = classes[j++]) {
  43595. // Remove *all* instances
  43596. while (cur.indexOf(" " + clazz + " ") > -1) {
  43597. cur = cur.replace(" " + clazz + " ", " ");
  43598. }
  43599. }
  43600. // Only assign if different to avoid unneeded rendering.
  43601. finalValue = stripAndCollapse(cur);
  43602. if (curValue !== finalValue) {
  43603. elem.setAttribute("class", finalValue);
  43604. }
  43605. }
  43606. }
  43607. }
  43608. return this;
  43609. },
  43610. toggleClass: function toggleClass(value, stateVal) {
  43611. var type = typeof value === "undefined" ? "undefined" : _typeof(value),
  43612. isValidValue = type === "string" || Array.isArray(value);
  43613. if (typeof stateVal === "boolean" && isValidValue) {
  43614. return stateVal ? this.addClass(value) : this.removeClass(value);
  43615. }
  43616. if (isFunction(value)) {
  43617. return this.each(function (i) {
  43618. jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
  43619. });
  43620. }
  43621. return this.each(function () {
  43622. var className, i, self, classNames;
  43623. if (isValidValue) {
  43624. // Toggle individual class names
  43625. i = 0;
  43626. self = jQuery(this);
  43627. classNames = classesToArray(value);
  43628. while (className = classNames[i++]) {
  43629. // Check each className given, space separated list
  43630. if (self.hasClass(className)) {
  43631. self.removeClass(className);
  43632. } else {
  43633. self.addClass(className);
  43634. }
  43635. }
  43636. // Toggle whole class name
  43637. } else if (value === undefined || type === "boolean") {
  43638. className = getClass(this);
  43639. if (className) {
  43640. // Store className if set
  43641. dataPriv.set(this, "__className__", className);
  43642. }
  43643. // If the element has a class name or if we're passed `false`,
  43644. // then remove the whole classname (if there was one, the above saved it).
  43645. // Otherwise bring back whatever was previously saved (if anything),
  43646. // falling back to the empty string if nothing was stored.
  43647. if (this.setAttribute) {
  43648. this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || "");
  43649. }
  43650. }
  43651. });
  43652. },
  43653. hasClass: function hasClass(selector) {
  43654. var className,
  43655. elem,
  43656. i = 0;
  43657. className = " " + selector + " ";
  43658. while (elem = this[i++]) {
  43659. if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
  43660. return true;
  43661. }
  43662. }
  43663. return false;
  43664. }
  43665. });
  43666. var rreturn = /\r/g;
  43667. jQuery.fn.extend({
  43668. val: function val(value) {
  43669. var hooks,
  43670. ret,
  43671. valueIsFunction,
  43672. elem = this[0];
  43673. if (!arguments.length) {
  43674. if (elem) {
  43675. hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  43676. if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
  43677. return ret;
  43678. }
  43679. ret = elem.value;
  43680. // Handle most common string cases
  43681. if (typeof ret === "string") {
  43682. return ret.replace(rreturn, "");
  43683. }
  43684. // Handle cases where value is null/undef or number
  43685. return ret == null ? "" : ret;
  43686. }
  43687. return;
  43688. }
  43689. valueIsFunction = isFunction(value);
  43690. return this.each(function (i) {
  43691. var val;
  43692. if (this.nodeType !== 1) {
  43693. return;
  43694. }
  43695. if (valueIsFunction) {
  43696. val = value.call(this, i, jQuery(this).val());
  43697. } else {
  43698. val = value;
  43699. }
  43700. // Treat null/undefined as ""; convert numbers to string
  43701. if (val == null) {
  43702. val = "";
  43703. } else if (typeof val === "number") {
  43704. val += "";
  43705. } else if (Array.isArray(val)) {
  43706. val = jQuery.map(val, function (value) {
  43707. return value == null ? "" : value + "";
  43708. });
  43709. }
  43710. hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  43711. // If set returns undefined, fall back to normal setting
  43712. if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
  43713. this.value = val;
  43714. }
  43715. });
  43716. }
  43717. });
  43718. jQuery.extend({
  43719. valHooks: {
  43720. option: {
  43721. get: function get(elem) {
  43722. var val = jQuery.find.attr(elem, "value");
  43723. return val != null ? val :
  43724. // Support: IE <=10 - 11 only
  43725. // option.text throws exceptions (#14686, #14858)
  43726. // Strip and collapse whitespace
  43727. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  43728. stripAndCollapse(jQuery.text(elem));
  43729. }
  43730. },
  43731. select: {
  43732. get: function get(elem) {
  43733. var value,
  43734. option,
  43735. i,
  43736. options = elem.options,
  43737. index = elem.selectedIndex,
  43738. one = elem.type === "select-one",
  43739. values = one ? null : [],
  43740. max = one ? index + 1 : options.length;
  43741. if (index < 0) {
  43742. i = max;
  43743. } else {
  43744. i = one ? index : 0;
  43745. }
  43746. // Loop through all the selected options
  43747. for (; i < max; i++) {
  43748. option = options[i];
  43749. // Support: IE <=9 only
  43750. // IE8-9 doesn't update selected after form reset (#2551)
  43751. if ((option.selected || i === index) &&
  43752. // Don't return options that are disabled or in a disabled optgroup
  43753. !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
  43754. // Get the specific value for the option
  43755. value = jQuery(option).val();
  43756. // We don't need an array for one selects
  43757. if (one) {
  43758. return value;
  43759. }
  43760. // Multi-Selects return an array
  43761. values.push(value);
  43762. }
  43763. }
  43764. return values;
  43765. },
  43766. set: function set(elem, value) {
  43767. var optionSet,
  43768. option,
  43769. options = elem.options,
  43770. values = jQuery.makeArray(value),
  43771. i = options.length;
  43772. while (i--) {
  43773. option = options[i];
  43774. /* eslint-disable no-cond-assign */
  43775. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
  43776. optionSet = true;
  43777. }
  43778. /* eslint-enable no-cond-assign */
  43779. }
  43780. // Force browsers to behave consistently when non-matching value is set
  43781. if (!optionSet) {
  43782. elem.selectedIndex = -1;
  43783. }
  43784. return values;
  43785. }
  43786. }
  43787. }
  43788. });
  43789. // Radios and checkboxes getter/setter
  43790. jQuery.each(["radio", "checkbox"], function () {
  43791. jQuery.valHooks[this] = {
  43792. set: function set(elem, value) {
  43793. if (Array.isArray(value)) {
  43794. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  43795. }
  43796. }
  43797. };
  43798. if (!support.checkOn) {
  43799. jQuery.valHooks[this].get = function (elem) {
  43800. return elem.getAttribute("value") === null ? "on" : elem.value;
  43801. };
  43802. }
  43803. });
  43804. // Return jQuery for attributes-only inclusion
  43805. support.focusin = "onfocusin" in window;
  43806. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  43807. stopPropagationCallback = function stopPropagationCallback(e) {
  43808. e.stopPropagation();
  43809. };
  43810. jQuery.extend(jQuery.event, {
  43811. trigger: function trigger(event, data, elem, onlyHandlers) {
  43812. var i,
  43813. cur,
  43814. tmp,
  43815. bubbleType,
  43816. ontype,
  43817. handle,
  43818. special,
  43819. lastElement,
  43820. eventPath = [elem || document],
  43821. type = hasOwn.call(event, "type") ? event.type : event,
  43822. namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
  43823. cur = lastElement = tmp = elem = elem || document;
  43824. // Don't do events on text and comment nodes
  43825. if (elem.nodeType === 3 || elem.nodeType === 8) {
  43826. return;
  43827. }
  43828. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  43829. if (rfocusMorph.test(type + jQuery.event.triggered)) {
  43830. return;
  43831. }
  43832. if (type.indexOf(".") > -1) {
  43833. // Namespaced trigger; create a regexp to match event type in handle()
  43834. namespaces = type.split(".");
  43835. type = namespaces.shift();
  43836. namespaces.sort();
  43837. }
  43838. ontype = type.indexOf(":") < 0 && "on" + type;
  43839. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  43840. event = event[jQuery.expando] ? event : new jQuery.Event(type, (typeof event === "undefined" ? "undefined" : _typeof(event)) === "object" && event);
  43841. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  43842. event.isTrigger = onlyHandlers ? 2 : 3;
  43843. event.namespace = namespaces.join(".");
  43844. event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  43845. // Clean up the event in case it is being reused
  43846. event.result = undefined;
  43847. if (!event.target) {
  43848. event.target = elem;
  43849. }
  43850. // Clone any incoming data and prepend the event, creating the handler arg list
  43851. data = data == null ? [event] : jQuery.makeArray(data, [event]);
  43852. // Allow special events to draw outside the lines
  43853. special = jQuery.event.special[type] || {};
  43854. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  43855. return;
  43856. }
  43857. // Determine event propagation path in advance, per W3C events spec (#9951)
  43858. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  43859. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  43860. bubbleType = special.delegateType || type;
  43861. if (!rfocusMorph.test(bubbleType + type)) {
  43862. cur = cur.parentNode;
  43863. }
  43864. for (; cur; cur = cur.parentNode) {
  43865. eventPath.push(cur);
  43866. tmp = cur;
  43867. }
  43868. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  43869. if (tmp === (elem.ownerDocument || document)) {
  43870. eventPath.push(tmp.defaultView || tmp.parentWindow || window);
  43871. }
  43872. }
  43873. // Fire handlers on the event path
  43874. i = 0;
  43875. while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
  43876. lastElement = cur;
  43877. event.type = i > 1 ? bubbleType : special.bindType || type;
  43878. // jQuery handler
  43879. handle = (dataPriv.get(cur, "events") || {})[event.type] && dataPriv.get(cur, "handle");
  43880. if (handle) {
  43881. handle.apply(cur, data);
  43882. }
  43883. // Native handler
  43884. handle = ontype && cur[ontype];
  43885. if (handle && handle.apply && acceptData(cur)) {
  43886. event.result = handle.apply(cur, data);
  43887. if (event.result === false) {
  43888. event.preventDefault();
  43889. }
  43890. }
  43891. }
  43892. event.type = type;
  43893. // If nobody prevented the default action, do it now
  43894. if (!onlyHandlers && !event.isDefaultPrevented()) {
  43895. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  43896. // Call a native DOM method on the target with the same name as the event.
  43897. // Don't do default actions on window, that's where global variables be (#6170)
  43898. if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
  43899. // Don't re-trigger an onFOO event when we call its FOO() method
  43900. tmp = elem[ontype];
  43901. if (tmp) {
  43902. elem[ontype] = null;
  43903. }
  43904. // Prevent re-triggering of the same event, since we already bubbled it above
  43905. jQuery.event.triggered = type;
  43906. if (event.isPropagationStopped()) {
  43907. lastElement.addEventListener(type, stopPropagationCallback);
  43908. }
  43909. elem[type]();
  43910. if (event.isPropagationStopped()) {
  43911. lastElement.removeEventListener(type, stopPropagationCallback);
  43912. }
  43913. jQuery.event.triggered = undefined;
  43914. if (tmp) {
  43915. elem[ontype] = tmp;
  43916. }
  43917. }
  43918. }
  43919. }
  43920. return event.result;
  43921. },
  43922. // Piggyback on a donor event to simulate a different one
  43923. // Used only for `focus(in | out)` events
  43924. simulate: function simulate(type, elem, event) {
  43925. var e = jQuery.extend(new jQuery.Event(), event, {
  43926. type: type,
  43927. isSimulated: true
  43928. });
  43929. jQuery.event.trigger(e, null, elem);
  43930. }
  43931. });
  43932. jQuery.fn.extend({
  43933. trigger: function trigger(type, data) {
  43934. return this.each(function () {
  43935. jQuery.event.trigger(type, data, this);
  43936. });
  43937. },
  43938. triggerHandler: function triggerHandler(type, data) {
  43939. var elem = this[0];
  43940. if (elem) {
  43941. return jQuery.event.trigger(type, data, elem, true);
  43942. }
  43943. }
  43944. });
  43945. // Support: Firefox <=44
  43946. // Firefox doesn't have focus(in | out) events
  43947. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  43948. //
  43949. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  43950. // focus(in | out) events fire after focus & blur events,
  43951. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  43952. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  43953. if (!support.focusin) {
  43954. jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) {
  43955. // Attach a single capturing handler on the document while someone wants focusin/focusout
  43956. var handler = function handler(event) {
  43957. jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
  43958. };
  43959. jQuery.event.special[fix] = {
  43960. setup: function setup() {
  43961. var doc = this.ownerDocument || this,
  43962. attaches = dataPriv.access(doc, fix);
  43963. if (!attaches) {
  43964. doc.addEventListener(orig, handler, true);
  43965. }
  43966. dataPriv.access(doc, fix, (attaches || 0) + 1);
  43967. },
  43968. teardown: function teardown() {
  43969. var doc = this.ownerDocument || this,
  43970. attaches = dataPriv.access(doc, fix) - 1;
  43971. if (!attaches) {
  43972. doc.removeEventListener(orig, handler, true);
  43973. dataPriv.remove(doc, fix);
  43974. } else {
  43975. dataPriv.access(doc, fix, attaches);
  43976. }
  43977. }
  43978. };
  43979. });
  43980. }
  43981. var location = window.location;
  43982. var nonce = Date.now();
  43983. var rquery = /\?/;
  43984. // Cross-browser xml parsing
  43985. jQuery.parseXML = function (data) {
  43986. var xml;
  43987. if (!data || typeof data !== "string") {
  43988. return null;
  43989. }
  43990. // Support: IE 9 - 11 only
  43991. // IE throws on parseFromString with invalid input.
  43992. try {
  43993. xml = new window.DOMParser().parseFromString(data, "text/xml");
  43994. } catch (e) {
  43995. xml = undefined;
  43996. }
  43997. if (!xml || xml.getElementsByTagName("parsererror").length) {
  43998. jQuery.error("Invalid XML: " + data);
  43999. }
  44000. return xml;
  44001. };
  44002. var rbracket = /\[\]$/,
  44003. rCRLF = /\r?\n/g,
  44004. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  44005. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  44006. function buildParams(prefix, obj, traditional, add) {
  44007. var name;
  44008. if (Array.isArray(obj)) {
  44009. // Serialize array item.
  44010. jQuery.each(obj, function (i, v) {
  44011. if (traditional || rbracket.test(prefix)) {
  44012. // Treat each array item as a scalar.
  44013. add(prefix, v);
  44014. } else {
  44015. // Item is non-scalar (array or object), encode its numeric index.
  44016. buildParams(prefix + "[" + ((typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && v != null ? i : "") + "]", v, traditional, add);
  44017. }
  44018. });
  44019. } else if (!traditional && toType(obj) === "object") {
  44020. // Serialize object item.
  44021. for (name in obj) {
  44022. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  44023. }
  44024. } else {
  44025. // Serialize scalar item.
  44026. add(prefix, obj);
  44027. }
  44028. }
  44029. // Serialize an array of form elements or a set of
  44030. // key/values into a query string
  44031. jQuery.param = function (a, traditional) {
  44032. var prefix,
  44033. s = [],
  44034. add = function add(key, valueOrFunction) {
  44035. // If value is a function, invoke it and use its return value
  44036. var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;
  44037. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
  44038. };
  44039. // If an array was passed in, assume that it is an array of form elements.
  44040. if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  44041. // Serialize the form elements
  44042. jQuery.each(a, function () {
  44043. add(this.name, this.value);
  44044. });
  44045. } else {
  44046. // If traditional, encode the "old" way (the way 1.3.2 or older
  44047. // did it), otherwise encode params recursively.
  44048. for (prefix in a) {
  44049. buildParams(prefix, a[prefix], traditional, add);
  44050. }
  44051. }
  44052. // Return the resulting serialization
  44053. return s.join("&");
  44054. };
  44055. jQuery.fn.extend({
  44056. serialize: function serialize() {
  44057. return jQuery.param(this.serializeArray());
  44058. },
  44059. serializeArray: function serializeArray() {
  44060. return this.map(function () {
  44061. // Can add propHook for "elements" to filter or add form elements
  44062. var elements = jQuery.prop(this, "elements");
  44063. return elements ? jQuery.makeArray(elements) : this;
  44064. }).filter(function () {
  44065. var type = this.type;
  44066. // Use .is( ":disabled" ) so that fieldset[disabled] works
  44067. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
  44068. }).map(function (i, elem) {
  44069. var val = jQuery(this).val();
  44070. if (val == null) {
  44071. return null;
  44072. }
  44073. if (Array.isArray(val)) {
  44074. return jQuery.map(val, function (val) {
  44075. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  44076. });
  44077. }
  44078. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  44079. }).get();
  44080. }
  44081. });
  44082. var r20 = /%20/g,
  44083. rhash = /#.*$/,
  44084. rantiCache = /([?&])_=[^&]*/,
  44085. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  44086. // #7653, #8125, #8152: local protocol detection
  44087. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  44088. rnoContent = /^(?:GET|HEAD)$/,
  44089. rprotocol = /^\/\//,
  44090. /* Prefilters
  44091. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  44092. * 2) These are called:
  44093. * - BEFORE asking for a transport
  44094. * - AFTER param serialization (s.data is a string if s.processData is true)
  44095. * 3) key is the dataType
  44096. * 4) the catchall symbol "*" can be used
  44097. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  44098. */
  44099. prefilters = {},
  44100. /* Transports bindings
  44101. * 1) key is the dataType
  44102. * 2) the catchall symbol "*" can be used
  44103. * 3) selection will start with transport dataType and THEN go to "*" if needed
  44104. */
  44105. transports = {},
  44106. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  44107. allTypes = "*/".concat("*"),
  44108. // Anchor tag for parsing the document origin
  44109. originAnchor = document.createElement("a");
  44110. originAnchor.href = location.href;
  44111. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  44112. function addToPrefiltersOrTransports(structure) {
  44113. // dataTypeExpression is optional and defaults to "*"
  44114. return function (dataTypeExpression, func) {
  44115. if (typeof dataTypeExpression !== "string") {
  44116. func = dataTypeExpression;
  44117. dataTypeExpression = "*";
  44118. }
  44119. var dataType,
  44120. i = 0,
  44121. dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  44122. if (isFunction(func)) {
  44123. // For each dataType in the dataTypeExpression
  44124. while (dataType = dataTypes[i++]) {
  44125. // Prepend if requested
  44126. if (dataType[0] === "+") {
  44127. dataType = dataType.slice(1) || "*";
  44128. (structure[dataType] = structure[dataType] || []).unshift(func);
  44129. // Otherwise append
  44130. } else {
  44131. (structure[dataType] = structure[dataType] || []).push(func);
  44132. }
  44133. }
  44134. }
  44135. };
  44136. }
  44137. // Base inspection function for prefilters and transports
  44138. function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
  44139. var inspected = {},
  44140. seekingTransport = structure === transports;
  44141. function inspect(dataType) {
  44142. var selected;
  44143. inspected[dataType] = true;
  44144. jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
  44145. var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
  44146. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  44147. options.dataTypes.unshift(dataTypeOrTransport);
  44148. inspect(dataTypeOrTransport);
  44149. return false;
  44150. } else if (seekingTransport) {
  44151. return !(selected = dataTypeOrTransport);
  44152. }
  44153. });
  44154. return selected;
  44155. }
  44156. return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
  44157. }
  44158. // A special extend for ajax options
  44159. // that takes "flat" options (not to be deep extended)
  44160. // Fixes #9887
  44161. function ajaxExtend(target, src) {
  44162. var key,
  44163. deep,
  44164. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  44165. for (key in src) {
  44166. if (src[key] !== undefined) {
  44167. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  44168. }
  44169. }
  44170. if (deep) {
  44171. jQuery.extend(true, target, deep);
  44172. }
  44173. return target;
  44174. }
  44175. /* Handles responses to an ajax request:
  44176. * - finds the right dataType (mediates between content-type and expected dataType)
  44177. * - returns the corresponding response
  44178. */
  44179. function ajaxHandleResponses(s, jqXHR, responses) {
  44180. var ct,
  44181. type,
  44182. finalDataType,
  44183. firstDataType,
  44184. contents = s.contents,
  44185. dataTypes = s.dataTypes;
  44186. // Remove auto dataType and get content-type in the process
  44187. while (dataTypes[0] === "*") {
  44188. dataTypes.shift();
  44189. if (ct === undefined) {
  44190. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  44191. }
  44192. }
  44193. // Check if we're dealing with a known content-type
  44194. if (ct) {
  44195. for (type in contents) {
  44196. if (contents[type] && contents[type].test(ct)) {
  44197. dataTypes.unshift(type);
  44198. break;
  44199. }
  44200. }
  44201. }
  44202. // Check to see if we have a response for the expected dataType
  44203. if (dataTypes[0] in responses) {
  44204. finalDataType = dataTypes[0];
  44205. } else {
  44206. // Try convertible dataTypes
  44207. for (type in responses) {
  44208. if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
  44209. finalDataType = type;
  44210. break;
  44211. }
  44212. if (!firstDataType) {
  44213. firstDataType = type;
  44214. }
  44215. }
  44216. // Or just use first one
  44217. finalDataType = finalDataType || firstDataType;
  44218. }
  44219. // If we found a dataType
  44220. // We add the dataType to the list if needed
  44221. // and return the corresponding response
  44222. if (finalDataType) {
  44223. if (finalDataType !== dataTypes[0]) {
  44224. dataTypes.unshift(finalDataType);
  44225. }
  44226. return responses[finalDataType];
  44227. }
  44228. }
  44229. /* Chain conversions given the request and the original response
  44230. * Also sets the responseXXX fields on the jqXHR instance
  44231. */
  44232. function ajaxConvert(s, response, jqXHR, isSuccess) {
  44233. var conv2,
  44234. current,
  44235. conv,
  44236. tmp,
  44237. prev,
  44238. converters = {},
  44239. // Work with a copy of dataTypes in case we need to modify it for conversion
  44240. dataTypes = s.dataTypes.slice();
  44241. // Create converters map with lowercased keys
  44242. if (dataTypes[1]) {
  44243. for (conv in s.converters) {
  44244. converters[conv.toLowerCase()] = s.converters[conv];
  44245. }
  44246. }
  44247. current = dataTypes.shift();
  44248. // Convert to each sequential dataType
  44249. while (current) {
  44250. if (s.responseFields[current]) {
  44251. jqXHR[s.responseFields[current]] = response;
  44252. }
  44253. // Apply the dataFilter if provided
  44254. if (!prev && isSuccess && s.dataFilter) {
  44255. response = s.dataFilter(response, s.dataType);
  44256. }
  44257. prev = current;
  44258. current = dataTypes.shift();
  44259. if (current) {
  44260. // There's only work to do if current dataType is non-auto
  44261. if (current === "*") {
  44262. current = prev;
  44263. // Convert response if prev dataType is non-auto and differs from current
  44264. } else if (prev !== "*" && prev !== current) {
  44265. // Seek a direct converter
  44266. conv = converters[prev + " " + current] || converters["* " + current];
  44267. // If none found, seek a pair
  44268. if (!conv) {
  44269. for (conv2 in converters) {
  44270. // If conv2 outputs current
  44271. tmp = conv2.split(" ");
  44272. if (tmp[1] === current) {
  44273. // If prev can be converted to accepted input
  44274. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  44275. if (conv) {
  44276. // Condense equivalence converters
  44277. if (conv === true) {
  44278. conv = converters[conv2];
  44279. // Otherwise, insert the intermediate dataType
  44280. } else if (converters[conv2] !== true) {
  44281. current = tmp[0];
  44282. dataTypes.unshift(tmp[1]);
  44283. }
  44284. break;
  44285. }
  44286. }
  44287. }
  44288. }
  44289. // Apply converter (if not an equivalence)
  44290. if (conv !== true) {
  44291. // Unless errors are allowed to bubble, catch and return them
  44292. if (conv && s.throws) {
  44293. response = conv(response);
  44294. } else {
  44295. try {
  44296. response = conv(response);
  44297. } catch (e) {
  44298. return {
  44299. state: "parsererror",
  44300. error: conv ? e : "No conversion from " + prev + " to " + current
  44301. };
  44302. }
  44303. }
  44304. }
  44305. }
  44306. }
  44307. }
  44308. return { state: "success", data: response };
  44309. }
  44310. jQuery.extend({
  44311. // Counter for holding the number of active queries
  44312. active: 0,
  44313. // Last-Modified header cache for next request
  44314. lastModified: {},
  44315. etag: {},
  44316. ajaxSettings: {
  44317. url: location.href,
  44318. type: "GET",
  44319. isLocal: rlocalProtocol.test(location.protocol),
  44320. global: true,
  44321. processData: true,
  44322. async: true,
  44323. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  44324. /*
  44325. timeout: 0,
  44326. data: null,
  44327. dataType: null,
  44328. username: null,
  44329. password: null,
  44330. cache: null,
  44331. throws: false,
  44332. traditional: false,
  44333. headers: {},
  44334. */
  44335. accepts: {
  44336. "*": allTypes,
  44337. text: "text/plain",
  44338. html: "text/html",
  44339. xml: "application/xml, text/xml",
  44340. json: "application/json, text/javascript"
  44341. },
  44342. contents: {
  44343. xml: /\bxml\b/,
  44344. html: /\bhtml/,
  44345. json: /\bjson\b/
  44346. },
  44347. responseFields: {
  44348. xml: "responseXML",
  44349. text: "responseText",
  44350. json: "responseJSON"
  44351. },
  44352. // Data converters
  44353. // Keys separate source (or catchall "*") and destination types with a single space
  44354. converters: {
  44355. // Convert anything to text
  44356. "* text": String,
  44357. // Text to html (true = no transformation)
  44358. "text html": true,
  44359. // Evaluate text as a json expression
  44360. "text json": JSON.parse,
  44361. // Parse text as xml
  44362. "text xml": jQuery.parseXML
  44363. },
  44364. // For options that shouldn't be deep extended:
  44365. // you can add your own custom options here if
  44366. // and when you create one that shouldn't be
  44367. // deep extended (see ajaxExtend)
  44368. flatOptions: {
  44369. url: true,
  44370. context: true
  44371. }
  44372. },
  44373. // Creates a full fledged settings object into target
  44374. // with both ajaxSettings and settings fields.
  44375. // If target is omitted, writes into ajaxSettings.
  44376. ajaxSetup: function ajaxSetup(target, settings) {
  44377. return settings ?
  44378. // Building a settings object
  44379. ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
  44380. // Extending ajaxSettings
  44381. ajaxExtend(jQuery.ajaxSettings, target);
  44382. },
  44383. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  44384. ajaxTransport: addToPrefiltersOrTransports(transports),
  44385. // Main method
  44386. ajax: function ajax(url, options) {
  44387. // If url is an object, simulate pre-1.5 signature
  44388. if ((typeof url === "undefined" ? "undefined" : _typeof(url)) === "object") {
  44389. options = url;
  44390. url = undefined;
  44391. }
  44392. // Force options to be an object
  44393. options = options || {};
  44394. var transport,
  44395. // URL without anti-cache param
  44396. cacheURL,
  44397. // Response headers
  44398. responseHeadersString,
  44399. responseHeaders,
  44400. // timeout handle
  44401. timeoutTimer,
  44402. // Url cleanup var
  44403. urlAnchor,
  44404. // Request state (becomes false upon send and true upon completion)
  44405. completed,
  44406. // To know if global events are to be dispatched
  44407. fireGlobals,
  44408. // Loop variable
  44409. i,
  44410. // uncached part of the url
  44411. uncached,
  44412. // Create the final options object
  44413. s = jQuery.ajaxSetup({}, options),
  44414. // Callbacks context
  44415. callbackContext = s.context || s,
  44416. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  44417. globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
  44418. // Deferreds
  44419. deferred = jQuery.Deferred(),
  44420. completeDeferred = jQuery.Callbacks("once memory"),
  44421. // Status-dependent callbacks
  44422. _statusCode = s.statusCode || {},
  44423. // Headers (they are sent all at once)
  44424. requestHeaders = {},
  44425. requestHeadersNames = {},
  44426. // Default abort message
  44427. strAbort = "canceled",
  44428. // Fake xhr
  44429. jqXHR = {
  44430. readyState: 0,
  44431. // Builds headers hashtable if needed
  44432. getResponseHeader: function getResponseHeader(key) {
  44433. var match;
  44434. if (completed) {
  44435. if (!responseHeaders) {
  44436. responseHeaders = {};
  44437. while (match = rheaders.exec(responseHeadersString)) {
  44438. responseHeaders[match[1].toLowerCase()] = match[2];
  44439. }
  44440. }
  44441. match = responseHeaders[key.toLowerCase()];
  44442. }
  44443. return match == null ? null : match;
  44444. },
  44445. // Raw string
  44446. getAllResponseHeaders: function getAllResponseHeaders() {
  44447. return completed ? responseHeadersString : null;
  44448. },
  44449. // Caches the header
  44450. setRequestHeader: function setRequestHeader(name, value) {
  44451. if (completed == null) {
  44452. name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
  44453. requestHeaders[name] = value;
  44454. }
  44455. return this;
  44456. },
  44457. // Overrides response content-type header
  44458. overrideMimeType: function overrideMimeType(type) {
  44459. if (completed == null) {
  44460. s.mimeType = type;
  44461. }
  44462. return this;
  44463. },
  44464. // Status-dependent callbacks
  44465. statusCode: function statusCode(map) {
  44466. var code;
  44467. if (map) {
  44468. if (completed) {
  44469. // Execute the appropriate callbacks
  44470. jqXHR.always(map[jqXHR.status]);
  44471. } else {
  44472. // Lazy-add the new callbacks in a way that preserves old ones
  44473. for (code in map) {
  44474. _statusCode[code] = [_statusCode[code], map[code]];
  44475. }
  44476. }
  44477. }
  44478. return this;
  44479. },
  44480. // Cancel the request
  44481. abort: function abort(statusText) {
  44482. var finalText = statusText || strAbort;
  44483. if (transport) {
  44484. transport.abort(finalText);
  44485. }
  44486. done(0, finalText);
  44487. return this;
  44488. }
  44489. };
  44490. // Attach deferreds
  44491. deferred.promise(jqXHR);
  44492. // Add protocol if not provided (prefilters might expect it)
  44493. // Handle falsy url in the settings object (#10093: consistency with old signature)
  44494. // We also use the url parameter if available
  44495. s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");
  44496. // Alias method option to type as per ticket #12004
  44497. s.type = options.method || options.type || s.method || s.type;
  44498. // Extract dataTypes list
  44499. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  44500. // A cross-domain request is in order when the origin doesn't match the current origin.
  44501. if (s.crossDomain == null) {
  44502. urlAnchor = document.createElement("a");
  44503. // Support: IE <=8 - 11, Edge 12 - 15
  44504. // IE throws exception on accessing the href property if url is malformed,
  44505. // e.g. http://example.com:80x/
  44506. try {
  44507. urlAnchor.href = s.url;
  44508. // Support: IE <=8 - 11 only
  44509. // Anchor's host property isn't correctly set when s.url is relative
  44510. urlAnchor.href = urlAnchor.href;
  44511. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
  44512. } catch (e) {
  44513. // If there is an error parsing the URL, assume it is crossDomain,
  44514. // it can be rejected by the transport if it is invalid
  44515. s.crossDomain = true;
  44516. }
  44517. }
  44518. // Convert data if not already a string
  44519. if (s.data && s.processData && typeof s.data !== "string") {
  44520. s.data = jQuery.param(s.data, s.traditional);
  44521. }
  44522. // Apply prefilters
  44523. inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
  44524. // If request was aborted inside a prefilter, stop there
  44525. if (completed) {
  44526. return jqXHR;
  44527. }
  44528. // We can fire global events as of now if asked to
  44529. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  44530. fireGlobals = jQuery.event && s.global;
  44531. // Watch for a new set of requests
  44532. if (fireGlobals && jQuery.active++ === 0) {
  44533. jQuery.event.trigger("ajaxStart");
  44534. }
  44535. // Uppercase the type
  44536. s.type = s.type.toUpperCase();
  44537. // Determine if request has content
  44538. s.hasContent = !rnoContent.test(s.type);
  44539. // Save the URL in case we're toying with the If-Modified-Since
  44540. // and/or If-None-Match header later on
  44541. // Remove hash to simplify url manipulation
  44542. cacheURL = s.url.replace(rhash, "");
  44543. // More options handling for requests with no content
  44544. if (!s.hasContent) {
  44545. // Remember the hash so we can put it back
  44546. uncached = s.url.slice(cacheURL.length);
  44547. // If data is available and should be processed, append data to url
  44548. if (s.data && (s.processData || typeof s.data === "string")) {
  44549. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  44550. // #9682: remove data so that it's not used in an eventual retry
  44551. delete s.data;
  44552. }
  44553. // Add or update anti-cache param if needed
  44554. if (s.cache === false) {
  44555. cacheURL = cacheURL.replace(rantiCache, "$1");
  44556. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++ + uncached;
  44557. }
  44558. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  44559. s.url = cacheURL + uncached;
  44560. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  44561. } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  44562. s.data = s.data.replace(r20, "+");
  44563. }
  44564. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  44565. if (s.ifModified) {
  44566. if (jQuery.lastModified[cacheURL]) {
  44567. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  44568. }
  44569. if (jQuery.etag[cacheURL]) {
  44570. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  44571. }
  44572. }
  44573. // Set the correct header, if data is being sent
  44574. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  44575. jqXHR.setRequestHeader("Content-Type", s.contentType);
  44576. }
  44577. // Set the Accepts header for the server, depending on the dataType
  44578. 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["*"]);
  44579. // Check for headers option
  44580. for (i in s.headers) {
  44581. jqXHR.setRequestHeader(i, s.headers[i]);
  44582. }
  44583. // Allow custom headers/mimetypes and early abort
  44584. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {
  44585. // Abort if not done already and return
  44586. return jqXHR.abort();
  44587. }
  44588. // Aborting is no longer a cancellation
  44589. strAbort = "abort";
  44590. // Install callbacks on deferreds
  44591. completeDeferred.add(s.complete);
  44592. jqXHR.done(s.success);
  44593. jqXHR.fail(s.error);
  44594. // Get transport
  44595. transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
  44596. // If no transport, we auto-abort
  44597. if (!transport) {
  44598. done(-1, "No Transport");
  44599. } else {
  44600. jqXHR.readyState = 1;
  44601. // Send global event
  44602. if (fireGlobals) {
  44603. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  44604. }
  44605. // If request was aborted inside ajaxSend, stop there
  44606. if (completed) {
  44607. return jqXHR;
  44608. }
  44609. // Timeout
  44610. if (s.async && s.timeout > 0) {
  44611. timeoutTimer = window.setTimeout(function () {
  44612. jqXHR.abort("timeout");
  44613. }, s.timeout);
  44614. }
  44615. try {
  44616. completed = false;
  44617. transport.send(requestHeaders, done);
  44618. } catch (e) {
  44619. // Rethrow post-completion exceptions
  44620. if (completed) {
  44621. throw e;
  44622. }
  44623. // Propagate others as results
  44624. done(-1, e);
  44625. }
  44626. }
  44627. // Callback for when everything is done
  44628. function done(status, nativeStatusText, responses, headers) {
  44629. var isSuccess,
  44630. success,
  44631. error,
  44632. response,
  44633. modified,
  44634. statusText = nativeStatusText;
  44635. // Ignore repeat invocations
  44636. if (completed) {
  44637. return;
  44638. }
  44639. completed = true;
  44640. // Clear timeout if it exists
  44641. if (timeoutTimer) {
  44642. window.clearTimeout(timeoutTimer);
  44643. }
  44644. // Dereference transport for early garbage collection
  44645. // (no matter how long the jqXHR object will be used)
  44646. transport = undefined;
  44647. // Cache response headers
  44648. responseHeadersString = headers || "";
  44649. // Set readyState
  44650. jqXHR.readyState = status > 0 ? 4 : 0;
  44651. // Determine if successful
  44652. isSuccess = status >= 200 && status < 300 || status === 304;
  44653. // Get response data
  44654. if (responses) {
  44655. response = ajaxHandleResponses(s, jqXHR, responses);
  44656. }
  44657. // Convert no matter what (that way responseXXX fields are always set)
  44658. response = ajaxConvert(s, response, jqXHR, isSuccess);
  44659. // If successful, handle type chaining
  44660. if (isSuccess) {
  44661. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  44662. if (s.ifModified) {
  44663. modified = jqXHR.getResponseHeader("Last-Modified");
  44664. if (modified) {
  44665. jQuery.lastModified[cacheURL] = modified;
  44666. }
  44667. modified = jqXHR.getResponseHeader("etag");
  44668. if (modified) {
  44669. jQuery.etag[cacheURL] = modified;
  44670. }
  44671. }
  44672. // if no content
  44673. if (status === 204 || s.type === "HEAD") {
  44674. statusText = "nocontent";
  44675. // if not modified
  44676. } else if (status === 304) {
  44677. statusText = "notmodified";
  44678. // If we have data, let's convert it
  44679. } else {
  44680. statusText = response.state;
  44681. success = response.data;
  44682. error = response.error;
  44683. isSuccess = !error;
  44684. }
  44685. } else {
  44686. // Extract error from statusText and normalize for non-aborts
  44687. error = statusText;
  44688. if (status || !statusText) {
  44689. statusText = "error";
  44690. if (status < 0) {
  44691. status = 0;
  44692. }
  44693. }
  44694. }
  44695. // Set data for the fake xhr object
  44696. jqXHR.status = status;
  44697. jqXHR.statusText = (nativeStatusText || statusText) + "";
  44698. // Success/Error
  44699. if (isSuccess) {
  44700. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  44701. } else {
  44702. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  44703. }
  44704. // Status-dependent callbacks
  44705. jqXHR.statusCode(_statusCode);
  44706. _statusCode = undefined;
  44707. if (fireGlobals) {
  44708. globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
  44709. }
  44710. // Complete
  44711. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  44712. if (fireGlobals) {
  44713. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  44714. // Handle the global AJAX counter
  44715. if (! --jQuery.active) {
  44716. jQuery.event.trigger("ajaxStop");
  44717. }
  44718. }
  44719. }
  44720. return jqXHR;
  44721. },
  44722. getJSON: function getJSON(url, data, callback) {
  44723. return jQuery.get(url, data, callback, "json");
  44724. },
  44725. getScript: function getScript(url, callback) {
  44726. return jQuery.get(url, undefined, callback, "script");
  44727. }
  44728. });
  44729. jQuery.each(["get", "post"], function (i, method) {
  44730. jQuery[method] = function (url, data, callback, type) {
  44731. // Shift arguments if data argument was omitted
  44732. if (isFunction(data)) {
  44733. type = type || callback;
  44734. callback = data;
  44735. data = undefined;
  44736. }
  44737. // The url can be an options object (which then must have .url)
  44738. return jQuery.ajax(jQuery.extend({
  44739. url: url,
  44740. type: method,
  44741. dataType: type,
  44742. data: data,
  44743. success: callback
  44744. }, jQuery.isPlainObject(url) && url));
  44745. };
  44746. });
  44747. jQuery._evalUrl = function (url) {
  44748. return jQuery.ajax({
  44749. url: url,
  44750. // Make this explicit, since user can override this through ajaxSetup (#11264)
  44751. type: "GET",
  44752. dataType: "script",
  44753. cache: true,
  44754. async: false,
  44755. global: false,
  44756. "throws": true
  44757. });
  44758. };
  44759. jQuery.fn.extend({
  44760. wrapAll: function wrapAll(html) {
  44761. var wrap;
  44762. if (this[0]) {
  44763. if (isFunction(html)) {
  44764. html = html.call(this[0]);
  44765. }
  44766. // The elements to wrap the target around
  44767. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  44768. if (this[0].parentNode) {
  44769. wrap.insertBefore(this[0]);
  44770. }
  44771. wrap.map(function () {
  44772. var elem = this;
  44773. while (elem.firstElementChild) {
  44774. elem = elem.firstElementChild;
  44775. }
  44776. return elem;
  44777. }).append(this);
  44778. }
  44779. return this;
  44780. },
  44781. wrapInner: function wrapInner(html) {
  44782. if (isFunction(html)) {
  44783. return this.each(function (i) {
  44784. jQuery(this).wrapInner(html.call(this, i));
  44785. });
  44786. }
  44787. return this.each(function () {
  44788. var self = jQuery(this),
  44789. contents = self.contents();
  44790. if (contents.length) {
  44791. contents.wrapAll(html);
  44792. } else {
  44793. self.append(html);
  44794. }
  44795. });
  44796. },
  44797. wrap: function wrap(html) {
  44798. var htmlIsFunction = isFunction(html);
  44799. return this.each(function (i) {
  44800. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
  44801. });
  44802. },
  44803. unwrap: function unwrap(selector) {
  44804. this.parent(selector).not("body").each(function () {
  44805. jQuery(this).replaceWith(this.childNodes);
  44806. });
  44807. return this;
  44808. }
  44809. });
  44810. jQuery.expr.pseudos.hidden = function (elem) {
  44811. return !jQuery.expr.pseudos.visible(elem);
  44812. };
  44813. jQuery.expr.pseudos.visible = function (elem) {
  44814. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  44815. };
  44816. jQuery.ajaxSettings.xhr = function () {
  44817. try {
  44818. return new window.XMLHttpRequest();
  44819. } catch (e) {}
  44820. };
  44821. var xhrSuccessStatus = {
  44822. // File protocol always yields status code 0, assume 200
  44823. 0: 200,
  44824. // Support: IE <=9 only
  44825. // #1450: sometimes IE returns 1223 when it should be 204
  44826. 1223: 204
  44827. },
  44828. xhrSupported = jQuery.ajaxSettings.xhr();
  44829. support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  44830. support.ajax = xhrSupported = !!xhrSupported;
  44831. jQuery.ajaxTransport(function (options) {
  44832. var _callback, errorCallback;
  44833. // Cross domain only allowed if supported through XMLHttpRequest
  44834. if (support.cors || xhrSupported && !options.crossDomain) {
  44835. return {
  44836. send: function send(headers, complete) {
  44837. var i,
  44838. xhr = options.xhr();
  44839. xhr.open(options.type, options.url, options.async, options.username, options.password);
  44840. // Apply custom fields if provided
  44841. if (options.xhrFields) {
  44842. for (i in options.xhrFields) {
  44843. xhr[i] = options.xhrFields[i];
  44844. }
  44845. }
  44846. // Override mime type if needed
  44847. if (options.mimeType && xhr.overrideMimeType) {
  44848. xhr.overrideMimeType(options.mimeType);
  44849. }
  44850. // X-Requested-With header
  44851. // For cross-domain requests, seeing as conditions for a preflight are
  44852. // akin to a jigsaw puzzle, we simply never set it to be sure.
  44853. // (it can always be set on a per-request basis or even using ajaxSetup)
  44854. // For same-domain requests, won't change header if already provided.
  44855. if (!options.crossDomain && !headers["X-Requested-With"]) {
  44856. headers["X-Requested-With"] = "XMLHttpRequest";
  44857. }
  44858. // Set headers
  44859. for (i in headers) {
  44860. xhr.setRequestHeader(i, headers[i]);
  44861. }
  44862. // Callback
  44863. _callback = function callback(type) {
  44864. return function () {
  44865. if (_callback) {
  44866. _callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
  44867. if (type === "abort") {
  44868. xhr.abort();
  44869. } else if (type === "error") {
  44870. // Support: IE <=9 only
  44871. // On a manual native abort, IE9 throws
  44872. // errors on any property access that is not readyState
  44873. if (typeof xhr.status !== "number") {
  44874. complete(0, "error");
  44875. } else {
  44876. complete(
  44877. // File: protocol always yields status 0; see #8605, #14207
  44878. xhr.status, xhr.statusText);
  44879. }
  44880. } else {
  44881. complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText,
  44882. // Support: IE <=9 only
  44883. // IE9 has no XHR2 but throws on binary (trac-11426)
  44884. // For XHR2 non-text, let the caller handle it (gh-2498)
  44885. (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders());
  44886. }
  44887. }
  44888. };
  44889. };
  44890. // Listen to events
  44891. xhr.onload = _callback();
  44892. errorCallback = xhr.onerror = xhr.ontimeout = _callback("error");
  44893. // Support: IE 9 only
  44894. // Use onreadystatechange to replace onabort
  44895. // to handle uncaught aborts
  44896. if (xhr.onabort !== undefined) {
  44897. xhr.onabort = errorCallback;
  44898. } else {
  44899. xhr.onreadystatechange = function () {
  44900. // Check readyState before timeout as it changes
  44901. if (xhr.readyState === 4) {
  44902. // Allow onerror to be called first,
  44903. // but that will not handle a native abort
  44904. // Also, save errorCallback to a variable
  44905. // as xhr.onerror cannot be accessed
  44906. window.setTimeout(function () {
  44907. if (_callback) {
  44908. errorCallback();
  44909. }
  44910. });
  44911. }
  44912. };
  44913. }
  44914. // Create the abort callback
  44915. _callback = _callback("abort");
  44916. try {
  44917. // Do send the request (this may raise an exception)
  44918. xhr.send(options.hasContent && options.data || null);
  44919. } catch (e) {
  44920. // #14683: Only rethrow if this hasn't been notified as an error yet
  44921. if (_callback) {
  44922. throw e;
  44923. }
  44924. }
  44925. },
  44926. abort: function abort() {
  44927. if (_callback) {
  44928. _callback();
  44929. }
  44930. }
  44931. };
  44932. }
  44933. });
  44934. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  44935. jQuery.ajaxPrefilter(function (s) {
  44936. if (s.crossDomain) {
  44937. s.contents.script = false;
  44938. }
  44939. });
  44940. // Install script dataType
  44941. jQuery.ajaxSetup({
  44942. accepts: {
  44943. script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript"
  44944. },
  44945. contents: {
  44946. script: /\b(?:java|ecma)script\b/
  44947. },
  44948. converters: {
  44949. "text script": function textScript(text) {
  44950. jQuery.globalEval(text);
  44951. return text;
  44952. }
  44953. }
  44954. });
  44955. // Handle cache's special case and crossDomain
  44956. jQuery.ajaxPrefilter("script", function (s) {
  44957. if (s.cache === undefined) {
  44958. s.cache = false;
  44959. }
  44960. if (s.crossDomain) {
  44961. s.type = "GET";
  44962. }
  44963. });
  44964. // Bind script tag hack transport
  44965. jQuery.ajaxTransport("script", function (s) {
  44966. // This transport only deals with cross domain requests
  44967. if (s.crossDomain) {
  44968. var script, _callback2;
  44969. return {
  44970. send: function send(_, complete) {
  44971. script = jQuery("<script>").prop({
  44972. charset: s.scriptCharset,
  44973. src: s.url
  44974. }).on("load error", _callback2 = function callback(evt) {
  44975. script.remove();
  44976. _callback2 = null;
  44977. if (evt) {
  44978. complete(evt.type === "error" ? 404 : 200, evt.type);
  44979. }
  44980. });
  44981. // Use native DOM manipulation to avoid our domManip AJAX trickery
  44982. document.head.appendChild(script[0]);
  44983. },
  44984. abort: function abort() {
  44985. if (_callback2) {
  44986. _callback2();
  44987. }
  44988. }
  44989. };
  44990. }
  44991. });
  44992. var oldCallbacks = [],
  44993. rjsonp = /(=)\?(?=&|$)|\?\?/;
  44994. // Default jsonp settings
  44995. jQuery.ajaxSetup({
  44996. jsonp: "callback",
  44997. jsonpCallback: function jsonpCallback() {
  44998. var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce++;
  44999. this[callback] = true;
  45000. return callback;
  45001. }
  45002. });
  45003. // Detect, normalize options and install callbacks for jsonp requests
  45004. jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
  45005. var callbackName,
  45006. overwritten,
  45007. responseContainer,
  45008. 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");
  45009. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  45010. if (jsonProp || s.dataTypes[0] === "jsonp") {
  45011. // Get callback name, remembering preexisting value associated with it
  45012. callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  45013. // Insert callback into url or form data
  45014. if (jsonProp) {
  45015. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  45016. } else if (s.jsonp !== false) {
  45017. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  45018. }
  45019. // Use data converter to retrieve json after script execution
  45020. s.converters["script json"] = function () {
  45021. if (!responseContainer) {
  45022. jQuery.error(callbackName + " was not called");
  45023. }
  45024. return responseContainer[0];
  45025. };
  45026. // Force json dataType
  45027. s.dataTypes[0] = "json";
  45028. // Install callback
  45029. overwritten = window[callbackName];
  45030. window[callbackName] = function () {
  45031. responseContainer = arguments;
  45032. };
  45033. // Clean-up function (fires after converters)
  45034. jqXHR.always(function () {
  45035. // If previous value didn't exist - remove it
  45036. if (overwritten === undefined) {
  45037. jQuery(window).removeProp(callbackName);
  45038. // Otherwise restore preexisting value
  45039. } else {
  45040. window[callbackName] = overwritten;
  45041. }
  45042. // Save back as free
  45043. if (s[callbackName]) {
  45044. // Make sure that re-using the options doesn't screw things around
  45045. s.jsonpCallback = originalSettings.jsonpCallback;
  45046. // Save the callback name for future use
  45047. oldCallbacks.push(callbackName);
  45048. }
  45049. // Call if it was a function and we have a response
  45050. if (responseContainer && isFunction(overwritten)) {
  45051. overwritten(responseContainer[0]);
  45052. }
  45053. responseContainer = overwritten = undefined;
  45054. });
  45055. // Delegate to script
  45056. return "script";
  45057. }
  45058. });
  45059. // Support: Safari 8 only
  45060. // In Safari 8 documents created via document.implementation.createHTMLDocument
  45061. // collapse sibling forms: the second one becomes a child of the first one.
  45062. // Because of that, this security measure has to be disabled in Safari 8.
  45063. // https://bugs.webkit.org/show_bug.cgi?id=137337
  45064. support.createHTMLDocument = function () {
  45065. var body = document.implementation.createHTMLDocument("").body;
  45066. body.innerHTML = "<form></form><form></form>";
  45067. return body.childNodes.length === 2;
  45068. }();
  45069. // Argument "data" should be string of html
  45070. // context (optional): If specified, the fragment will be created in this context,
  45071. // defaults to document
  45072. // keepScripts (optional): If true, will include scripts passed in the html string
  45073. jQuery.parseHTML = function (data, context, keepScripts) {
  45074. if (typeof data !== "string") {
  45075. return [];
  45076. }
  45077. if (typeof context === "boolean") {
  45078. keepScripts = context;
  45079. context = false;
  45080. }
  45081. var base, parsed, scripts;
  45082. if (!context) {
  45083. // Stop scripts or inline event handlers from being executed immediately
  45084. // by using document.implementation
  45085. if (support.createHTMLDocument) {
  45086. context = document.implementation.createHTMLDocument("");
  45087. // Set the base href for the created document
  45088. // so any parsed elements with URLs
  45089. // are based on the document's URL (gh-2965)
  45090. base = context.createElement("base");
  45091. base.href = document.location.href;
  45092. context.head.appendChild(base);
  45093. } else {
  45094. context = document;
  45095. }
  45096. }
  45097. parsed = rsingleTag.exec(data);
  45098. scripts = !keepScripts && [];
  45099. // Single tag
  45100. if (parsed) {
  45101. return [context.createElement(parsed[1])];
  45102. }
  45103. parsed = buildFragment([data], context, scripts);
  45104. if (scripts && scripts.length) {
  45105. jQuery(scripts).remove();
  45106. }
  45107. return jQuery.merge([], parsed.childNodes);
  45108. };
  45109. /**
  45110. * Load a url into a page
  45111. */
  45112. jQuery.fn.load = function (url, params, callback) {
  45113. var selector,
  45114. type,
  45115. response,
  45116. self = this,
  45117. off = url.indexOf(" ");
  45118. if (off > -1) {
  45119. selector = stripAndCollapse(url.slice(off));
  45120. url = url.slice(0, off);
  45121. }
  45122. // If it's a function
  45123. if (isFunction(params)) {
  45124. // We assume that it's the callback
  45125. callback = params;
  45126. params = undefined;
  45127. // Otherwise, build a param string
  45128. } else if (params && (typeof params === "undefined" ? "undefined" : _typeof(params)) === "object") {
  45129. type = "POST";
  45130. }
  45131. // If we have elements to modify, make the request
  45132. if (self.length > 0) {
  45133. jQuery.ajax({
  45134. url: url,
  45135. // If "type" variable is undefined, then "GET" method will be used.
  45136. // Make value of this field explicit since
  45137. // user can override it through ajaxSetup method
  45138. type: type || "GET",
  45139. dataType: "html",
  45140. data: params
  45141. }).done(function (responseText) {
  45142. // Save response for use in complete callback
  45143. response = arguments;
  45144. self.html(selector ?
  45145. // If a selector was specified, locate the right elements in a dummy div
  45146. // Exclude scripts to avoid IE 'Permission Denied' errors
  45147. jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
  45148. // Otherwise use the full result
  45149. responseText);
  45150. // If the request succeeds, this function gets "data", "status", "jqXHR"
  45151. // but they are ignored because response was set above.
  45152. // If it fails, this function gets "jqXHR", "status", "error"
  45153. }).always(callback && function (jqXHR, status) {
  45154. self.each(function () {
  45155. callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  45156. });
  45157. });
  45158. }
  45159. return this;
  45160. };
  45161. // Attach a bunch of functions for handling common AJAX events
  45162. jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) {
  45163. jQuery.fn[type] = function (fn) {
  45164. return this.on(type, fn);
  45165. };
  45166. });
  45167. jQuery.expr.pseudos.animated = function (elem) {
  45168. return jQuery.grep(jQuery.timers, function (fn) {
  45169. return elem === fn.elem;
  45170. }).length;
  45171. };
  45172. jQuery.offset = {
  45173. setOffset: function setOffset(elem, options, i) {
  45174. var curPosition,
  45175. curLeft,
  45176. curCSSTop,
  45177. curTop,
  45178. curOffset,
  45179. curCSSLeft,
  45180. calculatePosition,
  45181. position = jQuery.css(elem, "position"),
  45182. curElem = jQuery(elem),
  45183. props = {};
  45184. // Set position first, in-case top/left are set even on static elem
  45185. if (position === "static") {
  45186. elem.style.position = "relative";
  45187. }
  45188. curOffset = curElem.offset();
  45189. curCSSTop = jQuery.css(elem, "top");
  45190. curCSSLeft = jQuery.css(elem, "left");
  45191. calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  45192. // Need to be able to calculate position if either
  45193. // top or left is auto and position is either absolute or fixed
  45194. if (calculatePosition) {
  45195. curPosition = curElem.position();
  45196. curTop = curPosition.top;
  45197. curLeft = curPosition.left;
  45198. } else {
  45199. curTop = parseFloat(curCSSTop) || 0;
  45200. curLeft = parseFloat(curCSSLeft) || 0;
  45201. }
  45202. if (isFunction(options)) {
  45203. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  45204. options = options.call(elem, i, jQuery.extend({}, curOffset));
  45205. }
  45206. if (options.top != null) {
  45207. props.top = options.top - curOffset.top + curTop;
  45208. }
  45209. if (options.left != null) {
  45210. props.left = options.left - curOffset.left + curLeft;
  45211. }
  45212. if ("using" in options) {
  45213. options.using.call(elem, props);
  45214. } else {
  45215. curElem.css(props);
  45216. }
  45217. }
  45218. };
  45219. jQuery.fn.extend({
  45220. // offset() relates an element's border box to the document origin
  45221. offset: function offset(options) {
  45222. // Preserve chaining for setter
  45223. if (arguments.length) {
  45224. return options === undefined ? this : this.each(function (i) {
  45225. jQuery.offset.setOffset(this, options, i);
  45226. });
  45227. }
  45228. var rect,
  45229. win,
  45230. elem = this[0];
  45231. if (!elem) {
  45232. return;
  45233. }
  45234. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  45235. // Support: IE <=11 only
  45236. // Running getBoundingClientRect on a
  45237. // disconnected node in IE throws an error
  45238. if (!elem.getClientRects().length) {
  45239. return { top: 0, left: 0 };
  45240. }
  45241. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  45242. rect = elem.getBoundingClientRect();
  45243. win = elem.ownerDocument.defaultView;
  45244. return {
  45245. top: rect.top + win.pageYOffset,
  45246. left: rect.left + win.pageXOffset
  45247. };
  45248. },
  45249. // position() relates an element's margin box to its offset parent's padding box
  45250. // This corresponds to the behavior of CSS absolute positioning
  45251. position: function position() {
  45252. if (!this[0]) {
  45253. return;
  45254. }
  45255. var offsetParent,
  45256. offset,
  45257. doc,
  45258. elem = this[0],
  45259. parentOffset = { top: 0, left: 0 };
  45260. // position:fixed elements are offset from the viewport, which itself always has zero offset
  45261. if (jQuery.css(elem, "position") === "fixed") {
  45262. // Assume position:fixed implies availability of getBoundingClientRect
  45263. offset = elem.getBoundingClientRect();
  45264. } else {
  45265. offset = this.offset();
  45266. // Account for the *real* offset parent, which can be the document or its root element
  45267. // when a statically positioned element is identified
  45268. doc = elem.ownerDocument;
  45269. offsetParent = elem.offsetParent || doc.documentElement;
  45270. while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
  45271. offsetParent = offsetParent.parentNode;
  45272. }
  45273. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  45274. // Incorporate borders into its offset, since they are outside its content origin
  45275. parentOffset = jQuery(offsetParent).offset();
  45276. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  45277. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  45278. }
  45279. }
  45280. // Subtract parent offsets and element margins
  45281. return {
  45282. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  45283. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  45284. };
  45285. },
  45286. // This method will return documentElement in the following cases:
  45287. // 1) For the element inside the iframe without offsetParent, this method will return
  45288. // documentElement of the parent window
  45289. // 2) For the hidden or detached element
  45290. // 3) For body or html element, i.e. in case of the html node - it will return itself
  45291. //
  45292. // but those exceptions were never presented as a real life use-cases
  45293. // and might be considered as more preferable results.
  45294. //
  45295. // This logic, however, is not guaranteed and can change at any point in the future
  45296. offsetParent: function offsetParent() {
  45297. return this.map(function () {
  45298. var offsetParent = this.offsetParent;
  45299. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  45300. offsetParent = offsetParent.offsetParent;
  45301. }
  45302. return offsetParent || documentElement;
  45303. });
  45304. }
  45305. });
  45306. // Create scrollLeft and scrollTop methods
  45307. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) {
  45308. var top = "pageYOffset" === prop;
  45309. jQuery.fn[method] = function (val) {
  45310. return access(this, function (elem, method, val) {
  45311. // Coalesce documents and windows
  45312. var win;
  45313. if (isWindow(elem)) {
  45314. win = elem;
  45315. } else if (elem.nodeType === 9) {
  45316. win = elem.defaultView;
  45317. }
  45318. if (val === undefined) {
  45319. return win ? win[prop] : elem[method];
  45320. }
  45321. if (win) {
  45322. win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset);
  45323. } else {
  45324. elem[method] = val;
  45325. }
  45326. }, method, val, arguments.length);
  45327. };
  45328. });
  45329. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  45330. // Add the top/left cssHooks using jQuery.fn.position
  45331. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  45332. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  45333. // getComputedStyle returns percent when specified for top/left/bottom/right;
  45334. // rather than make the css module depend on the offset module, just check for it here
  45335. jQuery.each(["top", "left"], function (i, prop) {
  45336. jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) {
  45337. if (computed) {
  45338. computed = curCSS(elem, prop);
  45339. // If curCSS returns percentage, fallback to offset
  45340. return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
  45341. }
  45342. });
  45343. });
  45344. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  45345. jQuery.each({ Height: "height", Width: "width" }, function (name, type) {
  45346. jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) {
  45347. // Margin is only for outerHeight, outerWidth
  45348. jQuery.fn[funcName] = function (margin, value) {
  45349. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
  45350. extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  45351. return access(this, function (elem, type, value) {
  45352. var doc;
  45353. if (isWindow(elem)) {
  45354. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  45355. return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
  45356. }
  45357. // Get document width or height
  45358. if (elem.nodeType === 9) {
  45359. doc = elem.documentElement;
  45360. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  45361. // whichever is greatest
  45362. return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);
  45363. }
  45364. return value === undefined ?
  45365. // Get width or height on the element, requesting but not forcing parseFloat
  45366. jQuery.css(elem, type, extra) :
  45367. // Set width or height on the element
  45368. jQuery.style(elem, type, value, extra);
  45369. }, type, chainable ? margin : undefined, chainable);
  45370. };
  45371. });
  45372. });
  45373. 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) {
  45374. // Handle event binding
  45375. jQuery.fn[name] = function (data, fn) {
  45376. return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
  45377. };
  45378. });
  45379. jQuery.fn.extend({
  45380. hover: function hover(fnOver, fnOut) {
  45381. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  45382. }
  45383. });
  45384. jQuery.fn.extend({
  45385. bind: function bind(types, data, fn) {
  45386. return this.on(types, null, data, fn);
  45387. },
  45388. unbind: function unbind(types, fn) {
  45389. return this.off(types, null, fn);
  45390. },
  45391. delegate: function delegate(selector, types, data, fn) {
  45392. return this.on(types, selector, data, fn);
  45393. },
  45394. undelegate: function undelegate(selector, types, fn) {
  45395. // ( namespace ) or ( selector, types [, fn] )
  45396. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
  45397. }
  45398. });
  45399. // Bind a function to a context, optionally partially applying any
  45400. // arguments.
  45401. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  45402. // However, it is not slated for removal any time soon
  45403. jQuery.proxy = function (fn, context) {
  45404. var tmp, args, proxy;
  45405. if (typeof context === "string") {
  45406. tmp = fn[context];
  45407. context = fn;
  45408. fn = tmp;
  45409. }
  45410. // Quick check to determine if target is callable, in the spec
  45411. // this throws a TypeError, but we will just return undefined.
  45412. if (!isFunction(fn)) {
  45413. return undefined;
  45414. }
  45415. // Simulated bind
  45416. args = _slice.call(arguments, 2);
  45417. proxy = function proxy() {
  45418. return fn.apply(context || this, args.concat(_slice.call(arguments)));
  45419. };
  45420. // Set the guid of unique handler to the same of original handler, so it can be removed
  45421. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  45422. return proxy;
  45423. };
  45424. jQuery.holdReady = function (hold) {
  45425. if (hold) {
  45426. jQuery.readyWait++;
  45427. } else {
  45428. jQuery.ready(true);
  45429. }
  45430. };
  45431. jQuery.isArray = Array.isArray;
  45432. jQuery.parseJSON = JSON.parse;
  45433. jQuery.nodeName = nodeName;
  45434. jQuery.isFunction = isFunction;
  45435. jQuery.isWindow = isWindow;
  45436. jQuery.camelCase = camelCase;
  45437. jQuery.type = toType;
  45438. jQuery.now = Date.now;
  45439. jQuery.isNumeric = function (obj) {
  45440. // As of jQuery 3.0, isNumeric is limited to
  45441. // strings and numbers (primitives or objects)
  45442. // that can be coerced to finite numbers (gh-2662)
  45443. var type = jQuery.type(obj);
  45444. return (type === "number" || type === "string") &&
  45445. // parseFloat NaNs numeric-cast false positives ("")
  45446. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  45447. // subtraction forces infinities to NaN
  45448. !isNaN(obj - parseFloat(obj));
  45449. };
  45450. // Register as a named AMD module, since jQuery can be concatenated with other
  45451. // files that may use define, but not via a proper concatenation script that
  45452. // understands anonymous AMD modules. A named AMD is safest and most robust
  45453. // way to register. Lowercase jquery is used because AMD module names are
  45454. // derived from file names, and jQuery is normally delivered in a lowercase
  45455. // file name. Do this after creating the global so that if an AMD module wants
  45456. // to call noConflict to hide this version of jQuery, it will work.
  45457. // Note that for maximum portability, libraries that are not jQuery should
  45458. // declare themselves as anonymous modules, and avoid setting a global if an
  45459. // AMD loader is present. jQuery is a special case. For more information, see
  45460. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  45461. if (true) {
  45462. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  45463. return jQuery;
  45464. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  45465. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  45466. }
  45467. var
  45468. // Map over jQuery in case of overwrite
  45469. _jQuery = window.jQuery,
  45470. // Map over the $ in case of overwrite
  45471. _$ = window.$;
  45472. jQuery.noConflict = function (deep) {
  45473. if (window.$ === jQuery) {
  45474. window.$ = _$;
  45475. }
  45476. if (deep && window.jQuery === jQuery) {
  45477. window.jQuery = _jQuery;
  45478. }
  45479. return jQuery;
  45480. };
  45481. // Expose jQuery and $ identifiers, even in AMD
  45482. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  45483. // and CommonJS for browser emulators (#13566)
  45484. if (!noGlobal) {
  45485. window.jQuery = window.$ = jQuery;
  45486. }
  45487. return jQuery;
  45488. });
  45489. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
  45490. /***/ }),
  45491. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  45492. /*!********************************************************!*\
  45493. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  45494. \********************************************************/
  45495. /*! no static exports found */
  45496. /***/ (function(module, exports, __webpack_require__) {
  45497. "use strict";
  45498. Object.defineProperty(exports, "__esModule", {
  45499. value: true
  45500. });
  45501. var LanguageService = /** @class */function () {
  45502. function LanguageService(lsKey, defaultLang) {
  45503. if (defaultLang === void 0) {
  45504. defaultLang = 'pt';
  45505. }
  45506. this.lsKey = lsKey;
  45507. this.defaultLang = defaultLang;
  45508. this.listeners = [];
  45509. this.document = document;
  45510. this.setupListener();
  45511. }
  45512. LanguageService.prototype.setupListener = function () {
  45513. var _this = this;
  45514. if (this.document !== null) {
  45515. this.document.addEventListener("storage", function (event) {
  45516. var e = event;
  45517. if (e.key === _this.lsKey) {
  45518. _this.listeners.forEach(function (l) {
  45519. return l();
  45520. });
  45521. }
  45522. });
  45523. }
  45524. };
  45525. LanguageService.prototype.getLang = function () {
  45526. var lang = localStorage.getItem(this.lsKey);
  45527. if (lang === null || lang === undefined) {
  45528. console.warn("Internal Error: User language information has not been set. Returning default...");
  45529. return this.getDefaultLang();
  45530. }
  45531. return lang;
  45532. };
  45533. LanguageService.prototype.getDefaultLang = function () {
  45534. return this.defaultLang;
  45535. };
  45536. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  45537. this.listeners.push(listener);
  45538. };
  45539. return LanguageService;
  45540. }();
  45541. exports.LanguageService = LanguageService;
  45542. /***/ }),
  45543. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  45544. /*!************************************************************!*\
  45545. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  45546. \************************************************************/
  45547. /*! no static exports found */
  45548. /***/ (function(module, exports, __webpack_require__) {
  45549. "use strict";
  45550. Object.defineProperty(exports, "__esModule", {
  45551. value: true
  45552. });
  45553. var LanguageServiceNoLS = /** @class */function () {
  45554. function LanguageServiceNoLS(lang) {
  45555. this.lang = lang;
  45556. this.listeners = [];
  45557. }
  45558. LanguageServiceNoLS.prototype.setupListener = function () {};
  45559. LanguageServiceNoLS.prototype.notifyChange = function () {
  45560. this.listeners.forEach(function (l) {
  45561. return l();
  45562. });
  45563. };
  45564. LanguageServiceNoLS.prototype.setLang = function (lang) {
  45565. this.lang = lang;
  45566. this.notifyChange();
  45567. };
  45568. LanguageServiceNoLS.prototype.getLang = function () {
  45569. return this.lang;
  45570. };
  45571. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  45572. return this.lang;
  45573. };
  45574. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  45575. this.listeners.push(listener);
  45576. };
  45577. return LanguageServiceNoLS;
  45578. }();
  45579. exports.LanguageServiceNoLS = LanguageServiceNoLS;
  45580. /***/ }),
  45581. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  45582. /*!*********************************************************!*\
  45583. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  45584. \*********************************************************/
  45585. /*! no static exports found */
  45586. /***/ (function(module, exports, __webpack_require__) {
  45587. "use strict";
  45588. Object.defineProperty(exports, "__esModule", {
  45589. value: true
  45590. });
  45591. exports.LocalizedStrings = undefined;
  45592. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  45593. var LocalizedStrings = /** @class */function () {
  45594. function LocalizedStrings(service, i18nData, listenToChange) {
  45595. if (listenToChange === void 0) {
  45596. listenToChange = false;
  45597. }
  45598. var _this = this;
  45599. this.service = service;
  45600. this.i18nData = i18nData;
  45601. this.listenToChange = listenToChange;
  45602. this.document = document;
  45603. if (this.listenToChange) {
  45604. service.registerLanguageChangeListener(function () {
  45605. _this.updateTagText();
  45606. });
  45607. }
  45608. }
  45609. LocalizedStrings.prototype.getString = function (id, type) {
  45610. var i18nObj = this.i18nData[this.service.getLang()];
  45611. if (!!!i18nObj) {
  45612. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  45613. i18nObj = this.i18nData[this.service.getDefaultLang()];
  45614. }
  45615. if (!!!i18nObj[type]) {
  45616. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  45617. } else if (!!!i18nObj[type][id]) {
  45618. return "{MISSING_I18N_IDENTIFIER}";
  45619. } else {
  45620. return i18nObj[type][id];
  45621. }
  45622. };
  45623. LocalizedStrings.prototype.getOR = function () {
  45624. return this.getUI('join_or');
  45625. };
  45626. LocalizedStrings.prototype.getError = function (id, context) {
  45627. if (context === void 0) {
  45628. context = [];
  45629. }
  45630. var text = this.getString(id, _StringTypes.StringTypes.ERROR);
  45631. return this.processString(text, context);
  45632. };
  45633. LocalizedStrings.prototype.getMessage = function (id, context) {
  45634. if (context === void 0) {
  45635. context = [];
  45636. }
  45637. var text = this.getString(id, _StringTypes.StringTypes.MESSAGE);
  45638. return this.processString(text, context);
  45639. };
  45640. LocalizedStrings.prototype.getUI = function (id, context) {
  45641. if (context === void 0) {
  45642. context = [];
  45643. }
  45644. var text = this.getString(id, _StringTypes.StringTypes.UI);
  45645. return this.processString(text, context);
  45646. };
  45647. LocalizedStrings.prototype.processString = function (text, context) {
  45648. for (var i = 0; i < context.length; i++) {
  45649. var v = context[i];
  45650. text = text.replace('\$' + i, v);
  45651. }
  45652. return text;
  45653. };
  45654. LocalizedStrings.prototype.updateTagText = function (func) {
  45655. var _this = this;
  45656. if (func === void 0) {
  45657. func = null;
  45658. }
  45659. if (this.document !== null) {
  45660. var list = this.document.querySelectorAll("data.i18n");
  45661. list.forEach(function (node) {
  45662. if (func === null) {
  45663. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  45664. } else {
  45665. node.innerHTML = func(node.getAttribute("value"));
  45666. }
  45667. });
  45668. }
  45669. };
  45670. LocalizedStrings.prototype.processTagTex = function (text) {
  45671. if (text === null) {
  45672. return "<Invalid i18n identifier>";
  45673. }
  45674. var opts = text.split(':');
  45675. var type = opts[0].toLowerCase();
  45676. var id = opts[1];
  45677. if (_StringTypes.StringTypes.ERROR === type) {
  45678. return this.getError(id);
  45679. } else if (_StringTypes.StringTypes.MESSAGE === type) {
  45680. return this.getMessage(id);
  45681. } else if (_StringTypes.StringTypes.UI === type) {
  45682. return this.getUI(id);
  45683. } else {
  45684. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  45685. return this.getString(id, type);
  45686. }
  45687. };
  45688. return LocalizedStrings;
  45689. }();
  45690. exports.LocalizedStrings = LocalizedStrings;
  45691. /***/ }),
  45692. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  45693. /*!****************************************************!*\
  45694. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  45695. \****************************************************/
  45696. /*! no static exports found */
  45697. /***/ (function(module, exports, __webpack_require__) {
  45698. "use strict";
  45699. Object.defineProperty(exports, "__esModule", {
  45700. value: true
  45701. });
  45702. var StringTypes = exports.StringTypes = undefined;
  45703. (function (StringTypes) {
  45704. StringTypes["ERROR"] = "error";
  45705. StringTypes["MESSAGE"] = "message";
  45706. StringTypes["UI"] = "ui";
  45707. })(StringTypes || (exports.StringTypes = StringTypes = {}));
  45708. /***/ }),
  45709. /***/ "./node_modules/line-i18n/dist/index.js":
  45710. /*!**********************************************!*\
  45711. !*** ./node_modules/line-i18n/dist/index.js ***!
  45712. \**********************************************/
  45713. /*! no static exports found */
  45714. /***/ (function(module, exports, __webpack_require__) {
  45715. "use strict";
  45716. Object.defineProperty(exports, "__esModule", {
  45717. value: true
  45718. });
  45719. var _LanguageService = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  45720. var _LocalizedStrings = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  45721. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  45722. var _LanguageServiceNoLS = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  45723. exports.default = {
  45724. LanguageService: _LanguageService.LanguageService,
  45725. LanguageServiceNoLS: _LanguageServiceNoLS.LanguageServiceNoLS,
  45726. LocalizedStrings: _LocalizedStrings.LocalizedStrings,
  45727. StringTypes: _StringTypes.StringTypes
  45728. };
  45729. /***/ }),
  45730. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  45731. /*!***************************************************!*\
  45732. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  45733. \***************************************************/
  45734. /*! no static exports found */
  45735. /***/ (function(module, exports, __webpack_require__) {
  45736. "use strict";
  45737. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
  45738. * DEVELOPED BY
  45739. * GIL LOPES BUENO
  45740. * gilbueno.mail@gmail.com
  45741. *
  45742. * WORKS WITH:
  45743. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  45744. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  45745. *
  45746. * FORK:
  45747. * https://github.com/melanke/Watch.JS
  45748. *
  45749. * LICENSE: MIT
  45750. */
  45751. 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; };
  45752. (function (factory) {
  45753. if (( false ? undefined : _typeof(exports)) === 'object') {
  45754. // Node. Does not work with strict CommonJS, but
  45755. // only CommonJS-like enviroments that support module.exports,
  45756. // like Node.
  45757. module.exports = factory();
  45758. } else if (true) {
  45759. // AMD. Register as an anonymous module.
  45760. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  45761. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  45762. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  45763. __WEBPACK_AMD_DEFINE_FACTORY__),
  45764. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  45765. } else {}
  45766. })(function () {
  45767. var WatchJS = {
  45768. noMore: false, // use WatchJS.suspend(obj) instead
  45769. useDirtyCheck: false, // use only dirty checking to track changes.
  45770. preserveExistingSetters: false
  45771. },
  45772. lengthsubjects = [];
  45773. var dirtyChecklist = [];
  45774. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  45775. var supportDefineProperty = false;
  45776. try {
  45777. supportDefineProperty = Object.defineProperty && Object.defineProperty({}, 'x', {});
  45778. } catch (ex) {/* not supported */}
  45779. var isFunction = function isFunction(functionToCheck) {
  45780. var getType = {};
  45781. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  45782. };
  45783. var isInt = function isInt(x) {
  45784. return x % 1 === 0;
  45785. };
  45786. var isArray = function isArray(obj) {
  45787. return Object.prototype.toString.call(obj) === '[object Array]';
  45788. };
  45789. var isObject = function isObject(obj) {
  45790. return {}.toString.apply(obj) === '[object Object]';
  45791. };
  45792. var getObjDiff = function getObjDiff(a, b) {
  45793. var aplus = [],
  45794. bplus = [];
  45795. if (!(typeof a == "string") && !(typeof b == "string")) {
  45796. if (isArray(a) && b) {
  45797. for (var i = 0; i < a.length; i++) {
  45798. if (b[i] === undefined) aplus.push(i);
  45799. }
  45800. } else {
  45801. for (var i in a) {
  45802. if (a.hasOwnProperty(i)) {
  45803. if (b && !b.hasOwnProperty(i)) {
  45804. aplus.push(i);
  45805. }
  45806. }
  45807. }
  45808. }
  45809. if (isArray(b) && a) {
  45810. for (var j = 0; j < b.length; j++) {
  45811. if (a[j] === undefined) bplus.push(j);
  45812. }
  45813. } else {
  45814. for (var j in b) {
  45815. if (b.hasOwnProperty(j)) {
  45816. if (a && !a.hasOwnProperty(j)) {
  45817. bplus.push(j);
  45818. }
  45819. }
  45820. }
  45821. }
  45822. }
  45823. return {
  45824. added: aplus,
  45825. removed: bplus
  45826. };
  45827. };
  45828. var clone = function clone(obj) {
  45829. if (null == obj || "object" != (typeof obj === 'undefined' ? 'undefined' : _typeof(obj))) {
  45830. return obj;
  45831. }
  45832. var copy = obj.constructor();
  45833. for (var attr in obj) {
  45834. copy[attr] = obj[attr];
  45835. }
  45836. return copy;
  45837. };
  45838. var getExistingSetter = function getExistingSetter(obj, propName) {
  45839. if (WatchJS.preserveExistingSetters) {
  45840. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  45841. return existing.set;
  45842. }
  45843. return undefined;
  45844. };
  45845. var defineGetAndSet = function defineGetAndSet(obj, propName, getter, setter) {
  45846. try {
  45847. var existingSetter = getExistingSetter(obj, propName);
  45848. Object.defineProperty(obj, propName, {
  45849. get: getter,
  45850. set: function set(value) {
  45851. setter.call(this, value, true); // coalesce changes
  45852. if (existingSetter) {
  45853. existingSetter(value);
  45854. }
  45855. },
  45856. enumerable: true,
  45857. configurable: true
  45858. });
  45859. } catch (e1) {
  45860. try {
  45861. Object.prototype.__defineGetter__.call(obj, propName, getter);
  45862. Object.prototype.__defineSetter__.call(obj, propName, function (value) {
  45863. setter.call(this, value, true); // coalesce changes
  45864. });
  45865. } catch (e2) {
  45866. observeDirtyChanges(obj, propName, setter);
  45867. //throw new Error("watchJS error: browser not supported :/")
  45868. }
  45869. }
  45870. };
  45871. var defineProp = function defineProp(obj, propName, value) {
  45872. try {
  45873. Object.defineProperty(obj, propName, {
  45874. enumerable: false,
  45875. configurable: true,
  45876. writable: false,
  45877. value: value
  45878. });
  45879. } catch (error) {
  45880. obj[propName] = value;
  45881. }
  45882. };
  45883. var observeDirtyChanges = function observeDirtyChanges(obj, propName, setter) {
  45884. dirtyChecklist[dirtyChecklist.length] = {
  45885. prop: propName,
  45886. object: obj,
  45887. orig: clone(obj[propName]),
  45888. callback: setter
  45889. };
  45890. };
  45891. var watch = function watch() {
  45892. if (isFunction(arguments[1])) {
  45893. watchAll.apply(this, arguments);
  45894. } else if (isArray(arguments[1])) {
  45895. watchMany.apply(this, arguments);
  45896. } else {
  45897. watchOne.apply(this, arguments);
  45898. }
  45899. };
  45900. var watchAll = function watchAll(obj, watcher, level, addNRemove) {
  45901. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45902. //accepts only objects and array (not string)
  45903. return;
  45904. }
  45905. if (isArray(obj)) {
  45906. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  45907. if (level === undefined || level > 0) {
  45908. for (var prop = 0; prop < obj.length; prop++) {
  45909. // watch objects in array
  45910. watchAll(obj[prop], watcher, level, addNRemove);
  45911. }
  45912. }
  45913. } else {
  45914. var prop,
  45915. props = [];
  45916. for (prop in obj) {
  45917. //for each attribute if obj is an object
  45918. if (prop == "$val" || !supportDefineProperty && prop === 'watchers') {
  45919. continue;
  45920. }
  45921. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  45922. props.push(prop); //put in the props
  45923. }
  45924. }
  45925. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  45926. }
  45927. if (addNRemove) {
  45928. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  45929. }
  45930. };
  45931. var watchMany = function watchMany(obj, props, watcher, level, addNRemove) {
  45932. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45933. //accepts only objects and array (not string)
  45934. return;
  45935. }
  45936. for (var i = 0; i < props.length; i++) {
  45937. //watch each property
  45938. var prop = props[i];
  45939. watchOne(obj, prop, watcher, level, addNRemove);
  45940. }
  45941. };
  45942. var watchOne = function watchOne(obj, prop, watcher, level, addNRemove) {
  45943. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45944. //accepts only objects and array (not string)
  45945. return;
  45946. }
  45947. if (isFunction(obj[prop])) {
  45948. //dont watch if it is a function
  45949. return;
  45950. }
  45951. if (obj[prop] != null && (level === undefined || level > 0)) {
  45952. watchAll(obj[prop], watcher, level !== undefined ? level - 1 : level); //recursively watch all attributes of this
  45953. }
  45954. defineWatcher(obj, prop, watcher, level);
  45955. if (addNRemove && (level === undefined || level > 0)) {
  45956. pushToLengthSubjects(obj, prop, watcher, level);
  45957. }
  45958. };
  45959. var unwatch = function unwatch() {
  45960. if (isFunction(arguments[1])) {
  45961. unwatchAll.apply(this, arguments);
  45962. } else if (isArray(arguments[1])) {
  45963. unwatchMany.apply(this, arguments);
  45964. } else {
  45965. unwatchOne.apply(this, arguments);
  45966. }
  45967. };
  45968. var unwatchAll = function unwatchAll(obj, watcher) {
  45969. if (obj instanceof String || !(obj instanceof Object) && !isArray(obj)) {
  45970. //accepts only objects and array (not string)
  45971. return;
  45972. }
  45973. if (isArray(obj)) {
  45974. var props = ['__watchall__'];
  45975. for (var prop = 0; prop < obj.length; prop++) {
  45976. //for each item if obj is an array
  45977. props.push(prop); //put in the props
  45978. }
  45979. unwatchMany(obj, props, watcher); //watch all itens of the props
  45980. } else {
  45981. var unwatchPropsInObject = function unwatchPropsInObject(obj2) {
  45982. var props = [];
  45983. for (var prop2 in obj2) {
  45984. //for each attribute if obj is an object
  45985. if (obj2.hasOwnProperty(prop2)) {
  45986. if (obj2[prop2] instanceof Object) {
  45987. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  45988. } else {
  45989. props.push(prop2); //put in the props
  45990. }
  45991. }
  45992. }
  45993. unwatchMany(obj2, props, watcher); //unwatch all of the props
  45994. };
  45995. unwatchPropsInObject(obj);
  45996. }
  45997. };
  45998. var unwatchMany = function unwatchMany(obj, props, watcher) {
  45999. for (var prop2 in props) {
  46000. //watch each attribute of "props" if is an object
  46001. if (props.hasOwnProperty(prop2)) {
  46002. unwatchOne(obj, props[prop2], watcher);
  46003. }
  46004. }
  46005. };
  46006. var timeouts = [],
  46007. timerID = null;
  46008. function clearTimerID() {
  46009. timerID = null;
  46010. for (var i = 0; i < timeouts.length; i++) {
  46011. timeouts[i]();
  46012. }
  46013. timeouts.length = 0;
  46014. }
  46015. var getTimerID = function getTimerID() {
  46016. if (!timerID) {
  46017. timerID = setTimeout(clearTimerID);
  46018. }
  46019. return timerID;
  46020. };
  46021. var registerTimeout = function registerTimeout(fn) {
  46022. // register function to be called on timeout
  46023. if (timerID == null) getTimerID();
  46024. timeouts[timeouts.length] = fn;
  46025. };
  46026. // Track changes made to an array, object or an object's property
  46027. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  46028. // Syntax:
  46029. // trackChange(obj, callback, recursive, addNRemove)
  46030. // trackChange(obj, prop, callback, recursive, addNRemove)
  46031. var trackChange = function trackChange() {
  46032. var fn = isFunction(arguments[2]) ? trackProperty : trackObject;
  46033. fn.apply(this, arguments);
  46034. };
  46035. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  46036. var trackObject = function trackObject(obj, callback, recursive, addNRemove) {
  46037. var change = null,
  46038. lastTimerID = -1;
  46039. var isArr = isArray(obj);
  46040. var level,
  46041. fn = function fn(prop, action, newValue, oldValue) {
  46042. var timerID = getTimerID();
  46043. if (lastTimerID !== timerID) {
  46044. // check if timer has changed since last update
  46045. lastTimerID = timerID;
  46046. change = {
  46047. type: 'update'
  46048. };
  46049. change['value'] = obj;
  46050. change['splices'] = null;
  46051. registerTimeout(function () {
  46052. callback.call(this, change);
  46053. change = null;
  46054. });
  46055. }
  46056. // create splices for array changes
  46057. if (isArr && obj === this && change !== null) {
  46058. if (action === 'pop' || action === 'shift') {
  46059. newValue = [];
  46060. oldValue = [oldValue];
  46061. } else if (action === 'push' || action === 'unshift') {
  46062. newValue = [newValue];
  46063. oldValue = [];
  46064. } else if (action !== 'splice') {
  46065. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  46066. }
  46067. if (!change.splices) change.splices = [];
  46068. change.splices[change.splices.length] = {
  46069. index: prop,
  46070. deleteCount: oldValue ? oldValue.length : 0,
  46071. addedCount: newValue ? newValue.length : 0,
  46072. added: newValue,
  46073. deleted: oldValue
  46074. };
  46075. }
  46076. };
  46077. level = recursive == true ? undefined : 0;
  46078. watchAll(obj, fn, level, addNRemove);
  46079. };
  46080. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  46081. var trackProperty = function trackProperty(obj, prop, callback, recursive, addNRemove) {
  46082. if (obj && prop) {
  46083. watchOne(obj, prop, function (prop, action, newvalue, oldvalue) {
  46084. var change = {
  46085. type: 'update'
  46086. };
  46087. change['value'] = newvalue;
  46088. change['oldvalue'] = oldvalue;
  46089. if (recursive && isObject(newvalue) || isArray(newvalue)) {
  46090. trackObject(newvalue, callback, recursive, addNRemove);
  46091. }
  46092. callback.call(this, change);
  46093. }, 0);
  46094. if (recursive && isObject(obj[prop]) || isArray(obj[prop])) {
  46095. trackObject(obj[prop], callback, recursive, addNRemove);
  46096. }
  46097. }
  46098. };
  46099. var defineWatcher = function defineWatcher(obj, prop, watcher, level) {
  46100. var newWatcher = false;
  46101. var isArr = isArray(obj);
  46102. if (!obj.watchers) {
  46103. defineProp(obj, "watchers", {});
  46104. if (isArr) {
  46105. // watch array functions
  46106. watchFunctions(obj, function (index, action, newValue, oldValue) {
  46107. addPendingChange(obj, index, action, newValue, oldValue);
  46108. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  46109. var i,
  46110. n,
  46111. ln,
  46112. wAll,
  46113. watchList = obj.watchers[prop];
  46114. if (wAll = obj.watchers['__watchall__']) {
  46115. watchList = watchList ? watchList.concat(wAll) : wAll;
  46116. }
  46117. ln = watchList ? watchList.length : 0;
  46118. for (i = 0; i < ln; i++) {
  46119. if (action !== 'splice') {
  46120. watchAll(newValue, watchList[i], level === undefined ? level : level - 1);
  46121. } else {
  46122. // watch spliced values
  46123. for (n = 0; n < newValue.length; n++) {
  46124. watchAll(newValue[n], watchList[i], level === undefined ? level : level - 1);
  46125. }
  46126. }
  46127. }
  46128. }
  46129. });
  46130. }
  46131. }
  46132. if (!obj.watchers[prop]) {
  46133. obj.watchers[prop] = [];
  46134. if (!isArr) newWatcher = true;
  46135. }
  46136. for (var i = 0; i < obj.watchers[prop].length; i++) {
  46137. if (obj.watchers[prop][i] === watcher) {
  46138. return;
  46139. }
  46140. }
  46141. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  46142. if (newWatcher) {
  46143. var val = obj[prop];
  46144. var getter = function getter() {
  46145. return val;
  46146. };
  46147. var setter = function setter(newval, delayWatcher) {
  46148. var oldval = val;
  46149. val = newval;
  46150. if (level !== 0 && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop])) && !obj[prop].watchers) {
  46151. // watch sub properties
  46152. var i,
  46153. ln = obj.watchers[prop].length;
  46154. for (i = 0; i < ln; i++) {
  46155. watchAll(obj[prop], obj.watchers[prop][i], level === undefined ? level : level - 1);
  46156. }
  46157. }
  46158. //watchFunctions(obj, prop);
  46159. if (isSuspended(obj, prop)) {
  46160. resume(obj, prop);
  46161. return;
  46162. }
  46163. if (!WatchJS.noMore) {
  46164. // this does not work with Object.observe
  46165. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  46166. if (oldval !== newval) {
  46167. if (!delayWatcher) {
  46168. callWatchers(obj, prop, "set", newval, oldval);
  46169. } else {
  46170. addPendingChange(obj, prop, "set", newval, oldval);
  46171. }
  46172. WatchJS.noMore = false;
  46173. }
  46174. }
  46175. };
  46176. if (WatchJS.useDirtyCheck) {
  46177. observeDirtyChanges(obj, prop, setter);
  46178. } else {
  46179. defineGetAndSet(obj, prop, getter, setter);
  46180. }
  46181. }
  46182. };
  46183. var callWatchers = function callWatchers(obj, prop, action, newval, oldval) {
  46184. if (prop !== undefined) {
  46185. var ln,
  46186. wl,
  46187. watchList = obj.watchers[prop];
  46188. if (wl = obj.watchers['__watchall__']) {
  46189. watchList = watchList ? watchList.concat(wl) : wl;
  46190. }
  46191. ln = watchList ? watchList.length : 0;
  46192. for (var wr = 0; wr < ln; wr++) {
  46193. watchList[wr].call(obj, prop, action, newval, oldval);
  46194. }
  46195. } else {
  46196. for (var prop in obj) {
  46197. //call all
  46198. if (obj.hasOwnProperty(prop)) {
  46199. callWatchers(obj, prop, action, newval, oldval);
  46200. }
  46201. }
  46202. }
  46203. };
  46204. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  46205. var defineArrayMethodWatcher = function defineArrayMethodWatcher(obj, original, methodName, callback) {
  46206. defineProp(obj, methodName, function () {
  46207. var index = 0;
  46208. var i, newValue, oldValue, response;
  46209. // get values before splicing array
  46210. if (methodName === 'splice') {
  46211. var start = arguments[0];
  46212. var end = start + arguments[1];
  46213. oldValue = obj.slice(start, end);
  46214. newValue = [];
  46215. for (i = 2; i < arguments.length; i++) {
  46216. newValue[i - 2] = arguments[i];
  46217. }
  46218. index = start;
  46219. } else {
  46220. newValue = arguments.length > 0 ? arguments[0] : undefined;
  46221. }
  46222. response = original.apply(obj, arguments);
  46223. if (methodName !== 'slice') {
  46224. if (methodName === 'pop') {
  46225. oldValue = response;
  46226. index = obj.length;
  46227. } else if (methodName === 'push') {
  46228. index = obj.length - 1;
  46229. } else if (methodName === 'shift') {
  46230. oldValue = response;
  46231. } else if (methodName !== 'unshift' && newValue === undefined) {
  46232. newValue = response;
  46233. }
  46234. callback.call(obj, index, methodName, newValue, oldValue);
  46235. }
  46236. return response;
  46237. });
  46238. };
  46239. var watchFunctions = function watchFunctions(obj, callback) {
  46240. if (!isFunction(callback) || !obj || obj instanceof String || !isArray(obj)) {
  46241. return;
  46242. }
  46243. for (var i = methodNames.length, methodName; i--;) {
  46244. methodName = methodNames[i];
  46245. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  46246. }
  46247. };
  46248. var unwatchOne = function unwatchOne(obj, prop, watcher) {
  46249. if (prop) {
  46250. if (obj.watchers && obj.watchers[prop]) {
  46251. if (watcher === undefined) {
  46252. delete obj.watchers[prop]; // remove all property watchers
  46253. } else {
  46254. for (var i = 0; i < obj.watchers[prop].length; i++) {
  46255. var w = obj.watchers[prop][i];
  46256. if (w == watcher) {
  46257. obj.watchers[prop].splice(i, 1);
  46258. }
  46259. }
  46260. }
  46261. }
  46262. } else {
  46263. delete obj.watchers;
  46264. }
  46265. removeFromLengthSubjects(obj, prop, watcher);
  46266. removeFromDirtyChecklist(obj, prop);
  46267. };
  46268. // suspend watchers until next update cycle
  46269. var suspend = function suspend(obj, prop) {
  46270. if (obj.watchers) {
  46271. var name = '__wjs_suspend__' + (prop !== undefined ? prop : '');
  46272. obj.watchers[name] = true;
  46273. }
  46274. };
  46275. var isSuspended = function isSuspended(obj, prop) {
  46276. return obj.watchers && (obj.watchers['__wjs_suspend__'] || obj.watchers['__wjs_suspend__' + prop]);
  46277. };
  46278. // resumes preivously suspended watchers
  46279. var resume = function resume(obj, prop) {
  46280. registerTimeout(function () {
  46281. delete obj.watchers['__wjs_suspend__'];
  46282. delete obj.watchers['__wjs_suspend__' + prop];
  46283. });
  46284. };
  46285. var pendingTimerID = null;
  46286. var addPendingChange = function addPendingChange(obj, prop, mode, newval, oldval) {
  46287. pendingChanges[pendingChanges.length] = {
  46288. obj: obj,
  46289. prop: prop,
  46290. mode: mode,
  46291. newval: newval,
  46292. oldval: oldval
  46293. };
  46294. if (pendingTimerID === null) {
  46295. pendingTimerID = setTimeout(applyPendingChanges);
  46296. }
  46297. };
  46298. var applyPendingChanges = function applyPendingChanges() {
  46299. // apply pending changes
  46300. var change = null;
  46301. pendingTimerID = null;
  46302. for (var i = 0; i < pendingChanges.length; i++) {
  46303. change = pendingChanges[i];
  46304. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  46305. }
  46306. if (change) {
  46307. pendingChanges = [];
  46308. change = null;
  46309. }
  46310. };
  46311. var loop = function loop() {
  46312. // check for new or deleted props
  46313. for (var i = 0; i < lengthsubjects.length; i++) {
  46314. var subj = lengthsubjects[i];
  46315. if (subj.prop === "$$watchlengthsubjectroot") {
  46316. var difference = getObjDiff(subj.obj, subj.actual);
  46317. if (difference.added.length || difference.removed.length) {
  46318. if (difference.added.length) {
  46319. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  46320. }
  46321. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  46322. }
  46323. subj.actual = clone(subj.obj);
  46324. } else {
  46325. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  46326. if (difference.added.length || difference.removed.length) {
  46327. if (difference.added.length) {
  46328. for (var j = 0; j < subj.obj.watchers[subj.prop].length; j++) {
  46329. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  46330. }
  46331. }
  46332. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  46333. }
  46334. subj.actual = clone(subj.obj[subj.prop]);
  46335. }
  46336. }
  46337. // start dirty check
  46338. var n, value;
  46339. if (dirtyChecklist.length > 0) {
  46340. for (var i = 0; i < dirtyChecklist.length; i++) {
  46341. n = dirtyChecklist[i];
  46342. value = n.object[n.prop];
  46343. if (!compareValues(n.orig, value)) {
  46344. n.orig = clone(value);
  46345. n.callback(value);
  46346. }
  46347. }
  46348. }
  46349. };
  46350. var compareValues = function compareValues(a, b) {
  46351. var i,
  46352. state = true;
  46353. if (a !== b) {
  46354. if (isObject(a)) {
  46355. for (i in a) {
  46356. if (!supportDefineProperty && i === 'watchers') continue;
  46357. if (a[i] !== b[i]) {
  46358. state = false;
  46359. break;
  46360. };
  46361. }
  46362. } else {
  46363. state = false;
  46364. }
  46365. }
  46366. return state;
  46367. };
  46368. var pushToLengthSubjects = function pushToLengthSubjects(obj, prop, watcher, level) {
  46369. var actual;
  46370. if (prop === "$$watchlengthsubjectroot") {
  46371. actual = clone(obj);
  46372. } else {
  46373. actual = clone(obj[prop]);
  46374. }
  46375. lengthsubjects.push({
  46376. obj: obj,
  46377. prop: prop,
  46378. actual: actual,
  46379. watcher: watcher,
  46380. level: level
  46381. });
  46382. };
  46383. var removeFromLengthSubjects = function removeFromLengthSubjects(obj, prop, watcher) {
  46384. for (var i = 0; i < lengthsubjects.length; i++) {
  46385. var subj = lengthsubjects[i];
  46386. if (subj.obj == obj) {
  46387. if (!prop || subj.prop == prop) {
  46388. if (!watcher || subj.watcher == watcher) {
  46389. // if we splice off one item at position i
  46390. // we need to decrement i as the array is one item shorter
  46391. // so when we increment i in the loop statement we
  46392. // will land at the correct index.
  46393. // if it's not decremented, you won't delete all length subjects
  46394. lengthsubjects.splice(i--, 1);
  46395. }
  46396. }
  46397. }
  46398. }
  46399. };
  46400. var removeFromDirtyChecklist = function removeFromDirtyChecklist(obj, prop) {
  46401. var notInUse;
  46402. for (var i = 0; i < dirtyChecklist.length; i++) {
  46403. var n = dirtyChecklist[i];
  46404. var watchers = n.object.watchers;
  46405. notInUse = n.object == obj && (!prop || n.prop == prop) && watchers && (!prop || !watchers[prop] || watchers[prop].length == 0);
  46406. if (notInUse) {
  46407. // we use the same syntax as in removeFromLengthSubjects
  46408. dirtyChecklist.splice(i--, 1);
  46409. }
  46410. }
  46411. };
  46412. setInterval(loop, 50);
  46413. WatchJS.watch = watch;
  46414. WatchJS.unwatch = unwatch;
  46415. WatchJS.callWatchers = callWatchers;
  46416. WatchJS.suspend = suspend; // suspend watchers
  46417. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  46418. return WatchJS;
  46419. });
  46420. /***/ }),
  46421. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  46422. /*!******************************************************!*\
  46423. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  46424. \******************************************************/
  46425. /*! no static exports found */
  46426. /***/ (function(module, exports, __webpack_require__) {
  46427. "use strict";
  46428. /***/ }),
  46429. /***/ "./node_modules/webpack/buildin/module.js":
  46430. /*!***********************************!*\
  46431. !*** (webpack)/buildin/module.js ***!
  46432. \***********************************/
  46433. /*! no static exports found */
  46434. /***/ (function(module, exports, __webpack_require__) {
  46435. "use strict";
  46436. module.exports = function (module) {
  46437. if (!module.webpackPolyfill) {
  46438. module.deprecate = function () {};
  46439. module.paths = [];
  46440. // module.parent = undefined by default
  46441. if (!module.children) module.children = [];
  46442. Object.defineProperty(module, "loaded", {
  46443. enumerable: true,
  46444. get: function get() {
  46445. return module.l;
  46446. }
  46447. });
  46448. Object.defineProperty(module, "id", {
  46449. enumerable: true,
  46450. get: function get() {
  46451. return module.i;
  46452. }
  46453. });
  46454. module.webpackPolyfill = 1;
  46455. }
  46456. return module;
  46457. };
  46458. /***/ })
  46459. /******/ });
  46460. });
  46461. //# sourceMappingURL=ivprog.bundle.js.map