ivprog.bundle.js 2.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["ivprogCore"] = factory();
  8. else
  9. root["ivprogCore"] = factory();
  10. })(window, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = "./js/main.js");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "./grammar/en/ivprog.g4":
  99. /*!******************************!*\
  100. !*** ./grammar/en/ivprog.g4 ***!
  101. \******************************/
  102. /*! no static exports found */
  103. /***/ (function(module, exports, __webpack_require__) {
  104. module.exports =
  105. /******/ (function(modules) { // webpackBootstrap
  106. /******/ // The module cache
  107. /******/ var installedModules = {};
  108. /******/
  109. /******/ // The require function
  110. /******/ function __webpack_require__(moduleId) {
  111. /******/
  112. /******/ // Check if module is in cache
  113. /******/ if(installedModules[moduleId]) {
  114. /******/ return installedModules[moduleId].exports;
  115. /******/ }
  116. /******/ // Create a new module (and put it into the cache)
  117. /******/ var module = installedModules[moduleId] = {
  118. /******/ i: moduleId,
  119. /******/ l: false,
  120. /******/ exports: {}
  121. /******/ };
  122. /******/
  123. /******/ // Execute the module function
  124. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  125. /******/
  126. /******/ // Flag the module as loaded
  127. /******/ module.l = true;
  128. /******/
  129. /******/ // Return the exports of the module
  130. /******/ return module.exports;
  131. /******/ }
  132. /******/
  133. /******/
  134. /******/ // expose the modules object (__webpack_modules__)
  135. /******/ __webpack_require__.m = modules;
  136. /******/
  137. /******/ // expose the module cache
  138. /******/ __webpack_require__.c = installedModules;
  139. /******/
  140. /******/ // identity function for calling harmony imports with the correct context
  141. /******/ __webpack_require__.i = function(value) { return value; };
  142. /******/
  143. /******/ // define getter function for harmony exports
  144. /******/ __webpack_require__.d = function(exports, name, getter) {
  145. /******/ if(!__webpack_require__.o(exports, name)) {
  146. /******/ Object.defineProperty(exports, name, {
  147. /******/ configurable: false,
  148. /******/ enumerable: true,
  149. /******/ get: getter
  150. /******/ });
  151. /******/ }
  152. /******/ };
  153. /******/
  154. /******/ // getDefaultExport function for compatibility with non-harmony modules
  155. /******/ __webpack_require__.n = function(module) {
  156. /******/ var getter = module && module.__esModule ?
  157. /******/ function getDefault() { return module['default']; } :
  158. /******/ function getModuleExports() { return module; };
  159. /******/ __webpack_require__.d(getter, 'a', getter);
  160. /******/ return getter;
  161. /******/ };
  162. /******/
  163. /******/ // Object.prototype.hasOwnProperty.call
  164. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  165. /******/
  166. /******/ // __webpack_public_path__
  167. /******/ __webpack_require__.p = "";
  168. /******/
  169. /******/ // Load entry module and return exports
  170. /******/ return __webpack_require__(__webpack_require__.s = 1);
  171. /******/ })
  172. /************************************************************************/
  173. /******/ ([
  174. /* 0 */
  175. /***/ (function(module, exports, __webpack_require__) {
  176. // Generated from /tmp/tmp-3417pRptzVtsQAPm/ivprog.g4 by ANTLR 4.7
  177. // jshint ignore: start
  178. var antlr4 = __webpack_require__(2);
  179. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  180. "\u0002/\u01d1\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  181. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  182. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  183. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  184. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  185. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  186. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  187. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  188. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  189. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  190. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  191. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  192. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  193. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003",
  194. "\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
  195. "\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
  196. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003",
  197. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0007\u0003",
  198. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  199. "\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  200. "\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  201. "\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b\u0003\u000b\u0003",
  202. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003",
  203. "\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003",
  204. "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  205. "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  206. "\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u0010\u0003",
  207. "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003",
  208. "\u0011\u0003\u0011\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  209. "\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0014\u0003",
  210. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0015\u0003\u0015\u0003",
  211. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003",
  212. "\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0017\u0003",
  213. "\u0017\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  214. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  215. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  216. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  217. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  218. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0125\n&\u0003\'\u0003\'\u0003",
  219. "(\u0003(\u0003)\u0003)\u0007)\u012d\n)\f)\u000e)\u0130\u000b)\u0003",
  220. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0137\n+\r+\u000e+\u0138\u0003",
  221. "+\u0003+\u0003+\u0003+\u0005+\u013f\n+\u0003+\u0006+\u0142\n+\r+\u000e",
  222. "+\u0143\u0003+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d",
  223. "\n+\r+\u000e+\u014e\u0005+\u0151\n+\u0003,\u0006,\u0154\n,\r,\u000e",
  224. ",\u0155\u0003,\u0003,\u0006,\u015a\n,\r,\u000e,\u015b\u0003,\u0006,",
  225. "\u015f\n,\r,\u000e,\u0160\u0003,\u0003,\u0007,\u0165\n,\f,\u000e,\u0168",
  226. "\u000b,\u0003,\u0005,\u016b\n,\u0003-\u0003-\u0005-\u016f\n-\u0003-",
  227. "\u0006-\u0172\n-\r-\u000e-\u0173\u0003.\u0003.\u0007.\u0178\n.\f.\u000e",
  228. ".\u017b\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u0181\n/\u00030\u0003",
  229. "0\u00030\u00050\u0186\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  230. "2\u00032\u00033\u00063\u0191\n3\r3\u000e3\u0192\u00033\u00053\u0196",
  231. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01a0",
  232. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  233. "7\u00037\u00057\u01ad\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  234. "8\u00039\u00039\u00039\u00039\u00079\u01ba\n9\f9\u000e9\u01bd\u000b",
  235. "9\u00039\u00059\u01c0\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01c7",
  236. "\n9\f9\u000e9\u01ca\u000b9\u00039\u00039\u00059\u01ce\n9\u00039\u0003",
  237. "9\u0003\u01c8\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  238. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  239. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  240. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  241. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  242. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  243. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  244. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  245. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  246. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  247. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01e5\u0002\u0003\u0003",
  248. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  249. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  250. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  251. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  252. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  253. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  254. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  255. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  256. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  257. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  258. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  259. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  260. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  261. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  262. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  263. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  264. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  265. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  266. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  267. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  268. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  269. "s\u0003\u0002\u0002\u0002\u0005{\u0003\u0002\u0002\u0002\u0007\u0080",
  270. "\u0003\u0002\u0002\u0002\t\u0085\u0003\u0002\u0002\u0002\u000b\u008d",
  271. "\u0003\u0002\u0002\u0002\r\u0094\u0003\u0002\u0002\u0002\u000f\u009c",
  272. "\u0003\u0002\u0002\u0002\u0011\u00a6\u0003\u0002\u0002\u0002\u0013\u00ad",
  273. "\u0003\u0002\u0002\u0002\u0015\u00b2\u0003\u0002\u0002\u0002\u0017\u00bc",
  274. "\u0003\u0002\u0002\u0002\u0019\u00c2\u0003\u0002\u0002\u0002\u001b\u00cb",
  275. "\u0003\u0002\u0002\u0002\u001d\u00d2\u0003\u0002\u0002\u0002\u001f\u00d6",
  276. "\u0003\u0002\u0002\u0002!\u00dc\u0003\u0002\u0002\u0002#\u00df\u0003",
  277. "\u0002\u0002\u0002%\u00e5\u0003\u0002\u0002\u0002\'\u00e8\u0003\u0002",
  278. "\u0002\u0002)\u00ed\u0003\u0002\u0002\u0002+\u00f3\u0003\u0002\u0002",
  279. "\u0002-\u00f8\u0003\u0002\u0002\u0002/\u00fc\u0003\u0002\u0002\u0002",
  280. "1\u0100\u0003\u0002\u0002\u00023\u0103\u0003\u0002\u0002\u00025\u0105",
  281. "\u0003\u0002\u0002\u00027\u0107\u0003\u0002\u0002\u00029\u0109\u0003",
  282. "\u0002\u0002\u0002;\u010b\u0003\u0002\u0002\u0002=\u010d\u0003\u0002",
  283. "\u0002\u0002?\u010f\u0003\u0002\u0002\u0002A\u0111\u0003\u0002\u0002",
  284. "\u0002C\u0113\u0003\u0002\u0002\u0002E\u0115\u0003\u0002\u0002\u0002",
  285. "G\u0117\u0003\u0002\u0002\u0002I\u0119\u0003\u0002\u0002\u0002K\u0124",
  286. "\u0003\u0002\u0002\u0002M\u0126\u0003\u0002\u0002\u0002O\u0128\u0003",
  287. "\u0002\u0002\u0002Q\u012a\u0003\u0002\u0002\u0002S\u0131\u0003\u0002",
  288. "\u0002\u0002U\u0150\u0003\u0002\u0002\u0002W\u016a\u0003\u0002\u0002",
  289. "\u0002Y\u016c\u0003\u0002\u0002\u0002[\u0175\u0003\u0002\u0002\u0002",
  290. "]\u0180\u0003\u0002\u0002\u0002_\u0182\u0003\u0002\u0002\u0002a\u0189",
  291. "\u0003\u0002\u0002\u0002c\u018d\u0003\u0002\u0002\u0002e\u0195\u0003",
  292. "\u0002\u0002\u0002g\u0197\u0003\u0002\u0002\u0002i\u0199\u0003\u0002",
  293. "\u0002\u0002k\u019f\u0003\u0002\u0002\u0002m\u01ac\u0003\u0002\u0002",
  294. "\u0002o\u01ae\u0003\u0002\u0002\u0002q\u01cd\u0003\u0002\u0002\u0002",
  295. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  296. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  297. "\u0002z\u0004\u0003\u0002\u0002\u0002{|\u0007t\u0002\u0002|}\u0007g",
  298. "\u0002\u0002}~\u0007c\u0002\u0002~\u007f\u0007n\u0002\u0002\u007f\u0006",
  299. "\u0003\u0002\u0002\u0002\u0080\u0081\u0007x\u0002\u0002\u0081\u0082",
  300. "\u0007q\u0002\u0002\u0082\u0083\u0007k\u0002\u0002\u0083\u0084\u0007",
  301. "f\u0002\u0002\u0084\b\u0003\u0002\u0002\u0002\u0085\u0086\u0007d\u0002",
  302. "\u0002\u0086\u0087\u0007q\u0002\u0002\u0087\u0088\u0007q\u0002\u0002",
  303. "\u0088\u0089\u0007n\u0002\u0002\u0089\u008a\u0007g\u0002\u0002\u008a",
  304. "\u008b\u0007c\u0002\u0002\u008b\u008c\u0007p\u0002\u0002\u008c\n\u0003",
  305. "\u0002\u0002\u0002\u008d\u008e\u0007u\u0002\u0002\u008e\u008f\u0007",
  306. "v\u0002\u0002\u008f\u0090\u0007t\u0002\u0002\u0090\u0091\u0007k\u0002",
  307. "\u0002\u0091\u0092\u0007p\u0002\u0002\u0092\u0093\u0007i\u0002\u0002",
  308. "\u0093\f\u0003\u0002\u0002\u0002\u0094\u0095\u0007k\u0002\u0002\u0095",
  309. "\u0096\u0007p\u0002\u0002\u0096\u0097\u0007v\u0002\u0002\u0097\u0098",
  310. "\u0007g\u0002\u0002\u0098\u0099\u0007i\u0002\u0002\u0099\u009a\u0007",
  311. "g\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u000e\u0003\u0002",
  312. "\u0002\u0002\u009c\u009d\u0007e\u0002\u0002\u009d\u009e\u0007j\u0002",
  313. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  314. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  315. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  316. "\u0007t\u0002\u0002\u00a5\u0010\u0003\u0002\u0002\u0002\u00a6\u00a7",
  317. "\u0007u\u0002\u0002\u00a7\u00a8\u0007y\u0002\u0002\u00a8\u00a9\u0007",
  318. "k\u0002\u0002\u00a9\u00aa\u0007v\u0002\u0002\u00aa\u00ab\u0007e\u0002",
  319. "\u0002\u00ab\u00ac\u0007j\u0002\u0002\u00ac\u0012\u0003\u0002\u0002",
  320. "\u0002\u00ad\u00ae\u0007e\u0002\u0002\u00ae\u00af\u0007c\u0002\u0002",
  321. "\u00af\u00b0\u0007u\u0002\u0002\u00b0\u00b1\u0007g\u0002\u0002\u00b1",
  322. "\u0014\u0003\u0002\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3",
  323. "\u00b4\u0007v\u0002\u0002\u00b4\u00b5\u0007j\u0002\u0002\u00b5\u00b6",
  324. "\u0007g\u0002\u0002\u00b6\u00b7\u0007t\u0002\u0002\u00b7\u00b8\u0007",
  325. "y\u0002\u0002\u00b8\u00b9\u0007k\u0002\u0002\u00b9\u00ba\u0007u\u0002",
  326. "\u0002\u00ba\u00bb\u0007g\u0002\u0002\u00bb\u0016\u0003\u0002\u0002",
  327. "\u0002\u00bc\u00bd\u0007e\u0002\u0002\u00bd\u00be\u0007q\u0002\u0002",
  328. "\u00be\u00bf\u0007p\u0002\u0002\u00bf\u00c0\u0007u\u0002\u0002\u00c0",
  329. "\u00c1\u0007v\u0002\u0002\u00c1\u0018\u0003\u0002\u0002\u0002\u00c2",
  330. "\u00c3\u0007h\u0002\u0002\u00c3\u00c4\u0007w\u0002\u0002\u00c4\u00c5",
  331. "\u0007p\u0002\u0002\u00c5\u00c6\u0007e\u0002\u0002\u00c6\u00c7\u0007",
  332. "v\u0002\u0002\u00c7\u00c8\u0007k\u0002\u0002\u00c8\u00c9\u0007q\u0002",
  333. "\u0002\u00c9\u00ca\u0007p\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  334. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  335. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007w\u0002\u0002\u00cf",
  336. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u001c",
  337. "\u0003\u0002\u0002\u0002\u00d2\u00d3\u0007h\u0002\u0002\u00d3\u00d4",
  338. "\u0007q\u0002\u0002\u00d4\u00d5\u0007t\u0002\u0002\u00d5\u001e\u0003",
  339. "\u0002\u0002\u0002\u00d6\u00d7\u0007d\u0002\u0002\u00d7\u00d8\u0007",
  340. "t\u0002\u0002\u00d8\u00d9\u0007g\u0002\u0002\u00d9\u00da\u0007c\u0002",
  341. "\u0002\u00da\u00db\u0007m\u0002\u0002\u00db \u0003\u0002\u0002\u0002",
  342. "\u00dc\u00dd\u0007f\u0002\u0002\u00dd\u00de\u0007q\u0002\u0002\u00de",
  343. "\"\u0003\u0002\u0002\u0002\u00df\u00e0\u0007y\u0002\u0002\u00e0\u00e1",
  344. "\u0007j\u0002\u0002\u00e1\u00e2\u0007k\u0002\u0002\u00e2\u00e3\u0007",
  345. "n\u0002\u0002\u00e3\u00e4\u0007g\u0002\u0002\u00e4$\u0003\u0002\u0002",
  346. "\u0002\u00e5\u00e6\u0007k\u0002\u0002\u00e6\u00e7\u0007h\u0002\u0002",
  347. "\u00e7&\u0003\u0002\u0002\u0002\u00e8\u00e9\u0007g\u0002\u0002\u00e9",
  348. "\u00ea\u0007n\u0002\u0002\u00ea\u00eb\u0007u\u0002\u0002\u00eb\u00ec",
  349. "\u0007g\u0002\u0002\u00ec(\u0003\u0002\u0002\u0002\u00ed\u00ee\u0007",
  350. "h\u0002\u0002\u00ee\u00ef\u0007c\u0002\u0002\u00ef\u00f0\u0007n\u0002",
  351. "\u0002\u00f0\u00f1\u0007u\u0002\u0002\u00f1\u00f2\u0007g\u0002\u0002",
  352. "\u00f2*\u0003\u0002\u0002\u0002\u00f3\u00f4\u0007v\u0002\u0002\u00f4",
  353. "\u00f5\u0007t\u0002\u0002\u00f5\u00f6\u0007w\u0002\u0002\u00f6\u00f7",
  354. "\u0007g\u0002\u0002\u00f7,\u0003\u0002\u0002\u0002\u00f8\u00f9\u0007",
  355. "p\u0002\u0002\u00f9\u00fa\u0007q\u0002\u0002\u00fa\u00fb\u0007v\u0002",
  356. "\u0002\u00fb.\u0003\u0002\u0002\u0002\u00fc\u00fd\u0007C\u0002\u0002",
  357. "\u00fd\u00fe\u0007P\u0002\u0002\u00fe\u00ff\u0007F\u0002\u0002\u00ff",
  358. "0\u0003\u0002\u0002\u0002\u0100\u0101\u0007Q\u0002\u0002\u0101\u0102",
  359. "\u0007T\u0002\u0002\u01022\u0003\u0002\u0002\u0002\u0103\u0104\u0007",
  360. "*\u0002\u0002\u01044\u0003\u0002\u0002\u0002\u0105\u0106\u0007+\u0002",
  361. "\u0002\u01066\u0003\u0002\u0002\u0002\u0107\u0108\u0007]\u0002\u0002",
  362. "\u01088\u0003\u0002\u0002\u0002\u0109\u010a\u0007_\u0002\u0002\u010a",
  363. ":\u0003\u0002\u0002\u0002\u010b\u010c\u0007}\u0002\u0002\u010c<\u0003",
  364. "\u0002\u0002\u0002\u010d\u010e\u0007\u007f\u0002\u0002\u010e>\u0003",
  365. "\u0002\u0002\u0002\u010f\u0110\u0007.\u0002\u0002\u0110@\u0003\u0002",
  366. "\u0002\u0002\u0111\u0112\u0007?\u0002\u0002\u0112B\u0003\u0002\u0002",
  367. "\u0002\u0113\u0114\t\u0002\u0002\u0002\u0114D\u0003\u0002\u0002\u0002",
  368. "\u0115\u0116\t\u0003\u0002\u0002\u0116F\u0003\u0002\u0002\u0002\u0117",
  369. "\u0118\u0005/\u0018\u0002\u0118H\u0003\u0002\u0002\u0002\u0119\u011a",
  370. "\u00051\u0019\u0002\u011aJ\u0003\u0002\u0002\u0002\u011b\u011c\u0007",
  371. "@\u0002\u0002\u011c\u0125\u0007?\u0002\u0002\u011d\u011e\u0007?\u0002",
  372. "\u0002\u011e\u0125\u0007?\u0002\u0002\u011f\u0120\u0007>\u0002\u0002",
  373. "\u0120\u0125\u0007?\u0002\u0002\u0121\u0125\t\u0004\u0002\u0002\u0122",
  374. "\u0123\u0007#\u0002\u0002\u0123\u0125\u0007?\u0002\u0002\u0124\u011b",
  375. "\u0003\u0002\u0002\u0002\u0124\u011d\u0003\u0002\u0002\u0002\u0124\u011f",
  376. "\u0003\u0002\u0002\u0002\u0124\u0121\u0003\u0002\u0002\u0002\u0124\u0122",
  377. "\u0003\u0002\u0002\u0002\u0125L\u0003\u0002\u0002\u0002\u0126\u0127",
  378. "\u0007<\u0002\u0002\u0127N\u0003\u0002\u0002\u0002\u0128\u0129\u0005",
  379. "-\u0017\u0002\u0129P\u0003\u0002\u0002\u0002\u012a\u012e\t\u0005\u0002",
  380. "\u0002\u012b\u012d\t\u0006\u0002\u0002\u012c\u012b\u0003\u0002\u0002",
  381. "\u0002\u012d\u0130\u0003\u0002\u0002\u0002\u012e\u012c\u0003\u0002\u0002",
  382. "\u0002\u012e\u012f\u0003\u0002\u0002\u0002\u012fR\u0003\u0002\u0002",
  383. "\u0002\u0130\u012e\u0003\u0002\u0002\u0002\u0131\u0132\u0005Q)\u0002",
  384. "\u0132\u0133\u00070\u0002\u0002\u0133\u0134\u0005Q)\u0002\u0134T\u0003",
  385. "\u0002\u0002\u0002\u0135\u0137\t\u0007\u0002\u0002\u0136\u0135\u0003",
  386. "\u0002\u0002\u0002\u0137\u0138\u0003\u0002\u0002\u0002\u0138\u0136\u0003",
  387. "\u0002\u0002\u0002\u0138\u0139\u0003\u0002\u0002\u0002\u0139\u0151\u0003",
  388. "\u0002\u0002\u0002\u013a\u013b\u00072\u0002\u0002\u013b\u013f\u0007",
  389. "z\u0002\u0002\u013c\u013d\u00072\u0002\u0002\u013d\u013f\u0007Z\u0002",
  390. "\u0002\u013e\u013a\u0003\u0002\u0002\u0002\u013e\u013c\u0003\u0002\u0002",
  391. "\u0002\u013f\u0141\u0003\u0002\u0002\u0002\u0140\u0142\u0005g4\u0002",
  392. "\u0141\u0140\u0003\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002",
  393. "\u0143\u0141\u0003\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002",
  394. "\u0144\u0151\u0003\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002",
  395. "\u0146\u014a\u0007d\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148",
  396. "\u014a\u0007D\u0002\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149",
  397. "\u0147\u0003\u0002\u0002\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b",
  398. "\u014d\t\b\u0002\u0002\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e",
  399. "\u0003\u0002\u0002\u0002\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f",
  400. "\u0003\u0002\u0002\u0002\u014f\u0151\u0003\u0002\u0002\u0002\u0150\u0136",
  401. "\u0003\u0002\u0002\u0002\u0150\u013e\u0003\u0002\u0002\u0002\u0150\u0149",
  402. "\u0003\u0002\u0002\u0002\u0151V\u0003\u0002\u0002\u0002\u0152\u0154",
  403. "\t\u0007\u0002\u0002\u0153\u0152\u0003\u0002\u0002\u0002\u0154\u0155",
  404. "\u0003\u0002\u0002\u0002\u0155\u0153\u0003\u0002\u0002\u0002\u0155\u0156",
  405. "\u0003\u0002\u0002\u0002\u0156\u0157\u0003\u0002\u0002\u0002\u0157\u0159",
  406. "\u00070\u0002\u0002\u0158\u015a\t\u0007\u0002\u0002\u0159\u0158\u0003",
  407. "\u0002\u0002\u0002\u015a\u015b\u0003\u0002\u0002\u0002\u015b\u0159\u0003",
  408. "\u0002\u0002\u0002\u015b\u015c\u0003\u0002\u0002\u0002\u015c\u016b\u0003",
  409. "\u0002\u0002\u0002\u015d\u015f\t\u0007\u0002\u0002\u015e\u015d\u0003",
  410. "\u0002\u0002\u0002\u015f\u0160\u0003\u0002\u0002\u0002\u0160\u015e\u0003",
  411. "\u0002\u0002\u0002\u0160\u0161\u0003\u0002\u0002\u0002\u0161\u0162\u0003",
  412. "\u0002\u0002\u0002\u0162\u0166\u00070\u0002\u0002\u0163\u0165\t\u0007",
  413. "\u0002\u0002\u0164\u0163\u0003\u0002\u0002\u0002\u0165\u0168\u0003\u0002",
  414. "\u0002\u0002\u0166\u0164\u0003\u0002\u0002\u0002\u0166\u0167\u0003\u0002",
  415. "\u0002\u0002\u0167\u0169\u0003\u0002\u0002\u0002\u0168\u0166\u0003\u0002",
  416. "\u0002\u0002\u0169\u016b\u0005Y-\u0002\u016a\u0153\u0003\u0002\u0002",
  417. "\u0002\u016a\u015e\u0003\u0002\u0002\u0002\u016bX\u0003\u0002\u0002",
  418. "\u0002\u016c\u016e\t\t\u0002\u0002\u016d\u016f\t\u0002\u0002\u0002\u016e",
  419. "\u016d\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002\u016f",
  420. "\u0171\u0003\u0002\u0002\u0002\u0170\u0172\t\u0007\u0002\u0002\u0171",
  421. "\u0170\u0003\u0002\u0002\u0002\u0172\u0173\u0003\u0002\u0002\u0002\u0173",
  422. "\u0171\u0003\u0002\u0002\u0002\u0173\u0174\u0003\u0002\u0002\u0002\u0174",
  423. "Z\u0003\u0002\u0002\u0002\u0175\u0179\u0007$\u0002\u0002\u0176\u0178",
  424. "\u0005]/\u0002\u0177\u0176\u0003\u0002\u0002\u0002\u0178\u017b\u0003",
  425. "\u0002\u0002\u0002\u0179\u0177\u0003\u0002\u0002\u0002\u0179\u017a\u0003",
  426. "\u0002\u0002\u0002\u017a\u017c\u0003\u0002\u0002\u0002\u017b\u0179\u0003",
  427. "\u0002\u0002\u0002\u017c\u017d\u0007$\u0002\u0002\u017d\\\u0003\u0002",
  428. "\u0002\u0002\u017e\u0181\n\n\u0002\u0002\u017f\u0181\u0005k6\u0002\u0180",
  429. "\u017e\u0003\u0002\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181",
  430. "^\u0003\u0002\u0002\u0002\u0182\u0185\u0007)\u0002\u0002\u0183\u0186",
  431. "\u0005k6\u0002\u0184\u0186\n\u000b\u0002\u0002\u0185\u0183\u0003\u0002",
  432. "\u0002\u0002\u0185\u0184\u0003\u0002\u0002\u0002\u0186\u0187\u0003\u0002",
  433. "\u0002\u0002\u0187\u0188\u0007)\u0002\u0002\u0188`\u0003\u0002\u0002",
  434. "\u0002\u0189\u018a\t\f\u0002\u0002\u018a\u018b\u0003\u0002\u0002\u0002",
  435. "\u018b\u018c\b1\u0002\u0002\u018cb\u0003\u0002\u0002\u0002\u018d\u018e",
  436. "\u0007=\u0002\u0002\u018ed\u0003\u0002\u0002\u0002\u018f\u0191\t\r\u0002",
  437. "\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002\u0002",
  438. "\u0002\u0192\u0190\u0003\u0002\u0002\u0002\u0192\u0193\u0003\u0002\u0002",
  439. "\u0002\u0193\u0196\u0003\u0002\u0002\u0002\u0194\u0196\u0005c2\u0002",
  440. "\u0195\u0190\u0003\u0002\u0002\u0002\u0195\u0194\u0003\u0002\u0002\u0002",
  441. "\u0196f\u0003\u0002\u0002\u0002\u0197\u0198\t\u000e\u0002\u0002\u0198",
  442. "h\u0003\u0002\u0002\u0002\u0199\u019a\t\u000f\u0002\u0002\u019aj\u0003",
  443. "\u0002\u0002\u0002\u019b\u019c\u0007^\u0002\u0002\u019c\u01a0\t\u0010",
  444. "\u0002\u0002\u019d\u01a0\u0005o8\u0002\u019e\u01a0\u0005m7\u0002\u019f",
  445. "\u019b\u0003\u0002\u0002\u0002\u019f\u019d\u0003\u0002\u0002\u0002\u019f",
  446. "\u019e\u0003\u0002\u0002\u0002\u01a0l\u0003\u0002\u0002\u0002\u01a1",
  447. "\u01a2\u0007^\u0002\u0002\u01a2\u01a3\t\u0011\u0002\u0002\u01a3\u01a4",
  448. "\u0005i5\u0002\u01a4\u01a5\u0005i5\u0002\u01a5\u01ad\u0003\u0002\u0002",
  449. "\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01a8\u0005i5\u0002\u01a8",
  450. "\u01a9\u0005i5\u0002\u01a9\u01ad\u0003\u0002\u0002\u0002\u01aa\u01ab",
  451. "\u0007^\u0002\u0002\u01ab\u01ad\u0005i5\u0002\u01ac\u01a1\u0003\u0002",
  452. "\u0002\u0002\u01ac\u01a6\u0003\u0002\u0002\u0002\u01ac\u01aa\u0003\u0002",
  453. "\u0002\u0002\u01adn\u0003\u0002\u0002\u0002\u01ae\u01af\u0007^\u0002",
  454. "\u0002\u01af\u01b0\u0007w\u0002\u0002\u01b0\u01b1\u0005g4\u0002\u01b1",
  455. "\u01b2\u0005g4\u0002\u01b2\u01b3\u0005g4\u0002\u01b3\u01b4\u0005g4\u0002",
  456. "\u01b4p\u0003\u0002\u0002\u0002\u01b5\u01b6\u00071\u0002\u0002\u01b6",
  457. "\u01b7\u00071\u0002\u0002\u01b7\u01bb\u0003\u0002\u0002\u0002\u01b8",
  458. "\u01ba\n\r\u0002\u0002\u01b9\u01b8\u0003\u0002\u0002\u0002\u01ba\u01bd",
  459. "\u0003\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bb\u01bc",
  460. "\u0003\u0002\u0002\u0002\u01bc\u01bf\u0003\u0002\u0002\u0002\u01bd\u01bb",
  461. "\u0003\u0002\u0002\u0002\u01be\u01c0\u0007\u000f\u0002\u0002\u01bf\u01be",
  462. "\u0003\u0002\u0002\u0002\u01bf\u01c0\u0003\u0002\u0002\u0002\u01c0\u01c1",
  463. "\u0003\u0002\u0002\u0002\u01c1\u01ce\u0007\f\u0002\u0002\u01c2\u01c3",
  464. "\u00071\u0002\u0002\u01c3\u01c4\u0007,\u0002\u0002\u01c4\u01c8\u0003",
  465. "\u0002\u0002\u0002\u01c5\u01c7\u000b\u0002\u0002\u0002\u01c6\u01c5\u0003",
  466. "\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c9\u0003",
  467. "\u0002\u0002\u0002\u01c8\u01c6\u0003\u0002\u0002\u0002\u01c9\u01cb\u0003",
  468. "\u0002\u0002\u0002\u01ca\u01c8\u0003\u0002\u0002\u0002\u01cb\u01cc\u0007",
  469. ",\u0002\u0002\u01cc\u01ce\u00071\u0002\u0002\u01cd\u01b5\u0003\u0002",
  470. "\u0002\u0002\u01cd\u01c2\u0003\u0002\u0002\u0002\u01ce\u01cf\u0003\u0002",
  471. "\u0002\u0002\u01cf\u01d0\b9\u0003\u0002\u01d0r\u0003\u0002\u0002\u0002",
  472. "\u001d\u0002\u0124\u012e\u0138\u013e\u0143\u0149\u014e\u0150\u0155\u015b",
  473. "\u0160\u0166\u016a\u016e\u0173\u0179\u0180\u0185\u0192\u0195\u019f\u01ac",
  474. "\u01bb\u01bf\u01c8\u01cd\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  475. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  476. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  477. function ivprog(input) {
  478. antlr4.Lexer.call(this, input);
  479. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  480. return this;
  481. }
  482. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  483. ivprog.prototype.constructor = ivprog;
  484. ivprog.EOF = antlr4.Token.EOF;
  485. ivprog.RK_PROGRAM = 1;
  486. ivprog.RK_REAL = 2;
  487. ivprog.RK_VOID = 3;
  488. ivprog.RK_BOOLEAN = 4;
  489. ivprog.RK_STRING = 5;
  490. ivprog.RK_INTEGER = 6;
  491. ivprog.RK_CHARACTER = 7;
  492. ivprog.RK_SWITCH = 8;
  493. ivprog.RK_CASE = 9;
  494. ivprog.RK_DEFAULT = 10;
  495. ivprog.RK_CONST = 11;
  496. ivprog.RK_FUNCTION = 12;
  497. ivprog.RK_RETURN = 13;
  498. ivprog.RK_FOR = 14;
  499. ivprog.RK_BREAK = 15;
  500. ivprog.RK_DO = 16;
  501. ivprog.RK_WHILE = 17;
  502. ivprog.RK_IF = 18;
  503. ivprog.RK_ELSE = 19;
  504. ivprog.RK_FALSE = 20;
  505. ivprog.RK_TRUE = 21;
  506. ivprog.OPEN_PARENTHESIS = 22;
  507. ivprog.CLOSE_PARENTHESIS = 23;
  508. ivprog.OPEN_BRACE = 24;
  509. ivprog.CLOSE_BRACE = 25;
  510. ivprog.OPEN_CURLY = 26;
  511. ivprog.CLOSE_CURLY = 27;
  512. ivprog.COMMA = 28;
  513. ivprog.EQUAL = 29;
  514. ivprog.SUM_OP = 30;
  515. ivprog.MULTI_OP = 31;
  516. ivprog.AND_OPERATOR = 32;
  517. ivprog.OR_OPERATOR = 33;
  518. ivprog.RELATIONAL_OPERATOR = 34;
  519. ivprog.COLON = 35;
  520. ivprog.NOT_OPERATOR = 36;
  521. ivprog.ID = 37;
  522. ivprog.LIB_ID = 38;
  523. ivprog.INTEGER = 39;
  524. ivprog.REAL = 40;
  525. ivprog.STRING = 41;
  526. ivprog.CHARACTER = 42;
  527. ivprog.WHITESPACE = 43;
  528. ivprog.EOS = 44;
  529. ivprog.COMMENTS = 45;
  530. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  531. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  532. ivprog.prototype.literalNames = [ null, "'program'", "'real'", "'void'",
  533. "'boolean'", "'string'", "'integer'",
  534. "'character'", "'switch'", "'case'", "'otherwise'",
  535. "'const'", "'function'", "'return'", "'for'",
  536. "'break'", "'do'", "'while'", "'if'",
  537. "'else'", "'false'", "'true'", "'('",
  538. "')'", "'['", "']'", "'{'", "'}'", "','",
  539. "'='", null, null, null, null, null, "':'" ];
  540. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  541. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  542. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  543. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  544. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  545. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  546. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  547. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  548. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  549. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  550. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  551. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  552. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  553. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  554. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  555. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  556. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  557. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  558. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  559. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  560. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  561. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  562. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  563. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  564. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  565. "STRING", "STRING_CHARACTER", "CHARACTER",
  566. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  567. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  568. "COMMENTS" ];
  569. ivprog.prototype.grammarFileName = "ivprog.g4";
  570. exports.ivprog = ivprog;
  571. /***/ }),
  572. /* 1 */
  573. /***/ (function(module, exports, __webpack_require__) {
  574. module.exports = {
  575. ivprog: __webpack_require__(0).ivprog
  576. };
  577. /***/ }),
  578. /* 2 */
  579. /***/ (function(module, exports) {
  580. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  581. /***/ })
  582. /******/ ]);
  583. /***/ }),
  584. /***/ "./grammar/en/langFunctions.js":
  585. /*!*************************************!*\
  586. !*** ./grammar/en/langFunctions.js ***!
  587. \*************************************/
  588. /*! no static exports found */
  589. /***/ (function(module, exports, __webpack_require__) {
  590. "use strict";
  591. Object.defineProperty(exports, "__esModule", {
  592. value: true
  593. });
  594. /* This is a dictionary of the language defined functions
  595. **/
  596. exports.default = {
  597. main_function: "start",
  598. $read: "read",
  599. $write: "write",
  600. $numElements: "total_of_elements",
  601. $matrixLines: "total_of_lines",
  602. $matrixColumns: "total_of_columns",
  603. $substring: "subcadeia",
  604. $length: "comprimento",
  605. $uppercase: "caixa_alta",
  606. $lowercase: "caixa_baixa",
  607. $charAt: "char_at",
  608. $isReal: "is_real",
  609. $isInt: "is_integer",
  610. $isBool: "is_logic",
  611. $castReal: "to_real",
  612. $castInt: "to_integer",
  613. $castBool: "to_logic",
  614. $castString: "to_string",
  615. $sin: "sin",
  616. $cos: "cos",
  617. $tan: "tan",
  618. $sqrt: "sqrt",
  619. $pow: "pow",
  620. $log: "log",
  621. $abs: "abs",
  622. $negate: "negate",
  623. $invert: "invert",
  624. $max: "maximum",
  625. $min: "minimum"
  626. };
  627. /***/ }),
  628. /***/ "./grammar/en/langLibs.js":
  629. /*!********************************!*\
  630. !*** ./grammar/en/langLibs.js ***!
  631. \********************************/
  632. /*! no static exports found */
  633. /***/ (function(module, exports, __webpack_require__) {
  634. "use strict";
  635. Object.defineProperty(exports, "__esModule", {
  636. value: true
  637. });
  638. /**
  639. * This is the dictionary of the language defined libraries
  640. */
  641. exports.default = {
  642. $mathLib: "Mathematic",
  643. $ioLib: "ES",
  644. $strLib: "Texto",
  645. $arrayLib: "Arranjo",
  646. $langLib: "Conversion"
  647. };
  648. /***/ }),
  649. /***/ "./grammar/es/ivprog.g4":
  650. /*!******************************!*\
  651. !*** ./grammar/es/ivprog.g4 ***!
  652. \******************************/
  653. /*! no static exports found */
  654. /***/ (function(module, exports, __webpack_require__) {
  655. module.exports =
  656. /******/ (function(modules) { // webpackBootstrap
  657. /******/ // The module cache
  658. /******/ var installedModules = {};
  659. /******/
  660. /******/ // The require function
  661. /******/ function __webpack_require__(moduleId) {
  662. /******/
  663. /******/ // Check if module is in cache
  664. /******/ if(installedModules[moduleId]) {
  665. /******/ return installedModules[moduleId].exports;
  666. /******/ }
  667. /******/ // Create a new module (and put it into the cache)
  668. /******/ var module = installedModules[moduleId] = {
  669. /******/ i: moduleId,
  670. /******/ l: false,
  671. /******/ exports: {}
  672. /******/ };
  673. /******/
  674. /******/ // Execute the module function
  675. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  676. /******/
  677. /******/ // Flag the module as loaded
  678. /******/ module.l = true;
  679. /******/
  680. /******/ // Return the exports of the module
  681. /******/ return module.exports;
  682. /******/ }
  683. /******/
  684. /******/
  685. /******/ // expose the modules object (__webpack_modules__)
  686. /******/ __webpack_require__.m = modules;
  687. /******/
  688. /******/ // expose the module cache
  689. /******/ __webpack_require__.c = installedModules;
  690. /******/
  691. /******/ // identity function for calling harmony imports with the correct context
  692. /******/ __webpack_require__.i = function(value) { return value; };
  693. /******/
  694. /******/ // define getter function for harmony exports
  695. /******/ __webpack_require__.d = function(exports, name, getter) {
  696. /******/ if(!__webpack_require__.o(exports, name)) {
  697. /******/ Object.defineProperty(exports, name, {
  698. /******/ configurable: false,
  699. /******/ enumerable: true,
  700. /******/ get: getter
  701. /******/ });
  702. /******/ }
  703. /******/ };
  704. /******/
  705. /******/ // getDefaultExport function for compatibility with non-harmony modules
  706. /******/ __webpack_require__.n = function(module) {
  707. /******/ var getter = module && module.__esModule ?
  708. /******/ function getDefault() { return module['default']; } :
  709. /******/ function getModuleExports() { return module; };
  710. /******/ __webpack_require__.d(getter, 'a', getter);
  711. /******/ return getter;
  712. /******/ };
  713. /******/
  714. /******/ // Object.prototype.hasOwnProperty.call
  715. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  716. /******/
  717. /******/ // __webpack_public_path__
  718. /******/ __webpack_require__.p = "";
  719. /******/
  720. /******/ // Load entry module and return exports
  721. /******/ return __webpack_require__(__webpack_require__.s = 1);
  722. /******/ })
  723. /************************************************************************/
  724. /******/ ([
  725. /* 0 */
  726. /***/ (function(module, exports, __webpack_require__) {
  727. // Generated from /tmp/tmp-3417Yy87YlUWLZeI/ivprog.g4 by ANTLR 4.7
  728. // jshint ignore: start
  729. var antlr4 = __webpack_require__(2);
  730. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  731. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  732. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  733. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  734. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  735. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  736. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  737. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  738. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  739. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  740. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  741. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  742. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  743. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  744. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  745. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  746. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  747. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  748. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  749. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  750. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  751. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  752. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  753. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  754. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  755. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  756. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  757. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  758. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  759. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  760. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  761. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  762. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  763. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  764. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  765. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  766. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  767. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  768. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  769. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  770. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  771. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  772. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  773. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  774. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  775. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  776. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  777. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  778. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  779. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  780. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  781. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  782. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  783. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  784. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  785. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  786. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  787. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  788. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  789. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  790. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  791. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  792. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  793. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  794. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  795. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  796. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  797. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  798. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  799. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  800. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  801. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  802. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  803. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  804. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  805. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  806. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  807. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  808. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  809. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  810. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  811. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  812. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  813. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  814. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  815. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  816. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  817. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  818. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  819. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  820. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  821. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  822. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  823. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  824. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  825. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  826. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  827. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  828. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  829. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  830. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  831. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  832. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  833. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  834. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  835. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  836. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  837. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  838. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  839. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  840. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  841. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  842. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  843. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  844. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  845. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  846. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  847. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  848. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  849. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  850. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  851. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  852. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  853. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  854. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  855. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  856. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  857. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  858. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  859. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  860. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  861. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  862. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  863. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  864. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  865. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  866. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  867. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  868. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  869. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  870. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  871. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  872. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  873. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  874. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  875. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  876. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  877. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  878. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  879. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  880. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  881. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  882. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  883. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  884. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  885. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  886. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  887. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  888. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  889. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  890. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  891. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  892. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  893. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  894. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  895. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  896. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  897. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  898. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  899. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  900. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  901. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  902. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  903. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  904. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  905. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  906. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  907. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  908. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  909. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  910. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  911. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  912. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  913. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  914. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  915. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  916. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  917. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  918. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  919. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  920. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  921. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  922. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  923. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  924. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  925. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  926. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  927. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  928. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  929. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  930. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  931. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  932. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  933. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  934. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  935. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  936. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  937. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  938. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  939. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  940. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  941. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  942. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  943. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  944. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  945. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  946. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  947. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  948. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  949. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  950. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  951. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  952. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  953. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  954. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  955. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  956. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  957. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  958. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  959. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  960. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  961. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  962. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  963. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  964. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  965. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  966. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  967. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  968. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  969. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  970. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  971. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  972. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  973. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  974. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  975. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  976. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  977. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  978. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  979. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  980. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  981. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  982. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  983. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  984. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  985. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  986. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  987. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  988. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  989. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  990. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  991. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  992. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  993. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  994. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  995. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  996. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  997. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  998. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  999. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1000. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1001. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1002. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1003. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1004. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1005. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1006. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1007. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1008. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1009. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1010. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1011. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1012. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1013. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1014. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1015. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1016. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1017. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1018. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1019. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1020. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1021. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1022. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1023. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1024. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1025. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1026. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1027. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1028. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1029. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1030. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1031. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1032. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1033. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1034. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1035. function ivprog(input) {
  1036. antlr4.Lexer.call(this, input);
  1037. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1038. return this;
  1039. }
  1040. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1041. ivprog.prototype.constructor = ivprog;
  1042. ivprog.EOF = antlr4.Token.EOF;
  1043. ivprog.RK_PROGRAM = 1;
  1044. ivprog.RK_REAL = 2;
  1045. ivprog.RK_VOID = 3;
  1046. ivprog.RK_BOOLEAN = 4;
  1047. ivprog.RK_STRING = 5;
  1048. ivprog.RK_INTEGER = 6;
  1049. ivprog.RK_CHARACTER = 7;
  1050. ivprog.RK_SWITCH = 8;
  1051. ivprog.RK_CASE = 9;
  1052. ivprog.RK_DEFAULT = 10;
  1053. ivprog.RK_CONST = 11;
  1054. ivprog.RK_FUNCTION = 12;
  1055. ivprog.RK_RETURN = 13;
  1056. ivprog.RK_FOR = 14;
  1057. ivprog.RK_BREAK = 15;
  1058. ivprog.RK_DO = 16;
  1059. ivprog.RK_WHILE = 17;
  1060. ivprog.RK_IF = 18;
  1061. ivprog.RK_ELSE = 19;
  1062. ivprog.RK_FALSE = 20;
  1063. ivprog.RK_TRUE = 21;
  1064. ivprog.OPEN_PARENTHESIS = 22;
  1065. ivprog.CLOSE_PARENTHESIS = 23;
  1066. ivprog.OPEN_BRACE = 24;
  1067. ivprog.CLOSE_BRACE = 25;
  1068. ivprog.OPEN_CURLY = 26;
  1069. ivprog.CLOSE_CURLY = 27;
  1070. ivprog.COMMA = 28;
  1071. ivprog.EQUAL = 29;
  1072. ivprog.SUM_OP = 30;
  1073. ivprog.MULTI_OP = 31;
  1074. ivprog.AND_OPERATOR = 32;
  1075. ivprog.OR_OPERATOR = 33;
  1076. ivprog.RELATIONAL_OPERATOR = 34;
  1077. ivprog.COLON = 35;
  1078. ivprog.NOT_OPERATOR = 36;
  1079. ivprog.ID = 37;
  1080. ivprog.LIB_ID = 38;
  1081. ivprog.INTEGER = 39;
  1082. ivprog.REAL = 40;
  1083. ivprog.STRING = 41;
  1084. ivprog.CHARACTER = 42;
  1085. ivprog.WHITESPACE = 43;
  1086. ivprog.EOS = 44;
  1087. ivprog.COMMENTS = 45;
  1088. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1089. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1090. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1091. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1092. "'escolha'", "'caso'", "'contrario'",
  1093. "'const'", "'funcao'", "'retorne'", "'para'",
  1094. "'pare'", "'faca'", "'enquanto'", "'se'",
  1095. "'senao'", "'falso'", "'verdadeiro'",
  1096. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1097. "','", "'='", null, null, null, null,
  1098. null, "':'" ];
  1099. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1100. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1101. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1102. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1103. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1104. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1105. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1106. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1107. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1108. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1109. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1110. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1111. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1112. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1113. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1114. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1115. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1116. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1117. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1118. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1119. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1120. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1121. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1122. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1123. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1124. "STRING", "STRING_CHARACTER", "CHARACTER",
  1125. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1126. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1127. "COMMENTS" ];
  1128. ivprog.prototype.grammarFileName = "ivprog.g4";
  1129. exports.ivprog = ivprog;
  1130. /***/ }),
  1131. /* 1 */
  1132. /***/ (function(module, exports, __webpack_require__) {
  1133. module.exports = {
  1134. ivprog: __webpack_require__(0).ivprog
  1135. };
  1136. /***/ }),
  1137. /* 2 */
  1138. /***/ (function(module, exports) {
  1139. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1140. /***/ })
  1141. /******/ ]);
  1142. /***/ }),
  1143. /***/ "./grammar/es/langFunctions.js":
  1144. /*!*************************************!*\
  1145. !*** ./grammar/es/langFunctions.js ***!
  1146. \*************************************/
  1147. /*! no static exports found */
  1148. /***/ (function(module, exports, __webpack_require__) {
  1149. "use strict";
  1150. Object.defineProperty(exports, "__esModule", {
  1151. value: true
  1152. });
  1153. /* This is a dictionary of the language defined functions
  1154. **/
  1155. exports.default = {
  1156. main_function: "inicio",
  1157. $read: "leia",
  1158. $write: "escreva",
  1159. $numElements: "total_of_elements",
  1160. $matrixLines: "total_of_lines",
  1161. $matrixColumns: "total_of_columns",
  1162. $substring: "subcadeia",
  1163. $length: "comprimento",
  1164. $uppercase: "caixa_alta",
  1165. $lowercase: "caixa_baixa",
  1166. $charAt: "char_at",
  1167. $isReal: "is_real",
  1168. $isInt: "is_integer",
  1169. $isBool: "is_logic",
  1170. $castReal: "to_real",
  1171. $castInt: "to_integer",
  1172. $castBool: "to_logic",
  1173. $castString: "to_string",
  1174. $sin: "sin",
  1175. $cos: "cos",
  1176. $tan: "tan",
  1177. $sqrt: "sqrt",
  1178. $pow: "pow",
  1179. $log: "log",
  1180. $abs: "abs",
  1181. $negate: "negate",
  1182. $invert: "invert",
  1183. $max: "maximum",
  1184. $min: "minimum"
  1185. };
  1186. /***/ }),
  1187. /***/ "./grammar/es/langLibs.js":
  1188. /*!********************************!*\
  1189. !*** ./grammar/es/langLibs.js ***!
  1190. \********************************/
  1191. /*! no static exports found */
  1192. /***/ (function(module, exports, __webpack_require__) {
  1193. "use strict";
  1194. Object.defineProperty(exports, "__esModule", {
  1195. value: true
  1196. });
  1197. /**
  1198. * This is the dictionary of the language defined libraries
  1199. */
  1200. exports.default = {
  1201. $mathLib: "Mathematic",
  1202. $ioLib: "ES",
  1203. $strLib: "Texto",
  1204. $arrayLib: "Arranjo",
  1205. $langLib: "Conversion"
  1206. };
  1207. /***/ }),
  1208. /***/ "./grammar/index.js":
  1209. /*!**************************!*\
  1210. !*** ./grammar/index.js ***!
  1211. \**************************/
  1212. /*! no static exports found */
  1213. /***/ (function(module, exports, __webpack_require__) {
  1214. "use strict";
  1215. var _ivprog = __webpack_require__(/*! ./pt/ivprog.g4 */ "./grammar/pt/ivprog.g4");
  1216. var PT = _interopRequireWildcard(_ivprog);
  1217. var _langFunctions = __webpack_require__(/*! ./pt/langFunctions */ "./grammar/pt/langFunctions.js");
  1218. var _langFunctions2 = _interopRequireDefault(_langFunctions);
  1219. var _langLibs = __webpack_require__(/*! ./pt/langLibs */ "./grammar/pt/langLibs.js");
  1220. var _langLibs2 = _interopRequireDefault(_langLibs);
  1221. var _ivprog2 = __webpack_require__(/*! ./en/ivprog.g4 */ "./grammar/en/ivprog.g4");
  1222. var EN = _interopRequireWildcard(_ivprog2);
  1223. var _langFunctions3 = __webpack_require__(/*! ./en/langFunctions */ "./grammar/en/langFunctions.js");
  1224. var _langFunctions4 = _interopRequireDefault(_langFunctions3);
  1225. var _langLibs3 = __webpack_require__(/*! ./en/langLibs */ "./grammar/en/langLibs.js");
  1226. var _langLibs4 = _interopRequireDefault(_langLibs3);
  1227. var _ivprog3 = __webpack_require__(/*! ./es/ivprog.g4 */ "./grammar/es/ivprog.g4");
  1228. var ES = _interopRequireWildcard(_ivprog3);
  1229. var _langFunctions5 = __webpack_require__(/*! ./es/langFunctions */ "./grammar/es/langFunctions.js");
  1230. var _langFunctions6 = _interopRequireDefault(_langFunctions5);
  1231. var _langLibs5 = __webpack_require__(/*! ./es/langLibs */ "./grammar/es/langLibs.js");
  1232. var _langLibs6 = _interopRequireDefault(_langLibs5);
  1233. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1234. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  1235. exports.pt = { lexer: PT.ivprog, langFuncs: _langFunctions2.default, langLibs: _langLibs2.default };
  1236. exports.en = { lexer: EN.ivprog, langFuncs: _langFunctions4.default, langLibs: _langLibs4.default };
  1237. exports.es = { lexer: ES.ivprog, langFuncs: _langFunctions6.default, langLibs: _langLibs6.default };
  1238. /***/ }),
  1239. /***/ "./grammar/pt/ivprog.g4":
  1240. /*!******************************!*\
  1241. !*** ./grammar/pt/ivprog.g4 ***!
  1242. \******************************/
  1243. /*! no static exports found */
  1244. /***/ (function(module, exports, __webpack_require__) {
  1245. module.exports =
  1246. /******/ (function(modules) { // webpackBootstrap
  1247. /******/ // The module cache
  1248. /******/ var installedModules = {};
  1249. /******/
  1250. /******/ // The require function
  1251. /******/ function __webpack_require__(moduleId) {
  1252. /******/
  1253. /******/ // Check if module is in cache
  1254. /******/ if(installedModules[moduleId]) {
  1255. /******/ return installedModules[moduleId].exports;
  1256. /******/ }
  1257. /******/ // Create a new module (and put it into the cache)
  1258. /******/ var module = installedModules[moduleId] = {
  1259. /******/ i: moduleId,
  1260. /******/ l: false,
  1261. /******/ exports: {}
  1262. /******/ };
  1263. /******/
  1264. /******/ // Execute the module function
  1265. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1266. /******/
  1267. /******/ // Flag the module as loaded
  1268. /******/ module.l = true;
  1269. /******/
  1270. /******/ // Return the exports of the module
  1271. /******/ return module.exports;
  1272. /******/ }
  1273. /******/
  1274. /******/
  1275. /******/ // expose the modules object (__webpack_modules__)
  1276. /******/ __webpack_require__.m = modules;
  1277. /******/
  1278. /******/ // expose the module cache
  1279. /******/ __webpack_require__.c = installedModules;
  1280. /******/
  1281. /******/ // identity function for calling harmony imports with the correct context
  1282. /******/ __webpack_require__.i = function(value) { return value; };
  1283. /******/
  1284. /******/ // define getter function for harmony exports
  1285. /******/ __webpack_require__.d = function(exports, name, getter) {
  1286. /******/ if(!__webpack_require__.o(exports, name)) {
  1287. /******/ Object.defineProperty(exports, name, {
  1288. /******/ configurable: false,
  1289. /******/ enumerable: true,
  1290. /******/ get: getter
  1291. /******/ });
  1292. /******/ }
  1293. /******/ };
  1294. /******/
  1295. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1296. /******/ __webpack_require__.n = function(module) {
  1297. /******/ var getter = module && module.__esModule ?
  1298. /******/ function getDefault() { return module['default']; } :
  1299. /******/ function getModuleExports() { return module; };
  1300. /******/ __webpack_require__.d(getter, 'a', getter);
  1301. /******/ return getter;
  1302. /******/ };
  1303. /******/
  1304. /******/ // Object.prototype.hasOwnProperty.call
  1305. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  1306. /******/
  1307. /******/ // __webpack_public_path__
  1308. /******/ __webpack_require__.p = "";
  1309. /******/
  1310. /******/ // Load entry module and return exports
  1311. /******/ return __webpack_require__(__webpack_require__.s = 1);
  1312. /******/ })
  1313. /************************************************************************/
  1314. /******/ ([
  1315. /* 0 */
  1316. /***/ (function(module, exports, __webpack_require__) {
  1317. // Generated from /tmp/tmp-3417ZzpSKjvYshMW/ivprog.g4 by ANTLR 4.7
  1318. // jshint ignore: start
  1319. var antlr4 = __webpack_require__(2);
  1320. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  1321. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  1322. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  1323. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  1324. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  1325. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  1326. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  1327. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  1328. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  1329. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  1330. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  1331. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  1332. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  1333. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  1334. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  1335. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  1336. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  1337. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  1338. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  1339. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  1340. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  1341. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  1342. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  1343. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  1344. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  1345. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  1346. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  1347. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  1348. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  1349. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  1350. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  1351. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  1352. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  1353. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  1354. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  1355. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  1356. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  1357. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  1358. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  1359. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  1360. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  1361. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  1362. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  1363. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  1364. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  1365. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  1366. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  1367. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  1368. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  1369. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  1370. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  1371. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  1372. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  1373. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  1374. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  1375. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  1376. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  1377. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  1378. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  1379. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  1380. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  1381. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  1382. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  1383. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  1384. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  1385. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  1386. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  1387. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  1388. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  1389. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  1390. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  1391. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  1392. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  1393. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  1394. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  1395. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  1396. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  1397. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  1398. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  1399. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  1400. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  1401. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  1402. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  1403. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  1404. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  1405. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  1406. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  1407. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  1408. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  1409. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  1410. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  1411. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  1412. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  1413. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  1414. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  1415. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  1416. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  1417. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  1418. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  1419. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  1420. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  1421. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  1422. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  1423. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  1424. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  1425. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  1426. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  1427. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  1428. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  1429. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  1430. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  1431. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  1432. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  1433. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  1434. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  1435. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  1436. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  1437. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  1438. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  1439. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  1440. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  1441. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  1442. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  1443. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  1444. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  1445. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  1446. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  1447. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  1448. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  1449. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  1450. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  1451. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  1452. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  1453. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  1454. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  1455. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  1456. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  1457. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  1458. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  1459. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  1460. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  1461. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  1462. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  1463. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  1464. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  1465. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  1466. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  1467. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  1468. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  1469. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  1470. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  1471. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  1472. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  1473. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  1474. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  1475. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  1476. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  1477. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  1478. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  1479. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  1480. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  1481. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  1482. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  1483. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  1484. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  1485. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  1486. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  1487. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  1488. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  1489. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  1490. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  1491. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  1492. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  1493. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  1494. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  1495. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  1496. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  1497. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  1498. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  1499. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  1500. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  1501. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  1502. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  1503. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  1504. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  1505. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  1506. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  1507. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  1508. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  1509. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  1510. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  1511. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  1512. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  1513. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  1514. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  1515. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  1516. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  1517. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  1518. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  1519. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  1520. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  1521. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  1522. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  1523. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  1524. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  1525. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  1526. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  1527. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  1528. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  1529. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  1530. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  1531. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  1532. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  1533. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  1534. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  1535. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  1536. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  1537. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  1538. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  1539. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  1540. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  1541. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  1542. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  1543. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  1544. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  1545. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  1546. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  1547. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  1548. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  1549. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  1550. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  1551. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  1552. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  1553. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  1554. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  1555. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  1556. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  1557. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  1558. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  1559. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  1560. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  1561. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  1562. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  1563. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  1564. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  1565. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  1566. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  1567. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  1568. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  1569. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  1570. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  1571. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  1572. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  1573. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  1574. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  1575. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  1576. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  1577. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  1578. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  1579. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  1580. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  1581. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  1582. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  1583. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  1584. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  1585. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1586. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1587. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1588. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1589. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1590. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1591. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1592. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1593. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1594. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1595. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1596. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1597. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1598. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1599. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1600. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1601. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1602. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1603. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1604. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1605. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1606. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1607. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1608. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1609. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1610. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1611. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1612. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1613. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1614. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1615. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1616. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1617. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1618. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1619. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1620. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1621. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1622. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1623. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1624. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1625. function ivprog(input) {
  1626. antlr4.Lexer.call(this, input);
  1627. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1628. return this;
  1629. }
  1630. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1631. ivprog.prototype.constructor = ivprog;
  1632. ivprog.EOF = antlr4.Token.EOF;
  1633. ivprog.RK_PROGRAM = 1;
  1634. ivprog.RK_REAL = 2;
  1635. ivprog.RK_VOID = 3;
  1636. ivprog.RK_BOOLEAN = 4;
  1637. ivprog.RK_STRING = 5;
  1638. ivprog.RK_INTEGER = 6;
  1639. ivprog.RK_CHARACTER = 7;
  1640. ivprog.RK_SWITCH = 8;
  1641. ivprog.RK_CASE = 9;
  1642. ivprog.RK_DEFAULT = 10;
  1643. ivprog.RK_CONST = 11;
  1644. ivprog.RK_FUNCTION = 12;
  1645. ivprog.RK_RETURN = 13;
  1646. ivprog.RK_FOR = 14;
  1647. ivprog.RK_BREAK = 15;
  1648. ivprog.RK_DO = 16;
  1649. ivprog.RK_WHILE = 17;
  1650. ivprog.RK_IF = 18;
  1651. ivprog.RK_ELSE = 19;
  1652. ivprog.RK_FALSE = 20;
  1653. ivprog.RK_TRUE = 21;
  1654. ivprog.OPEN_PARENTHESIS = 22;
  1655. ivprog.CLOSE_PARENTHESIS = 23;
  1656. ivprog.OPEN_BRACE = 24;
  1657. ivprog.CLOSE_BRACE = 25;
  1658. ivprog.OPEN_CURLY = 26;
  1659. ivprog.CLOSE_CURLY = 27;
  1660. ivprog.COMMA = 28;
  1661. ivprog.EQUAL = 29;
  1662. ivprog.SUM_OP = 30;
  1663. ivprog.MULTI_OP = 31;
  1664. ivprog.AND_OPERATOR = 32;
  1665. ivprog.OR_OPERATOR = 33;
  1666. ivprog.RELATIONAL_OPERATOR = 34;
  1667. ivprog.COLON = 35;
  1668. ivprog.NOT_OPERATOR = 36;
  1669. ivprog.ID = 37;
  1670. ivprog.LIB_ID = 38;
  1671. ivprog.INTEGER = 39;
  1672. ivprog.REAL = 40;
  1673. ivprog.STRING = 41;
  1674. ivprog.CHARACTER = 42;
  1675. ivprog.WHITESPACE = 43;
  1676. ivprog.EOS = 44;
  1677. ivprog.COMMENTS = 45;
  1678. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1679. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1680. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1681. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1682. "'escolha'", "'caso'", "'contrario'",
  1683. "'const'", "'funcao'", "'retorne'", "'para'",
  1684. "'pare'", "'faca'", "'enquanto'", "'se'",
  1685. "'senao'", "'falso'", "'verdadeiro'",
  1686. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1687. "','", "'='", null, null, null, null,
  1688. null, "':'" ];
  1689. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1690. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1691. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1692. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1693. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1694. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1695. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1696. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1697. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1698. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1699. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1700. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1701. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1702. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1703. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1704. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1705. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1706. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1707. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1708. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1709. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1710. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1711. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1712. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1713. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1714. "STRING", "STRING_CHARACTER", "CHARACTER",
  1715. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1716. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1717. "COMMENTS" ];
  1718. ivprog.prototype.grammarFileName = "ivprog.g4";
  1719. exports.ivprog = ivprog;
  1720. /***/ }),
  1721. /* 1 */
  1722. /***/ (function(module, exports, __webpack_require__) {
  1723. module.exports = {
  1724. ivprog: __webpack_require__(0).ivprog
  1725. };
  1726. /***/ }),
  1727. /* 2 */
  1728. /***/ (function(module, exports) {
  1729. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1730. /***/ })
  1731. /******/ ]);
  1732. /***/ }),
  1733. /***/ "./grammar/pt/langFunctions.js":
  1734. /*!*************************************!*\
  1735. !*** ./grammar/pt/langFunctions.js ***!
  1736. \*************************************/
  1737. /*! no static exports found */
  1738. /***/ (function(module, exports, __webpack_require__) {
  1739. "use strict";
  1740. Object.defineProperty(exports, "__esModule", {
  1741. value: true
  1742. });
  1743. /* This is a dictionary of the language defined functions
  1744. **/
  1745. exports.default = {
  1746. main_function: "inicio",
  1747. $read: "leia",
  1748. $write: "escreva",
  1749. $numElements: "total_de_elementos",
  1750. $matrixLines: "total_de_linhas",
  1751. $matrixColumns: "total_de_colunas",
  1752. $substring: "subcadeia",
  1753. $length: "comprimento",
  1754. $uppercase: "caixa_alta",
  1755. $lowercase: "caixa_baixa",
  1756. $charAt: "char_at",
  1757. $isReal: "e_real",
  1758. $isInt: "e_inteiro",
  1759. $isBool: "e_logico",
  1760. $castReal: "como_real",
  1761. $castInt: "como_inteiro",
  1762. $castBool: "como_logico",
  1763. $castString: "como_cadeia",
  1764. $sin: "seno",
  1765. $cos: "cosseno",
  1766. $tan: "tangente",
  1767. $sqrt: "raiz_quadrada",
  1768. $pow: "potencia",
  1769. $log: "logaritmo",
  1770. $abs: "modulo",
  1771. $negate: "trocar_sinal",
  1772. $invert: "inverter_valor",
  1773. $max: "maximo",
  1774. $min: "minimo"
  1775. };
  1776. /***/ }),
  1777. /***/ "./grammar/pt/langLibs.js":
  1778. /*!********************************!*\
  1779. !*** ./grammar/pt/langLibs.js ***!
  1780. \********************************/
  1781. /*! no static exports found */
  1782. /***/ (function(module, exports, __webpack_require__) {
  1783. "use strict";
  1784. Object.defineProperty(exports, "__esModule", {
  1785. value: true
  1786. });
  1787. /**
  1788. * This is the dictionary of the language defined libraries
  1789. */
  1790. exports.default = {
  1791. $mathLib: "Matematica",
  1792. $ioLib: "ES",
  1793. $strLib: "Texto",
  1794. $arrayLib: "Arranjo",
  1795. $langLib: "Conversao"
  1796. };
  1797. /***/ }),
  1798. /***/ "./i18n/en/error.json":
  1799. /*!****************************!*\
  1800. !*** ./i18n/en/error.json ***!
  1801. \****************************/
  1802. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, id_missing, main_missing, invalid_global_var, not_implemented, function_missing, invalid_parameters_size, invalid_ref, invalid_parameter_type, unknown_command, loop_condition_type, if_condition_type, invalid_return_type, unexpected_break_command, invalid_dimension, void_in_expression, invalid_array, invalid_array_access, column_outbounds, line_outbounds, invalid_infix_op, invalid_unary_op, unknown_op, default */
  1803. /***/ (function(module) {
  1804. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","invalid_parameters_size":"A quantidade de parâmetros fornecidos está incorreta. Esperava-se $0, encontrou-se $1","invalid_ref":"Você deve fornecer apenas um identificador como parâmetro","invalid_parameter_type":"O valor fornecido como parâmetro é do tipo $0, mas o tipo esperado é $1","unknown_command":"Erro interno crítico: Comando desconhecido encontrado","loop_condition_type":"A condição dos laços de repetição deve ser do tipo lógico","if_condition_type":"A condição de um comando se...senao deve ser do tipo lógico","invalid_return_type":"A função $0 deve retornar um tipo $1, ao invés de $1","unexpected_break_command":"Erro interno crítico: Comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression":"A função $0 não pode ser utilizada aqui pois seu tipo de retorno é vazio","invalid_array":"Expressão literal de Vetor/Mariz inválida","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","line_outbounds":"Número de linhas $0 é invaálido para a matriz $1 que possui $2 linhas","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida"};
  1805. /***/ }),
  1806. /***/ "./i18n/en/index.js":
  1807. /*!**************************!*\
  1808. !*** ./i18n/en/index.js ***!
  1809. \**************************/
  1810. /*! no static exports found */
  1811. /***/ (function(module, exports, __webpack_require__) {
  1812. "use strict";
  1813. Object.defineProperty(exports, "__esModule", {
  1814. value: true
  1815. });
  1816. var _error = __webpack_require__(/*! ./error.json */ "./i18n/en/error.json");
  1817. var _error2 = _interopRequireDefault(_error);
  1818. var _message = __webpack_require__(/*! ./message.json */ "./i18n/en/message.json");
  1819. var _message2 = _interopRequireDefault(_message);
  1820. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/en/ui.json");
  1821. var _ui2 = _interopRequireDefault(_ui);
  1822. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1823. exports.default = {
  1824. 'message': _message2.default,
  1825. 'error': _error2.default,
  1826. 'ui': _ui2.default
  1827. };
  1828. /***/ }),
  1829. /***/ "./i18n/en/message.json":
  1830. /*!******************************!*\
  1831. !*** ./i18n/en/message.json ***!
  1832. \******************************/
  1833. /*! exports provided: default */
  1834. /***/ (function(module) {
  1835. module.exports = {};
  1836. /***/ }),
  1837. /***/ "./i18n/en/ui.json":
  1838. /*!*************************!*\
  1839. !*** ./i18n/en/ui.json ***!
  1840. \*************************/
  1841. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_else, text_break, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_receives, text_repeatNtimes, text_return, text_btn_return, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, 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, 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 */
  1842. /***/ (function(module) {
  1843. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"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":"Arithmetic Expression","text_iftrue":"If true then","text_receives":"receives","text_repeatNtimes":"Repeat N times","text_return":"return","text_btn_return":"Return","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","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":"Select an expression","math":"Mathematic","text_t":"Text","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 2018_12_19 Build 13_18"};
  1844. /***/ }),
  1845. /***/ "./i18n/es/error.json":
  1846. /*!****************************!*\
  1847. !*** ./i18n/es/error.json ***!
  1848. \****************************/
  1849. /*! exports provided: default */
  1850. /***/ (function(module) {
  1851. module.exports = {};
  1852. /***/ }),
  1853. /***/ "./i18n/es/index.js":
  1854. /*!**************************!*\
  1855. !*** ./i18n/es/index.js ***!
  1856. \**************************/
  1857. /*! no static exports found */
  1858. /***/ (function(module, exports, __webpack_require__) {
  1859. "use strict";
  1860. Object.defineProperty(exports, "__esModule", {
  1861. value: true
  1862. });
  1863. var _error = __webpack_require__(/*! ./error.json */ "./i18n/es/error.json");
  1864. var _error2 = _interopRequireDefault(_error);
  1865. var _message = __webpack_require__(/*! ./message.json */ "./i18n/es/message.json");
  1866. var _message2 = _interopRequireDefault(_message);
  1867. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/es/ui.json");
  1868. var _ui2 = _interopRequireDefault(_ui);
  1869. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1870. exports.default = {
  1871. 'message': _message2.default,
  1872. 'error': _error2.default,
  1873. 'ui': _ui2.default
  1874. };
  1875. /***/ }),
  1876. /***/ "./i18n/es/message.json":
  1877. /*!******************************!*\
  1878. !*** ./i18n/es/message.json ***!
  1879. \******************************/
  1880. /*! exports provided: default */
  1881. /***/ (function(module) {
  1882. module.exports = {};
  1883. /***/ }),
  1884. /***/ "./i18n/es/ui.json":
  1885. /*!*************************!*\
  1886. !*** ./i18n/es/ui.json ***!
  1887. \*************************/
  1888. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_break, text_else, text_return, text_btn_return, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_repeatNtimes, text_receives, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, 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, 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 */
  1889. /***/ (function(module) {
  1890. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"Text","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_break":"break","text_else":"else","text_return":"return","text_btn_return":"Return","text_for":"for","text_code_while":"while","text_code_do":"do","text_command_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Arithmetic Expression","text_iftrue":"If true then","text_repeatNtimes":"Repeat N times","text_receives":"receives","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","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":"Select an expression","$sin":"sin","math":"Mathematic","arrangement":"Arrangement","conversion":"Conversion","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 2018_12_19 Build 13_18"};
  1891. /***/ }),
  1892. /***/ "./i18n/index.js":
  1893. /*!***********************!*\
  1894. !*** ./i18n/index.js ***!
  1895. \***********************/
  1896. /*! no static exports found */
  1897. /***/ (function(module, exports, __webpack_require__) {
  1898. "use strict";
  1899. Object.defineProperty(exports, "__esModule", {
  1900. value: true
  1901. });
  1902. var _en = __webpack_require__(/*! ./en */ "./i18n/en/index.js");
  1903. var _en2 = _interopRequireDefault(_en);
  1904. var _pt = __webpack_require__(/*! ./pt */ "./i18n/pt/index.js");
  1905. var _pt2 = _interopRequireDefault(_pt);
  1906. var _es = __webpack_require__(/*! ./es */ "./i18n/es/index.js");
  1907. var _es2 = _interopRequireDefault(_es);
  1908. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1909. exports.default = {
  1910. 'en': _en2.default,
  1911. 'pt': _pt2.default,
  1912. 'es': _es2.default
  1913. };
  1914. /***/ }),
  1915. /***/ "./i18n/pt/error.json":
  1916. /*!****************************!*\
  1917. !*** ./i18n/pt/error.json ***!
  1918. \****************************/
  1919. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, 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, default */
  1920. /***/ (function(module) {
  1921. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","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."};
  1922. /***/ }),
  1923. /***/ "./i18n/pt/index.js":
  1924. /*!**************************!*\
  1925. !*** ./i18n/pt/index.js ***!
  1926. \**************************/
  1927. /*! no static exports found */
  1928. /***/ (function(module, exports, __webpack_require__) {
  1929. "use strict";
  1930. Object.defineProperty(exports, "__esModule", {
  1931. value: true
  1932. });
  1933. var _error = __webpack_require__(/*! ./error.json */ "./i18n/pt/error.json");
  1934. var _error2 = _interopRequireDefault(_error);
  1935. var _message = __webpack_require__(/*! ./message.json */ "./i18n/pt/message.json");
  1936. var _message2 = _interopRequireDefault(_message);
  1937. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/pt/ui.json");
  1938. var _ui2 = _interopRequireDefault(_ui);
  1939. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1940. exports.default = {
  1941. 'message': _message2.default,
  1942. 'error': _error2.default,
  1943. 'ui': _ui2.default
  1944. };
  1945. /***/ }),
  1946. /***/ "./i18n/pt/message.json":
  1947. /*!******************************!*\
  1948. !*** ./i18n/pt/message.json ***!
  1949. \******************************/
  1950. /*! exports provided: default */
  1951. /***/ (function(module) {
  1952. module.exports = {};
  1953. /***/ }),
  1954. /***/ "./i18n/pt/ui.json":
  1955. /*!*************************!*\
  1956. !*** ./i18n/pt/ui.json ***!
  1957. \*************************/
  1958. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, 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, 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 */
  1959. /***/ (function(module) {
  1960. module.exports = {"function":"funcao","btn_clear":"Limpar","btn_function":"Função","btn_arithmetic_plus":"Adição","btn_arithmetic_minus":"Subtração","btn_arithmetic_multiplication":"Multiplicação","btn_arithmetic_division":"Divisão","btn_arithmetic_module":"Módulo","btn_break":"Pare","btn_case":"Caso","start":"inicio","void":"vazio","integer":"inteiro","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 Aritmética","text_iftrue":"Se verdadeiro então","text_repeatNtimes":"Repita N vezes","text_receives":"recebe","text_whiletrue":"Enquanto verdadeiro","text_dowhiletrue":"Faça enquanto verdadeiro","text_switch":"Escolha","text_functioncall":"Chamada de função","text_value":"Valor","text_operator":"Operador","text_parentheses":"Parênteses","text_change":"Alterar","text_teacher_algorithm":"Algoritmo","text_teacher_algorithm_include":"Incluir o algoritmo abaixo no exercício","text_teacher_test_case":"Casos de teste","text_teacher_config":"Configurações","text_teacher_data_types":"Tipos de dados","text_teacher_commands":"Comandos","text_teacher_functions":"Funções","text_teacher_create_functions":"Criar novas funções","text_teacher_create_movement_functions":"Movimentar funções","text_teacher_test_case_input":"Entrada","text_teacher_test_case_output":"Saída","text_teacher_test_case_actions":"Ações","text_teacher_test_case_add":"Adicionar caso de teste","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":"Selecione uma expressão","$sin":"seno","math":"Matematica","text_t":"Texto","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 2018_12_19 Build 13_18"};
  1961. /***/ }),
  1962. /***/ "./js/Sortable.js":
  1963. /*!************************!*\
  1964. !*** ./js/Sortable.js ***!
  1965. \************************/
  1966. /*! no static exports found */
  1967. /***/ (function(module, exports, __webpack_require__) {
  1968. "use strict";
  1969. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  1970. 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; };
  1971. /**!
  1972. * Sortable
  1973. * @author RubaXa <trash@rubaxa.org>
  1974. * @license MIT
  1975. */
  1976. (function sortableModule(factory) {
  1977. "use strict";
  1978. if (true) {
  1979. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  1980. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  1981. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  1982. __WEBPACK_AMD_DEFINE_FACTORY__),
  1983. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1984. } else {}
  1985. })(function sortableFactory() {
  1986. "use strict";
  1987. if (typeof window == "undefined" || !window.document) {
  1988. return function sortableError() {
  1989. throw new Error("Sortable.js requires a window with a document");
  1990. };
  1991. }
  1992. var dragEl,
  1993. parentEl,
  1994. ghostEl,
  1995. cloneEl,
  1996. rootEl,
  1997. nextEl,
  1998. lastDownEl,
  1999. scrollEl,
  2000. scrollParentEl,
  2001. scrollCustomFn,
  2002. lastEl,
  2003. lastCSS,
  2004. lastParentCSS,
  2005. oldIndex,
  2006. newIndex,
  2007. activeGroup,
  2008. putSortable,
  2009. autoScroll = {},
  2010. tapEvt,
  2011. touchEvt,
  2012. moved,
  2013. /** @const */
  2014. R_SPACE = /\s+/g,
  2015. R_FLOAT = /left|right|inline/,
  2016. expando = 'Sortable' + new Date().getTime(),
  2017. win = window,
  2018. document = win.document,
  2019. parseInt = win.parseInt,
  2020. $ = win.jQuery || win.Zepto,
  2021. Polymer = win.Polymer,
  2022. captureMode = false,
  2023. supportDraggable = !!('draggable' in document.createElement('div')),
  2024. supportCssPointerEvents = function (el) {
  2025. // false when IE11
  2026. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  2027. return false;
  2028. }
  2029. el = document.createElement('x');
  2030. el.style.cssText = 'pointer-events:auto';
  2031. return el.style.pointerEvents === 'auto';
  2032. }(),
  2033. _silent = false,
  2034. abs = Math.abs,
  2035. min = Math.min,
  2036. savedInputChecked = [],
  2037. touchDragOverListeners = [],
  2038. _autoScroll = _throttle(function ( /**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
  2039. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  2040. if (rootEl && options.scroll) {
  2041. var _this = rootEl[expando],
  2042. el,
  2043. rect,
  2044. sens = options.scrollSensitivity,
  2045. speed = options.scrollSpeed,
  2046. x = evt.clientX,
  2047. y = evt.clientY,
  2048. winWidth = window.innerWidth,
  2049. winHeight = window.innerHeight,
  2050. vx,
  2051. vy,
  2052. scrollOffsetX,
  2053. scrollOffsetY;
  2054. // Delect scrollEl
  2055. if (scrollParentEl !== rootEl) {
  2056. scrollEl = options.scroll;
  2057. scrollParentEl = rootEl;
  2058. scrollCustomFn = options.scrollFn;
  2059. if (scrollEl === true) {
  2060. scrollEl = rootEl;
  2061. do {
  2062. if (scrollEl.offsetWidth < scrollEl.scrollWidth || scrollEl.offsetHeight < scrollEl.scrollHeight) {
  2063. break;
  2064. }
  2065. /* jshint boss:true */
  2066. } while (scrollEl = scrollEl.parentNode);
  2067. }
  2068. }
  2069. if (scrollEl) {
  2070. el = scrollEl;
  2071. rect = scrollEl.getBoundingClientRect();
  2072. vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
  2073. vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
  2074. }
  2075. if (!(vx || vy)) {
  2076. vx = (winWidth - x <= sens) - (x <= sens);
  2077. vy = (winHeight - y <= sens) - (y <= sens);
  2078. /* jshint expr:true */
  2079. (vx || vy) && (el = win);
  2080. }
  2081. if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
  2082. autoScroll.el = el;
  2083. autoScroll.vx = vx;
  2084. autoScroll.vy = vy;
  2085. clearInterval(autoScroll.pid);
  2086. if (el) {
  2087. autoScroll.pid = setInterval(function () {
  2088. scrollOffsetY = vy ? vy * speed : 0;
  2089. scrollOffsetX = vx ? vx * speed : 0;
  2090. if ('function' === typeof scrollCustomFn) {
  2091. return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
  2092. }
  2093. if (el === win) {
  2094. win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
  2095. } else {
  2096. el.scrollTop += scrollOffsetY;
  2097. el.scrollLeft += scrollOffsetX;
  2098. }
  2099. }, 24);
  2100. }
  2101. }
  2102. }
  2103. }, 30),
  2104. _prepareGroup = function _prepareGroup(options) {
  2105. function toFn(value, pull) {
  2106. if (value === void 0 || value === true) {
  2107. value = group.name;
  2108. }
  2109. if (typeof value === 'function') {
  2110. return value;
  2111. } else {
  2112. return function (to, from) {
  2113. var fromGroup = from.options.group.name;
  2114. return pull ? value : value && (value.join ? value.indexOf(fromGroup) > -1 : fromGroup == value);
  2115. };
  2116. }
  2117. }
  2118. var group = {};
  2119. var originalGroup = options.group;
  2120. if (!originalGroup || (typeof originalGroup === "undefined" ? "undefined" : _typeof(originalGroup)) != 'object') {
  2121. originalGroup = { name: originalGroup };
  2122. }
  2123. group.name = originalGroup.name;
  2124. group.checkPull = toFn(originalGroup.pull, true);
  2125. group.checkPut = toFn(originalGroup.put);
  2126. group.revertClone = originalGroup.revertClone;
  2127. options.group = group;
  2128. };
  2129. /**
  2130. * @class Sortable
  2131. * @param {HTMLElement} el
  2132. * @param {Object} [options]
  2133. */
  2134. function Sortable(el, options) {
  2135. if (!(el && el.nodeType && el.nodeType === 1)) {
  2136. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  2137. }
  2138. this.el = el; // root element
  2139. this.options = options = _extend({}, options);
  2140. // Export instance
  2141. el[expando] = this;
  2142. // Default options
  2143. var defaults = {
  2144. group: Math.random(),
  2145. sort: true,
  2146. disabled: false,
  2147. store: null,
  2148. handle: null,
  2149. scroll: true,
  2150. scrollSensitivity: 30,
  2151. scrollSpeed: 10,
  2152. draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
  2153. ghostClass: 'sortable-ghost',
  2154. chosenClass: 'sortable-chosen',
  2155. dragClass: 'sortable-drag',
  2156. ignore: 'a, img',
  2157. filter: null,
  2158. preventOnFilter: true,
  2159. animation: 0,
  2160. setData: function setData(dataTransfer, dragEl) {
  2161. dataTransfer.setData('Text', dragEl.textContent);
  2162. },
  2163. dropBubble: false,
  2164. dragoverBubble: false,
  2165. dataIdAttr: 'data-id',
  2166. delay: 0,
  2167. forceFallback: false,
  2168. fallbackClass: 'sortable-fallback',
  2169. fallbackOnBody: false,
  2170. fallbackTolerance: 0,
  2171. fallbackOffset: { x: 0, y: 0 }
  2172. };
  2173. // Set default options
  2174. for (var name in defaults) {
  2175. !(name in options) && (options[name] = defaults[name]);
  2176. }
  2177. _prepareGroup(options);
  2178. // Bind all private methods
  2179. for (var fn in this) {
  2180. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  2181. this[fn] = this[fn].bind(this);
  2182. }
  2183. }
  2184. // Setup drag mode
  2185. this.nativeDraggable = options.forceFallback ? false : supportDraggable;
  2186. // Bind events
  2187. _on(el, 'mousedown', this._onTapStart);
  2188. _on(el, 'touchstart', this._onTapStart);
  2189. _on(el, 'pointerdown', this._onTapStart);
  2190. if (this.nativeDraggable) {
  2191. _on(el, 'dragover', this);
  2192. _on(el, 'dragenter', this);
  2193. }
  2194. touchDragOverListeners.push(this._onDragOver);
  2195. // Restore sorting
  2196. options.store && this.sort(options.store.get(this));
  2197. }
  2198. Sortable.prototype = /** @lends Sortable.prototype */{
  2199. constructor: Sortable,
  2200. _onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {
  2201. var _this = this,
  2202. el = this.el,
  2203. options = this.options,
  2204. preventOnFilter = options.preventOnFilter,
  2205. type = evt.type,
  2206. touch = evt.touches && evt.touches[0],
  2207. target = (touch || evt).target,
  2208. originalTarget = evt.target.shadowRoot && evt.path && evt.path[0] || target,
  2209. filter = options.filter,
  2210. startIndex;
  2211. _saveInputCheckedState(el);
  2212. // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  2213. if (dragEl) {
  2214. return;
  2215. }
  2216. if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
  2217. return; // only left button or enabled
  2218. }
  2219. target = _closest(target, options.draggable, el);
  2220. if (!target) {
  2221. return;
  2222. }
  2223. if (lastDownEl === target) {
  2224. // Ignoring duplicate `down`
  2225. return;
  2226. }
  2227. // Get the index of the dragged element within its parent
  2228. startIndex = _index(target, options.draggable);
  2229. // Check filter
  2230. if (typeof filter === 'function') {
  2231. if (filter.call(this, evt, target, this)) {
  2232. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  2233. preventOnFilter && evt.preventDefault();
  2234. return; // cancel dnd
  2235. }
  2236. } else if (filter) {
  2237. filter = filter.split(',').some(function (criteria) {
  2238. criteria = _closest(originalTarget, criteria.trim(), el);
  2239. if (criteria) {
  2240. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  2241. return true;
  2242. }
  2243. });
  2244. if (filter) {
  2245. preventOnFilter && evt.preventDefault();
  2246. return; // cancel dnd
  2247. }
  2248. }
  2249. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  2250. return;
  2251. }
  2252. // Prepare `dragstart`
  2253. this._prepareDragStart(evt, touch, target, startIndex);
  2254. },
  2255. _prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target, /** Number */startIndex) {
  2256. var _this = this,
  2257. el = _this.el,
  2258. options = _this.options,
  2259. ownerDocument = el.ownerDocument,
  2260. dragStartFn;
  2261. if (target && !dragEl && target.parentNode === el) {
  2262. tapEvt = evt;
  2263. rootEl = el;
  2264. dragEl = target;
  2265. parentEl = dragEl.parentNode;
  2266. nextEl = dragEl.nextSibling;
  2267. lastDownEl = target;
  2268. activeGroup = options.group;
  2269. oldIndex = startIndex;
  2270. this._lastX = (touch || evt).clientX;
  2271. this._lastY = (touch || evt).clientY;
  2272. dragEl.style['will-change'] = 'transform';
  2273. dragStartFn = function dragStartFn() {
  2274. // Delayed drag has been triggered
  2275. // we can re-enable the events: touchmove/mousemove
  2276. _this._disableDelayedDrag();
  2277. // Make the element draggable
  2278. dragEl.draggable = _this.nativeDraggable;
  2279. // Chosen item
  2280. _toggleClass(dragEl, options.chosenClass, true);
  2281. // Bind the events: dragstart/dragend
  2282. _this._triggerDragStart(evt, touch);
  2283. // Drag start event
  2284. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  2285. };
  2286. // Disable "draggable"
  2287. options.ignore.split(',').forEach(function (criteria) {
  2288. _find(dragEl, criteria.trim(), _disableDraggable);
  2289. });
  2290. _on(ownerDocument, 'mouseup', _this._onDrop);
  2291. _on(ownerDocument, 'touchend', _this._onDrop);
  2292. _on(ownerDocument, 'touchcancel', _this._onDrop);
  2293. _on(ownerDocument, 'pointercancel', _this._onDrop);
  2294. _on(ownerDocument, 'selectstart', _this);
  2295. if (options.delay) {
  2296. // If the user moves the pointer or let go the click or touch
  2297. // before the delay has been reached:
  2298. // disable the delayed drag
  2299. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  2300. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  2301. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  2302. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  2303. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  2304. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  2305. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  2306. } else {
  2307. dragStartFn();
  2308. }
  2309. }
  2310. },
  2311. _disableDelayedDrag: function _disableDelayedDrag() {
  2312. var ownerDocument = this.el.ownerDocument;
  2313. clearTimeout(this._dragStartTimer);
  2314. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  2315. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  2316. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  2317. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  2318. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  2319. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  2320. },
  2321. _triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {
  2322. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  2323. if (touch) {
  2324. // Touch device support
  2325. tapEvt = {
  2326. target: dragEl,
  2327. clientX: touch.clientX,
  2328. clientY: touch.clientY
  2329. };
  2330. this._onDragStart(tapEvt, 'touch');
  2331. } else if (!this.nativeDraggable) {
  2332. this._onDragStart(tapEvt, true);
  2333. } else {
  2334. _on(dragEl, 'dragend', this);
  2335. _on(rootEl, 'dragstart', this._onDragStart);
  2336. }
  2337. try {
  2338. if (document.selection) {
  2339. // Timeout neccessary for IE9
  2340. setTimeout(function () {
  2341. document.selection.empty();
  2342. });
  2343. } else {
  2344. window.getSelection().removeAllRanges();
  2345. }
  2346. } catch (err) {}
  2347. },
  2348. _dragStarted: function _dragStarted() {
  2349. if (rootEl && dragEl) {
  2350. var options = this.options;
  2351. // Apply effect
  2352. _toggleClass(dragEl, options.ghostClass, true);
  2353. _toggleClass(dragEl, options.dragClass, false);
  2354. Sortable.active = this;
  2355. // Drag start event
  2356. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  2357. } else {
  2358. this._nulling();
  2359. }
  2360. },
  2361. _emulateDragOver: function _emulateDragOver() {
  2362. if (touchEvt) {
  2363. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  2364. return;
  2365. }
  2366. this._lastX = touchEvt.clientX;
  2367. this._lastY = touchEvt.clientY;
  2368. if (!supportCssPointerEvents) {
  2369. _css(ghostEl, 'display', 'none');
  2370. }
  2371. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  2372. parent = target,
  2373. i = touchDragOverListeners.length;
  2374. if (parent) {
  2375. do {
  2376. if (parent[expando]) {
  2377. while (i--) {
  2378. touchDragOverListeners[i]({
  2379. clientX: touchEvt.clientX,
  2380. clientY: touchEvt.clientY,
  2381. target: target,
  2382. rootEl: parent
  2383. });
  2384. }
  2385. break;
  2386. }
  2387. target = parent; // store last element
  2388. }
  2389. /* jshint boss:true */
  2390. while (parent = parent.parentNode);
  2391. }
  2392. if (!supportCssPointerEvents) {
  2393. _css(ghostEl, 'display', '');
  2394. }
  2395. }
  2396. },
  2397. _onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {
  2398. if (tapEvt) {
  2399. var options = this.options,
  2400. fallbackTolerance = options.fallbackTolerance,
  2401. fallbackOffset = options.fallbackOffset,
  2402. touch = evt.touches ? evt.touches[0] : evt,
  2403. dx = touch.clientX - tapEvt.clientX + fallbackOffset.x,
  2404. dy = touch.clientY - tapEvt.clientY + fallbackOffset.y,
  2405. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
  2406. // only set the status to dragging, when we are actually dragging
  2407. if (!Sortable.active) {
  2408. if (fallbackTolerance && min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance) {
  2409. return;
  2410. }
  2411. this._dragStarted();
  2412. }
  2413. // as well as creating the ghost element on the document body
  2414. this._appendGhost();
  2415. moved = true;
  2416. touchEvt = touch;
  2417. _css(ghostEl, 'webkitTransform', translate3d);
  2418. _css(ghostEl, 'mozTransform', translate3d);
  2419. _css(ghostEl, 'msTransform', translate3d);
  2420. _css(ghostEl, 'transform', translate3d);
  2421. evt.preventDefault();
  2422. }
  2423. },
  2424. _appendGhost: function _appendGhost() {
  2425. if (!ghostEl) {
  2426. var rect = dragEl.getBoundingClientRect(),
  2427. css = _css(dragEl),
  2428. options = this.options,
  2429. ghostRect;
  2430. ghostEl = dragEl.cloneNode(true);
  2431. _toggleClass(ghostEl, options.ghostClass, false);
  2432. _toggleClass(ghostEl, options.fallbackClass, true);
  2433. _toggleClass(ghostEl, options.dragClass, true);
  2434. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  2435. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  2436. _css(ghostEl, 'width', rect.width);
  2437. _css(ghostEl, 'height', rect.height);
  2438. _css(ghostEl, 'opacity', '0.8');
  2439. _css(ghostEl, 'position', 'fixed');
  2440. _css(ghostEl, 'zIndex', '100000');
  2441. _css(ghostEl, 'pointerEvents', 'none');
  2442. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
  2443. // Fixing dimensions.
  2444. ghostRect = ghostEl.getBoundingClientRect();
  2445. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  2446. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  2447. }
  2448. },
  2449. _onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/useFallback) {
  2450. var dataTransfer = evt.dataTransfer,
  2451. options = this.options;
  2452. this._offUpEvents();
  2453. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  2454. cloneEl = _clone(dragEl);
  2455. cloneEl.draggable = false;
  2456. cloneEl.style['will-change'] = '';
  2457. _css(cloneEl, 'display', 'none');
  2458. _toggleClass(cloneEl, this.options.chosenClass, false);
  2459. rootEl.insertBefore(cloneEl, dragEl);
  2460. _dispatchEvent(this, rootEl, 'clone', dragEl);
  2461. }
  2462. _toggleClass(dragEl, options.dragClass, true);
  2463. if (useFallback) {
  2464. if (useFallback === 'touch') {
  2465. // Bind touch events
  2466. _on(document, 'touchmove', this._onTouchMove);
  2467. _on(document, 'touchend', this._onDrop);
  2468. _on(document, 'touchcancel', this._onDrop);
  2469. _on(document, 'pointermove', this._onTouchMove);
  2470. _on(document, 'pointerup', this._onDrop);
  2471. } else {
  2472. // Old brwoser
  2473. _on(document, 'mousemove', this._onTouchMove);
  2474. _on(document, 'mouseup', this._onDrop);
  2475. }
  2476. this._loopId = setInterval(this._emulateDragOver, 50);
  2477. } else {
  2478. if (dataTransfer) {
  2479. dataTransfer.effectAllowed = 'move';
  2480. options.setData && options.setData.call(this, dataTransfer, dragEl);
  2481. }
  2482. _on(document, 'drop', this);
  2483. setTimeout(this._dragStarted, 0);
  2484. }
  2485. },
  2486. _onDragOver: function _onDragOver( /**Event*/evt) {
  2487. var el = this.el,
  2488. target,
  2489. dragRect,
  2490. targetRect,
  2491. revert,
  2492. options = this.options,
  2493. group = options.group,
  2494. activeSortable = Sortable.active,
  2495. isOwner = activeGroup === group,
  2496. isMovingBetweenSortable = false,
  2497. canSort = options.sort;
  2498. if (evt.preventDefault !== void 0) {
  2499. evt.preventDefault();
  2500. !options.dragoverBubble && evt.stopPropagation();
  2501. }
  2502. if (dragEl.animated) {
  2503. return;
  2504. }
  2505. moved = true;
  2506. if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  2507. : 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
  2508. ) {
  2509. // Smart auto-scrolling
  2510. _autoScroll(evt, options, this.el);
  2511. if (_silent) {
  2512. return;
  2513. }
  2514. target = _closest(evt.target, options.draggable, el);
  2515. dragRect = dragEl.getBoundingClientRect();
  2516. if (putSortable !== this) {
  2517. putSortable = this;
  2518. isMovingBetweenSortable = true;
  2519. }
  2520. if (revert) {
  2521. _cloneHide(activeSortable, true);
  2522. parentEl = rootEl; // actualization
  2523. if (cloneEl || nextEl) {
  2524. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  2525. } else if (!canSort) {
  2526. rootEl.appendChild(dragEl);
  2527. }
  2528. return;
  2529. }
  2530. if (el.children.length === 0 || el.children[0] === ghostEl || el === evt.target && _ghostIsLast(el, evt)) {
  2531. //assign target only if condition is true
  2532. if (el.children.length !== 0 && el.children[0] !== ghostEl && el === evt.target) {
  2533. target = el.lastElementChild;
  2534. }
  2535. if (target) {
  2536. if (target.animated) {
  2537. return;
  2538. }
  2539. targetRect = target.getBoundingClientRect();
  2540. }
  2541. _cloneHide(activeSortable, isOwner);
  2542. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  2543. if (!dragEl.contains(el)) {
  2544. el.appendChild(dragEl);
  2545. parentEl = el; // actualization
  2546. }
  2547. this._animate(dragRect, dragEl);
  2548. target && this._animate(targetRect, target);
  2549. }
  2550. } else if (target && !target.animated && target !== dragEl && target.parentNode[expando] !== void 0) {
  2551. if (lastEl !== target) {
  2552. lastEl = target;
  2553. lastCSS = _css(target);
  2554. lastParentCSS = _css(target.parentNode);
  2555. }
  2556. targetRect = target.getBoundingClientRect();
  2557. var width = targetRect.right - targetRect.left,
  2558. height = targetRect.bottom - targetRect.top,
  2559. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display) || lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0,
  2560. isWide = target.offsetWidth > dragEl.offsetWidth,
  2561. isLong = target.offsetHeight > dragEl.offsetHeight,
  2562. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  2563. nextSibling = target.nextElementSibling,
  2564. after = false;
  2565. if (floating) {
  2566. var elTop = dragEl.offsetTop,
  2567. tgTop = target.offsetTop;
  2568. if (elTop === tgTop) {
  2569. after = target.previousElementSibling === dragEl && !isWide || halfway && isWide;
  2570. } else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  2571. after = (evt.clientY - targetRect.top) / height > 0.5;
  2572. } else {
  2573. after = tgTop > elTop;
  2574. }
  2575. } else if (!isMovingBetweenSortable) {
  2576. after = nextSibling !== dragEl && !isLong || halfway && isLong;
  2577. }
  2578. var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
  2579. if (moveVector !== false) {
  2580. if (moveVector === 1 || moveVector === -1) {
  2581. after = moveVector === 1;
  2582. }
  2583. _silent = true;
  2584. setTimeout(_unsilent, 30);
  2585. _cloneHide(activeSortable, isOwner);
  2586. if (!dragEl.contains(el)) {
  2587. if (after && !nextSibling) {
  2588. el.appendChild(dragEl);
  2589. } else {
  2590. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  2591. }
  2592. }
  2593. parentEl = dragEl.parentNode; // actualization
  2594. this._animate(dragRect, dragEl);
  2595. this._animate(targetRect, target);
  2596. }
  2597. }
  2598. }
  2599. },
  2600. _animate: function _animate(prevRect, target) {
  2601. var ms = this.options.animation;
  2602. if (ms) {
  2603. var currentRect = target.getBoundingClientRect();
  2604. if (prevRect.nodeType === 1) {
  2605. prevRect = prevRect.getBoundingClientRect();
  2606. }
  2607. _css(target, 'transition', 'none');
  2608. _css(target, 'transform', 'translate3d(' + (prevRect.left - currentRect.left) + 'px,' + (prevRect.top - currentRect.top) + 'px,0)');
  2609. target.offsetWidth; // repaint
  2610. _css(target, 'transition', 'all ' + ms + 'ms');
  2611. _css(target, 'transform', 'translate3d(0,0,0)');
  2612. clearTimeout(target.animated);
  2613. target.animated = setTimeout(function () {
  2614. _css(target, 'transition', '');
  2615. _css(target, 'transform', '');
  2616. target.animated = false;
  2617. }, ms);
  2618. }
  2619. },
  2620. _offUpEvents: function _offUpEvents() {
  2621. var ownerDocument = this.el.ownerDocument;
  2622. _off(document, 'touchmove', this._onTouchMove);
  2623. _off(document, 'pointermove', this._onTouchMove);
  2624. _off(ownerDocument, 'mouseup', this._onDrop);
  2625. _off(ownerDocument, 'touchend', this._onDrop);
  2626. _off(ownerDocument, 'pointerup', this._onDrop);
  2627. _off(ownerDocument, 'touchcancel', this._onDrop);
  2628. _off(ownerDocument, 'pointercancel', this._onDrop);
  2629. _off(ownerDocument, 'selectstart', this);
  2630. },
  2631. _onDrop: function _onDrop( /**Event*/evt) {
  2632. var el = this.el,
  2633. options = this.options;
  2634. clearInterval(this._loopId);
  2635. clearInterval(autoScroll.pid);
  2636. clearTimeout(this._dragStartTimer);
  2637. // Unbind events
  2638. _off(document, 'mousemove', this._onTouchMove);
  2639. if (this.nativeDraggable) {
  2640. _off(document, 'drop', this);
  2641. _off(el, 'dragstart', this._onDragStart);
  2642. }
  2643. this._offUpEvents();
  2644. if (evt) {
  2645. if (moved) {
  2646. evt.preventDefault();
  2647. !options.dropBubble && evt.stopPropagation();
  2648. }
  2649. ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
  2650. if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
  2651. // Remove clone
  2652. cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
  2653. }
  2654. if (dragEl) {
  2655. if (this.nativeDraggable) {
  2656. _off(dragEl, 'dragend', this);
  2657. }
  2658. _disableDraggable(dragEl);
  2659. dragEl.style['will-change'] = '';
  2660. // Remove class's
  2661. _toggleClass(dragEl, this.options.ghostClass, false);
  2662. _toggleClass(dragEl, this.options.chosenClass, false);
  2663. // Drag stop event
  2664. _dispatchEvent(this, rootEl, 'unchoose', dragEl, rootEl, oldIndex);
  2665. if (rootEl !== parentEl) {
  2666. newIndex = _index(dragEl, options.draggable);
  2667. if (newIndex >= 0) {
  2668. // Add event
  2669. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
  2670. // Remove event
  2671. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
  2672. // drag from one list and drop into another
  2673. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2674. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2675. }
  2676. } else {
  2677. if (dragEl.nextSibling !== nextEl) {
  2678. // Get the index of the dragged element within its parent
  2679. newIndex = _index(dragEl, options.draggable);
  2680. if (newIndex >= 0) {
  2681. // drag & drop within the same list
  2682. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  2683. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2684. }
  2685. }
  2686. }
  2687. if (Sortable.active) {
  2688. /* jshint eqnull:true */
  2689. if (newIndex == null || newIndex === -1) {
  2690. newIndex = oldIndex;
  2691. }
  2692. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
  2693. // Save sorting
  2694. this.save();
  2695. }
  2696. }
  2697. }
  2698. this._nulling();
  2699. },
  2700. _nulling: function _nulling() {
  2701. rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = scrollEl = scrollParentEl = tapEvt = touchEvt = moved = newIndex = lastEl = lastCSS = putSortable = activeGroup = Sortable.active = null;
  2702. savedInputChecked.forEach(function (el) {
  2703. el.checked = true;
  2704. });
  2705. savedInputChecked.length = 0;
  2706. },
  2707. handleEvent: function handleEvent( /**Event*/evt) {
  2708. switch (evt.type) {
  2709. case 'drop':
  2710. case 'dragend':
  2711. this._onDrop(evt);
  2712. break;
  2713. case 'dragover':
  2714. case 'dragenter':
  2715. if (dragEl) {
  2716. this._onDragOver(evt);
  2717. _globalDragOver(evt);
  2718. }
  2719. break;
  2720. case 'selectstart':
  2721. evt.preventDefault();
  2722. break;
  2723. }
  2724. },
  2725. /**
  2726. * Serializes the item into an array of string.
  2727. * @returns {String[]}
  2728. */
  2729. toArray: function toArray() {
  2730. var order = [],
  2731. el,
  2732. children = this.el.children,
  2733. i = 0,
  2734. n = children.length,
  2735. options = this.options;
  2736. for (; i < n; i++) {
  2737. el = children[i];
  2738. if (_closest(el, options.draggable, this.el)) {
  2739. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  2740. }
  2741. }
  2742. return order;
  2743. },
  2744. /**
  2745. * Sorts the elements according to the array.
  2746. * @param {String[]} order order of the items
  2747. */
  2748. sort: function sort(order) {
  2749. var items = {},
  2750. rootEl = this.el;
  2751. this.toArray().forEach(function (id, i) {
  2752. var el = rootEl.children[i];
  2753. if (_closest(el, this.options.draggable, rootEl)) {
  2754. items[id] = el;
  2755. }
  2756. }, this);
  2757. order.forEach(function (id) {
  2758. if (items[id]) {
  2759. rootEl.removeChild(items[id]);
  2760. rootEl.appendChild(items[id]);
  2761. }
  2762. });
  2763. },
  2764. /**
  2765. * Save the current sorting
  2766. */
  2767. save: function save() {
  2768. var store = this.options.store;
  2769. store && store.set(this);
  2770. },
  2771. /**
  2772. * 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.
  2773. * @param {HTMLElement} el
  2774. * @param {String} [selector] default: `options.draggable`
  2775. * @returns {HTMLElement|null}
  2776. */
  2777. closest: function closest(el, selector) {
  2778. return _closest(el, selector || this.options.draggable, this.el);
  2779. },
  2780. /**
  2781. * Set/get option
  2782. * @param {string} name
  2783. * @param {*} [value]
  2784. * @returns {*}
  2785. */
  2786. option: function option(name, value) {
  2787. var options = this.options;
  2788. if (value === void 0) {
  2789. return options[name];
  2790. } else {
  2791. options[name] = value;
  2792. if (name === 'group') {
  2793. _prepareGroup(options);
  2794. }
  2795. }
  2796. },
  2797. /**
  2798. * Destroy
  2799. */
  2800. destroy: function destroy() {
  2801. var el = this.el;
  2802. el[expando] = null;
  2803. _off(el, 'mousedown', this._onTapStart);
  2804. _off(el, 'touchstart', this._onTapStart);
  2805. _off(el, 'pointerdown', this._onTapStart);
  2806. if (this.nativeDraggable) {
  2807. _off(el, 'dragover', this);
  2808. _off(el, 'dragenter', this);
  2809. }
  2810. // Remove draggable attributes
  2811. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  2812. el.removeAttribute('draggable');
  2813. });
  2814. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  2815. this._onDrop();
  2816. this.el = el = null;
  2817. }
  2818. };
  2819. function _cloneHide(sortable, state) {
  2820. if (sortable.lastPullMode !== 'clone') {
  2821. state = true;
  2822. }
  2823. if (cloneEl && cloneEl.state !== state) {
  2824. _css(cloneEl, 'display', state ? 'none' : '');
  2825. if (!state) {
  2826. if (cloneEl.state) {
  2827. if (sortable.options.group.revertClone) {
  2828. rootEl.insertBefore(cloneEl, nextEl);
  2829. sortable._animate(dragEl, cloneEl);
  2830. } else {
  2831. rootEl.insertBefore(cloneEl, dragEl);
  2832. }
  2833. }
  2834. }
  2835. cloneEl.state = state;
  2836. }
  2837. }
  2838. function _closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
  2839. if (el) {
  2840. ctx = ctx || document;
  2841. do {
  2842. if (selector === '>*' && el.parentNode === ctx || _matches(el, selector)) {
  2843. return el;
  2844. }
  2845. /* jshint boss:true */
  2846. } while (el = _getParentOrHost(el));
  2847. }
  2848. return null;
  2849. }
  2850. function _getParentOrHost(el) {
  2851. var parent = el.host;
  2852. return parent && parent.nodeType ? parent : el.parentNode;
  2853. }
  2854. function _globalDragOver( /**Event*/evt) {
  2855. if (evt.dataTransfer) {
  2856. evt.dataTransfer.dropEffect = 'move';
  2857. }
  2858. evt.preventDefault();
  2859. }
  2860. function _on(el, event, fn) {
  2861. el.addEventListener(event, fn, captureMode);
  2862. }
  2863. function _off(el, event, fn) {
  2864. el.removeEventListener(event, fn, captureMode);
  2865. }
  2866. function _toggleClass(el, name, state) {
  2867. if (el) {
  2868. if (el.classList) {
  2869. el.classList[state ? 'add' : 'remove'](name);
  2870. } else {
  2871. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  2872. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  2873. }
  2874. }
  2875. }
  2876. function _css(el, prop, val) {
  2877. var style = el && el.style;
  2878. if (style) {
  2879. if (val === void 0) {
  2880. if (document.defaultView && document.defaultView.getComputedStyle) {
  2881. val = document.defaultView.getComputedStyle(el, '');
  2882. } else if (el.currentStyle) {
  2883. val = el.currentStyle;
  2884. }
  2885. return prop === void 0 ? val : val[prop];
  2886. } else {
  2887. if (!(prop in style)) {
  2888. prop = '-webkit-' + prop;
  2889. }
  2890. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  2891. }
  2892. }
  2893. }
  2894. function _find(ctx, tagName, iterator) {
  2895. if (ctx) {
  2896. var list = ctx.getElementsByTagName(tagName),
  2897. i = 0,
  2898. n = list.length;
  2899. if (iterator) {
  2900. for (; i < n; i++) {
  2901. iterator(list[i], i);
  2902. }
  2903. }
  2904. return list;
  2905. }
  2906. return [];
  2907. }
  2908. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  2909. sortable = sortable || rootEl[expando];
  2910. var evt = document.createEvent('Event'),
  2911. options = sortable.options,
  2912. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  2913. evt.initEvent(name, true, true);
  2914. evt.to = rootEl;
  2915. evt.from = fromEl || rootEl;
  2916. evt.item = targetEl || rootEl;
  2917. evt.clone = cloneEl;
  2918. evt.oldIndex = startIndex;
  2919. evt.newIndex = newIndex;
  2920. rootEl.dispatchEvent(evt);
  2921. if (options[onName]) {
  2922. options[onName].call(sortable, evt);
  2923. }
  2924. }
  2925. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt, willInsertAfter) {
  2926. var evt,
  2927. sortable = fromEl[expando],
  2928. onMoveFn = sortable.options.onMove,
  2929. retVal;
  2930. evt = document.createEvent('Event');
  2931. evt.initEvent('move', true, true);
  2932. evt.to = toEl;
  2933. evt.from = fromEl;
  2934. evt.dragged = dragEl;
  2935. evt.draggedRect = dragRect;
  2936. evt.related = targetEl || toEl;
  2937. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  2938. evt.willInsertAfter = willInsertAfter;
  2939. fromEl.dispatchEvent(evt);
  2940. if (onMoveFn) {
  2941. retVal = onMoveFn.call(sortable, evt, originalEvt);
  2942. }
  2943. return retVal;
  2944. }
  2945. function _disableDraggable(el) {
  2946. el.draggable = false;
  2947. }
  2948. function _unsilent() {
  2949. _silent = false;
  2950. }
  2951. /** @returns {HTMLElement|false} */
  2952. function _ghostIsLast(el, evt) {
  2953. var lastEl = el.lastElementChild,
  2954. rect = lastEl.getBoundingClientRect();
  2955. // 5 — min delta
  2956. // abs — нельзя добавлять, а то глюки при наведении сверху
  2957. return evt.clientY - (rect.top + rect.height) > 5 || evt.clientX - (rect.left + rect.width) > 5;
  2958. }
  2959. /**
  2960. * Generate id
  2961. * @param {HTMLElement} el
  2962. * @returns {String}
  2963. * @private
  2964. */
  2965. function _generateId(el) {
  2966. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  2967. i = str.length,
  2968. sum = 0;
  2969. while (i--) {
  2970. sum += str.charCodeAt(i);
  2971. }
  2972. return sum.toString(36);
  2973. }
  2974. /**
  2975. * Returns the index of an element within its parent for a selected set of
  2976. * elements
  2977. * @param {HTMLElement} el
  2978. * @param {selector} selector
  2979. * @return {number}
  2980. */
  2981. function _index(el, selector) {
  2982. var index = 0;
  2983. if (!el || !el.parentNode) {
  2984. return -1;
  2985. }
  2986. while (el && (el = el.previousElementSibling)) {
  2987. if (el.nodeName.toUpperCase() !== 'TEMPLATE' && (selector === '>*' || _matches(el, selector))) {
  2988. index++;
  2989. }
  2990. }
  2991. return index;
  2992. }
  2993. function _matches( /**HTMLElement*/el, /**String*/selector) {
  2994. if (el) {
  2995. selector = selector.split('.');
  2996. var tag = selector.shift().toUpperCase(),
  2997. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  2998. return (tag === '' || el.nodeName.toUpperCase() == tag) && (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length);
  2999. }
  3000. return false;
  3001. }
  3002. function _throttle(callback, ms) {
  3003. var args, _this;
  3004. return function () {
  3005. if (args === void 0) {
  3006. args = arguments;
  3007. _this = this;
  3008. setTimeout(function () {
  3009. if (args.length === 1) {
  3010. callback.call(_this, args[0]);
  3011. } else {
  3012. callback.apply(_this, args);
  3013. }
  3014. args = void 0;
  3015. }, ms);
  3016. }
  3017. };
  3018. }
  3019. function _extend(dst, src) {
  3020. if (dst && src) {
  3021. for (var key in src) {
  3022. if (src.hasOwnProperty(key)) {
  3023. dst[key] = src[key];
  3024. }
  3025. }
  3026. }
  3027. return dst;
  3028. }
  3029. function _clone(el) {
  3030. return $ ? $(el).clone(true)[0] : Polymer && Polymer.dom ? Polymer.dom(el).cloneNode(true) : el.cloneNode(true);
  3031. }
  3032. function _saveInputCheckedState(root) {
  3033. var inputs = root.getElementsByTagName('input');
  3034. var idx = inputs.length;
  3035. while (idx--) {
  3036. var el = inputs[idx];
  3037. el.checked && savedInputChecked.push(el);
  3038. }
  3039. }
  3040. // Fixed #973:
  3041. _on(document, 'touchmove', function (evt) {
  3042. if (Sortable.active) {
  3043. evt.preventDefault();
  3044. }
  3045. });
  3046. try {
  3047. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  3048. get: function get() {
  3049. captureMode = {
  3050. capture: false,
  3051. passive: false
  3052. };
  3053. }
  3054. }));
  3055. } catch (err) {}
  3056. // Export utils
  3057. Sortable.utils = {
  3058. on: _on,
  3059. off: _off,
  3060. css: _css,
  3061. find: _find,
  3062. is: function is(el, selector) {
  3063. return !!_closest(el, selector, el);
  3064. },
  3065. extend: _extend,
  3066. throttle: _throttle,
  3067. closest: _closest,
  3068. toggleClass: _toggleClass,
  3069. clone: _clone,
  3070. index: _index
  3071. };
  3072. /**
  3073. * Create sortable instance
  3074. * @param {HTMLElement} el
  3075. * @param {Object} [options]
  3076. */
  3077. Sortable.create = function (el, options) {
  3078. return new Sortable(el, options);
  3079. };
  3080. // Export
  3081. Sortable.version = '1.6.1';
  3082. return Sortable;
  3083. });
  3084. /***/ }),
  3085. /***/ "./js/assessment/ivprogAssessment.js":
  3086. /*!*******************************************!*\
  3087. !*** ./js/assessment/ivprogAssessment.js ***!
  3088. \*******************************************/
  3089. /*! no static exports found */
  3090. /***/ (function(module, exports, __webpack_require__) {
  3091. "use strict";
  3092. Object.defineProperty(exports, "__esModule", {
  3093. value: true
  3094. });
  3095. exports.IVProgAssessment = undefined;
  3096. 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; }; }();
  3097. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  3098. var _semanticAnalyser = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  3099. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  3100. var _inputTest = __webpack_require__(/*! ./../util/inputTest */ "./js/util/inputTest.js");
  3101. var _outputTest = __webpack_require__(/*! ./../util/outputTest */ "./js/util/outputTest.js");
  3102. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3103. var IVProgAssessment = exports.IVProgAssessment = function () {
  3104. function IVProgAssessment(textCode, testCases, domConsole) {
  3105. _classCallCheck(this, IVProgAssessment);
  3106. this.textCode = textCode;
  3107. this.testCases = testCases;
  3108. this.domConsole = domConsole;
  3109. }
  3110. _createClass(IVProgAssessment, [{
  3111. key: "runTest",
  3112. value: function runTest() {
  3113. var _this = this;
  3114. try {
  3115. // try and show error messages through domconsole
  3116. var parser = _ivprogParser.IVProgParser.createParser(this.textCode);
  3117. var semantic = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  3118. var validTree = semantic.analyseTree();
  3119. // loop test cases and show messages through domconsole
  3120. var partialTests = this.testCases.map(function (t, name) {
  3121. return _this.partialEvaluateTestCase(new _ivprogProcessor.IVProgProcessor(validTree), t.input, t.output, name);
  3122. });
  3123. var testResult = partialTests.reduce(function (acc, curr) {
  3124. return acc.then(function (v) {
  3125. return curr(v);
  3126. });
  3127. }, Promise.resolve(0));
  3128. return testResult.then(function (total) {
  3129. return Promise.resolve(total / _this.testCases.length);
  3130. }).catch(function (err) {
  3131. _this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3132. _this.domConsole.err(err.message);
  3133. return Promise.resolve(0);
  3134. });
  3135. } catch (error) {
  3136. this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3137. this.domConsole.err(error.message);
  3138. return Promise.resolve(0);
  3139. }
  3140. }
  3141. }, {
  3142. key: "evaluateTestCase",
  3143. value: function evaluateTestCase(prog, inputList, outputList, name, accumulator) {
  3144. var outerThis = this;
  3145. var input = new _inputTest.InputTest(inputList);
  3146. var output = new _outputTest.OutputTest();
  3147. prog.registerInput(input);
  3148. prog.registerOutput(output);
  3149. var startTime = Date.now();
  3150. return prog.interpretAST().then(function (_) {
  3151. var millis = Date.now() - startTime;
  3152. if (input.inputList.length !== input.index) {
  3153. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou, ainda restam entradas!");
  3154. outerThis.domConsole.info("Levou " + millis + "ms");
  3155. return Promise.resolve(accumulator + 1 * (input.index / inputList.length));
  3156. } else if (output.list.length < outputList.length) {
  3157. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3158. outerThis.domConsole.info("Levou " + millis + "ms");
  3159. return Promise.resolve(accumulator + 1 * (output.list.length / outputList.length));
  3160. } else if (output.list.length > outputList.length) {
  3161. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3162. outerThis.domConsole.info("Levou " + millis + "ms");
  3163. return Promise.resolve(accumulator + 1 * (outputList.length / output.list.length));
  3164. } else {
  3165. var isOk = outerThis.checkOutput(output.list, outputList);
  3166. if (!isOk) {
  3167. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3168. outerThis.domConsole.info("Levou " + millis + "ms");
  3169. return Promise.resolve(accumulator);
  3170. } else {
  3171. outerThis.domConsole.info("Caso de teste " + (name + 1) + ": OK!");
  3172. outerThis.domConsole.info("Levou " + millis + "ms");
  3173. return Promise.resolve(accumulator + 1);
  3174. }
  3175. }
  3176. }).catch(function (_) {
  3177. return Promise.resolve(accumulator);
  3178. });
  3179. }
  3180. }, {
  3181. key: "partialEvaluateTestCase",
  3182. value: function partialEvaluateTestCase(prog, inputList, outputList, name) {
  3183. var _this2 = this;
  3184. var partial = function partial(accumulator) {
  3185. return _this2.evaluateTestCase(prog, inputList, outputList, name, accumulator);
  3186. };
  3187. partial = partial.bind(this);
  3188. return partial;
  3189. }
  3190. }, {
  3191. key: "checkOutput",
  3192. value: function checkOutput(aList, bList) {
  3193. for (var i = 0; i < aList.length; i++) {
  3194. var outValue = aList[i];
  3195. if (outValue != bList[i]) {
  3196. return false;
  3197. }
  3198. }
  3199. return true;
  3200. }
  3201. }]);
  3202. return IVProgAssessment;
  3203. }();
  3204. /***/ }),
  3205. /***/ "./js/ast/commands/arrayAssign.js":
  3206. /*!****************************************!*\
  3207. !*** ./js/ast/commands/arrayAssign.js ***!
  3208. \****************************************/
  3209. /*! no static exports found */
  3210. /***/ (function(module, exports, __webpack_require__) {
  3211. "use strict";
  3212. Object.defineProperty(exports, "__esModule", {
  3213. value: true
  3214. });
  3215. exports.ArrayIndexAssign = undefined;
  3216. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3217. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3218. 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; }
  3219. 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; }
  3220. var ArrayIndexAssign = exports.ArrayIndexAssign = function (_Assign) {
  3221. _inherits(ArrayIndexAssign, _Assign);
  3222. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  3223. _classCallCheck(this, ArrayIndexAssign);
  3224. var _this = _possibleConstructorReturn(this, (ArrayIndexAssign.__proto__ || Object.getPrototypeOf(ArrayIndexAssign)).call(this, id, expression));
  3225. _this.line = lineExpression;
  3226. _this.column = columnExpression;
  3227. return _this;
  3228. }
  3229. return ArrayIndexAssign;
  3230. }(_assign.Assign);
  3231. /***/ }),
  3232. /***/ "./js/ast/commands/arrayDeclaration.js":
  3233. /*!*********************************************!*\
  3234. !*** ./js/ast/commands/arrayDeclaration.js ***!
  3235. \*********************************************/
  3236. /*! no static exports found */
  3237. /***/ (function(module, exports, __webpack_require__) {
  3238. "use strict";
  3239. Object.defineProperty(exports, "__esModule", {
  3240. value: true
  3241. });
  3242. exports.ArrayDeclaration = undefined;
  3243. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3244. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3245. 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; }
  3246. 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; }
  3247. var ArrayDeclaration = exports.ArrayDeclaration = function (_Declaration) {
  3248. _inherits(ArrayDeclaration, _Declaration);
  3249. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  3250. _classCallCheck(this, ArrayDeclaration);
  3251. var _this = _possibleConstructorReturn(this, (ArrayDeclaration.__proto__ || Object.getPrototypeOf(ArrayDeclaration)).call(this, id, type, initial, isConst));
  3252. _this.lines = lines;
  3253. _this.columns = columns;
  3254. return _this;
  3255. }
  3256. return ArrayDeclaration;
  3257. }(_declaration.Declaration);
  3258. /***/ }),
  3259. /***/ "./js/ast/commands/assign.js":
  3260. /*!***********************************!*\
  3261. !*** ./js/ast/commands/assign.js ***!
  3262. \***********************************/
  3263. /*! no static exports found */
  3264. /***/ (function(module, exports, __webpack_require__) {
  3265. "use strict";
  3266. Object.defineProperty(exports, "__esModule", {
  3267. value: true
  3268. });
  3269. exports.Assign = undefined;
  3270. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3271. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3272. 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; }
  3273. 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; }
  3274. var Assign = exports.Assign = function (_Command) {
  3275. _inherits(Assign, _Command);
  3276. function Assign(id, expression) {
  3277. _classCallCheck(this, Assign);
  3278. var _this = _possibleConstructorReturn(this, (Assign.__proto__ || Object.getPrototypeOf(Assign)).call(this));
  3279. _this.id = id;
  3280. _this.expression = expression;
  3281. return _this;
  3282. }
  3283. return Assign;
  3284. }(_command.Command);
  3285. /***/ }),
  3286. /***/ "./js/ast/commands/break.js":
  3287. /*!**********************************!*\
  3288. !*** ./js/ast/commands/break.js ***!
  3289. \**********************************/
  3290. /*! no static exports found */
  3291. /***/ (function(module, exports, __webpack_require__) {
  3292. "use strict";
  3293. Object.defineProperty(exports, "__esModule", {
  3294. value: true
  3295. });
  3296. exports.Break = undefined;
  3297. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3298. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3299. 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; }
  3300. 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; }
  3301. var Break = exports.Break = function (_Command) {
  3302. _inherits(Break, _Command);
  3303. function Break() {
  3304. _classCallCheck(this, Break);
  3305. return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).call(this));
  3306. }
  3307. return Break;
  3308. }(_command.Command);
  3309. /***/ }),
  3310. /***/ "./js/ast/commands/case.js":
  3311. /*!*********************************!*\
  3312. !*** ./js/ast/commands/case.js ***!
  3313. \*********************************/
  3314. /*! no static exports found */
  3315. /***/ (function(module, exports, __webpack_require__) {
  3316. "use strict";
  3317. Object.defineProperty(exports, "__esModule", {
  3318. value: true
  3319. });
  3320. exports.Case = undefined;
  3321. 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; }; }();
  3322. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3323. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3324. 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; }
  3325. 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; }
  3326. var Case = exports.Case = function (_Command) {
  3327. _inherits(Case, _Command);
  3328. function Case(expression) {
  3329. _classCallCheck(this, Case);
  3330. var _this = _possibleConstructorReturn(this, (Case.__proto__ || Object.getPrototypeOf(Case)).call(this));
  3331. _this.expression = expression;
  3332. _this.commands = [];
  3333. return _this;
  3334. }
  3335. _createClass(Case, [{
  3336. key: 'setCommands',
  3337. value: function setCommands(commands) {
  3338. this.commands = commands;
  3339. }
  3340. }, {
  3341. key: 'isDefault',
  3342. get: function get() {
  3343. return this.expression === null;
  3344. }
  3345. }]);
  3346. return Case;
  3347. }(_command.Command);
  3348. /***/ }),
  3349. /***/ "./js/ast/commands/command.js":
  3350. /*!************************************!*\
  3351. !*** ./js/ast/commands/command.js ***!
  3352. \************************************/
  3353. /*! no static exports found */
  3354. /***/ (function(module, exports, __webpack_require__) {
  3355. "use strict";
  3356. Object.defineProperty(exports, "__esModule", {
  3357. value: true
  3358. });
  3359. 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; }; }();
  3360. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3361. var Command = exports.Command = function () {
  3362. function Command() {
  3363. _classCallCheck(this, Command);
  3364. this._sourceInfo = null;
  3365. }
  3366. _createClass(Command, [{
  3367. key: "sourceInfo",
  3368. set: function set(sourceInfo) {
  3369. this._sourceInfo = sourceInfo;
  3370. },
  3371. get: function get() {
  3372. return this._sourceInfo;
  3373. }
  3374. }]);
  3375. return Command;
  3376. }();
  3377. /***/ }),
  3378. /***/ "./js/ast/commands/commandBlock.js":
  3379. /*!*****************************************!*\
  3380. !*** ./js/ast/commands/commandBlock.js ***!
  3381. \*****************************************/
  3382. /*! no static exports found */
  3383. /***/ (function(module, exports, __webpack_require__) {
  3384. "use strict";
  3385. Object.defineProperty(exports, "__esModule", {
  3386. value: true
  3387. });
  3388. 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; }; }();
  3389. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3390. var CommandBlock = exports.CommandBlock = function () {
  3391. function CommandBlock(variables, commands) {
  3392. _classCallCheck(this, CommandBlock);
  3393. this.variables = variables;
  3394. this.commands = commands;
  3395. this._sourceInfo = null;
  3396. }
  3397. _createClass(CommandBlock, [{
  3398. key: "sourceInfo",
  3399. set: function set(sourceInfo) {
  3400. this._sourceInfo = sourceInfo;
  3401. },
  3402. get: function get() {
  3403. return this._sourceInfo;
  3404. }
  3405. }]);
  3406. return CommandBlock;
  3407. }();
  3408. /***/ }),
  3409. /***/ "./js/ast/commands/declaration.js":
  3410. /*!****************************************!*\
  3411. !*** ./js/ast/commands/declaration.js ***!
  3412. \****************************************/
  3413. /*! no static exports found */
  3414. /***/ (function(module, exports, __webpack_require__) {
  3415. "use strict";
  3416. Object.defineProperty(exports, "__esModule", {
  3417. value: true
  3418. });
  3419. exports.Declaration = undefined;
  3420. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3421. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3422. 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; }
  3423. 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; }
  3424. var Declaration = exports.Declaration = function (_Command) {
  3425. _inherits(Declaration, _Command);
  3426. function Declaration(id, type, initial, isConst) {
  3427. _classCallCheck(this, Declaration);
  3428. var _this = _possibleConstructorReturn(this, (Declaration.__proto__ || Object.getPrototypeOf(Declaration)).call(this));
  3429. _this.id = id;
  3430. _this.type = type;
  3431. _this.initial = initial;
  3432. _this.isConst = isConst;
  3433. return _this;
  3434. }
  3435. return Declaration;
  3436. }(_command.Command);
  3437. /***/ }),
  3438. /***/ "./js/ast/commands/doWhile.js":
  3439. /*!************************************!*\
  3440. !*** ./js/ast/commands/doWhile.js ***!
  3441. \************************************/
  3442. /*! no static exports found */
  3443. /***/ (function(module, exports, __webpack_require__) {
  3444. "use strict";
  3445. Object.defineProperty(exports, "__esModule", {
  3446. value: true
  3447. });
  3448. exports.DoWhile = undefined;
  3449. 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; }; }();
  3450. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3451. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3452. 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; }
  3453. 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; }
  3454. var DoWhile = exports.DoWhile = function (_While) {
  3455. _inherits(DoWhile, _While);
  3456. function DoWhile(condition, commandBlock) {
  3457. _classCallCheck(this, DoWhile);
  3458. return _possibleConstructorReturn(this, (DoWhile.__proto__ || Object.getPrototypeOf(DoWhile)).call(this, condition, commandBlock));
  3459. }
  3460. _createClass(DoWhile, [{
  3461. key: 'testFirst',
  3462. get: function get() {
  3463. return false;
  3464. }
  3465. }]);
  3466. return DoWhile;
  3467. }(_while.While);
  3468. /***/ }),
  3469. /***/ "./js/ast/commands/for.js":
  3470. /*!********************************!*\
  3471. !*** ./js/ast/commands/for.js ***!
  3472. \********************************/
  3473. /*! no static exports found */
  3474. /***/ (function(module, exports, __webpack_require__) {
  3475. "use strict";
  3476. Object.defineProperty(exports, "__esModule", {
  3477. value: true
  3478. });
  3479. exports.For = undefined;
  3480. 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; }; }();
  3481. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3482. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3483. 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; }
  3484. 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; }
  3485. var For = exports.For = function (_Command) {
  3486. _inherits(For, _Command);
  3487. function For(assignment, condition, increment, commandBlock) {
  3488. _classCallCheck(this, For);
  3489. var _this = _possibleConstructorReturn(this, (For.__proto__ || Object.getPrototypeOf(For)).call(this));
  3490. _this.assignment = assignment;
  3491. _this.condition = condition;
  3492. _this.increment = increment;
  3493. _this.commandBlock = commandBlock;
  3494. return _this;
  3495. }
  3496. _createClass(For, [{
  3497. key: 'commands',
  3498. get: function get() {
  3499. return this.commandBlock.commands;
  3500. }
  3501. }]);
  3502. return For;
  3503. }(_command.Command);
  3504. /***/ }),
  3505. /***/ "./js/ast/commands/formalParameter.js":
  3506. /*!********************************************!*\
  3507. !*** ./js/ast/commands/formalParameter.js ***!
  3508. \********************************************/
  3509. /*! no static exports found */
  3510. /***/ (function(module, exports, __webpack_require__) {
  3511. "use strict";
  3512. Object.defineProperty(exports, "__esModule", {
  3513. value: true
  3514. });
  3515. 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; }; }();
  3516. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3517. var FormalParameter = exports.FormalParameter = function () {
  3518. function FormalParameter(type, id) {
  3519. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3520. _classCallCheck(this, FormalParameter);
  3521. this.type = type;
  3522. this.id = id;
  3523. this.byRef = byRef;
  3524. this._sourceInfo = null;
  3525. }
  3526. _createClass(FormalParameter, [{
  3527. key: "sourceInfo",
  3528. set: function set(sourceInfo) {
  3529. this._sourceInfo = sourceInfo;
  3530. },
  3531. get: function get() {
  3532. return this._sourceInfo;
  3533. }
  3534. }]);
  3535. return FormalParameter;
  3536. }();
  3537. /***/ }),
  3538. /***/ "./js/ast/commands/function.js":
  3539. /*!*************************************!*\
  3540. !*** ./js/ast/commands/function.js ***!
  3541. \*************************************/
  3542. /*! no static exports found */
  3543. /***/ (function(module, exports, __webpack_require__) {
  3544. "use strict";
  3545. Object.defineProperty(exports, "__esModule", {
  3546. value: true
  3547. });
  3548. exports.Function = undefined;
  3549. 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; }; }();
  3550. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3551. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3552. var Function = exports.Function = function () {
  3553. function Function(name, returnType, formalParameters, commandBlock) {
  3554. _classCallCheck(this, Function);
  3555. this.name = name;
  3556. this.returnType = returnType;
  3557. this.formalParameters = formalParameters;
  3558. this.commandBlock = commandBlock;
  3559. this._sourceInfo = null;
  3560. }
  3561. _createClass(Function, [{
  3562. key: 'isMain',
  3563. get: function get() {
  3564. return this.name === null && this.returnType.isCompatible(_types.Types.VOID);
  3565. }
  3566. }, {
  3567. key: 'commands',
  3568. get: function get() {
  3569. return this.commandBlock.commands;
  3570. }
  3571. }, {
  3572. key: 'variablesDeclarations',
  3573. get: function get() {
  3574. return this.commandBlock.variables;
  3575. }
  3576. }, {
  3577. key: 'sourceInfo',
  3578. set: function set(sourceInfo) {
  3579. this._sourceInfo = sourceInfo;
  3580. },
  3581. get: function get() {
  3582. return this._sourceInfo;
  3583. }
  3584. }]);
  3585. return Function;
  3586. }();
  3587. /***/ }),
  3588. /***/ "./js/ast/commands/ifThenElse.js":
  3589. /*!***************************************!*\
  3590. !*** ./js/ast/commands/ifThenElse.js ***!
  3591. \***************************************/
  3592. /*! no static exports found */
  3593. /***/ (function(module, exports, __webpack_require__) {
  3594. "use strict";
  3595. Object.defineProperty(exports, "__esModule", {
  3596. value: true
  3597. });
  3598. exports.IfThenElse = undefined;
  3599. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3600. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3601. 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; }
  3602. 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; }
  3603. var IfThenElse = exports.IfThenElse = function (_Command) {
  3604. _inherits(IfThenElse, _Command);
  3605. function IfThenElse(condition, ifTrue, ifFalse) {
  3606. _classCallCheck(this, IfThenElse);
  3607. var _this = _possibleConstructorReturn(this, (IfThenElse.__proto__ || Object.getPrototypeOf(IfThenElse)).call(this));
  3608. _this.condition = condition;
  3609. _this.ifTrue = ifTrue;
  3610. _this.ifFalse = ifFalse;
  3611. return _this;
  3612. }
  3613. return IfThenElse;
  3614. }(_command.Command);
  3615. /***/ }),
  3616. /***/ "./js/ast/commands/index.js":
  3617. /*!**********************************!*\
  3618. !*** ./js/ast/commands/index.js ***!
  3619. \**********************************/
  3620. /*! no static exports found */
  3621. /***/ (function(module, exports, __webpack_require__) {
  3622. "use strict";
  3623. Object.defineProperty(exports, "__esModule", {
  3624. value: true
  3625. });
  3626. 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;
  3627. var _break = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  3628. var _return = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  3629. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3630. var _arrayAssign = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  3631. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3632. var _arrayDeclaration = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  3633. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3634. var _for = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  3635. var _function = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  3636. var _ifThenElse = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  3637. var _commandBlock = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  3638. var _doWhile = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js");
  3639. var _switch = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  3640. var _case = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  3641. var _sysCall = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  3642. var _formalParameter = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  3643. var _functionCall = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  3644. //Proxy to expression since they do exatcly the same thing
  3645. exports.Break = _break.Break;
  3646. exports.Return = _return.Return;
  3647. exports.Assign = _assign.Assign;
  3648. exports.ArrayIndexAssign = _arrayAssign.ArrayIndexAssign;
  3649. exports.Declaration = _declaration.Declaration;
  3650. exports.ArrayDeclaration = _arrayDeclaration.ArrayDeclaration;
  3651. exports.While = _while.While;
  3652. exports.For = _for.For;
  3653. exports.Function = _function.Function;
  3654. exports.IfThenElse = _ifThenElse.IfThenElse;
  3655. exports.CommandBlock = _commandBlock.CommandBlock;
  3656. exports.DoWhile = _doWhile.DoWhile;
  3657. exports.Switch = _switch.Switch;
  3658. exports.Case = _case.Case;
  3659. exports.SysCall = _sysCall.SysCall;
  3660. exports.FormalParameter = _formalParameter.FormalParameter;
  3661. exports.FunctionCall = _functionCall.FunctionCall;
  3662. /***/ }),
  3663. /***/ "./js/ast/commands/return.js":
  3664. /*!***********************************!*\
  3665. !*** ./js/ast/commands/return.js ***!
  3666. \***********************************/
  3667. /*! no static exports found */
  3668. /***/ (function(module, exports, __webpack_require__) {
  3669. "use strict";
  3670. Object.defineProperty(exports, "__esModule", {
  3671. value: true
  3672. });
  3673. exports.Return = undefined;
  3674. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3675. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3676. 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; }
  3677. 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; }
  3678. var Return = exports.Return = function (_Command) {
  3679. _inherits(Return, _Command);
  3680. function Return(expression) {
  3681. _classCallCheck(this, Return);
  3682. var _this = _possibleConstructorReturn(this, (Return.__proto__ || Object.getPrototypeOf(Return)).call(this));
  3683. _this.expression = expression;
  3684. return _this;
  3685. }
  3686. return Return;
  3687. }(_command.Command);
  3688. /***/ }),
  3689. /***/ "./js/ast/commands/switch.js":
  3690. /*!***********************************!*\
  3691. !*** ./js/ast/commands/switch.js ***!
  3692. \***********************************/
  3693. /*! no static exports found */
  3694. /***/ (function(module, exports, __webpack_require__) {
  3695. "use strict";
  3696. Object.defineProperty(exports, "__esModule", {
  3697. value: true
  3698. });
  3699. exports.Switch = undefined;
  3700. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3701. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3702. 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; }
  3703. 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; }
  3704. var Switch = exports.Switch = function (_Command) {
  3705. _inherits(Switch, _Command);
  3706. function Switch(expression, cases) {
  3707. _classCallCheck(this, Switch);
  3708. var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this));
  3709. _this.expression = expression;
  3710. _this.cases = cases;
  3711. return _this;
  3712. }
  3713. return Switch;
  3714. }(_command.Command);
  3715. /***/ }),
  3716. /***/ "./js/ast/commands/sysCall.js":
  3717. /*!************************************!*\
  3718. !*** ./js/ast/commands/sysCall.js ***!
  3719. \************************************/
  3720. /*! no static exports found */
  3721. /***/ (function(module, exports, __webpack_require__) {
  3722. "use strict";
  3723. Object.defineProperty(exports, "__esModule", {
  3724. value: true
  3725. });
  3726. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3727. /**
  3728. * This class represents all the language defined functions.
  3729. * The language processor uses the id provided here to properly execute the desired function.
  3730. * The function is actually implemented inside the language processor.
  3731. * All the functions can be found at: js/processor/definedFunctions.js
  3732. */
  3733. var SysCall = exports.SysCall = function SysCall(langFunc) {
  3734. _classCallCheck(this, SysCall);
  3735. this.langFunc = langFunc;
  3736. };
  3737. /***/ }),
  3738. /***/ "./js/ast/commands/while.js":
  3739. /*!**********************************!*\
  3740. !*** ./js/ast/commands/while.js ***!
  3741. \**********************************/
  3742. /*! no static exports found */
  3743. /***/ (function(module, exports, __webpack_require__) {
  3744. "use strict";
  3745. Object.defineProperty(exports, "__esModule", {
  3746. value: true
  3747. });
  3748. exports.While = undefined;
  3749. 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; }; }();
  3750. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3751. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3752. 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; }
  3753. 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; }
  3754. var While = exports.While = function (_Command) {
  3755. _inherits(While, _Command);
  3756. function While(expression, commandBlock) {
  3757. _classCallCheck(this, While);
  3758. var _this = _possibleConstructorReturn(this, (While.__proto__ || Object.getPrototypeOf(While)).call(this));
  3759. _this.expression = expression;
  3760. _this.commandBlock = commandBlock;
  3761. return _this;
  3762. }
  3763. _createClass(While, [{
  3764. key: 'commands',
  3765. get: function get() {
  3766. return this.commandBlock.commands;
  3767. }
  3768. }, {
  3769. key: 'testFirst',
  3770. get: function get() {
  3771. return true;
  3772. }
  3773. }]);
  3774. return While;
  3775. }(_command.Command);
  3776. /***/ }),
  3777. /***/ "./js/ast/error/syntaxError.js":
  3778. /*!*************************************!*\
  3779. !*** ./js/ast/error/syntaxError.js ***!
  3780. \*************************************/
  3781. /*! no static exports found */
  3782. /***/ (function(module, exports, __webpack_require__) {
  3783. "use strict";
  3784. Object.defineProperty(exports, "__esModule", {
  3785. value: true
  3786. });
  3787. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3788. 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; }
  3789. 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; }
  3790. var SyntaxError = exports.SyntaxError = function (_Error) {
  3791. _inherits(SyntaxError, _Error);
  3792. function SyntaxError() {
  3793. var _ref;
  3794. _classCallCheck(this, SyntaxError);
  3795. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  3796. msg[_key] = arguments[_key];
  3797. }
  3798. var _this = _possibleConstructorReturn(this, (_ref = SyntaxError.__proto__ || Object.getPrototypeOf(SyntaxError)).call.apply(_ref, [this].concat(msg)));
  3799. if (Error.captureStackTrace) Error.captureStackTrace(_this, SyntaxError);
  3800. return _this;
  3801. }
  3802. return SyntaxError;
  3803. }(Error);
  3804. /***/ }),
  3805. /***/ "./js/ast/error/syntaxErrorFactory.js":
  3806. /*!********************************************!*\
  3807. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  3808. \********************************************/
  3809. /*! no static exports found */
  3810. /***/ (function(module, exports, __webpack_require__) {
  3811. "use strict";
  3812. Object.defineProperty(exports, "__esModule", {
  3813. value: true
  3814. });
  3815. exports.SyntaxErrorFactory = undefined;
  3816. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3817. var _syntaxError = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  3818. var SyntaxErrorFactory = exports.SyntaxErrorFactory = Object.freeze({
  3819. extra_lines: function extra_lines() {
  3820. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("extra_lines"));
  3821. },
  3822. token_missing_one: function token_missing_one(expected, token) {
  3823. var context = [expected, token.text, token.line, token.column];
  3824. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("token_missing_one", context));
  3825. },
  3826. token_missing_list: function token_missing_list(expectedList, token) {
  3827. var line = expectedList.join(_localizedStringsService.LocalizedStrings.getOR());
  3828. return SyntaxErrorFactory.token_missing_one(line, token);
  3829. },
  3830. id_missing: function id_missing(token) {
  3831. var context = [token.text, token.line, token.column];
  3832. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("id_missing", context));
  3833. },
  3834. eos_missing: function eos_missing(token) {
  3835. var context = [token.line, token.column];
  3836. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("eos_missing", context));
  3837. },
  3838. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  3839. var context = [token.line, token.column, typeName];
  3840. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_dimension", context));
  3841. },
  3842. invalid_array_size: function invalid_array_size(token) {
  3843. var context = [token.line];
  3844. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_size", context));
  3845. },
  3846. invalid_main_return: function invalid_main_return(name, typeName, token) {
  3847. var context = [name, typeName, token.line];
  3848. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_main_return", context));
  3849. },
  3850. invalid_var_declaration: function invalid_var_declaration(token) {
  3851. var context = [token.line];
  3852. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_var_declaration", context));
  3853. },
  3854. invalid_break_command: function invalid_break_command(cmdName, token) {
  3855. var context = [token.line, cmdName];
  3856. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_break_command", context));
  3857. },
  3858. invalid_terminal: function invalid_terminal(token) {
  3859. var context = [token.text, token.line, token.column];
  3860. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError('invalid_terminal', context));
  3861. },
  3862. invalid_type: function invalid_type(list, token) {
  3863. var line = list.join(_localizedStringsService.LocalizedStrings.getOR());
  3864. var context = [token.text, token.line, token.column, line];
  3865. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_type", context));
  3866. },
  3867. const_not_init: function const_not_init(token) {
  3868. var context = [token.line, token.column];
  3869. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("const_not_init", context));
  3870. },
  3871. invalid_id_format: function invalid_id_format(token) {
  3872. var context = [token.text, token.line, token.column];
  3873. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_id_format", context));
  3874. },
  3875. duplicate_function: function duplicate_function(token) {
  3876. var context = [token.text, token.line, token.column];
  3877. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_function", context));
  3878. },
  3879. main_parameters: function main_parameters() {
  3880. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("main_parameters"));
  3881. },
  3882. duplicate_variable: function duplicate_variable(token) {
  3883. var context = [token.text, token.line, token.column];
  3884. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_variable", context));
  3885. }
  3886. });
  3887. /***/ }),
  3888. /***/ "./js/ast/expressions/arrayAccess.js":
  3889. /*!*******************************************!*\
  3890. !*** ./js/ast/expressions/arrayAccess.js ***!
  3891. \*******************************************/
  3892. /*! no static exports found */
  3893. /***/ (function(module, exports, __webpack_require__) {
  3894. "use strict";
  3895. Object.defineProperty(exports, "__esModule", {
  3896. value: true
  3897. });
  3898. exports.ArrayAccess = undefined;
  3899. 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; }; }();
  3900. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  3901. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3902. 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; }
  3903. 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; }
  3904. var ArrayAccess = exports.ArrayAccess = function (_Expression) {
  3905. _inherits(ArrayAccess, _Expression);
  3906. function ArrayAccess(id, line, column) {
  3907. _classCallCheck(this, ArrayAccess);
  3908. var _this = _possibleConstructorReturn(this, (ArrayAccess.__proto__ || Object.getPrototypeOf(ArrayAccess)).call(this));
  3909. _this.id = id;
  3910. _this.line = line;
  3911. _this.column = column;
  3912. return _this;
  3913. }
  3914. _createClass(ArrayAccess, [{
  3915. key: 'toString',
  3916. value: function toString() {
  3917. var strLine = this.line.toString();
  3918. var strColumn = null;
  3919. if (this.column) {
  3920. strColumn = this.column.toString();
  3921. }
  3922. if (strColumn) {
  3923. return this.id + '[' + strLine + '][' + strColumn + ']';
  3924. } else {
  3925. return this.id + '[' + strLine + ']';
  3926. }
  3927. }
  3928. }]);
  3929. return ArrayAccess;
  3930. }(_expression.Expression);
  3931. /***/ }),
  3932. /***/ "./js/ast/expressions/arrayLiteral.js":
  3933. /*!********************************************!*\
  3934. !*** ./js/ast/expressions/arrayLiteral.js ***!
  3935. \********************************************/
  3936. /*! no static exports found */
  3937. /***/ (function(module, exports, __webpack_require__) {
  3938. "use strict";
  3939. Object.defineProperty(exports, "__esModule", {
  3940. value: true
  3941. });
  3942. exports.ArrayLiteral = undefined;
  3943. 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; }; }();
  3944. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3945. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3946. 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; }
  3947. 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; }
  3948. var ArrayLiteral = exports.ArrayLiteral = function (_Literal) {
  3949. _inherits(ArrayLiteral, _Literal);
  3950. function ArrayLiteral(type, value) {
  3951. _classCallCheck(this, ArrayLiteral);
  3952. var _this = _possibleConstructorReturn(this, (ArrayLiteral.__proto__ || Object.getPrototypeOf(ArrayLiteral)).call(this, type));
  3953. _this.value = value;
  3954. return _this;
  3955. }
  3956. _createClass(ArrayLiteral, [{
  3957. key: 'validateType',
  3958. value: function validateType() {
  3959. // let valid = true;
  3960. // if(this.columns !== null) {
  3961. // const len = this.columns;
  3962. // const len2 = this.lines;
  3963. // for (let i = len - 1; i >= 0; i--) {
  3964. // for (let j = len2 - 1; j >= 0; j--) {
  3965. // if(this.value[i].value[j].type !== this.subtype) {
  3966. // valid = false;
  3967. // break;
  3968. // }
  3969. // }
  3970. // }
  3971. // } else {
  3972. // const len = this.lines;
  3973. // for (var i = len - 1; i >= 0; i--) {
  3974. // if(this.value[i].type !== this.subtype) {
  3975. // valid = false;
  3976. // break;
  3977. // }
  3978. // }
  3979. // }
  3980. return true; //valid;
  3981. }
  3982. }, {
  3983. key: 'validateSize',
  3984. value: function validateSize() {
  3985. var valid = true;
  3986. if (this.columns !== null) {
  3987. var equalityTest = data.value.map(function (v) {
  3988. return v.length;
  3989. }).reduce(function (old, next) {
  3990. if (old === null) {
  3991. return next;
  3992. } else if (old === next) {
  3993. return old;
  3994. } else {
  3995. return -1;
  3996. }
  3997. }, null);
  3998. valid = equalityTest !== -1;
  3999. }
  4000. return valid;
  4001. }
  4002. }, {
  4003. key: 'toString',
  4004. value: function toString() {
  4005. var strList = this.value.map(function (arrayLiteral) {
  4006. return arrayLiteral.toString();
  4007. });
  4008. return "{" + strList.join(',') + "}";
  4009. }
  4010. }, {
  4011. key: 'subtype',
  4012. get: function get() {
  4013. var element = this.value[0];
  4014. if (element instanceof ArrayLiteral) {
  4015. return element.value[0].type;
  4016. } else {
  4017. return element.type;
  4018. }
  4019. }
  4020. }, {
  4021. key: 'lines',
  4022. get: function get() {
  4023. return this.value.length;
  4024. }
  4025. }, {
  4026. key: 'columns',
  4027. get: function get() {
  4028. var element = this.value[0];
  4029. if (!(element instanceof ArrayLiteral)) {
  4030. return null;
  4031. } else {
  4032. return element.value[0].value.length;
  4033. }
  4034. }
  4035. }, {
  4036. key: 'isVector',
  4037. get: function get() {
  4038. return this.columns === null;
  4039. }
  4040. }, {
  4041. key: 'isValid',
  4042. get: function get() {
  4043. return true; //this.validateType() && this.validateSize();
  4044. }
  4045. }]);
  4046. return ArrayLiteral;
  4047. }(_literal.Literal);
  4048. /***/ }),
  4049. /***/ "./js/ast/expressions/boolLiteral.js":
  4050. /*!*******************************************!*\
  4051. !*** ./js/ast/expressions/boolLiteral.js ***!
  4052. \*******************************************/
  4053. /*! no static exports found */
  4054. /***/ (function(module, exports, __webpack_require__) {
  4055. "use strict";
  4056. Object.defineProperty(exports, "__esModule", {
  4057. value: true
  4058. });
  4059. exports.BoolLiteral = undefined;
  4060. 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; }; }();
  4061. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4062. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4063. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4064. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4065. 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; }
  4066. 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; }
  4067. var BoolLiteral = exports.BoolLiteral = function (_Literal) {
  4068. _inherits(BoolLiteral, _Literal);
  4069. function BoolLiteral(value) {
  4070. _classCallCheck(this, BoolLiteral);
  4071. var _this = _possibleConstructorReturn(this, (BoolLiteral.__proto__ || Object.getPrototypeOf(BoolLiteral)).call(this, _types.Types.BOOLEAN));
  4072. _this.value = value;
  4073. return _this;
  4074. }
  4075. _createClass(BoolLiteral, [{
  4076. key: 'toString',
  4077. value: function toString() {
  4078. return (0, _parsers.convertBoolToString)(this.value);
  4079. }
  4080. }]);
  4081. return BoolLiteral;
  4082. }(_literal.Literal);
  4083. /***/ }),
  4084. /***/ "./js/ast/expressions/expression.js":
  4085. /*!******************************************!*\
  4086. !*** ./js/ast/expressions/expression.js ***!
  4087. \******************************************/
  4088. /*! no static exports found */
  4089. /***/ (function(module, exports, __webpack_require__) {
  4090. "use strict";
  4091. Object.defineProperty(exports, "__esModule", {
  4092. value: true
  4093. });
  4094. 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; }; }();
  4095. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4096. var Expression = exports.Expression = function () {
  4097. function Expression() {
  4098. _classCallCheck(this, Expression);
  4099. this._sourceInfo = null;
  4100. }
  4101. _createClass(Expression, [{
  4102. key: "sourceInfo",
  4103. set: function set(sourceInfo) {
  4104. this._sourceInfo = sourceInfo;
  4105. },
  4106. get: function get() {
  4107. return this._sourceInfo;
  4108. }
  4109. }]);
  4110. return Expression;
  4111. }();
  4112. /***/ }),
  4113. /***/ "./js/ast/expressions/functionCall.js":
  4114. /*!********************************************!*\
  4115. !*** ./js/ast/expressions/functionCall.js ***!
  4116. \********************************************/
  4117. /*! no static exports found */
  4118. /***/ (function(module, exports, __webpack_require__) {
  4119. "use strict";
  4120. Object.defineProperty(exports, "__esModule", {
  4121. value: true
  4122. });
  4123. exports.FunctionCall = undefined;
  4124. 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; }; }();
  4125. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4126. var _definedFunctions = __webpack_require__(/*! ../../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4127. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4128. 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; }
  4129. 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; }
  4130. var FunctionCall = exports.FunctionCall = function (_Expression) {
  4131. _inherits(FunctionCall, _Expression);
  4132. function FunctionCall(id, actualParameters) {
  4133. _classCallCheck(this, FunctionCall);
  4134. var _this = _possibleConstructorReturn(this, (FunctionCall.__proto__ || Object.getPrototypeOf(FunctionCall)).call(this));
  4135. _this.id = id;
  4136. _this.actualParameters = actualParameters;
  4137. return _this;
  4138. }
  4139. _createClass(FunctionCall, [{
  4140. key: 'toString',
  4141. value: function toString() {
  4142. var name = null;
  4143. if (this.isMainCall) {
  4144. name = _definedFunctions.LanguageDefinedFunction.getMainFunctionName();
  4145. } else {
  4146. name = _definedFunctions.LanguageDefinedFunction.getLocalName(this.id);
  4147. }
  4148. var params = null;
  4149. if (this.actualParameters.length == 0) {
  4150. params = "()";
  4151. } else {
  4152. var strParams = this.actualParameters.map(function (v) {
  4153. return v.toString();
  4154. });
  4155. params = "(" + strParams.join(",") + ")";
  4156. }
  4157. return name + params;
  4158. }
  4159. }, {
  4160. key: 'isMainCall',
  4161. get: function get() {
  4162. return this.id === null;
  4163. }
  4164. }, {
  4165. key: 'parametersSize',
  4166. get: function get() {
  4167. return this.actualParameters.length;
  4168. }
  4169. }]);
  4170. return FunctionCall;
  4171. }(_expression.Expression);
  4172. /***/ }),
  4173. /***/ "./js/ast/expressions/index.js":
  4174. /*!*************************************!*\
  4175. !*** ./js/ast/expressions/index.js ***!
  4176. \*************************************/
  4177. /*! no static exports found */
  4178. /***/ (function(module, exports, __webpack_require__) {
  4179. "use strict";
  4180. Object.defineProperty(exports, "__esModule", {
  4181. value: true
  4182. });
  4183. exports.UnaryApp = exports.InfixApp = exports.VariableLiteral = exports.ArrayLiteral = exports.StringLiteral = exports.BoolLiteral = exports.RealLiteral = exports.IntLiteral = exports.FunctionCall = exports.ArrayAccess = undefined;
  4184. var _arrayAccess = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  4185. var _functionCall = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  4186. var _intLiteral = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  4187. var _realLiteral = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  4188. var _boolLiteral = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  4189. var _stringLiteral = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  4190. var _arrayLiteral = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  4191. var _variableLiteral = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  4192. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4193. var _unaryApp = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  4194. exports.ArrayAccess = _arrayAccess.ArrayAccess;
  4195. exports.FunctionCall = _functionCall.FunctionCall;
  4196. exports.IntLiteral = _intLiteral.IntLiteral;
  4197. exports.RealLiteral = _realLiteral.RealLiteral;
  4198. exports.BoolLiteral = _boolLiteral.BoolLiteral;
  4199. exports.StringLiteral = _stringLiteral.StringLiteral;
  4200. exports.ArrayLiteral = _arrayLiteral.ArrayLiteral;
  4201. exports.VariableLiteral = _variableLiteral.VariableLiteral;
  4202. exports.InfixApp = _infixApp.InfixApp;
  4203. exports.UnaryApp = _unaryApp.UnaryApp;
  4204. /***/ }),
  4205. /***/ "./js/ast/expressions/infixApp.js":
  4206. /*!****************************************!*\
  4207. !*** ./js/ast/expressions/infixApp.js ***!
  4208. \****************************************/
  4209. /*! no static exports found */
  4210. /***/ (function(module, exports, __webpack_require__) {
  4211. "use strict";
  4212. Object.defineProperty(exports, "__esModule", {
  4213. value: true
  4214. });
  4215. exports.InfixApp = undefined;
  4216. 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; }; }();
  4217. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4218. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4219. 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; }
  4220. 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; }
  4221. var InfixApp = exports.InfixApp = function (_Expression) {
  4222. _inherits(InfixApp, _Expression);
  4223. function InfixApp(op, left, right) {
  4224. _classCallCheck(this, InfixApp);
  4225. var _this = _possibleConstructorReturn(this, (InfixApp.__proto__ || Object.getPrototypeOf(InfixApp)).call(this));
  4226. _this.op = op;
  4227. _this.left = left;
  4228. _this.right = right;
  4229. return _this;
  4230. }
  4231. _createClass(InfixApp, [{
  4232. key: 'toString',
  4233. value: function toString() {
  4234. var l = this.left.toString();
  4235. var op = this.op.value;
  4236. var r = this.right.toString();
  4237. return l + op + r;
  4238. }
  4239. }]);
  4240. return InfixApp;
  4241. }(_expression.Expression);
  4242. /***/ }),
  4243. /***/ "./js/ast/expressions/intLiteral.js":
  4244. /*!******************************************!*\
  4245. !*** ./js/ast/expressions/intLiteral.js ***!
  4246. \******************************************/
  4247. /*! no static exports found */
  4248. /***/ (function(module, exports, __webpack_require__) {
  4249. "use strict";
  4250. Object.defineProperty(exports, "__esModule", {
  4251. value: true
  4252. });
  4253. exports.IntLiteral = undefined;
  4254. 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; }; }();
  4255. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4256. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4257. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4258. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4259. 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; }
  4260. 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; }
  4261. var IntLiteral = exports.IntLiteral = function (_Literal) {
  4262. _inherits(IntLiteral, _Literal);
  4263. function IntLiteral(value) {
  4264. _classCallCheck(this, IntLiteral);
  4265. var _this = _possibleConstructorReturn(this, (IntLiteral.__proto__ || Object.getPrototypeOf(IntLiteral)).call(this, _types.Types.INTEGER));
  4266. _this.value = value;
  4267. return _this;
  4268. }
  4269. _createClass(IntLiteral, [{
  4270. key: 'toString',
  4271. value: function toString() {
  4272. return (0, _parsers.convertToString)(this.value, this.type);
  4273. }
  4274. }]);
  4275. return IntLiteral;
  4276. }(_literal.Literal);
  4277. /***/ }),
  4278. /***/ "./js/ast/expressions/literal.js":
  4279. /*!***************************************!*\
  4280. !*** ./js/ast/expressions/literal.js ***!
  4281. \***************************************/
  4282. /*! no static exports found */
  4283. /***/ (function(module, exports, __webpack_require__) {
  4284. "use strict";
  4285. Object.defineProperty(exports, "__esModule", {
  4286. value: true
  4287. });
  4288. exports.Literal = undefined;
  4289. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4290. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4291. 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; }
  4292. 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; }
  4293. var Literal = exports.Literal = function (_Expression) {
  4294. _inherits(Literal, _Expression);
  4295. function Literal(type) {
  4296. _classCallCheck(this, Literal);
  4297. var _this = _possibleConstructorReturn(this, (Literal.__proto__ || Object.getPrototypeOf(Literal)).call(this));
  4298. _this.type = type;
  4299. return _this;
  4300. }
  4301. return Literal;
  4302. }(_expression.Expression);
  4303. /***/ }),
  4304. /***/ "./js/ast/expressions/realLiteral.js":
  4305. /*!*******************************************!*\
  4306. !*** ./js/ast/expressions/realLiteral.js ***!
  4307. \*******************************************/
  4308. /*! no static exports found */
  4309. /***/ (function(module, exports, __webpack_require__) {
  4310. "use strict";
  4311. Object.defineProperty(exports, "__esModule", {
  4312. value: true
  4313. });
  4314. exports.RealLiteral = undefined;
  4315. 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; }; }();
  4316. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4317. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4318. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4319. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4320. 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; }
  4321. 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; }
  4322. var RealLiteral = exports.RealLiteral = function (_Literal) {
  4323. _inherits(RealLiteral, _Literal);
  4324. function RealLiteral(value) {
  4325. _classCallCheck(this, RealLiteral);
  4326. var _this = _possibleConstructorReturn(this, (RealLiteral.__proto__ || Object.getPrototypeOf(RealLiteral)).call(this, _types.Types.REAL));
  4327. _this.value = value;
  4328. return _this;
  4329. }
  4330. _createClass(RealLiteral, [{
  4331. key: 'toString',
  4332. value: function toString() {
  4333. return (0, _parsers.convertToString)(this.value, this.type);
  4334. }
  4335. }]);
  4336. return RealLiteral;
  4337. }(_literal.Literal);
  4338. /***/ }),
  4339. /***/ "./js/ast/expressions/stringLiteral.js":
  4340. /*!*********************************************!*\
  4341. !*** ./js/ast/expressions/stringLiteral.js ***!
  4342. \*********************************************/
  4343. /*! no static exports found */
  4344. /***/ (function(module, exports, __webpack_require__) {
  4345. "use strict";
  4346. Object.defineProperty(exports, "__esModule", {
  4347. value: true
  4348. });
  4349. exports.StringLiteral = undefined;
  4350. 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; }; }();
  4351. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4352. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4353. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4354. 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; }
  4355. 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; }
  4356. var StringLiteral = exports.StringLiteral = function (_Literal) {
  4357. _inherits(StringLiteral, _Literal);
  4358. function StringLiteral(value) {
  4359. _classCallCheck(this, StringLiteral);
  4360. var _this = _possibleConstructorReturn(this, (StringLiteral.__proto__ || Object.getPrototypeOf(StringLiteral)).call(this, _types.Types.STRING));
  4361. _this.value = value;
  4362. return _this;
  4363. }
  4364. _createClass(StringLiteral, [{
  4365. key: 'toString',
  4366. value: function toString() {
  4367. return this.value;
  4368. }
  4369. }]);
  4370. return StringLiteral;
  4371. }(_literal.Literal);
  4372. /***/ }),
  4373. /***/ "./js/ast/expressions/unaryApp.js":
  4374. /*!****************************************!*\
  4375. !*** ./js/ast/expressions/unaryApp.js ***!
  4376. \****************************************/
  4377. /*! no static exports found */
  4378. /***/ (function(module, exports, __webpack_require__) {
  4379. "use strict";
  4380. Object.defineProperty(exports, "__esModule", {
  4381. value: true
  4382. });
  4383. exports.UnaryApp = undefined;
  4384. 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; }; }();
  4385. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4386. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4387. 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; }
  4388. 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; }
  4389. var UnaryApp = exports.UnaryApp = function (_InfixApp) {
  4390. _inherits(UnaryApp, _InfixApp);
  4391. function UnaryApp(op, left) {
  4392. _classCallCheck(this, UnaryApp);
  4393. return _possibleConstructorReturn(this, (UnaryApp.__proto__ || Object.getPrototypeOf(UnaryApp)).call(this, op, left, null));
  4394. }
  4395. _createClass(UnaryApp, [{
  4396. key: 'toString',
  4397. value: function toString() {
  4398. var l = this.left.toString();
  4399. var op = this.op.value;
  4400. return op + l;
  4401. }
  4402. }]);
  4403. return UnaryApp;
  4404. }(_infixApp.InfixApp);
  4405. /***/ }),
  4406. /***/ "./js/ast/expressions/variableLiteral.js":
  4407. /*!***********************************************!*\
  4408. !*** ./js/ast/expressions/variableLiteral.js ***!
  4409. \***********************************************/
  4410. /*! no static exports found */
  4411. /***/ (function(module, exports, __webpack_require__) {
  4412. "use strict";
  4413. Object.defineProperty(exports, "__esModule", {
  4414. value: true
  4415. });
  4416. exports.VariableLiteral = undefined;
  4417. 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; }; }();
  4418. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4419. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4420. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4421. 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; }
  4422. 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; }
  4423. var VariableLiteral = exports.VariableLiteral = function (_Literal) {
  4424. _inherits(VariableLiteral, _Literal);
  4425. function VariableLiteral(id) {
  4426. _classCallCheck(this, VariableLiteral);
  4427. var _this = _possibleConstructorReturn(this, (VariableLiteral.__proto__ || Object.getPrototypeOf(VariableLiteral)).call(this, _types.Types.UNDEFINED));
  4428. _this.id = id;
  4429. return _this;
  4430. }
  4431. _createClass(VariableLiteral, [{
  4432. key: 'toString',
  4433. value: function toString() {
  4434. return this.id;
  4435. }
  4436. }]);
  4437. return VariableLiteral;
  4438. }(_literal.Literal);
  4439. /***/ }),
  4440. /***/ "./js/ast/ivprogParser.js":
  4441. /*!********************************!*\
  4442. !*** ./js/ast/ivprogParser.js ***!
  4443. \********************************/
  4444. /*! no static exports found */
  4445. /***/ (function(module, exports, __webpack_require__) {
  4446. "use strict";
  4447. Object.defineProperty(exports, "__esModule", {
  4448. value: true
  4449. });
  4450. exports.IVProgParser = undefined;
  4451. 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; }; }();
  4452. var _index = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  4453. var _expressions = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js");
  4454. var Expressions = _interopRequireWildcard(_expressions);
  4455. var _commands = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js");
  4456. var Commands = _interopRequireWildcard(_commands);
  4457. var _parsers = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4458. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  4459. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  4460. var _sourceInfo2 = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  4461. var _operators = __webpack_require__(/*! ./operators */ "./js/ast/operators.js");
  4462. var _syntaxErrorFactory = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  4463. var _definedFunctions = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4464. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  4465. 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; } }
  4466. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4467. var IVProgParser = exports.IVProgParser = function () {
  4468. _createClass(IVProgParser, null, [{
  4469. key: 'createParser',
  4470. value: function createParser(input) {
  4471. var lexerClass = _languageService.LanguageService.getCurrentLexer();
  4472. return new IVProgParser(input, lexerClass);
  4473. }
  4474. // <BEGIN scope consts>
  4475. }, {
  4476. key: 'BASE',
  4477. get: function get() {
  4478. return 0;
  4479. }
  4480. }, {
  4481. key: 'FUNCTION',
  4482. get: function get() {
  4483. return 1;
  4484. }
  4485. }, {
  4486. key: 'COMMAND',
  4487. get: function get() {
  4488. return 2;
  4489. }
  4490. }, {
  4491. key: 'BREAKABLE',
  4492. get: function get() {
  4493. return 4;
  4494. }
  4495. // </ END scope consts>
  4496. }]);
  4497. function IVProgParser(input, lexerClass) {
  4498. _classCallCheck(this, IVProgParser);
  4499. this.lexerClass = lexerClass;
  4500. this.lexer = new lexerClass(new _index.InputStream(input));
  4501. this.tokenStream = new _index.CommonTokenStream(this.lexer);
  4502. this.tokenStream.fill();
  4503. this.pos = 1;
  4504. this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING];
  4505. this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID);
  4506. this.parsingArrayDimension = 0;
  4507. this.scope = [];
  4508. this.langFuncs = _languageService.LanguageService.getCurrentLangFuncs();
  4509. this.definedFuncsNameList = [];
  4510. this.definedVariablesStack = [];
  4511. }
  4512. _createClass(IVProgParser, [{
  4513. key: 'parseTree',
  4514. value: function parseTree() {
  4515. return this.parseProgram();
  4516. }
  4517. }, {
  4518. key: 'getToken',
  4519. value: function getToken() {
  4520. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  4521. // if(index === null)
  4522. // index = this.pos;
  4523. return this.tokenStream.LT(index);
  4524. }
  4525. }, {
  4526. key: 'insideScope',
  4527. value: function insideScope(scope) {
  4528. if (this.scope.length <= 0) {
  4529. return IVProgParser.BASE === scope;
  4530. } else {
  4531. return this.scope[this.scope.length - 1] === scope;
  4532. }
  4533. }
  4534. }, {
  4535. key: 'pushScope',
  4536. value: function pushScope(scope) {
  4537. this.scope.push(scope);
  4538. }
  4539. }, {
  4540. key: 'pushVariableStack',
  4541. value: function pushVariableStack() {
  4542. this.definedVariablesStack.push([]);
  4543. }
  4544. }, {
  4545. key: 'popScope',
  4546. value: function popScope() {
  4547. return this.scope.pop();
  4548. }
  4549. }, {
  4550. key: 'popVariableStack',
  4551. value: function popVariableStack() {
  4552. return this.definedVariablesStack.pop();
  4553. }
  4554. }, {
  4555. key: 'getCurrentVariableStack',
  4556. value: function getCurrentVariableStack() {
  4557. return this.definedVariablesStack[this.definedVariablesStack.length - 1];
  4558. }
  4559. }, {
  4560. key: 'isEOF',
  4561. value: function isEOF() {
  4562. this.getToken(this.pos);
  4563. return this.tokenStream.fetchedEOF;
  4564. }
  4565. }, {
  4566. key: 'parseProgram',
  4567. value: function parseProgram() {
  4568. var token = this.getToken();
  4569. var globalVars = [];
  4570. var functions = [];
  4571. if (this.lexerClass.RK_PROGRAM === token.type) {
  4572. this.pos++;
  4573. this.consumeNewLines();
  4574. this.checkOpenCurly();
  4575. this.pos++;
  4576. this.pushVariableStack();
  4577. while (true) {
  4578. this.consumeNewLines();
  4579. var _token = this.getToken();
  4580. if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) {
  4581. globalVars = globalVars.concat(this.parseGlobalVariables());
  4582. } else if (_token.type === this.lexerClass.RK_FUNCTION) {
  4583. this.pushVariableStack();
  4584. functions = functions.concat(this.parseFunction());
  4585. this.popVariableStack();
  4586. } else {
  4587. break;
  4588. }
  4589. }
  4590. this.consumeNewLines();
  4591. this.checkCloseCurly();
  4592. this.pos++;
  4593. this.consumeNewLines();
  4594. if (!this.isEOF()) {
  4595. throw _syntaxErrorFactory.SyntaxErrorFactory.extra_lines();
  4596. }
  4597. this.popVariableStack();
  4598. return { global: globalVars, functions: functions };
  4599. } else {
  4600. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token);
  4601. }
  4602. }
  4603. }, {
  4604. key: 'checkOpenCurly',
  4605. value: function checkOpenCurly() {
  4606. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4607. var token = this.getToken();
  4608. if (this.lexerClass.OPEN_CURLY !== token.type) {
  4609. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('{', token);else return false;
  4610. }
  4611. return true;
  4612. }
  4613. }, {
  4614. key: 'checkCloseCurly',
  4615. value: function checkCloseCurly() {
  4616. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4617. var token = this.getToken();
  4618. if (this.lexerClass.CLOSE_CURLY !== token.type) {
  4619. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('}', token);else return false;
  4620. }
  4621. return true;
  4622. }
  4623. /* It checks if the current token at position pos is a ']'.
  4624. * As a check function it doesn't increment pos.
  4625. *
  4626. * @params bool:attempt, indicates that the token is optional. Defaults: false
  4627. *
  4628. * @returns true if the attempt is true and current token is '[',
  4629. * false is attempt is true and current token is not '['
  4630. **/
  4631. }, {
  4632. key: 'checkOpenBrace',
  4633. value: function checkOpenBrace() {
  4634. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4635. var token = this.getToken();
  4636. if (this.lexerClass.OPEN_BRACE !== token.type) {
  4637. if (!attempt) {
  4638. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('[', token);
  4639. } else {
  4640. return false;
  4641. }
  4642. }
  4643. return true;
  4644. }
  4645. }, {
  4646. key: 'checkCloseBrace',
  4647. value: function checkCloseBrace() {
  4648. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4649. var token = this.getToken();
  4650. if (this.lexerClass.CLOSE_BRACE !== token.type) {
  4651. if (!attempt) {
  4652. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(']', token);
  4653. } else {
  4654. return false;
  4655. }
  4656. }
  4657. return true;
  4658. }
  4659. }, {
  4660. key: 'checkOpenParenthesis',
  4661. value: function checkOpenParenthesis() {
  4662. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4663. var token = this.getToken();
  4664. if (this.lexerClass.OPEN_PARENTHESIS !== token.type) {
  4665. if (!attempt) {
  4666. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('(', token);
  4667. } else {
  4668. return false;
  4669. }
  4670. }
  4671. return true;
  4672. }
  4673. }, {
  4674. key: 'checkCloseParenthesis',
  4675. value: function checkCloseParenthesis() {
  4676. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4677. var token = this.getToken();
  4678. if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) {
  4679. if (!attempt) {
  4680. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(')', token);
  4681. } else {
  4682. return false;
  4683. }
  4684. }
  4685. return true;
  4686. }
  4687. }, {
  4688. key: 'checkEOS',
  4689. value: function checkEOS() {
  4690. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4691. var eosToken = this.getToken();
  4692. if (eosToken.type !== this.lexerClass.EOS) {
  4693. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.eos_missing(eosToken);else return false;
  4694. }
  4695. return true;
  4696. }
  4697. }, {
  4698. key: 'checkFunctionDuplicate',
  4699. value: function checkFunctionDuplicate(functionID, funcIDToken) {
  4700. var id = functionID === null ? "$main" : functionID;
  4701. var index = this.definedFuncsNameList.indexOf(id);
  4702. if (index !== -1) {
  4703. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_function(funcIDToken);
  4704. }
  4705. this.definedFuncsNameList.push(id);
  4706. }
  4707. }, {
  4708. key: 'checkVariableDuplicate',
  4709. value: function checkVariableDuplicate(variableID, variableIDToken) {
  4710. var index = this.getCurrentVariableStack().indexOf(variableID);
  4711. if (index !== -1) {
  4712. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_variable(variableIDToken);
  4713. }
  4714. this.getCurrentVariableStack().push(variableID);
  4715. }
  4716. }, {
  4717. key: 'consumeForSemiColon',
  4718. value: function consumeForSemiColon() {
  4719. var eosToken = this.getToken();
  4720. if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
  4721. this.pos++;
  4722. return;
  4723. }
  4724. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(';', eosToken);
  4725. }
  4726. }, {
  4727. key: 'parseGlobalVariables',
  4728. value: function parseGlobalVariables() {
  4729. var decl = this.parseMaybeConst();
  4730. this.checkEOS();
  4731. this.pos++;
  4732. return decl;
  4733. }
  4734. /*
  4735. * Checks if the next token is PR_CONST. It's only available
  4736. * at global variables declaration level
  4737. * @returns Declararion(const, type, id, initVal?)
  4738. **/
  4739. }, {
  4740. key: 'parseMaybeConst',
  4741. value: function parseMaybeConst() {
  4742. var constToken = this.getToken();
  4743. if (constToken.type === this.lexerClass.RK_CONST) {
  4744. this.pos++;
  4745. var typeString = this.parseType();
  4746. return this.parseDeclaration(typeString, true);
  4747. } else if (this.isVariableType(constToken)) {
  4748. var _typeString = this.parseType();
  4749. return this.parseDeclaration(_typeString);
  4750. } else {
  4751. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken);
  4752. }
  4753. }
  4754. /*
  4755. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  4756. * @returns a list of Declararion(const, type, id, initVal?)
  4757. **/
  4758. }, {
  4759. key: 'parseDeclaration',
  4760. value: function parseDeclaration(typeString) {
  4761. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4762. var initial = null;
  4763. var dim1 = null;
  4764. var dim2 = null;
  4765. var idToken = this.getToken();
  4766. var idString = this.parseID();
  4767. this.checkVariableDuplicate(idString, idToken);
  4768. // Check for array or vector
  4769. // ID[int/IDi][int/IDj]
  4770. if (this.checkOpenBrace(true)) {
  4771. this.pos++;
  4772. this.consumeNewLines();
  4773. dim1 = this.parseArrayDimension();
  4774. this.consumeNewLines();
  4775. this.checkCloseBrace();
  4776. this.pos++;
  4777. if (this.checkOpenBrace(true)) {
  4778. this.pos++;
  4779. this.consumeNewLines();
  4780. dim2 = this.parseArrayDimension();
  4781. this.consumeNewLines();
  4782. this.checkCloseBrace();
  4783. this.pos++;
  4784. }
  4785. }
  4786. var equalsToken = this.getToken();
  4787. if (isConst && equalsToken.type !== this.lexerClass.EQUAL) {
  4788. throw _syntaxErrorFactory.SyntaxErrorFactory.const_not_init(idToken);
  4789. }
  4790. if (equalsToken.type === this.lexerClass.EQUAL) {
  4791. this.pos++;
  4792. initial = this.parseExpressionOR();
  4793. }
  4794. var declaration = null;
  4795. var dimensions = 0;
  4796. if (dim1 !== null) {
  4797. dimensions++;
  4798. if (dim2 !== null) {
  4799. dimensions++;
  4800. }
  4801. declaration = new Commands.ArrayDeclaration(idString, new _compoundType.CompoundType(typeString, dimensions), dim1, dim2, initial, isConst);
  4802. } else {
  4803. declaration = new Commands.Declaration(idString, typeString, initial, isConst);
  4804. }
  4805. declaration.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(idToken);
  4806. var commaToken = this.getToken();
  4807. if (commaToken.type === this.lexerClass.COMMA) {
  4808. this.pos++;
  4809. this.consumeNewLines();
  4810. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  4811. } else {
  4812. return [declaration];
  4813. }
  4814. }
  4815. }, {
  4816. key: 'consumeNewLines',
  4817. value: function consumeNewLines() {
  4818. var token = this.getToken();
  4819. while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) {
  4820. this.pos++;
  4821. token = this.getToken();
  4822. }
  4823. }
  4824. }, {
  4825. key: 'isVariableType',
  4826. value: function isVariableType(token) {
  4827. return this.variableTypes.find(function (v) {
  4828. return v === token.type;
  4829. });
  4830. }
  4831. /*
  4832. * Reads the next token of the stream to check if it is a Integer or an ID.
  4833. * @returns Integer | ID
  4834. **/
  4835. }, {
  4836. key: 'parseArrayDimension',
  4837. value: function parseArrayDimension() {
  4838. var dimToken = this.getToken();
  4839. if (dimToken.type === this.lexerClass.INTEGER) {
  4840. //parse as int literal
  4841. this.pos++;
  4842. return this.getIntLiteral(dimToken);
  4843. } else if (dimToken.type === this.lexerClass.ID) {
  4844. //parse as variable
  4845. this.pos++;
  4846. return this.parseVariable(dimToken);
  4847. } else {
  4848. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken);
  4849. }
  4850. }
  4851. /*
  4852. * Returns an object {type: 'int', value: value}.
  4853. * It checks for binary and hexadecimal integers.
  4854. * @returns object with fields type and value
  4855. **/
  4856. }, {
  4857. key: 'getIntLiteral',
  4858. value: function getIntLiteral(token) {
  4859. var text = token.text;
  4860. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4861. var exp = new Expressions.IntLiteral((0, _parsers.toInt)(text));
  4862. exp.sourceInfo = sourceInfo;
  4863. return exp;
  4864. }
  4865. }, {
  4866. key: 'getRealLiteral',
  4867. value: function getRealLiteral(token) {
  4868. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4869. var exp = new Expressions.RealLiteral((0, _parsers.toReal)(token.text));
  4870. exp.sourceInfo = sourceInfo;
  4871. return exp;
  4872. }
  4873. }, {
  4874. key: 'getStringLiteral',
  4875. value: function getStringLiteral(token) {
  4876. var text = token.text;
  4877. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4878. var exp = new Expressions.StringLiteral((0, _parsers.toString)(text));
  4879. exp.sourceInfo = sourceInfo;
  4880. return exp;
  4881. }
  4882. }, {
  4883. key: 'getBoolLiteral',
  4884. value: function getBoolLiteral(token) {
  4885. var val = (0, _parsers.toBool)(token.text);
  4886. var exp = new Expressions.BoolLiteral(val);
  4887. exp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);;
  4888. return exp;
  4889. }
  4890. }, {
  4891. key: 'parseArrayLiteral',
  4892. value: function parseArrayLiteral() {
  4893. this.checkOpenCurly();
  4894. var beginArray = this.getToken();
  4895. if (this.parsingArrayDimension >= 2) {
  4896. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list('Array dimensions exceed maximum size of 2 at line ' + beginArray.line);
  4897. }
  4898. this.pos++;
  4899. this.parsingArrayDimension++;
  4900. this.consumeNewLines();
  4901. var data = this.parseExpressionList();
  4902. this.consumeNewLines();
  4903. this.checkCloseCurly();
  4904. var endArray = this.getToken();
  4905. this.pos++;
  4906. this.parsingArrayDimension--;
  4907. if (this.parsingArrayDimension === 0) {
  4908. // if (!data.isValid) {
  4909. // // TODO: better error message
  4910. // console.log('invalid array');
  4911. // throw new Error(`Invalid array at line ${beginArray.line}`);
  4912. // }
  4913. }
  4914. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(beginArray, endArray);
  4915. var dataDim = 1;
  4916. if (data[0] instanceof Expressions.ArrayLiteral) {
  4917. dataDim++;
  4918. }
  4919. var type = new _compoundType.CompoundType(_types.Types.UNDEFINED, dataDim);
  4920. var exp = new Expressions.ArrayLiteral(type, data);
  4921. exp.sourceInfo = sourceInfo;
  4922. return exp;
  4923. }
  4924. /*
  4925. * Returns an object {type: 'variable', value: value}.
  4926. * @returns object with fields type and value
  4927. **/
  4928. }, {
  4929. key: 'parseVariable',
  4930. value: function parseVariable(token) {
  4931. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4932. var exp = new Expressions.VariableLiteral(token.text);
  4933. exp.sourceInfo = sourceInfo;
  4934. return exp;
  4935. }
  4936. /*
  4937. * Returns an object representing a function. It has
  4938. * four attributes: returnType, id, formalParams and block.
  4939. * The block object has two attributes: declarations and commands
  4940. **/
  4941. }, {
  4942. key: 'parseFunction',
  4943. value: function parseFunction() {
  4944. this.pushScope(IVProgParser.FUNCTION);
  4945. var formalParams = [];
  4946. var token = this.getToken();
  4947. if (token.type !== this.lexerClass.RK_FUNCTION) {
  4948. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  4949. return null;
  4950. }
  4951. this.pos++;
  4952. var funType = this.parseType();
  4953. var dimensions = 0;
  4954. if (this.checkOpenBrace(true)) {
  4955. this.pos++;
  4956. this.checkCloseBrace();
  4957. this.pos++;
  4958. dimensions++;
  4959. if (this.checkOpenBrace(true)) {
  4960. this.pos++;
  4961. this.checkCloseBrace();
  4962. this.pos++;
  4963. dimensions++;
  4964. }
  4965. }
  4966. var funcIDToken = this.getToken();
  4967. var functionID = this.parseID();
  4968. this.checkFunctionDuplicate(functionID, funcIDToken);
  4969. this.checkOpenParenthesis();
  4970. this.pos++;
  4971. this.consumeNewLines();
  4972. if (!this.checkCloseParenthesis(true)) {
  4973. formalParams = this.parseFormalParameters(); // formal parameters
  4974. this.consumeNewLines();
  4975. this.checkCloseParenthesis();
  4976. this.pos++;
  4977. } else {
  4978. this.pos++;
  4979. }
  4980. this.consumeNewLines();
  4981. var commandsBlock = this.parseCommandBlock();
  4982. var returnType = funType;
  4983. if (dimensions > 0) {
  4984. returnType = new _compoundType.CompoundType(funType, dimensions);
  4985. }
  4986. var func = new Commands.Function(functionID, returnType, formalParams, commandsBlock);
  4987. if (functionID === null && !func.isMain) {
  4988. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_main_return(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line);
  4989. } else if (func.isMain && formalParams.length !== 0) {
  4990. throw _syntaxErrorFactory.SyntaxErrorFactory.main_parameters();
  4991. }
  4992. this.popScope();
  4993. return func;
  4994. }
  4995. /*
  4996. * Parse the formal parameters of a function.
  4997. * @returns a list of objects with the following attributes: type, id and dimensions.
  4998. **/
  4999. }, {
  5000. key: 'parseFormalParameters',
  5001. value: function parseFormalParameters() {
  5002. var list = [];
  5003. while (true) {
  5004. var dimensions = 0;
  5005. var typeString = this.parseType();
  5006. var idToken = this.getToken();
  5007. var idString = this.parseID();
  5008. this.checkVariableDuplicate(idString, idToken);
  5009. if (this.checkOpenBrace(true)) {
  5010. this.pos++;
  5011. dimensions++;
  5012. this.checkCloseBrace();
  5013. this.pos++;
  5014. if (this.checkOpenBrace(true)) {
  5015. this.pos++;
  5016. dimensions++;
  5017. this.checkCloseBrace();
  5018. this.pos++;
  5019. }
  5020. }
  5021. var type = null;
  5022. if (dimensions > 0) {
  5023. type = new _compoundType.CompoundType(typeString, dimensions);
  5024. } else {
  5025. type = typeString;
  5026. }
  5027. list.push(new Commands.FormalParameter(type, idString));
  5028. var commaToken = this.getToken();
  5029. if (commaToken.type !== this.lexerClass.COMMA) break;
  5030. this.pos++;
  5031. this.consumeNewLines();
  5032. }
  5033. return list;
  5034. }
  5035. }, {
  5036. key: 'parseID',
  5037. value: function parseID() {
  5038. var token = this.getToken();
  5039. if (token.type !== this.lexerClass.ID) {
  5040. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5041. }
  5042. this.pos++;
  5043. if (this.insideScope(IVProgParser.FUNCTION)) {
  5044. if (token.text === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5045. return null;
  5046. }
  5047. }
  5048. return token.text;
  5049. }
  5050. }, {
  5051. key: 'parseMaybeLibID',
  5052. value: function parseMaybeLibID() {
  5053. var token = this.getToken();
  5054. if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) {
  5055. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5056. }
  5057. this.pos++;
  5058. return token.text;
  5059. }
  5060. }, {
  5061. key: 'parseType',
  5062. value: function parseType() {
  5063. var token = this.getToken();
  5064. if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) {
  5065. return _types.Types.VOID;
  5066. } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  5067. this.pos++;
  5068. return _types.Types.VOID;
  5069. } else if (this.isVariableType(token)) {
  5070. this.pos++;
  5071. switch (token.type) {
  5072. case this.lexerClass.RK_INTEGER:
  5073. return _types.Types.INTEGER;
  5074. case this.lexerClass.RK_BOOLEAN:
  5075. return _types.Types.BOOLEAN;
  5076. case this.lexerClass.RK_REAL:
  5077. return _types.Types.REAL;
  5078. case this.lexerClass.RK_STRING:
  5079. return _types.Types.STRING;
  5080. default:
  5081. break;
  5082. }
  5083. }
  5084. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_type(this.getTypeArray(), token);
  5085. }
  5086. }, {
  5087. key: 'parseCommandBlock',
  5088. value: function parseCommandBlock() {
  5089. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5090. var variablesDecl = [];
  5091. var commands = [];
  5092. var hasOpen = false;
  5093. if (this.checkOpenCurly(optionalCurly)) {
  5094. this.pos++;
  5095. hasOpen = true;
  5096. }
  5097. this.consumeNewLines();
  5098. while (true) {
  5099. var cmd = this.parseCommand();
  5100. if (cmd === null) break;
  5101. if (cmd !== -1) {
  5102. if (cmd instanceof Array) {
  5103. variablesDecl = variablesDecl.concat(cmd);
  5104. } else {
  5105. commands.push(cmd);
  5106. }
  5107. }
  5108. }
  5109. this.consumeNewLines();
  5110. if (hasOpen) {
  5111. this.checkCloseCurly();
  5112. this.pos++;
  5113. this.consumeNewLines();
  5114. }
  5115. return new Commands.CommandBlock(variablesDecl, commands);
  5116. }
  5117. }, {
  5118. key: 'parseCommand',
  5119. value: function parseCommand() {
  5120. var token = this.getToken();
  5121. if (this.isVariableType(token)) {
  5122. if (!this.insideScope(IVProgParser.FUNCTION)) {
  5123. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_var_declaration(token.line);
  5124. }
  5125. this.pushScope(IVProgParser.BASE);
  5126. var varType = this.parseType();
  5127. this.popScope();
  5128. var cmd = this.parseDeclaration(varType);
  5129. this.checkEOS();
  5130. this.pos++;
  5131. return cmd;
  5132. } else if (token.type === this.lexerClass.ID) {
  5133. return this.parseIDCommand();
  5134. } else if (token.type === this.lexerClass.LIB_ID) {
  5135. return this.parseIDCommand();
  5136. } else if (token.type === this.lexerClass.RK_RETURN) {
  5137. return this.parseReturn();
  5138. } else if (token.type === this.lexerClass.RK_WHILE) {
  5139. return this.parseWhile();
  5140. } else if (token.type === this.lexerClass.RK_FOR) {
  5141. return this.parseFor();
  5142. } else if (token.type === this.lexerClass.RK_BREAK) {
  5143. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  5144. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token);
  5145. }
  5146. return this.parseBreak();
  5147. } else if (token.type === this.lexerClass.RK_SWITCH) {
  5148. return this.parseSwitchCase();
  5149. } else if (token.type === this.lexerClass.RK_DO) {
  5150. return this.parseDoWhile();
  5151. } else if (token.type === this.lexerClass.RK_IF) {
  5152. return this.parseIfThenElse();
  5153. } else if (this.checkEOS(true)) {
  5154. this.pos++;
  5155. return -1;
  5156. } else {
  5157. return null;
  5158. }
  5159. }
  5160. }, {
  5161. key: 'parseSwitchCase',
  5162. value: function parseSwitchCase() {
  5163. this.pushScope(IVProgParser.BREAKABLE);
  5164. this.pos++;
  5165. this.checkOpenParenthesis();
  5166. this.pos++;
  5167. this.consumeNewLines();
  5168. var exp = this.parseExpressionOR();
  5169. this.consumeNewLines();
  5170. this.checkCloseParenthesis();
  5171. this.pos++;
  5172. this.consumeNewLines();
  5173. this.checkOpenCurly();
  5174. this.pos++;
  5175. this.consumeNewLines();
  5176. var casesList = this.parseCases();
  5177. this.consumeNewLines();
  5178. this.checkCloseCurly();
  5179. this.pos++;
  5180. this.consumeNewLines();
  5181. this.popScope();
  5182. return new Commands.Switch(exp, casesList);
  5183. }
  5184. }, {
  5185. key: 'parseDoWhile',
  5186. value: function parseDoWhile() {
  5187. this.pos++;
  5188. this.consumeNewLines();
  5189. this.pushScope(IVProgParser.BREAKABLE);
  5190. var commandsBlock = this.parseCommandBlock();
  5191. this.consumeNewLines(); //Maybe not...
  5192. var whileToken = this.getToken();
  5193. if (whileToken.type !== this.lexerClass.RK_WHILE) {
  5194. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
  5195. }
  5196. this.pos++;
  5197. this.checkOpenParenthesis();
  5198. this.pos++;
  5199. this.consumeNewLines();
  5200. var condition = this.parseExpressionOR();
  5201. this.consumeNewLines();
  5202. this.checkCloseParenthesis();
  5203. this.pos++;
  5204. this.checkEOS();
  5205. this.popScope();
  5206. return new Commands.DoWhile(condition, commandsBlock);
  5207. }
  5208. }, {
  5209. key: 'parseIfThenElse',
  5210. value: function parseIfThenElse() {
  5211. if (this.insideScope(IVProgParser.BREAKABLE)) {
  5212. this.pushScope(IVProgParser.BREAKABLE);
  5213. } else {
  5214. this.pushScope(IVProgParser.COMMAND);
  5215. }
  5216. this.pos++;
  5217. this.checkOpenParenthesis();
  5218. this.pos++;
  5219. this.consumeNewLines();
  5220. var logicalExpression = this.parseExpressionOR();
  5221. this.consumeNewLines();
  5222. this.checkCloseParenthesis();
  5223. this.pos++;
  5224. this.consumeNewLines();
  5225. var cmdBlocks = this.parseCommandBlock();
  5226. var maybeElse = this.getToken();
  5227. if (maybeElse.type === this.lexerClass.RK_ELSE) {
  5228. this.pos++;
  5229. this.consumeNewLines();
  5230. var maybeIf = this.getToken();
  5231. var elseBlock = null;
  5232. if (this.checkOpenCurly(true)) {
  5233. elseBlock = this.parseCommandBlock();
  5234. } else if (maybeIf.type === this.lexerClass.RK_IF) {
  5235. elseBlock = this.parseIfThenElse();
  5236. } else {
  5237. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf);
  5238. }
  5239. return new Commands.IfThenElse(logicalExpression, cmdBlocks, elseBlock);
  5240. }
  5241. this.popScope();
  5242. return new Commands.IfThenElse(logicalExpression, cmdBlocks, null);
  5243. }
  5244. }, {
  5245. key: 'parseFor',
  5246. value: function parseFor() {
  5247. this.pushScope(IVProgParser.BREAKABLE);
  5248. this.pos++;
  5249. this.checkOpenParenthesis();
  5250. this.pos++;
  5251. this.consumeNewLines();
  5252. var attribution = this.parseForAssign();
  5253. this.consumeNewLines();
  5254. var condition = this.parseExpressionOR();
  5255. this.consumeForSemiColon();
  5256. var increment = this.parseForAssign(true);
  5257. this.checkCloseParenthesis();
  5258. this.pos++;
  5259. this.consumeNewLines();
  5260. var commandsBlock = this.parseCommandBlock();
  5261. this.popScope();
  5262. return new Commands.For(attribution, condition, increment, commandsBlock);
  5263. }
  5264. }, {
  5265. key: 'parseWhile',
  5266. value: function parseWhile() {
  5267. this.pushScope(IVProgParser.BREAKABLE);
  5268. this.pos++;
  5269. this.checkOpenParenthesis();
  5270. this.pos++;
  5271. this.consumeNewLines();
  5272. var logicalExpression = this.parseExpressionOR();
  5273. this.consumeNewLines();
  5274. this.checkCloseParenthesis();
  5275. this.pos++;
  5276. this.consumeNewLines();
  5277. var cmdBlocks = this.parseCommandBlock();
  5278. this.popScope();
  5279. return new Commands.While(logicalExpression, cmdBlocks);
  5280. }
  5281. }, {
  5282. key: 'parseBreak',
  5283. value: function parseBreak() {
  5284. this.pos++;
  5285. this.checkEOS();
  5286. this.pos++;
  5287. return new Commands.Break();
  5288. }
  5289. }, {
  5290. key: 'parseReturn',
  5291. value: function parseReturn() {
  5292. this.pos++;
  5293. var exp = null;
  5294. if (!this.checkEOS(true)) {
  5295. exp = this.parseExpressionOR();
  5296. this.checkEOS();
  5297. }
  5298. this.pos++;
  5299. return new Commands.Return(exp);
  5300. }
  5301. }, {
  5302. key: 'parseIDCommand',
  5303. value: function parseIDCommand() {
  5304. var refToken = this.getToken();
  5305. var isID = refToken.type === this.lexerClass.ID;
  5306. var id = this.parseMaybeLibID();
  5307. if (this.checkOpenBrace(true)) {
  5308. this.pos++;
  5309. var lineExpression = null;
  5310. var columnExpression = null;
  5311. this.consumeNewLines();
  5312. lineExpression = this.parseExpression();
  5313. this.consumeNewLines();
  5314. this.checkCloseBrace();
  5315. this.pos++;
  5316. if (this.checkOpenBrace(true)) {
  5317. this.pos++;
  5318. this.consumeNewLines();
  5319. columnExpression = this.parseExpression();
  5320. this.consumeNewLines();
  5321. this.checkCloseBrace();
  5322. this.pos++;
  5323. }
  5324. var equalToken = this.getToken();
  5325. if (equalToken.type !== this.lexerClass.EQUAL) {
  5326. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equalToken);
  5327. }
  5328. this.pos++;
  5329. var exp = this.parseExpressionOR();
  5330. this.checkEOS();
  5331. this.pos++;
  5332. var cmd = new Commands.ArrayIndexAssign(id, lineExpression, columnExpression, exp);
  5333. cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalToken);
  5334. return cmd;
  5335. }
  5336. var equalOrParenthesis = this.getToken();
  5337. if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) {
  5338. this.pos++;
  5339. var _exp = this.parseExpressionOR();
  5340. this.checkEOS();
  5341. this.pos++;
  5342. var _cmd = new Commands.Assign(id, _exp);
  5343. _cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalOrParenthesis);
  5344. return _cmd;
  5345. } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) {
  5346. var funcCall = this.parseFunctionCallCommand(id);
  5347. this.checkEOS();
  5348. this.pos++;
  5349. return funcCall;
  5350. } else if (isID) {
  5351. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list(['=', '('], equalOrParenthesis);
  5352. } else {
  5353. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(refToken);
  5354. }
  5355. }
  5356. }, {
  5357. key: 'parseForAssign',
  5358. value: function parseForAssign() {
  5359. var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5360. if (!isLast) this.consumeNewLines();
  5361. if (this.checkEOS(true)) {
  5362. return null;
  5363. }
  5364. var id = this.parseID();
  5365. var equal = this.getToken();
  5366. if (equal.type !== this.lexerClass.EQUAL) {
  5367. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equal);
  5368. }
  5369. this.pos++;
  5370. var exp = this.parseExpressionOR();
  5371. if (!isLast) {
  5372. this.consumeForSemiColon();
  5373. }
  5374. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equal);
  5375. var cmd = new Commands.Assign(id, exp);
  5376. cmd.sourceInfo = sourceInfo;
  5377. return cmd;
  5378. }
  5379. }, {
  5380. key: 'parseCases',
  5381. value: function parseCases() {
  5382. var token = this.getToken();
  5383. if (token.type !== this.lexerClass.RK_CASE) {
  5384. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token);
  5385. }
  5386. this.pos++;
  5387. var nextToken = this.getToken();
  5388. if (nextToken.type === this.lexerClass.RK_DEFAULT) {
  5389. this.pos++;
  5390. var colonToken = this.getToken();
  5391. if (colonToken.type !== this.lexerClass.COLON) {
  5392. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', colonToken);
  5393. }
  5394. this.pos++;
  5395. this.consumeNewLines();
  5396. var block = this.parseCommandBlock(true);
  5397. var defaultCase = new Commands.Case(null);
  5398. defaultCase.setCommands(block.commands);
  5399. return [defaultCase];
  5400. } else {
  5401. var exp = this.parseExpressionOR();
  5402. var _colonToken = this.getToken();
  5403. if (_colonToken.type !== this.lexerClass.COLON) {
  5404. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', _colonToken);
  5405. }
  5406. this.pos++;
  5407. this.consumeNewLines();
  5408. var _block = this.parseCommandBlock(true);
  5409. var aCase = new Commands.Case(exp);
  5410. aCase.setCommands(_block.commands);
  5411. var caseToken = this.getToken();
  5412. if (caseToken.type === this.lexerClass.RK_CASE) {
  5413. return [aCase].concat(this.parseCases());
  5414. } else {
  5415. return [aCase];
  5416. }
  5417. }
  5418. }
  5419. /*
  5420. * Parses an Expression following the structure:
  5421. *
  5422. * EOR => EAnd ( 'or' EOR)? #expression and
  5423. *
  5424. * EOR => ENot ('and' EOR)? #expression or
  5425. *
  5426. * ENot => 'not'? ER #expression not
  5427. *
  5428. * ER => E ((>=, <=, ==, >, <) E)? #expression relational
  5429. *
  5430. * E => factor ((+, -) E)? #expression
  5431. *
  5432. * factor=> term ((*, /, %) factor)?
  5433. *
  5434. * term => literal || arrayAccess || FuncCall || ID || '('EAnd')'
  5435. **/
  5436. }, {
  5437. key: 'parseExpressionOR',
  5438. value: function parseExpressionOR() {
  5439. var exp1 = this.parseExpressionAND();
  5440. while (this.getToken().type === this.lexerClass.OR_OPERATOR) {
  5441. var opToken = this.getToken();
  5442. this.pos++;
  5443. var or = (0, _operators.convertFromString)('or');
  5444. this.consumeNewLines();
  5445. var exp2 = this.parseExpressionAND();
  5446. var _finalExp = new Expressions.InfixApp(or, exp1, exp2);
  5447. _finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5448. exp1 = _finalExp;
  5449. }
  5450. return exp1;
  5451. }
  5452. }, {
  5453. key: 'parseExpressionAND',
  5454. value: function parseExpressionAND() {
  5455. var exp1 = this.parseExpressionNot();
  5456. while (this.getToken().type === this.lexerClass.AND_OPERATOR) {
  5457. var opToken = this.getToken();
  5458. this.pos++;
  5459. var and = (0, _operators.convertFromString)('and');
  5460. this.consumeNewLines();
  5461. var exp2 = this.parseExpressionNot();
  5462. var _finalExp2 = new Expressions.InfixApp(and, exp1, exp2);
  5463. _finalExp2.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5464. exp1 = _finalExp2;
  5465. }
  5466. return exp1;
  5467. }
  5468. }, {
  5469. key: 'parseExpressionNot',
  5470. value: function parseExpressionNot() {
  5471. var maybeNotToken = this.getToken();
  5472. if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) {
  5473. var opToken = this.getToken();
  5474. this.pos++;
  5475. var not = (0, _operators.convertFromString)('not');
  5476. var exp1 = this.parseExpressionRel();
  5477. finalExp = new Expressions.UnaryApp(not, exp1);
  5478. finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5479. return finalExp;
  5480. } else {
  5481. return this.parseExpressionRel();
  5482. }
  5483. }
  5484. }, {
  5485. key: 'parseExpressionRel',
  5486. value: function parseExpressionRel() {
  5487. var exp1 = this.parseExpression();
  5488. while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) {
  5489. var relToken = this.getToken();
  5490. this.pos++;
  5491. var rel = (0, _operators.convertFromString)(relToken.text);
  5492. var exp2 = this.parseExpression();
  5493. var _finalExp3 = new Expressions.InfixApp(rel, exp1, exp2);
  5494. _finalExp3.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(relToken);
  5495. exp1 = _finalExp3;
  5496. }
  5497. return exp1;
  5498. }
  5499. }, {
  5500. key: 'parseExpression',
  5501. value: function parseExpression() {
  5502. var factor = this.parseFactor();
  5503. while (this.getToken().type === this.lexerClass.SUM_OP) {
  5504. var sumOpToken = this.getToken();
  5505. this.pos++;
  5506. var op = (0, _operators.convertFromString)(sumOpToken.text);
  5507. var factor2 = this.parseFactor();
  5508. var _finalExp4 = new Expressions.InfixApp(op, factor, factor2);
  5509. _finalExp4.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(sumOpToken);
  5510. factor = _finalExp4;
  5511. }
  5512. return factor;
  5513. }
  5514. }, {
  5515. key: 'parseFactor',
  5516. value: function parseFactor() {
  5517. var term = this.parseTerm();
  5518. while (this.getToken().type === this.lexerClass.MULTI_OP) {
  5519. var multOpToken = this.getToken();
  5520. this.pos++;
  5521. var op = (0, _operators.convertFromString)(multOpToken.text);
  5522. var term2 = this.parseTerm();
  5523. var _finalExp5 = new Expressions.InfixApp(op, term, term2);
  5524. _finalExp5.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(multOpToken);
  5525. term = _finalExp5;
  5526. }
  5527. return term;
  5528. }
  5529. }, {
  5530. key: 'parseTerm',
  5531. value: function parseTerm() {
  5532. var token = this.getToken();
  5533. var sourceInfo = null;
  5534. switch (token.type) {
  5535. case this.lexerClass.SUM_OP:
  5536. this.pos++;
  5537. sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  5538. var exp = new Expressions.UnaryApp((0, _operators.convertFromString)(token.text), this.parseTerm());
  5539. exp.sourceInfo = sourceInfo;
  5540. return exp;
  5541. case this.lexerClass.INTEGER:
  5542. this.pos++;
  5543. return this.getIntLiteral(token);
  5544. case this.lexerClass.REAL:
  5545. this.pos++;
  5546. return this.getRealLiteral(token);
  5547. case this.lexerClass.STRING:
  5548. this.pos++;
  5549. return this.getStringLiteral(token);
  5550. case this.lexerClass.RK_TRUE:
  5551. case this.lexerClass.RK_FALSE:
  5552. this.pos++;
  5553. return this.getBoolLiteral(token);
  5554. case this.lexerClass.OPEN_CURLY:
  5555. return this.parseArrayLiteral();
  5556. case this.lexerClass.ID:
  5557. case this.lexerClass.LIB_ID:
  5558. return this.parseIDTerm();
  5559. case this.lexerClass.OPEN_PARENTHESIS:
  5560. return this.parseParenthesisExp();
  5561. default:
  5562. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_terminal(token);
  5563. }
  5564. }
  5565. }, {
  5566. key: 'parseIDTerm',
  5567. value: function parseIDTerm() {
  5568. var tokenA = this.getToken();
  5569. var id = this.parseMaybeLibID();
  5570. var isID = tokenA.type === this.lexerClass.ID;
  5571. if (isID && this.checkOpenBrace(true)) {
  5572. var tokenB = null;
  5573. this.pos++;
  5574. var firstIndex = this.parseExpression();
  5575. var secondIndex = null;
  5576. this.consumeNewLines();
  5577. this.checkCloseBrace();
  5578. tokenB = this.getToken();
  5579. this.pos++;
  5580. if (this.checkOpenBrace(true)) {
  5581. this.pos++;
  5582. secondIndex = this.parseExpression();
  5583. this.consumeNewLines();
  5584. this.checkCloseBrace();
  5585. tokenB = this.getToken();
  5586. this.pos++;
  5587. }
  5588. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5589. var exp = new Expressions.ArrayAccess(id, firstIndex, secondIndex);
  5590. exp.sourceInfo = sourceInfo;
  5591. return exp;
  5592. } else if (this.checkOpenParenthesis(true)) {
  5593. return this.parseFunctionCallExpression(id);
  5594. } else if (isID) {
  5595. var _sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(tokenA);
  5596. var _exp2 = new Expressions.VariableLiteral(id);
  5597. _exp2.sourceInfo = _sourceInfo;
  5598. return _exp2;
  5599. } else {
  5600. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(tokenA);
  5601. }
  5602. }
  5603. }, {
  5604. key: 'getFunctionName',
  5605. value: function getFunctionName(id) {
  5606. var name = _definedFunctions.LanguageDefinedFunction.getInternalName(id);
  5607. if (name === null) {
  5608. if (id === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5609. return null;
  5610. }
  5611. return id;
  5612. } else {
  5613. return name;
  5614. }
  5615. }
  5616. }, {
  5617. key: 'parseFunctionCallExpression',
  5618. value: function parseFunctionCallExpression(id) {
  5619. var tokenA = this.getToken(this.pos - 1);
  5620. var actualParameters = this.parseActualParameters();
  5621. var tokenB = this.getToken(this.pos - 1);
  5622. var funcName = this.getFunctionName(id);
  5623. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5624. var cmd = new Expressions.FunctionCall(funcName, actualParameters);
  5625. cmd.sourceInfo = sourceInfo;
  5626. return cmd;
  5627. }
  5628. }, {
  5629. key: 'parseFunctionCallCommand',
  5630. value: function parseFunctionCallCommand(id) {
  5631. return this.parseFunctionCallExpression(id);
  5632. }
  5633. }, {
  5634. key: 'parseParenthesisExp',
  5635. value: function parseParenthesisExp() {
  5636. this.checkOpenParenthesis();
  5637. var tokenA = this.getToken();
  5638. this.pos++;
  5639. this.consumeNewLines();
  5640. var exp = this.parseExpressionOR();
  5641. this.consumeNewLines();
  5642. this.checkCloseParenthesis();
  5643. var tokenB = this.getToken();
  5644. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5645. this.pos++;
  5646. exp.sourceInfo = sourceInfo;
  5647. return exp;
  5648. }
  5649. }, {
  5650. key: 'parseActualParameters',
  5651. value: function parseActualParameters() {
  5652. this.checkOpenParenthesis();
  5653. this.pos++;
  5654. if (this.checkCloseParenthesis(true)) {
  5655. this.pos++;
  5656. return [];
  5657. }
  5658. this.consumeNewLines();
  5659. var list = this.parseExpressionList();
  5660. this.consumeNewLines();
  5661. this.checkCloseParenthesis();
  5662. this.pos++;
  5663. return list;
  5664. }
  5665. }, {
  5666. key: 'parseExpressionList',
  5667. value: function parseExpressionList() {
  5668. var list = [];
  5669. while (true) {
  5670. var exp = this.parseExpressionOR();
  5671. list.push(exp);
  5672. var maybeToken = this.getToken();
  5673. if (maybeToken.type !== this.lexerClass.COMMA) {
  5674. break;
  5675. } else {
  5676. this.pos++;
  5677. this.consumeNewLines();
  5678. }
  5679. }
  5680. return list;
  5681. }
  5682. }, {
  5683. key: 'getTypeArray',
  5684. value: function getTypeArray() {
  5685. var _this = this;
  5686. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  5687. return types.map(function (x) {
  5688. return _this.lexer.literalNames[x];
  5689. });
  5690. }
  5691. }]);
  5692. return IVProgParser;
  5693. }();
  5694. /***/ }),
  5695. /***/ "./js/ast/operators.js":
  5696. /*!*****************************!*\
  5697. !*** ./js/ast/operators.js ***!
  5698. \*****************************/
  5699. /*! no static exports found */
  5700. /***/ (function(module, exports, __webpack_require__) {
  5701. "use strict";
  5702. Object.defineProperty(exports, "__esModule", {
  5703. value: true
  5704. });
  5705. exports.convertFromString = convertFromString;
  5706. var Operators = exports.Operators = Object.freeze({
  5707. ADD: { ord: 0, value: "+" },
  5708. SUB: { ord: 1, value: "-" },
  5709. MULT: { ord: 2, value: '*' },
  5710. DIV: { ord: 3, value: '/' },
  5711. MOD: { ord: 4, value: '%' },
  5712. GT: { ord: 5, value: '>' },
  5713. GE: { ord: 6, value: '>=' },
  5714. LT: { ord: 7, value: '<' },
  5715. LE: { ord: 8, value: '<=' },
  5716. EQ: { ord: 9, value: '==' },
  5717. NEQ: { ord: 10, value: '!=' },
  5718. AND: { ord: 11, value: 'and' },
  5719. OR: { ord: 12, value: 'or' },
  5720. NOT: { ord: 13, value: 'not' }
  5721. });
  5722. function convertFromString(op) {
  5723. switch (op) {
  5724. case '+':
  5725. return Operators.ADD;
  5726. case '-':
  5727. return Operators.SUB;
  5728. case '*':
  5729. return Operators.MULT;
  5730. case '/':
  5731. return Operators.DIV;
  5732. case '%':
  5733. return Operators.MOD;
  5734. case '>':
  5735. return Operators.GT;
  5736. case '>=':
  5737. return Operators.GE;
  5738. case '<':
  5739. return Operators.LT;
  5740. case '<=':
  5741. return Operators.LE;
  5742. case '==':
  5743. return Operators.EQ;
  5744. case '!=':
  5745. return Operators.NEQ;
  5746. case 'and':
  5747. return Operators.AND;
  5748. case 'or':
  5749. return Operators.OR;
  5750. case 'not':
  5751. return Operators.NOT;
  5752. }
  5753. }
  5754. /***/ }),
  5755. /***/ "./js/ast/sourceInfo.js":
  5756. /*!******************************!*\
  5757. !*** ./js/ast/sourceInfo.js ***!
  5758. \******************************/
  5759. /*! no static exports found */
  5760. /***/ (function(module, exports, __webpack_require__) {
  5761. "use strict";
  5762. Object.defineProperty(exports, "__esModule", {
  5763. value: true
  5764. });
  5765. 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; }; }();
  5766. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5767. var SourceInfo = exports.SourceInfo = function () {
  5768. _createClass(SourceInfo, null, [{
  5769. key: "createSourceInfo",
  5770. value: function createSourceInfo(token) {
  5771. return new SourceInfo(token.line, token.column, token.text.length);
  5772. }
  5773. }, {
  5774. key: "createSourceInfoFromList",
  5775. value: function createSourceInfoFromList(tokenA, tokenB) {
  5776. var line = tokenA.line;
  5777. var column = tokenA.column;
  5778. // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  5779. // No idea why...
  5780. var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex;
  5781. return new SourceInfo(line, column, size);
  5782. }
  5783. }]);
  5784. function SourceInfo(line, column, size) {
  5785. _classCallCheck(this, SourceInfo);
  5786. this.line = line;
  5787. this.column = column;
  5788. this.size = size;
  5789. }
  5790. return SourceInfo;
  5791. }();
  5792. /***/ }),
  5793. /***/ "./js/io/domConsole.js":
  5794. /*!*****************************!*\
  5795. !*** ./js/io/domConsole.js ***!
  5796. \*****************************/
  5797. /*! no static exports found */
  5798. /***/ (function(module, exports, __webpack_require__) {
  5799. "use strict";
  5800. Object.defineProperty(exports, "__esModule", {
  5801. value: true
  5802. });
  5803. exports.DOMConsole = undefined;
  5804. 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; }; }();
  5805. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  5806. var _jquery2 = _interopRequireDefault(_jquery);
  5807. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5808. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5809. var DOMConsole = exports.DOMConsole = function () {
  5810. _createClass(DOMConsole, null, [{
  5811. key: 'USER',
  5812. get: function get() {
  5813. return 0;
  5814. }
  5815. }, {
  5816. key: 'INFO',
  5817. get: function get() {
  5818. return 1;
  5819. }
  5820. }, {
  5821. key: 'ERR',
  5822. get: function get() {
  5823. return 2;
  5824. }
  5825. }]);
  5826. function DOMConsole(elementID) {
  5827. _classCallCheck(this, DOMConsole);
  5828. this.input = null;
  5829. this.needInput = false;
  5830. this.termDiv = null;
  5831. this.anyKey = false;
  5832. this.parent = (0, _jquery2.default)(elementID);
  5833. this.setup();
  5834. this.inputListeners = [];
  5835. }
  5836. _createClass(DOMConsole, [{
  5837. key: 'setup',
  5838. value: function setup() {
  5839. this._setupDom();
  5840. this._setupEvents();
  5841. }
  5842. }, {
  5843. key: '_setupEvents',
  5844. value: function _setupEvents() {
  5845. var _this = this;
  5846. this.input.on("keydown", function (event) {
  5847. if (!_this.needInput) {
  5848. event.preventDefault();
  5849. return;
  5850. }
  5851. var keyCode = event.which;
  5852. if (keyCode === 13 || _this.anyKey) {
  5853. var text = _this.input.val();
  5854. text = text.replace('[\n\r]+', '');
  5855. _this.notifyListeners(text);
  5856. _this.write(text);
  5857. _this.input.val("");
  5858. }
  5859. });
  5860. }
  5861. }, {
  5862. key: '_setupDom',
  5863. value: function _setupDom() {
  5864. this.termDiv = (0, _jquery2.default)("<div></div>");
  5865. this.termDiv.addClass("ivprog-term-div");
  5866. this.input = (0, _jquery2.default)('<input text="type">');
  5867. this.input.addClass("ivprog-term-input");
  5868. this.termDiv.append(this.input);
  5869. this.parent.append(this.termDiv);
  5870. }
  5871. }, {
  5872. key: 'notifyListeners',
  5873. value: function notifyListeners(text) {
  5874. this.inputListeners.forEach(function (resolve) {
  5875. return resolve(text);
  5876. });
  5877. this.inputListeners.splice(0, this.inputListeners.length);
  5878. this.hideInput();
  5879. this.anyKey = false;
  5880. }
  5881. }, {
  5882. key: 'write',
  5883. value: function write(text) {
  5884. this._appendText(text, DOMConsole.USER);
  5885. }
  5886. }, {
  5887. key: 'info',
  5888. value: function info(text) {
  5889. this._appendText(text, DOMConsole.INFO);
  5890. }
  5891. }, {
  5892. key: 'err',
  5893. value: function err(text) {
  5894. this._appendText(text, DOMConsole.ERR);
  5895. }
  5896. }, {
  5897. key: '_appendText',
  5898. value: function _appendText(text, type) {
  5899. var divClass = this.getClassForType(type);
  5900. var textDiv = (0, _jquery2.default)("<div></div>");
  5901. textDiv.addClass(divClass);
  5902. textDiv.append(text);
  5903. textDiv.insertBefore(this.input);
  5904. this.scrollTerm();
  5905. }
  5906. }, {
  5907. key: 'scrollTerm',
  5908. value: function scrollTerm() {
  5909. this.termDiv.animate({
  5910. scrollTop: this.termDiv.prop('scrollHeight')
  5911. }, 0);
  5912. }
  5913. }, {
  5914. key: 'getClassForType',
  5915. value: function getClassForType(type) {
  5916. switch (type) {
  5917. case DOMConsole.USER:
  5918. return "ivprog-term-userText";
  5919. case DOMConsole.INFO:
  5920. return "ivprog-term-info";
  5921. case DOMConsole.ERR:
  5922. return "ivprog-term-error";
  5923. }
  5924. }
  5925. }, {
  5926. key: 'dispose',
  5927. value: function dispose() {
  5928. this.parent.off();
  5929. this.input.off();
  5930. this.input = null;
  5931. this.parent.empty();
  5932. }
  5933. }, {
  5934. key: 'showInput',
  5935. value: function showInput() {
  5936. this.needInput = true;
  5937. this.input.show();
  5938. this.input.focus();
  5939. }
  5940. }, {
  5941. key: 'hideInput',
  5942. value: function hideInput() {
  5943. this.needInput = false;
  5944. this.input.hide();
  5945. }
  5946. }, {
  5947. key: 'requestInput',
  5948. value: function requestInput(callback) {
  5949. var anyKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5950. this.inputListeners.push(callback);
  5951. this.anyKey = anyKey;
  5952. this.showInput();
  5953. }
  5954. }, {
  5955. key: 'sendOutput',
  5956. value: function sendOutput(text) {
  5957. var _this2 = this;
  5958. text.split("\n").forEach(function (t) {
  5959. t = t.replace(/\t/g, '&#9;');
  5960. _this2.write(t);
  5961. });
  5962. }
  5963. }, {
  5964. key: 'clear',
  5965. value: function clear() {
  5966. this.input.parent().children().not(this.input).remove();
  5967. this.input.val("");
  5968. }
  5969. }]);
  5970. return DOMConsole;
  5971. }();
  5972. /***/ }),
  5973. /***/ "./js/io/input.js":
  5974. /*!************************!*\
  5975. !*** ./js/io/input.js ***!
  5976. \************************/
  5977. /*! no static exports found */
  5978. /***/ (function(module, exports, __webpack_require__) {
  5979. "use strict";
  5980. Object.defineProperty(exports, "__esModule", {
  5981. value: true
  5982. });
  5983. 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; }; }();
  5984. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5985. var Input = exports.Input = function () {
  5986. function Input() {
  5987. _classCallCheck(this, Input);
  5988. }
  5989. _createClass(Input, [{
  5990. key: "requestInput",
  5991. value: function requestInput(callback) {
  5992. throw new Error("Must be implemented");
  5993. }
  5994. }]);
  5995. return Input;
  5996. }();
  5997. /***/ }),
  5998. /***/ "./js/io/output.js":
  5999. /*!*************************!*\
  6000. !*** ./js/io/output.js ***!
  6001. \*************************/
  6002. /*! no static exports found */
  6003. /***/ (function(module, exports, __webpack_require__) {
  6004. "use strict";
  6005. Object.defineProperty(exports, "__esModule", {
  6006. value: true
  6007. });
  6008. 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; }; }();
  6009. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6010. var Output = exports.Output = function () {
  6011. function Output() {
  6012. _classCallCheck(this, Output);
  6013. }
  6014. _createClass(Output, [{
  6015. key: "sendOutput",
  6016. value: function sendOutput(text) {
  6017. throw new Error("Must be implemented");
  6018. }
  6019. }]);
  6020. return Output;
  6021. }();
  6022. /***/ }),
  6023. /***/ "./js/main.js":
  6024. /*!********************!*\
  6025. !*** ./js/main.js ***!
  6026. \********************/
  6027. /*! no static exports found */
  6028. /***/ (function(module, exports, __webpack_require__) {
  6029. "use strict";
  6030. Object.defineProperty(exports, "__esModule", {
  6031. value: true
  6032. });
  6033. exports.i18n = exports.LocalizedStrings = exports.initVisualUI = exports.runner = undefined;
  6034. var _runner = __webpack_require__(/*! ./runner */ "./js/runner.js");
  6035. var _functions = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js");
  6036. var _localizedStringsService = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6037. var _i18nHelper = __webpack_require__(/*! ./services/i18nHelper */ "./js/services/i18nHelper.js");
  6038. var i18n = _i18nHelper.i18nHelper.i18n;
  6039. exports.runner = _runner.runner;
  6040. exports.initVisualUI = _functions.initVisualUI;
  6041. exports.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  6042. exports.i18n = i18n;
  6043. /***/ }),
  6044. /***/ "./js/processor/compatibilityTable.js":
  6045. /*!********************************************!*\
  6046. !*** ./js/processor/compatibilityTable.js ***!
  6047. \********************************************/
  6048. /*! no static exports found */
  6049. /***/ (function(module, exports, __webpack_require__) {
  6050. "use strict";
  6051. Object.defineProperty(exports, "__esModule", {
  6052. value: true
  6053. });
  6054. exports.resultTypeAfterInfixOp = resultTypeAfterInfixOp;
  6055. exports.resultTypeAfterUnaryOp = resultTypeAfterUnaryOp;
  6056. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6057. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6058. var _multiType = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6059. function buildInfixAddTable() {
  6060. var table = [[], [], [], []];
  6061. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6062. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6063. table[_types.Types.INTEGER.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6064. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6065. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6066. table[_types.Types.REAL.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6067. table[_types.Types.STRING.ord][_types.Types.INTEGER.ord] = _types.Types.STRING;
  6068. table[_types.Types.STRING.ord][_types.Types.REAL.ord] = _types.Types.STRING;
  6069. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6070. table[_types.Types.STRING.ord][_types.Types.BOOLEAN.ord] = _types.Types.STRING;
  6071. return table;
  6072. }
  6073. function buildInfixMultiDivSubTable() {
  6074. var table = [[], [], [], []];
  6075. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6076. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6077. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6078. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6079. return table;
  6080. }
  6081. function buildInfixEqualityInequalityTable() {
  6082. var table = [[], [], [], []];
  6083. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  6084. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  6085. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6086. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6087. return table;
  6088. }
  6089. function buildInfixRelationalTable() {
  6090. var table = [[], [], [], []];
  6091. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  6092. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  6093. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6094. return table;
  6095. }
  6096. function buildInfixAndOrTable() {
  6097. var table = [[], [], [], []];
  6098. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6099. return table;
  6100. }
  6101. function buildInfixModTable() {
  6102. var table = [[], [], [], []];
  6103. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6104. return table;
  6105. }
  6106. function buildUnarySumSubList() {
  6107. var list = [];
  6108. list[_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6109. list[_types.Types.REAL.ord] = _types.Types.REAL;
  6110. return list;
  6111. }
  6112. function buildUnaryNegList() {
  6113. var list = [];
  6114. list[_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6115. return list;
  6116. }
  6117. function buildInfixCompatibilityTable() {
  6118. var compatibilityMap = new WeakMap();
  6119. compatibilityMap.set(_operators.Operators.ADD, buildInfixAddTable());
  6120. compatibilityMap.set(_operators.Operators.SUB, buildInfixMultiDivSubTable());
  6121. compatibilityMap.set(_operators.Operators.MULT, buildInfixMultiDivSubTable());
  6122. compatibilityMap.set(_operators.Operators.DIV, buildInfixMultiDivSubTable());
  6123. compatibilityMap.set(_operators.Operators.EQ, buildInfixEqualityInequalityTable());
  6124. compatibilityMap.set(_operators.Operators.NEQ, buildInfixEqualityInequalityTable());
  6125. compatibilityMap.set(_operators.Operators.GE, buildInfixRelationalTable());
  6126. compatibilityMap.set(_operators.Operators.GT, buildInfixRelationalTable());
  6127. compatibilityMap.set(_operators.Operators.LE, buildInfixRelationalTable());
  6128. compatibilityMap.set(_operators.Operators.LT, buildInfixRelationalTable());
  6129. compatibilityMap.set(_operators.Operators.OR, buildInfixAndOrTable());
  6130. compatibilityMap.set(_operators.Operators.AND, buildInfixAndOrTable());
  6131. compatibilityMap.set(_operators.Operators.MOD, buildInfixModTable());
  6132. return compatibilityMap;
  6133. }
  6134. function buildUnaryCompatibilityTable() {
  6135. var compatibilityMap = new WeakMap();
  6136. compatibilityMap.set(_operators.Operators.ADD, buildUnarySumSubList());
  6137. compatibilityMap.set(_operators.Operators.SUB, buildUnarySumSubList());
  6138. compatibilityMap.set(_operators.Operators.NOT, buildUnaryNegList());
  6139. return compatibilityMap;
  6140. }
  6141. var infixMap = buildInfixCompatibilityTable();
  6142. var unaryMap = buildUnaryCompatibilityTable();
  6143. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  6144. try {
  6145. if (leftExpressionType instanceof _multiType.MultiType && rightExpressionType instanceof _multiType.MultiType) {
  6146. var newMulti = [];
  6147. for (var i = 0; i < leftExpressionType.types.length; i++) {
  6148. var element = leftExpressionType.types[i];
  6149. if (rightExpressionType.types.indexOf(element) !== -1) {
  6150. newMulti.push(element);
  6151. }
  6152. }
  6153. if (newMulti.length <= 0) {
  6154. return _types.Types.UNDEFINED;
  6155. } else {
  6156. return new _multiType.MultiType(newMulti);
  6157. }
  6158. } else if (leftExpressionType instanceof _multiType.MultiType) {
  6159. if (leftExpressionType.isCompatible(rightExpressionType)) {
  6160. return rightExpressionType;
  6161. } else {
  6162. return _types.Types.UNDEFINED;
  6163. }
  6164. } else if (rightExpressionType instanceof _multiType.MultiType) {
  6165. if (rightExpressionType.isCompatible(leftExpressionType)) {
  6166. return leftExpressionType;
  6167. } else {
  6168. return _types.Types.UNDEFINED;
  6169. }
  6170. }
  6171. var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
  6172. if (resultType === null || resultType === undefined) {
  6173. return _types.Types.UNDEFINED;
  6174. }
  6175. return resultType;
  6176. } catch (e) {
  6177. if (e instanceof TypeError) {
  6178. return _types.Types.UNDEFINED;
  6179. } else {
  6180. throw e;
  6181. }
  6182. }
  6183. }
  6184. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  6185. try {
  6186. if (leftExpressionType instanceof _multiType.MultiType) {
  6187. return leftExpressionType;
  6188. }
  6189. return unaryMap.get(operator)[leftExpressionType.ord];
  6190. } catch (e) {
  6191. if (e instanceof TypeError) {
  6192. return _types.Types.UNDEFINED;
  6193. } else {
  6194. throw e;
  6195. }
  6196. }
  6197. }
  6198. /***/ }),
  6199. /***/ "./js/processor/context.js":
  6200. /*!*********************************!*\
  6201. !*** ./js/processor/context.js ***!
  6202. \*********************************/
  6203. /*! no static exports found */
  6204. /***/ (function(module, exports, __webpack_require__) {
  6205. "use strict";
  6206. Object.defineProperty(exports, "__esModule", {
  6207. value: true
  6208. });
  6209. var Context = exports.Context = Object.freeze({
  6210. BASE: Symbol('context:base'),
  6211. BREAKABLE: Symbol('context:breakable'),
  6212. FUNCTION: Symbol('context:function')
  6213. });
  6214. /***/ }),
  6215. /***/ "./js/processor/definedFunctions.js":
  6216. /*!******************************************!*\
  6217. !*** ./js/processor/definedFunctions.js ***!
  6218. \******************************************/
  6219. /*! no static exports found */
  6220. /***/ (function(module, exports, __webpack_require__) {
  6221. "use strict";
  6222. Object.defineProperty(exports, "__esModule", {
  6223. value: true
  6224. });
  6225. exports.LanguageDefinedFunction = undefined;
  6226. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  6227. var _io = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  6228. var _strings = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  6229. var _arrays = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  6230. var _lang = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  6231. var _math = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  6232. function valueToKey(value, object) {
  6233. for (var key in object) {
  6234. if (object.hasOwnProperty(key)) {
  6235. if (object[key] === value) {
  6236. return key;
  6237. }
  6238. }
  6239. }
  6240. return null;
  6241. }
  6242. function concatObjects() {
  6243. var result = {};
  6244. for (var _len = arguments.length, objs = Array(_len), _key = 0; _key < _len; _key++) {
  6245. objs[_key] = arguments[_key];
  6246. }
  6247. for (var i = 0; i < objs.length; i++) {
  6248. var obj = objs[i];
  6249. for (var key in obj) {
  6250. if (obj.hasOwnProperty(key)) {
  6251. result[key] = obj[key];
  6252. }
  6253. }
  6254. }
  6255. return result;
  6256. }
  6257. var libsObject = {
  6258. $mathLib: {
  6259. $sin: (0, _math.createSinFun)(),
  6260. $cos: (0, _math.createCosFun)(),
  6261. $tan: (0, _math.createTanFun)(),
  6262. $sqrt: (0, _math.createSqrtFun)(),
  6263. $pow: (0, _math.createPowFun)(),
  6264. $log: (0, _math.createLogFun)(),
  6265. $abs: (0, _math.createAbsFun)(),
  6266. $negate: (0, _math.createNegateFun)(),
  6267. $invert: (0, _math.createInvertFun)(),
  6268. $max: (0, _math.createMaxFun)(),
  6269. $min: (0, _math.createMinFun)()
  6270. },
  6271. $ioLib: {
  6272. $read: (0, _io.createInputFun)(),
  6273. $write: (0, _io.createOutputFun)()
  6274. },
  6275. $strLib: {
  6276. $substring: (0, _strings.createSubstringFun)(),
  6277. $length: (0, _strings.createLengthFun)(),
  6278. $uppercase: (0, _strings.createUppercaseFun)(),
  6279. $lowercase: (0, _strings.createLowercaseFun)(),
  6280. $charAt: (0, _strings.createrCharAtFun)()
  6281. },
  6282. $arrayLib: {
  6283. $numElements: (0, _arrays.createNumElementsFun)(),
  6284. $matrixLines: (0, _arrays.createMatrixLinesFun)(),
  6285. $matrixColumns: (0, _arrays.createMatrixColumnsFun)()
  6286. },
  6287. $langLib: {
  6288. $isReal: (0, _lang.createIsRealFun)(),
  6289. $isInt: (0, _lang.createIsIntFun)(),
  6290. $isBool: (0, _lang.createIsBoolFun)(),
  6291. $castReal: (0, _lang.createCastRealFun)(),
  6292. $castInt: (0, _lang.createCastIntFun)(),
  6293. $castBool: (0, _lang.createCastBoolFun)(),
  6294. $castString: (0, _lang.createCastStringFun)()
  6295. }
  6296. };
  6297. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  6298. var LanguageDefinedFunction = exports.LanguageDefinedFunction = Object.freeze({
  6299. getMainFunctionName: function getMainFunctionName() {
  6300. return _languageService.LanguageService.getCurrentLangFuncs().main_function;
  6301. },
  6302. getInternalName: function getInternalName(localName) {
  6303. if (localName.indexOf(".") !== -1) {
  6304. var names = localName.split(".");
  6305. var lib = valueToKey(names[0], _languageService.LanguageService.getCurrentLangLibs());
  6306. var internalName = valueToKey(names[1], _languageService.LanguageService.getCurrentLangFuncs());
  6307. if (lib === null || internalName === null) {
  6308. return null;
  6309. }
  6310. return lib + "." + internalName;
  6311. }
  6312. var funcName = valueToKey(localName, _languageService.LanguageService.getCurrentLangFuncs());
  6313. if (funcName !== null) {
  6314. if (funcsObject[funcName]) {
  6315. return funcName;
  6316. }
  6317. }
  6318. return null;
  6319. },
  6320. getFunction: function getFunction(internalName) {
  6321. if (internalName.indexOf(".") !== -1) {
  6322. var names = internalName.split(".");
  6323. var libName = names[0];
  6324. var funName = names[1];
  6325. return libsObject[libName][funName];
  6326. }
  6327. return funcsObject[internalName];
  6328. },
  6329. getLocalName: function getLocalName(internalName) {
  6330. if (internalName.indexOf(".") !== -1) {
  6331. var names = internalName.split(".");
  6332. var libName = _languageService.LanguageService.getCurrentLangLibs()[names[0]];
  6333. var funName = _languageService.LanguageService.getCurrentLangFuncs()[names[1]];
  6334. return libName + '.' + funName;
  6335. } else if (_languageService.LanguageService.getCurrentLangFuncs()[internalName]) {
  6336. return _languageService.LanguageService.getCurrentLangFuncs()[internalName];
  6337. } else {
  6338. return internalName;
  6339. }
  6340. }
  6341. });
  6342. /***/ }),
  6343. /***/ "./js/processor/error/processorErrorFactory.js":
  6344. /*!*****************************************************!*\
  6345. !*** ./js/processor/error/processorErrorFactory.js ***!
  6346. \*****************************************************/
  6347. /*! no static exports found */
  6348. /***/ (function(module, exports, __webpack_require__) {
  6349. "use strict";
  6350. Object.defineProperty(exports, "__esModule", {
  6351. value: true
  6352. });
  6353. exports.ProcessorErrorFactory = undefined;
  6354. var _runtimeError = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  6355. var _semanticError = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  6356. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6357. var _operators = __webpack_require__(/*! ../../ast/operators */ "./js/ast/operators.js");
  6358. function translateType(type, dim) {
  6359. switch (dim) {
  6360. case 0:
  6361. return _localizedStringsService.LocalizedStrings.getUI(type);
  6362. default:
  6363. var transType = _localizedStringsService.LocalizedStrings.getUI(type);
  6364. if (dim === 1) return _localizedStringsService.LocalizedStrings.getUI("vector_string", [transType]);else return _localizedStringsService.LocalizedStrings.getUI("matrix_string", [transType]);
  6365. }
  6366. }
  6367. function translateOp(op) {
  6368. switch (op.ord) {
  6369. case _operators.Operators.AND.ord:
  6370. case _operators.Operators.OR.ord:
  6371. case _operators.Operators.NOT.ord:
  6372. return _localizedStringsService.LocalizedStrings.getUI(op.value);
  6373. default:
  6374. return op.value;
  6375. }
  6376. }
  6377. var ProcessorErrorFactory = exports.ProcessorErrorFactory = Object.freeze({
  6378. symbol_not_found_full: function symbol_not_found_full(id, sourceInfo) {
  6379. if (sourceInfo) {
  6380. var context = [id, sourceInfo.line, sourceInfo.column];
  6381. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found_full", context));
  6382. } else {
  6383. return ProcessorErrorFactory.symbol_not_found(id);
  6384. }
  6385. },
  6386. symbol_not_found: function symbol_not_found(id) {
  6387. var context = [id];
  6388. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found", context));
  6389. },
  6390. function_missing_full: function function_missing_full(id, sourceInfo) {
  6391. if (sourceInfo) {
  6392. var context = [id, sourceInfo.line, sourceInfo.column];
  6393. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing_full", context));
  6394. } else {
  6395. return ProcessorErrorFactory.function_missing(id);
  6396. }
  6397. },
  6398. function_missing: function function_missing(id) {
  6399. var context = [id];
  6400. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing", context));
  6401. },
  6402. main_missing: function main_missing() {
  6403. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("main_missing"));
  6404. }, // TODO: better urgent error message
  6405. array_dimension_not_int_full: function array_dimension_not_int_full(sourceInfo) {
  6406. if (sourceInfo) {
  6407. var context = [sourceInfo.line];
  6408. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int_full", context));
  6409. } else {
  6410. return ProcessorErrorFactory.array_dimension_not_int();
  6411. }
  6412. },
  6413. array_dimension_not_int: function array_dimension_not_int() {
  6414. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int"));
  6415. },
  6416. unknown_command_full: function unknown_command_full(sourceInfo) {
  6417. if (sourceInfo) {
  6418. var context = [sourceInfo.line];
  6419. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command_full", context));
  6420. } else {
  6421. return ProcessorErrorFactory.unknown_command();
  6422. }
  6423. },
  6424. unknown_command: function unknown_command() {
  6425. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command"));
  6426. },
  6427. incompatible_types_full: function incompatible_types_full(type, dim, sourceInfo) {
  6428. if (sourceInfo) {
  6429. var context = [translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6430. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_full", context));
  6431. } else {
  6432. return ProcessorErrorFactory.incompatible_types(type, dim);
  6433. }
  6434. },
  6435. incompatible_types: function incompatible_types(type, dim) {
  6436. var context = [translateType(type, dim)];
  6437. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types", context));
  6438. },
  6439. incompatible_types_array_full: function incompatible_types_array_full(exp, type, dim, sourceInfo) {
  6440. if (sourceInfo) {
  6441. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6442. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array_full", context));
  6443. } else {
  6444. return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
  6445. }
  6446. },
  6447. incompatible_types_array: function incompatible_types_array(exp, type, dim) {
  6448. var context = [exp, translateType(type, dim)];
  6449. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array", context));
  6450. },
  6451. loop_condition_type_full: function loop_condition_type_full(sourceInfo) {
  6452. if (sourceInfo) {
  6453. var context = [sourceInfo.line, sourceInfo.column];
  6454. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type_full", context));
  6455. } else {
  6456. return ProcessorErrorFactory.loop_condition_type();
  6457. }
  6458. },
  6459. loop_condition_type: function loop_condition_type() {
  6460. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type"));
  6461. },
  6462. endless_loop_full: function endless_loop_full(sourceInfo) {
  6463. if (sourceInfo) {
  6464. var context = [sourceInfo.line];
  6465. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop_full", context));
  6466. } else {
  6467. return ProcessorErrorFactory.endless_loop();
  6468. }
  6469. },
  6470. endless_loop: function endless_loop() {
  6471. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop"));
  6472. },
  6473. for_condition_type_full: function for_condition_type_full(sourceInfo) {
  6474. if (sourceInfo) {
  6475. var context = [sourceInfo.line, sourceInfo.column];
  6476. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type_full", context));
  6477. } else {
  6478. return ProcessorErrorFactory.for_condition_type();
  6479. }
  6480. },
  6481. for_condition_type: function for_condition_type() {
  6482. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type"));
  6483. },
  6484. if_condition_type_full: function if_condition_type_full(sourceInfo) {
  6485. if (sourceInfo) {
  6486. var context = [sourceInfo.line, sourceInfo.column];
  6487. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type_full", context));
  6488. } else {
  6489. return ProcessorErrorFactory.if_condition_type();
  6490. }
  6491. },
  6492. if_condition_type: function if_condition_type() {
  6493. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type"));
  6494. },
  6495. invalid_global_var: function invalid_global_var() {
  6496. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_global_var"));
  6497. },
  6498. not_implemented: function not_implemented(id) {
  6499. var context = [id];
  6500. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("not_implemented", context));
  6501. },
  6502. invalid_case_type_full: function invalid_case_type_full(exp, type, dim, sourceInfo) {
  6503. if (sourceInfo) {
  6504. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6505. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type_full", context));
  6506. } else {
  6507. return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
  6508. }
  6509. },
  6510. invalid_case_type: function invalid_case_type(exp, type, dim) {
  6511. var context = [exp, translateType(type, dim)];
  6512. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type", context));
  6513. },
  6514. void_in_expression_full: function void_in_expression_full(id, sourceInfo) {
  6515. if (sourceInfo) {
  6516. var context = [sourceInfo.line, sourceInfo.column, id];
  6517. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression_full", context));
  6518. } else {
  6519. return ProcessorErrorFactory.void_in_expression(id);
  6520. }
  6521. },
  6522. void_in_expression: function void_in_expression(id) {
  6523. var context = [id];
  6524. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression", context));
  6525. },
  6526. invalid_array_access_full: function invalid_array_access_full(id, sourceInfo) {
  6527. if (sourceInfo) {
  6528. var context = [id, sourceInfo.line, sourceInfo.column];
  6529. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access_full", context));
  6530. } else {
  6531. return ProcessorErrorFactory.invalid_array_access(id);
  6532. }
  6533. },
  6534. invalid_array_access: function invalid_array_access(id) {
  6535. var context = [id];
  6536. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access", context));
  6537. },
  6538. invalid_matrix_access_full: function invalid_matrix_access_full(id, sourceInfo) {
  6539. if (sourceInfo) {
  6540. var context = [id, sourceInfo.line, sourceInfo.column];
  6541. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access_full", context));
  6542. } else {
  6543. return ProcessorErrorFactory.invalid_matrix_access(id);
  6544. }
  6545. },
  6546. invalid_matrix_access: function invalid_matrix_access(id) {
  6547. var context = [id];
  6548. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access", context));
  6549. },
  6550. matrix_column_outbounds_full: function matrix_column_outbounds_full(id, value, columns, sourceInfo) {
  6551. if (sourceInfo) {
  6552. var context = [sourceInfo.line, value, id, columns];
  6553. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds_full", context));
  6554. } else {
  6555. return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
  6556. }
  6557. },
  6558. matrix_column_outbounds: function matrix_column_outbounds(id, value, columns) {
  6559. var context = [value, id, columns];
  6560. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds", context));
  6561. },
  6562. matrix_line_outbounds_full: function matrix_line_outbounds_full(id, value, lines, sourceInfo) {
  6563. if (sourceInfo) {
  6564. var context = [sourceInfo.line, value, id, lines];
  6565. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds_full", context));
  6566. } else {
  6567. return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
  6568. }
  6569. },
  6570. matrix_line_outbounds: function matrix_line_outbounds(id, value, lines) {
  6571. var context = [value, id, lines];
  6572. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds", context));
  6573. },
  6574. vector_line_outbounds_full: function vector_line_outbounds_full(id, value, lines, sourceInfo) {
  6575. if (sourceInfo) {
  6576. var context = [sourceInfo.line, value, id, lines];
  6577. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds_full", context));
  6578. } else {
  6579. return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
  6580. }
  6581. },
  6582. vector_line_outbounds: function vector_line_outbounds(id, value, lines) {
  6583. var context = [value, id, lines];
  6584. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds", context));
  6585. },
  6586. vector_not_matrix_full: function vector_not_matrix_full(id, sourceInfo) {
  6587. if (sourceInfo) {
  6588. var context = [sourceInfo.line, id];
  6589. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix_full", context));
  6590. } else {
  6591. return ProcessorErrorFactory.vector_not_matrix(id);
  6592. }
  6593. },
  6594. vector_not_matrix: function vector_not_matrix(id) {
  6595. var context = [id];
  6596. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix", context));
  6597. },
  6598. function_no_return: function function_no_return(id) {
  6599. var context = [id];
  6600. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_no_return", context));
  6601. },
  6602. invalid_void_return_full: function invalid_void_return_full(id, type, dim, sourceInfo) {
  6603. if (sourceInfo) {
  6604. var context = [sourceInfo.line, id, translateType(type, dim)];
  6605. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6606. } else {
  6607. return ProcessorErrorFactory.invalid_void_return(id, type, dim);
  6608. }
  6609. },
  6610. invalid_void_return: function invalid_void_return(id, type, dim) {
  6611. var context = [id, translateType(type, dim)];
  6612. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6613. },
  6614. invalid_return_type_full: function invalid_return_type_full(id, type, dim, sourceInfo) {
  6615. if (sourceInfo) {
  6616. var context = [sourceInfo.line, id, translateType(type, dim)];
  6617. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type_full", context));
  6618. } else {
  6619. return ProcessorErrorFactory.invalid_return_type(id, type, dim);
  6620. }
  6621. },
  6622. invalid_return_type: function invalid_return_type(id, type, dim) {
  6623. var context = [id, translateType(type, dim)];
  6624. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type", context));
  6625. },
  6626. invalid_parameters_size_full: function invalid_parameters_size_full(id, expected, actual, sourceInfo) {
  6627. if (sourceInfo) {
  6628. var context = [sourceInfo.line, id, expected, actual];
  6629. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size_full", context));
  6630. } else {
  6631. return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
  6632. }
  6633. },
  6634. invalid_parameters_size: function invalid_parameters_size(id, expected, actual) {
  6635. var context = [id, expected, actual];
  6636. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size", context));
  6637. },
  6638. invalid_parameter_type_full: function invalid_parameter_type_full(id, exp, sourceInfo) {
  6639. if (sourceInfo) {
  6640. var context = [exp, id, sourceInfo.line];
  6641. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6642. } else {
  6643. return ProcessorErrorFactory.invalid_parameter_type(id, exp);
  6644. }
  6645. },
  6646. invalid_parameter_type: function invalid_parameter_type(id, exp) {
  6647. var context = [exp, id];
  6648. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6649. },
  6650. invalid_ref_full: function invalid_ref_full(id, exp, sourceInfo) {
  6651. if (sourceInfo) {
  6652. var context = [exp, id, sourceInfo.line];
  6653. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref_full", context));
  6654. } else {
  6655. return ProcessorErrorFactory.invalid_ref(id, exp);
  6656. }
  6657. },
  6658. invalid_ref: function invalid_ref(id, exp) {
  6659. var context = [exp, id];
  6660. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref", context));
  6661. },
  6662. unexpected_break_command_full: function unexpected_break_command_full(sourceInfo) {
  6663. if (sourceInfo) {
  6664. var context = [sourceInfo.line];
  6665. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command_full", context));
  6666. } else {
  6667. return ProcessorErrorFactory.unexpected_break_command();
  6668. }
  6669. },
  6670. unexpected_break_command: function unexpected_break_command() {
  6671. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command"));
  6672. },
  6673. invalid_array_literal_type_full: function invalid_array_literal_type_full(exp, sourceInfo) {
  6674. if (sourceInfo) {
  6675. var context = [sourceInfo.line, exp];
  6676. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type_full", context));
  6677. } else {
  6678. return ProcessorErrorFactory.invalid_array_literal_type(exp);
  6679. }
  6680. },
  6681. invalid_array_literal_type: function invalid_array_literal_type(exp) {
  6682. var context = [exp];
  6683. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type", context));
  6684. },
  6685. invalid_array_literal_line_full: function invalid_array_literal_line_full(expected, actual, sourceInfo) {
  6686. if (sourceInfo) {
  6687. var context = [sourceInfo.line, expected, actual];
  6688. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line_full", context));
  6689. } else {
  6690. return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
  6691. }
  6692. },
  6693. invalid_array_literal_line: function invalid_array_literal_line(expected, actual) {
  6694. var context = [expected, actual];
  6695. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line", context));
  6696. },
  6697. invalid_array_literal_column_full: function invalid_array_literal_column_full(expected, actual, sourceInfo) {
  6698. if (sourceInfo) {
  6699. var context = [sourceInfo.line, expected, actual];
  6700. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column_full", context));
  6701. } else {
  6702. return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
  6703. }
  6704. },
  6705. invalid_array_literal_column: function invalid_array_literal_column(expected, actual) {
  6706. var context = [expected, actual];
  6707. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column", context));
  6708. },
  6709. invalid_unary_op_full: function invalid_unary_op_full(opName, type, dim, sourceInfo) {
  6710. if (sourceInfo) {
  6711. var context = [sourceInfo.line, translateOp(opName), translateType(type, dim)];
  6712. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op_full", context));
  6713. } else {
  6714. return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
  6715. }
  6716. },
  6717. invalid_unary_op: function invalid_unary_op(opName, type, dim) {
  6718. var context = [translateOp(opName), translateType(type, dim)];
  6719. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op", context));
  6720. },
  6721. invalid_infix_op_full: function invalid_infix_op_full(opName, typeLeft, dimLeft, typeRight, dimRight, sourceInfo) {
  6722. if (sourceInfo) {
  6723. var context = [sourceInfo.line, translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6724. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op_full", context));
  6725. } else {
  6726. return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
  6727. }
  6728. },
  6729. invalid_infix_op: function invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight) {
  6730. var context = [translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6731. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op", context));
  6732. },
  6733. array_dimension_not_positive_full: function array_dimension_not_positive_full(sourceInfo) {
  6734. if (sourceInfo) {
  6735. var context = [sourceInfo.line];
  6736. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive_full", context));
  6737. } else {
  6738. return ProcessorErrorFactory.array_dimension_not_positive();
  6739. }
  6740. },
  6741. array_dimension_not_positive: function array_dimension_not_positive() {
  6742. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive"));
  6743. }
  6744. });
  6745. /***/ }),
  6746. /***/ "./js/processor/error/runtimeError.js":
  6747. /*!********************************************!*\
  6748. !*** ./js/processor/error/runtimeError.js ***!
  6749. \********************************************/
  6750. /*! no static exports found */
  6751. /***/ (function(module, exports, __webpack_require__) {
  6752. "use strict";
  6753. Object.defineProperty(exports, "__esModule", {
  6754. value: true
  6755. });
  6756. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6757. 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; }
  6758. 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; }
  6759. var RuntimeError = exports.RuntimeError = function (_Error) {
  6760. _inherits(RuntimeError, _Error);
  6761. function RuntimeError() {
  6762. var _ref;
  6763. _classCallCheck(this, RuntimeError);
  6764. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6765. msg[_key] = arguments[_key];
  6766. }
  6767. var _this = _possibleConstructorReturn(this, (_ref = RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).call.apply(_ref, [this].concat(msg)));
  6768. if (Error.captureStackTrace) Error.captureStackTrace(_this, RuntimeError);
  6769. return _this;
  6770. }
  6771. return RuntimeError;
  6772. }(Error);
  6773. /***/ }),
  6774. /***/ "./js/processor/error/semanticError.js":
  6775. /*!*********************************************!*\
  6776. !*** ./js/processor/error/semanticError.js ***!
  6777. \*********************************************/
  6778. /*! no static exports found */
  6779. /***/ (function(module, exports, __webpack_require__) {
  6780. "use strict";
  6781. Object.defineProperty(exports, "__esModule", {
  6782. value: true
  6783. });
  6784. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6785. 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; }
  6786. 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; }
  6787. var SemanticError = exports.SemanticError = function (_Error) {
  6788. _inherits(SemanticError, _Error);
  6789. function SemanticError() {
  6790. var _ref;
  6791. _classCallCheck(this, SemanticError);
  6792. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6793. msg[_key] = arguments[_key];
  6794. }
  6795. var _this = _possibleConstructorReturn(this, (_ref = SemanticError.__proto__ || Object.getPrototypeOf(SemanticError)).call.apply(_ref, [this].concat(msg)));
  6796. if (Error.captureStackTrace) Error.captureStackTrace(_this, SemanticError);
  6797. return _this;
  6798. }
  6799. return SemanticError;
  6800. }(Error);
  6801. /***/ }),
  6802. /***/ "./js/processor/ivprogProcessor.js":
  6803. /*!*****************************************!*\
  6804. !*** ./js/processor/ivprogProcessor.js ***!
  6805. \*****************************************/
  6806. /*! no static exports found */
  6807. /***/ (function(module, exports, __webpack_require__) {
  6808. "use strict";
  6809. Object.defineProperty(exports, "__esModule", {
  6810. value: true
  6811. });
  6812. exports.IVProgProcessor = undefined;
  6813. 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; }; }();
  6814. var _store = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js");
  6815. var _storeObject = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js");
  6816. var _storeObjectArray = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  6817. var _storeObjectRef = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js");
  6818. var _modes = __webpack_require__(/*! ./modes */ "./js/processor/modes.js");
  6819. var _context = __webpack_require__(/*! ./context */ "./js/processor/context.js");
  6820. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6821. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6822. var _definedFunctions = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  6823. var _compatibilityTable = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js");
  6824. var _commands = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  6825. var Commands = _interopRequireWildcard(_commands);
  6826. var _expressions = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  6827. var Expressions = _interopRequireWildcard(_expressions);
  6828. var _storeObjectArrayAddress = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js");
  6829. var _storeObjectArrayAddressRef = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js");
  6830. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6831. var _parsers = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6832. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6833. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  6834. var _decimal2 = _interopRequireDefault(_decimal);
  6835. var _processorErrorFactory = __webpack_require__(/*! ./error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  6836. var _runtimeError = __webpack_require__(/*! ./error/runtimeError */ "./js/processor/error/runtimeError.js");
  6837. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6838. 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; } }
  6839. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6840. var IVProgProcessor = exports.IVProgProcessor = function () {
  6841. _createClass(IVProgProcessor, null, [{
  6842. key: 'LOOP_TIMEOUT',
  6843. get: function get() {
  6844. return _config.Config.loopTimeout;
  6845. },
  6846. set: function set(ms) {
  6847. _config.Config.setConfig({ loopTimeout: ms });
  6848. }
  6849. }, {
  6850. key: 'MAIN_INTERNAL_ID',
  6851. get: function get() {
  6852. return "$main";
  6853. }
  6854. }]);
  6855. function IVProgProcessor(ast) {
  6856. _classCallCheck(this, IVProgProcessor);
  6857. this.ast = ast;
  6858. this.globalStore = new _store.Store("$global");
  6859. this.stores = [this.globalStore];
  6860. this.context = [_context.Context.BASE];
  6861. this.input = null;
  6862. this.forceKill = false;
  6863. this.loopTimers = [];
  6864. this.output = null;
  6865. }
  6866. _createClass(IVProgProcessor, [{
  6867. key: 'registerInput',
  6868. value: function registerInput(input) {
  6869. if (this.input !== null) this.input = null;
  6870. this.input = input;
  6871. }
  6872. }, {
  6873. key: 'registerOutput',
  6874. value: function registerOutput(output) {
  6875. if (this.output !== null) this.output = null;
  6876. this.output = output;
  6877. }
  6878. }, {
  6879. key: 'checkContext',
  6880. value: function checkContext(context) {
  6881. return this.context[this.context.length - 1] === context;
  6882. }
  6883. }, {
  6884. key: 'ignoreSwitchCases',
  6885. value: function ignoreSwitchCases(store) {
  6886. if (store.mode === _modes.Modes.RETURN) {
  6887. return true;
  6888. } else if (store.mode === _modes.Modes.BREAK) {
  6889. return true;
  6890. } else {
  6891. return false;
  6892. }
  6893. }
  6894. }, {
  6895. key: 'prepareState',
  6896. value: function prepareState() {
  6897. if (this.stores !== null) {
  6898. for (var i = 0; i < this.stores.length; i++) {
  6899. delete this.stores[i];
  6900. }
  6901. this.stores = null;
  6902. }
  6903. if (this.globalStore !== null) this.globalStore = null;
  6904. this.globalStore = new _store.Store("$global");
  6905. this.stores = [this.globalStore];
  6906. this.context = [_context.Context.BASE];
  6907. }
  6908. }, {
  6909. key: 'interpretAST',
  6910. value: function interpretAST() {
  6911. this.prepareState();
  6912. this.initGlobal();
  6913. var mainFunc = this.findMainFunction();
  6914. if (mainFunc === null) {
  6915. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  6916. }
  6917. return this.runFunction(mainFunc, [], this.globalStore);
  6918. }
  6919. }, {
  6920. key: 'initGlobal',
  6921. value: function initGlobal() {
  6922. var _this = this;
  6923. if (!this.checkContext(_context.Context.BASE)) {
  6924. throw _processorErrorFactory.ProcessorErrorFactory.invalid_global_var();
  6925. }
  6926. this.ast.global.forEach(function (decl) {
  6927. _this.executeCommand(_this.globalStore, decl).then(function (sto) {
  6928. return _this.globalStore = sto;
  6929. });
  6930. });
  6931. }
  6932. }, {
  6933. key: 'findMainFunction',
  6934. value: function findMainFunction() {
  6935. return this.ast.functions.find(function (v) {
  6936. return v.isMain;
  6937. });
  6938. }
  6939. }, {
  6940. key: 'findFunction',
  6941. value: function findFunction(name) {
  6942. if (name.match(/^\$.+$/)) {
  6943. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  6944. if (!!!fun) {
  6945. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  6946. }
  6947. return fun;
  6948. } else {
  6949. var val = this.ast.functions.find(function (v) {
  6950. return v.name === name;
  6951. });
  6952. if (!!!val) {
  6953. // TODO: better error message;
  6954. throw _processorErrorFactory.ProcessorErrorFactory.function_missing(name);
  6955. }
  6956. return val;
  6957. }
  6958. }
  6959. }, {
  6960. key: 'runFunction',
  6961. value: function runFunction(func, actualParameters, store) {
  6962. var _this2 = this;
  6963. var funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
  6964. var funcStore = new _store.Store(funcName);
  6965. funcStore.extendStore(this.globalStore);
  6966. var returnStoreObject = null;
  6967. if (func.returnType instanceof _compoundType.CompoundType) {
  6968. if (func.returnType.dimensions > 1) {
  6969. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, -1, [[]]);
  6970. } else {
  6971. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, null, []);
  6972. }
  6973. } else {
  6974. returnStoreObject = new _storeObject.StoreObject(func.returnType, null);
  6975. }
  6976. funcStore.insertStore('$', returnStoreObject);
  6977. var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  6978. return newFuncStore$.then(function (sto) {
  6979. _this2.context.push(_context.Context.FUNCTION);
  6980. _this2.stores.push(sto);
  6981. return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) {
  6982. return _this2.executeCommands(stoWithVars, func.commands);
  6983. }).then(function (finalSto) {
  6984. _this2.stores.pop();
  6985. _this2.context.pop();
  6986. return finalSto;
  6987. });
  6988. });
  6989. }
  6990. }, {
  6991. key: 'associateParameters',
  6992. value: function associateParameters(formalList, actualList, callerStore, calleeStore) {
  6993. var _this3 = this;
  6994. var funcName = calleeStore.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : calleeStore.name;
  6995. if (formalList.length != actualList.length) {
  6996. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size(funcName, formalList.length, actualList.length);
  6997. }
  6998. var promises$ = actualList.map(function (actualParameter) {
  6999. return _this3.evaluateExpression(callerStore, actualParameter);
  7000. });
  7001. return Promise.all(promises$).then(function (values) {
  7002. for (var i = 0; i < values.length; i++) {
  7003. var stoObj = values[i];
  7004. var exp = actualList[i];
  7005. var formalParameter = formalList[i];
  7006. if (formalParameter.type.isCompatible(stoObj.type)) {
  7007. if (formalParameter.byRef && !stoObj.inStore) {
  7008. throw _processorErrorFactory.ProcessorErrorFactory.invalid_ref(funcName, exp.toString());
  7009. }
  7010. if (formalParameter.byRef) {
  7011. var ref = null;
  7012. if (stoObj instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7013. ref = new _storeObjectArrayAddressRef.StoreObjectArrayAddressRef(stoObj);
  7014. } else {
  7015. ref = new _storeObjectRef.StoreObjectRef(stoObj.id, callerStore);
  7016. }
  7017. calleeStore.insertStore(formalParameter.id, ref);
  7018. } else {
  7019. var realValue = _this3.parseStoreObjectValue(stoObj);
  7020. calleeStore.insertStore(formalParameter.id, realValue);
  7021. }
  7022. } else {
  7023. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type(funcName, exp.toString());
  7024. }
  7025. }
  7026. return calleeStore;
  7027. });
  7028. }
  7029. }, {
  7030. key: 'executeCommands',
  7031. value: function executeCommands(store, cmds) {
  7032. // helper to partially apply a function, in this case executeCommand
  7033. var outerRef = this;
  7034. var partial = function partial(fun, cmd) {
  7035. return function (sto) {
  7036. return fun(sto, cmd);
  7037. };
  7038. };
  7039. return cmds.reduce(function (lastCommand, next) {
  7040. var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
  7041. return lastCommand.then(nextCommand);
  7042. }, Promise.resolve(store));
  7043. }
  7044. }, {
  7045. key: 'executeCommand',
  7046. value: function executeCommand(store, cmd) {
  7047. if (this.forceKill) {
  7048. return Promise.reject("FORCED_KILL!");
  7049. } else if (store.mode === _modes.Modes.PAUSE) {
  7050. return Promise.resolve(this.executeCommand(store, cmd));
  7051. } else if (store.mode === _modes.Modes.RETURN) {
  7052. return Promise.resolve(store);
  7053. } else if (this.checkContext(_context.Context.BREAKABLE) && store.mode === _modes.Modes.BREAK) {
  7054. return Promise.resolve(store);
  7055. }
  7056. if (cmd instanceof Commands.Declaration) {
  7057. return this.executeDeclaration(store, cmd);
  7058. } else if (cmd instanceof Commands.ArrayIndexAssign) {
  7059. return this.executeArrayIndexAssign(store, cmd);
  7060. } else if (cmd instanceof Commands.Assign) {
  7061. return this.executeAssign(store, cmd);
  7062. } else if (cmd instanceof Commands.Break) {
  7063. return this.executeBreak(store, cmd);
  7064. } else if (cmd instanceof Commands.Return) {
  7065. return this.executeReturn(store, cmd);
  7066. } else if (cmd instanceof Commands.IfThenElse) {
  7067. return this.executeIfThenElse(store, cmd);
  7068. } else if (cmd instanceof Commands.While) {
  7069. return this.executeWhile(store, cmd);
  7070. } else if (cmd instanceof Commands.DoWhile) {
  7071. return this.executeDoWhile(store, cmd);
  7072. } else if (cmd instanceof Commands.For) {
  7073. return this.executeFor(store, cmd);
  7074. } else if (cmd instanceof Commands.Switch) {
  7075. return this.executeSwitch(store, cmd);
  7076. } else if (cmd instanceof Expressions.FunctionCall) {
  7077. return this.executeFunctionCall(store, cmd);
  7078. } else if (cmd instanceof Commands.SysCall) {
  7079. return this.executeSysCall(store, cmd);
  7080. } else {
  7081. throw _processorErrorFactory.ProcessorErrorFactory.unknown_command(cmd.sourceInfo);
  7082. }
  7083. }
  7084. }, {
  7085. key: 'executeSysCall',
  7086. value: function executeSysCall(store, cmd) {
  7087. var func = cmd.langFunc.bind(this);
  7088. return func(store, cmd);
  7089. }
  7090. }, {
  7091. key: 'executeFunctionCall',
  7092. value: function executeFunctionCall(store, cmd) {
  7093. var func = null;
  7094. if (cmd.isMainCall) {
  7095. func = this.findMainFunction();
  7096. } else {
  7097. func = this.findFunction(cmd.id);
  7098. }
  7099. return this.runFunction(func, cmd.actualParameters, store).then(function (sto) {
  7100. if (!_types.Types.VOID.isCompatible(func.returnType) && sto.mode !== _modes.Modes.RETURN) {
  7101. var funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : func.name;
  7102. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.function_no_return(funcName));
  7103. } else {
  7104. return store;
  7105. }
  7106. });
  7107. }
  7108. }, {
  7109. key: 'executeSwitch',
  7110. value: function executeSwitch(store, cmd) {
  7111. var _this4 = this;
  7112. this.context.push(_context.Context.BREAKABLE);
  7113. var auxCaseFun = function auxCaseFun(promise, switchExp, aCase) {
  7114. return promise.then(function (result) {
  7115. var sto = result.sto;
  7116. if (_this4.ignoreSwitchCases(sto)) {
  7117. return Promise.resolve(result);
  7118. } else if (result.wasTrue || aCase.isDefault) {
  7119. var $newSto = _this4.executeCommands(result.sto, aCase.commands);
  7120. return $newSto.then(function (nSto) {
  7121. return Promise.resolve({ wasTrue: true, sto: nSto });
  7122. });
  7123. } else {
  7124. var $value = _this4.evaluateExpression(sto, new Expressions.InfixApp(_operators.Operators.EQ, switchExp, aCase.expression));
  7125. return $value.then(function (vl) {
  7126. if (vl.value) {
  7127. var _$newSto = _this4.executeCommands(result.sto, aCase.commands);
  7128. return _$newSto.then(function (nSto) {
  7129. return Promise.resolve({ wasTrue: true, sto: nSto });
  7130. });
  7131. } else {
  7132. return Promise.resolve({ wasTrue: false, sto: sto });
  7133. }
  7134. });
  7135. }
  7136. });
  7137. };
  7138. try {
  7139. var breakLoop = false;
  7140. var $result = Promise.resolve({ wasTrue: false, sto: store });
  7141. for (var index = 0; index < cmd.cases.length && !breakLoop; index++) {
  7142. var aCase = cmd.cases[index];
  7143. $result = auxCaseFun($result, cmd.expression, aCase);
  7144. $result.then(function (r) {
  7145. return breakLoop = _this4.ignoreSwitchCases(r.sto);
  7146. });
  7147. }
  7148. return $result.then(function (r) {
  7149. _this4.context.pop();
  7150. if (r.sto.mode === _modes.Modes.BREAK) {
  7151. r.sto.mode = _modes.Modes.RUN;
  7152. }
  7153. return r.sto;
  7154. });
  7155. } catch (error) {
  7156. return Promise.reject(error);
  7157. }
  7158. }
  7159. }, {
  7160. key: 'executeFor',
  7161. value: function executeFor(store, cmd) {
  7162. try {
  7163. //BEGIN for -> while rewrite
  7164. var initCmd = cmd.assignment;
  7165. var condition = cmd.condition;
  7166. var increment = cmd.increment;
  7167. var whileBlock = new Commands.CommandBlock([], cmd.commands.concat(increment));
  7168. var forAsWhile = new Commands.While(condition, whileBlock);
  7169. //END for -> while rewrite
  7170. var newCmdList = [initCmd, forAsWhile];
  7171. return this.executeCommands(store, newCmdList);
  7172. } catch (error) {
  7173. return Promise.reject(error);
  7174. }
  7175. }
  7176. }, {
  7177. key: 'executeDoWhile',
  7178. value: function executeDoWhile(store, cmd) {
  7179. var outerRef = this;
  7180. try {
  7181. outerRef.loopTimers.push(Date.now());
  7182. outerRef.context.push(_context.Context.BREAKABLE);
  7183. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7184. return $newStore.then(function (sto) {
  7185. if (sto.mode === _modes.Modes.BREAK) {
  7186. outerRef.context.pop();
  7187. sto.mode = _modes.Modes.RUN;
  7188. outerRef.loopTimers.pop();
  7189. return sto;
  7190. }
  7191. var $value = outerRef.evaluateExpression(sto, cmd.expression);
  7192. return $value.then(function (vl) {
  7193. if (!vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7194. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  7195. }
  7196. if (vl.value) {
  7197. outerRef.context.pop();
  7198. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7199. var time = outerRef.loopTimers[i];
  7200. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7201. outerRef.forceKill = true;
  7202. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7203. }
  7204. }
  7205. return outerRef.executeCommand(sto, cmd);
  7206. } else {
  7207. outerRef.context.pop();
  7208. outerRef.loopTimers.pop();
  7209. return sto;
  7210. }
  7211. });
  7212. });
  7213. } catch (error) {
  7214. return Promise.reject(error);
  7215. }
  7216. }
  7217. }, {
  7218. key: 'executeWhile',
  7219. value: function executeWhile(store, cmd) {
  7220. var outerRef = this;
  7221. try {
  7222. outerRef.loopTimers.push(Date.now());
  7223. outerRef.context.push(_context.Context.BREAKABLE);
  7224. var $value = outerRef.evaluateExpression(store, cmd.expression);
  7225. return $value.then(function (vl) {
  7226. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7227. if (vl.value) {
  7228. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7229. return $newStore.then(function (sto) {
  7230. outerRef.context.pop();
  7231. if (sto.mode === _modes.Modes.BREAK) {
  7232. outerRef.loopTimers.pop();
  7233. sto.mode = _modes.Modes.RUN;
  7234. return sto;
  7235. }
  7236. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7237. var time = outerRef.loopTimers[i];
  7238. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7239. outerRef.forceKill = true;
  7240. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7241. }
  7242. }
  7243. return outerRef.executeCommand(sto, cmd);
  7244. });
  7245. } else {
  7246. outerRef.context.pop();
  7247. outerRef.loopTimers.pop();
  7248. return store;
  7249. }
  7250. } else {
  7251. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  7252. }
  7253. });
  7254. } catch (error) {
  7255. return Promise.reject(error);
  7256. }
  7257. }
  7258. }, {
  7259. key: 'executeIfThenElse',
  7260. value: function executeIfThenElse(store, cmd) {
  7261. var _this5 = this;
  7262. try {
  7263. var $value = this.evaluateExpression(store, cmd.condition);
  7264. return $value.then(function (vl) {
  7265. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7266. if (vl.value) {
  7267. return _this5.executeCommands(store, cmd.ifTrue.commands);
  7268. } else if (cmd.ifFalse !== null) {
  7269. if (cmd.ifFalse instanceof Commands.IfThenElse) {
  7270. return _this5.executeCommand(store, cmd.ifFalse);
  7271. } else {
  7272. return _this5.executeCommands(store, cmd.ifFalse.commands);
  7273. }
  7274. } else {
  7275. return Promise.resolve(store);
  7276. }
  7277. } else {
  7278. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo));
  7279. }
  7280. });
  7281. } catch (error) {
  7282. return Promise.reject(error);
  7283. }
  7284. }
  7285. }, {
  7286. key: 'executeReturn',
  7287. value: function executeReturn(store, cmd) {
  7288. var _this6 = this;
  7289. try {
  7290. var funcType = store.applyStore('$').type;
  7291. var $value = this.evaluateExpression(store, cmd.expression);
  7292. var funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : store.name;
  7293. return $value.then(function (vl) {
  7294. if (vl === null && funcType.isCompatible(_types.Types.VOID)) {
  7295. return Promise.resolve(store);
  7296. }
  7297. if (vl === null || !funcType.isCompatible(vl.type)) {
  7298. var stringInfo = funcType.stringInfo();
  7299. var info = stringInfo[0];
  7300. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo));
  7301. } else {
  7302. var realValue = _this6.parseStoreObjectValue(vl);
  7303. store.updateStore('$', realValue);
  7304. store.mode = _modes.Modes.RETURN;
  7305. return Promise.resolve(store);
  7306. }
  7307. });
  7308. } catch (error) {
  7309. return Promise.reject(error);
  7310. }
  7311. }
  7312. }, {
  7313. key: 'executeBreak',
  7314. value: function executeBreak(store, cmd) {
  7315. if (this.checkContext(_context.Context.BREAKABLE)) {
  7316. store.mode = _modes.Modes.BREAK;
  7317. return Promise.resolve(store);
  7318. } else {
  7319. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.unexpected_break_command_full(cmd.sourceInfo));
  7320. }
  7321. }
  7322. }, {
  7323. key: 'executeAssign',
  7324. value: function executeAssign(store, cmd) {
  7325. var _this7 = this;
  7326. try {
  7327. var $value = this.evaluateExpression(store, cmd.expression);
  7328. return $value.then(function (vl) {
  7329. var realValue = _this7.parseStoreObjectValue(vl);
  7330. store.updateStore(cmd.id, realValue);
  7331. return store;
  7332. });
  7333. } catch (error) {
  7334. return Promise.reject(error);
  7335. }
  7336. }
  7337. }, {
  7338. key: 'executeArrayIndexAssign',
  7339. value: function executeArrayIndexAssign(store, cmd) {
  7340. var _this8 = this;
  7341. var mustBeArray = store.applyStore(cmd.id);
  7342. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7343. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo));
  7344. }
  7345. var line$ = this.evaluateExpression(store, cmd.line);
  7346. var column$ = this.evaluateExpression(store, cmd.column);
  7347. var value$ = this.evaluateExpression(store, cmd.expression);
  7348. return Promise.all([line$, column$, value$]).then(function (results) {
  7349. var lineSO = results[0];
  7350. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7351. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7352. }
  7353. var line = lineSO.number;
  7354. var columnSO = results[1];
  7355. var column = null;
  7356. if (columnSO !== null) {
  7357. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7358. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7359. }
  7360. column = columnSO.number;
  7361. }
  7362. var value = _this8.parseStoreObjectValue(results[2]);
  7363. if (line >= mustBeArray.lines) {
  7364. if (mustBeArray.isVector) {
  7365. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7366. } else {
  7367. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7368. }
  7369. } else if (line < 0) {
  7370. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7371. }
  7372. if (column !== null && mustBeArray.columns === null) {
  7373. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(cmd.id, cmd.sourceInfo));
  7374. }
  7375. if (column !== null) {
  7376. if (column >= mustBeArray.columns) {
  7377. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(cmd.id, column, mustBeArray.columns, cmd.sourceInfo));
  7378. } else if (column < 0) {
  7379. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7380. }
  7381. }
  7382. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), mustBeArray);
  7383. if (column !== null) {
  7384. if (value.type instanceof _compoundType.CompoundType) {
  7385. var type = mustBeArray.type.innerType;
  7386. var stringInfo = type.stringInfo();
  7387. var info = stringInfo[0];
  7388. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7389. }
  7390. newArray.value[line].value[column] = value;
  7391. store.updateStore(cmd.id, newArray);
  7392. } else {
  7393. if (mustBeArray.columns !== null && value.type instanceof _compoundType.CompoundType) {
  7394. var _type = mustBeArray.type;
  7395. var _stringInfo = _type.stringInfo();
  7396. var _info = _stringInfo[0];
  7397. var exp = cmd.expression.toString();
  7398. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(exp, _info.type, _info.dim - 1, cmd.sourceInfo));
  7399. }
  7400. newArray.value[line] = value;
  7401. store.updateStore(cmd.id, newArray);
  7402. }
  7403. return store;
  7404. });
  7405. }
  7406. }, {
  7407. key: 'executeDeclaration',
  7408. value: function executeDeclaration(store, cmd) {
  7409. try {
  7410. var $value = this.evaluateExpression(store, cmd.initial);
  7411. if (cmd instanceof Commands.ArrayDeclaration) {
  7412. var $lines = this.evaluateExpression(store, cmd.lines);
  7413. var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns);
  7414. return Promise.all([$lines, $columns, $value]).then(function (values) {
  7415. var lineSO = values[0];
  7416. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7417. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7418. }
  7419. var line = lineSO.number;
  7420. if (line < 0) {
  7421. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7422. }
  7423. var columnSO = values[1];
  7424. var column = null;
  7425. if (columnSO !== null) {
  7426. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7427. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7428. }
  7429. column = columnSO.number;
  7430. if (column < 0) {
  7431. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7432. }
  7433. }
  7434. var value = values[2];
  7435. var temp = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, null);
  7436. store.insertStore(cmd.id, temp);
  7437. var realValue = value;
  7438. if (value !== null) {
  7439. if (value instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7440. if (value.type instanceof _compoundType.CompoundType) {
  7441. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), value.refValue);
  7442. } else {
  7443. realValue = Object.assign(new _storeObject.StoreObject(null, null), value.refValue);
  7444. }
  7445. }
  7446. } else {
  7447. realValue = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, []);
  7448. if (column !== null) {
  7449. for (var i = 0; i < line; i++) {
  7450. realValue.value.push(new _storeObjectArray.StoreObjectArray(new _compoundType.CompoundType(cmd.type.innerType, 1), column, null, []));
  7451. }
  7452. }
  7453. }
  7454. realValue.readOnly = cmd.isConst;
  7455. store.updateStore(cmd.id, realValue);
  7456. return store;
  7457. });
  7458. } else {
  7459. var temp = new _storeObject.StoreObject(cmd.type, null);
  7460. store.insertStore(cmd.id, temp);
  7461. return $value.then(function (vl) {
  7462. var realValue = vl;
  7463. if (vl !== null) {
  7464. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7465. if (vl.type instanceof _compoundType.CompoundType) {
  7466. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), vl.refValue);
  7467. } else {
  7468. realValue = Object.assign(new _storeObject.StoreObject(null, null), vl.refValue);
  7469. }
  7470. }
  7471. } else {
  7472. realValue = new _storeObject.StoreObject(cmd.type, 0);
  7473. }
  7474. realValue.readOnly = cmd.isConst;
  7475. store.updateStore(cmd.id, realValue);
  7476. return store;
  7477. });
  7478. }
  7479. } catch (e) {
  7480. return Promise.reject(e);
  7481. }
  7482. }
  7483. }, {
  7484. key: 'evaluateExpression',
  7485. value: function evaluateExpression(store, exp) {
  7486. if (exp instanceof Expressions.UnaryApp) {
  7487. return this.evaluateUnaryApp(store, exp);
  7488. } else if (exp instanceof Expressions.InfixApp) {
  7489. return this.evaluateInfixApp(store, exp);
  7490. } else if (exp instanceof Expressions.ArrayAccess) {
  7491. return this.evaluateArrayAccess(store, exp);
  7492. } else if (exp instanceof Expressions.VariableLiteral) {
  7493. return this.evaluateVariableLiteral(store, exp);
  7494. } else if (exp instanceof Expressions.IntLiteral) {
  7495. return this.evaluateLiteral(store, exp);
  7496. } else if (exp instanceof Expressions.RealLiteral) {
  7497. return this.evaluateLiteral(store, exp);
  7498. } else if (exp instanceof Expressions.BoolLiteral) {
  7499. return this.evaluateLiteral(store, exp);
  7500. } else if (exp instanceof Expressions.StringLiteral) {
  7501. return this.evaluateLiteral(store, exp);
  7502. } else if (exp instanceof Expressions.ArrayLiteral) {
  7503. return this.evaluateArrayLiteral(store, exp);
  7504. } else if (exp instanceof Expressions.FunctionCall) {
  7505. return this.evaluateFunctionCall(store, exp);
  7506. }
  7507. return Promise.resolve(null);
  7508. }
  7509. }, {
  7510. key: 'evaluateFunctionCall',
  7511. value: function evaluateFunctionCall(store, exp) {
  7512. if (exp.isMainCall) {
  7513. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), exp.sourceInfo));
  7514. }
  7515. var func = this.findFunction(exp.id);
  7516. if (_types.Types.VOID.isCompatible(func.returnType)) {
  7517. // TODO: better error message
  7518. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(exp.id, exp.sourceInfo));
  7519. }
  7520. var $newStore = this.runFunction(func, exp.actualParameters, store);
  7521. return $newStore.then(function (sto) {
  7522. if (sto.mode !== _modes.Modes.RETURN) {
  7523. return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id));
  7524. }
  7525. var val = sto.applyStore('$');
  7526. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7527. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null, null), val));
  7528. } else {
  7529. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7530. }
  7531. });
  7532. }
  7533. }, {
  7534. key: 'evaluateArrayLiteral',
  7535. value: function evaluateArrayLiteral(store, exp) {
  7536. var errorHelperFunction = function errorHelperFunction(validationResult, exp) {
  7537. var errorCode = validationResult[0];
  7538. switch (errorCode) {
  7539. case _storeObjectArray.StoreObjectArray.WRONG_COLUMN_NUMBER:
  7540. {
  7541. var columnValue = validationResult[1];
  7542. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_column_full(arr.columns, columnValue, exp.sourceInfo));
  7543. }
  7544. case _storeObjectArray.StoreObjectArray.WRONG_LINE_NUMBER:
  7545. {
  7546. var lineValue = validationResult[1];
  7547. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_line_full(arr.lines, lineValue, exp.sourceInfo));
  7548. }
  7549. case _storeObjectArray.StoreObjectArray.WRONG_TYPE:
  7550. {
  7551. var line = null;
  7552. var strExp = null;
  7553. if (validationResult.length > 2) {
  7554. line = validationResult[1];
  7555. var column = validationResult[2];
  7556. strExp = exp.value[line].value[column].toString();
  7557. } else {
  7558. line = validationResult[1];
  7559. strExp = exp.value[line].toString();
  7560. }
  7561. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_type_full(strExp, exp.sourceInfo));
  7562. }
  7563. }
  7564. };
  7565. if (!exp.isVector) {
  7566. var $matrix = this.evaluateMatrix(store, exp.value);
  7567. return $matrix.then(function (list) {
  7568. var type = new _compoundType.CompoundType(list[0].type.innerType, 2);
  7569. var arr = new _storeObjectArray.StoreObjectArray(type, list.length, list[0].lines, list);
  7570. var checkResult = arr.isValid;
  7571. if (checkResult.length == 0) return Promise.resolve(arr);else {
  7572. return errorHelperFunction(checkResult, exp);
  7573. }
  7574. });
  7575. } else {
  7576. return this.evaluateVector(store, exp.value).then(function (list) {
  7577. var type = new _compoundType.CompoundType(list[0].type, 1);
  7578. var stoArray = new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7579. var checkResult = stoArray.isValid;
  7580. if (checkResult.length == 0) return Promise.resolve(stoArray);else {
  7581. return errorHelperFunction(checkResult, exp);
  7582. }
  7583. });
  7584. }
  7585. }
  7586. }, {
  7587. key: 'evaluateVector',
  7588. value: function evaluateVector(store, exps) {
  7589. var _this9 = this;
  7590. return Promise.all(exps.map(function (exp) {
  7591. return _this9.evaluateExpression(store, exp);
  7592. }));
  7593. }
  7594. }, {
  7595. key: 'evaluateMatrix',
  7596. value: function evaluateMatrix(store, exps) {
  7597. var _this10 = this;
  7598. return Promise.all(exps.map(function (vector) {
  7599. var $vector = _this10.evaluateVector(store, vector.value);
  7600. return $vector.then(function (list) {
  7601. var type = new _compoundType.CompoundType(list[0].type, 1);
  7602. return new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7603. });
  7604. }));
  7605. }
  7606. }, {
  7607. key: 'evaluateLiteral',
  7608. value: function evaluateLiteral(_, exp) {
  7609. return Promise.resolve(new _storeObject.StoreObject(exp.type, exp.value));
  7610. }
  7611. }, {
  7612. key: 'evaluateVariableLiteral',
  7613. value: function evaluateVariableLiteral(store, exp) {
  7614. try {
  7615. var val = store.applyStore(exp.id);
  7616. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7617. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null), val));
  7618. } else {
  7619. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7620. }
  7621. } catch (error) {
  7622. return Promise.reject(error);
  7623. }
  7624. }
  7625. }, {
  7626. key: 'evaluateArrayAccess',
  7627. value: function evaluateArrayAccess(store, exp) {
  7628. var mustBeArray = store.applyStore(exp.id);
  7629. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7630. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(exp.id, exp.sourceInfo));
  7631. }
  7632. var $line = this.evaluateExpression(store, exp.line);
  7633. var $column = this.evaluateExpression(store, exp.column);
  7634. return Promise.all([$line, $column]).then(function (values) {
  7635. var lineSO = values[0];
  7636. var columnSO = values[1];
  7637. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7638. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7639. }
  7640. var line = lineSO.number;
  7641. var column = null;
  7642. if (columnSO !== null) {
  7643. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7644. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7645. }
  7646. column = columnSO.number;
  7647. }
  7648. if (line >= mustBeArray.lines) {
  7649. if (mustBeArray.isVector) {
  7650. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7651. } else {
  7652. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7653. }
  7654. } else if (line < 0) {
  7655. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7656. }
  7657. if (column !== null && mustBeArray.columns === null) {
  7658. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(exp.id, exp.sourceInfo));
  7659. }
  7660. if (column !== null) {
  7661. if (column >= mustBeArray.columns) {
  7662. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(exp.id, column, mustBeArray.columns, exp.sourceInfo));
  7663. } else if (column < 0) {
  7664. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7665. }
  7666. }
  7667. return Promise.resolve(new _storeObjectArrayAddress.StoreObjectArrayAddress(mustBeArray.id, line, column, store));
  7668. });
  7669. }
  7670. }, {
  7671. key: 'evaluateUnaryApp',
  7672. value: function evaluateUnaryApp(store, unaryApp) {
  7673. var $left = this.evaluateExpression(store, unaryApp.left);
  7674. return $left.then(function (left) {
  7675. var resultType = (0, _compatibilityTable.resultTypeAfterUnaryOp)(unaryApp.op, left.type);
  7676. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7677. var stringInfo = left.type.stringInfo();
  7678. var info = stringInfo[0];
  7679. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo));
  7680. }
  7681. switch (unaryApp.op.ord) {
  7682. case _operators.Operators.ADD.ord:
  7683. return new _storeObject.StoreObject(resultType, left.value);
  7684. case _operators.Operators.SUB.ord:
  7685. return new _storeObject.StoreObject(resultType, left.value.negated());
  7686. case _operators.Operators.NOT.ord:
  7687. return new _storeObject.StoreObject(resultType, !left.value);
  7688. default:
  7689. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid UnaryApp ' + unaryApp.op));
  7690. }
  7691. });
  7692. }
  7693. }, {
  7694. key: 'evaluateInfixApp',
  7695. value: function evaluateInfixApp(store, infixApp) {
  7696. var $left = this.evaluateExpression(store, infixApp.left);
  7697. var $right = this.evaluateExpression(store, infixApp.right);
  7698. return Promise.all([$left, $right]).then(function (values) {
  7699. var left = values[0];
  7700. var right = values[1];
  7701. var resultType = (0, _compatibilityTable.resultTypeAfterInfixOp)(infixApp.op, left.type, right.type);
  7702. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7703. var stringInfoLeft = left.type.stringInfo();
  7704. var infoLeft = stringInfoLeft[0];
  7705. var stringInfoRight = right.type.stringInfo();
  7706. var infoRight = stringInfoRight[0];
  7707. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, infixApp.sourceInfo));
  7708. }
  7709. var result = null;
  7710. switch (infixApp.op.ord) {
  7711. case _operators.Operators.ADD.ord:
  7712. {
  7713. if (_types.Types.STRING.isCompatible(left.type)) {
  7714. var rightStr = (0, _parsers.convertToString)(right.value, right.type);
  7715. return new _storeObject.StoreObject(resultType, left.value + rightStr);
  7716. } else if (_types.Types.STRING.isCompatible(right.type)) {
  7717. var leftStr = (0, _parsers.convertToString)(left.value, left.type);
  7718. return new _storeObject.StoreObject(resultType, leftStr + right.value);
  7719. } else {
  7720. return new _storeObject.StoreObject(resultType, left.value.plus(right.value));
  7721. }
  7722. }
  7723. case _operators.Operators.SUB.ord:
  7724. return new _storeObject.StoreObject(resultType, left.value.minus(right.value));
  7725. case _operators.Operators.MULT.ord:
  7726. {
  7727. result = left.value.times(right.value);
  7728. if (result.dp() > _config.Config.decimalPlaces) {
  7729. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7730. }
  7731. return new _storeObject.StoreObject(resultType, result);
  7732. }
  7733. case _operators.Operators.DIV.ord:
  7734. {
  7735. if (_types.Types.INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value);
  7736. if (result.dp() > _config.Config.decimalPlaces) {
  7737. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7738. }
  7739. return new _storeObject.StoreObject(resultType, result);
  7740. }
  7741. case _operators.Operators.MOD.ord:
  7742. {
  7743. result = left.value.modulo(right.value);
  7744. if (result.dp() > _config.Config.decimalPlaces) {
  7745. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7746. }
  7747. return new _storeObject.StoreObject(resultType, result);
  7748. }
  7749. case _operators.Operators.GT.ord:
  7750. {
  7751. if (_types.Types.STRING.isCompatible(left.type)) {
  7752. result = left.value.length > right.value.length;
  7753. } else {
  7754. result = left.value.gt(right.value);
  7755. }
  7756. return new _storeObject.StoreObject(resultType, result);
  7757. }
  7758. case _operators.Operators.GE.ord:
  7759. {
  7760. if (_types.Types.STRING.isCompatible(left.type)) {
  7761. result = left.value.length >= right.value.length;
  7762. } else {
  7763. result = left.value.gte(right.value);
  7764. }
  7765. return new _storeObject.StoreObject(resultType, result);
  7766. }
  7767. case _operators.Operators.LT.ord:
  7768. {
  7769. if (_types.Types.STRING.isCompatible(left.type)) {
  7770. result = left.value.length < right.value.length;
  7771. } else {
  7772. result = left.value.lt(right.value);
  7773. }
  7774. return new _storeObject.StoreObject(resultType, result);
  7775. }
  7776. case _operators.Operators.LE.ord:
  7777. {
  7778. if (_types.Types.STRING.isCompatible(left.type)) {
  7779. result = left.value.length <= right.value.length;
  7780. } else {
  7781. result = left.value.lte(right.value);
  7782. }
  7783. return new _storeObject.StoreObject(resultType, result);
  7784. }
  7785. case _operators.Operators.EQ.ord:
  7786. {
  7787. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7788. result = left.value.eq(right.value);
  7789. } else {
  7790. result = left.value === right.value;
  7791. }
  7792. return new _storeObject.StoreObject(resultType, result);
  7793. }
  7794. case _operators.Operators.NEQ.ord:
  7795. {
  7796. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7797. result = !left.value.eq(right.value);
  7798. } else {
  7799. result = left.value !== right.value;
  7800. }
  7801. return new _storeObject.StoreObject(resultType, result);
  7802. }
  7803. case _operators.Operators.AND.ord:
  7804. return new _storeObject.StoreObject(resultType, left.value && right.value);
  7805. case _operators.Operators.OR.ord:
  7806. return new _storeObject.StoreObject(resultType, left.value || right.value);
  7807. default:
  7808. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid InfixApp ' + infixApp.op));
  7809. }
  7810. });
  7811. }
  7812. }, {
  7813. key: 'parseStoreObjectValue',
  7814. value: function parseStoreObjectValue(vl) {
  7815. var realValue = vl;
  7816. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7817. if (vl.type instanceof _compoundType.CompoundType) {
  7818. switch (vl.type.dimensions) {
  7819. case 1:
  7820. {
  7821. realValue = new _storeObjectArray.StoreObjectArray(vl.type, vl.value);
  7822. break;
  7823. }
  7824. default:
  7825. {
  7826. throw new _runtimeError.RuntimeError("Three dimensional array address...");
  7827. }
  7828. }
  7829. } else {
  7830. realValue = new _storeObject.StoreObject(vl.type, vl.value);
  7831. }
  7832. }
  7833. return realValue;
  7834. }
  7835. }]);
  7836. return IVProgProcessor;
  7837. }();
  7838. /***/ }),
  7839. /***/ "./js/processor/lib/arrays.js":
  7840. /*!************************************!*\
  7841. !*** ./js/processor/lib/arrays.js ***!
  7842. \************************************/
  7843. /*! no static exports found */
  7844. /***/ (function(module, exports, __webpack_require__) {
  7845. "use strict";
  7846. Object.defineProperty(exports, "__esModule", {
  7847. value: true
  7848. });
  7849. exports.createNumElementsFun = createNumElementsFun;
  7850. exports.createMatrixLinesFun = createMatrixLinesFun;
  7851. exports.createMatrixColumnsFun = createMatrixColumnsFun;
  7852. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  7853. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7854. var Commands = _interopRequireWildcard(_commands);
  7855. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7856. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7857. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  7858. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  7859. 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; } }
  7860. /**
  7861. * num_elements
  7862. * matrix_lines
  7863. * matrix_columns
  7864. */
  7865. function createNumElementsFun() {
  7866. var numElementsFun = function numElementsFun(sto, _) {
  7867. var vector = sto.applyStore("vector");
  7868. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(vector.lines));
  7869. sto.mode = _modes.Modes.RETURN;
  7870. return Promise.resolve(sto.updateStore("$", temp));
  7871. };
  7872. var block = new Commands.CommandBlock([], [new Commands.SysCall(numElementsFun)]);
  7873. var func = new Commands.Function('$numElements', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 1), 'vector', false)], block);
  7874. return func;
  7875. }
  7876. function createMatrixLinesFun() {
  7877. var matrixLinesFun = function matrixLinesFun(sto, _) {
  7878. var matrix = sto.applyStore("matrix");
  7879. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.lines));
  7880. sto.mode = _modes.Modes.RETURN;
  7881. return Promise.resolve(sto.updateStore("$", temp));
  7882. };
  7883. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixLinesFun)]);
  7884. var func = new Commands.Function('$matrixLines', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  7885. return func;
  7886. }
  7887. function createMatrixColumnsFun() {
  7888. var matrixColumnsFun = function matrixColumnsFun(sto, _) {
  7889. var matrix = sto.applyStore("matrix");
  7890. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.columns));
  7891. sto.mode = _modes.Modes.RETURN;
  7892. return Promise.resolve(sto.updateStore("$", temp));
  7893. };
  7894. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixColumnsFun)]);
  7895. var func = new Commands.Function('$matrixColumns', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  7896. return func;
  7897. }
  7898. /***/ }),
  7899. /***/ "./js/processor/lib/io.js":
  7900. /*!********************************!*\
  7901. !*** ./js/processor/lib/io.js ***!
  7902. \********************************/
  7903. /*! no static exports found */
  7904. /***/ (function(module, exports, __webpack_require__) {
  7905. "use strict";
  7906. Object.defineProperty(exports, "__esModule", {
  7907. value: true
  7908. });
  7909. exports.createOutputFun = createOutputFun;
  7910. exports.createInputFun = createInputFun;
  7911. var _storeObject = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js");
  7912. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7913. var Commands = _interopRequireWildcard(_commands);
  7914. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7915. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7916. 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; } }
  7917. function createOutputFun() {
  7918. var writeFunction = function writeFunction(store, _) {
  7919. var val = store.applyStore('p1');
  7920. if (val.type.isCompatible(_types.Types.INTEGER)) {
  7921. this.output.sendOutput(val.value.toString());
  7922. } else if (val.type.isCompatible(_types.Types.REAL)) {
  7923. if (val.value.dp() <= 0) {
  7924. this.output.sendOutput(val.value.toFixed(1));
  7925. } else {
  7926. this.output.sendOutput(val.value.toString());
  7927. }
  7928. } else {
  7929. this.output.sendOutput(val.value);
  7930. }
  7931. return Promise.resolve(store);
  7932. };
  7933. var block = new Commands.CommandBlock([], [new Commands.SysCall(writeFunction)]);
  7934. var func = new Commands.Function('$write', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', false)], block);
  7935. return func;
  7936. }
  7937. function createInputFun() {
  7938. var readFunction = function readFunction(store, _) {
  7939. var _this = this;
  7940. var request = new Promise(function (resolve, _) {
  7941. _this.input.requestInput(resolve);
  7942. });
  7943. return request.then(function (text) {
  7944. var typeToConvert = store.applyStore('p1').type;
  7945. var stoObj = null;
  7946. if (typeToConvert.isCompatible(_types.Types.INTEGER)) {
  7947. var val = (0, _parsers.toInt)(text);
  7948. stoObj = new _storeObject.StoreObject(_types.Types.INTEGER, val);
  7949. } else if (typeToConvert.isCompatible(_types.Types.REAL)) {
  7950. stoObj = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(text));
  7951. } else if (typeToConvert.isCompatible(_types.Types.BOOLEAN)) {
  7952. stoObj = new _storeObject.StoreObject(_types.Types.BOOLEAN, (0, _parsers.toBool)(text));
  7953. } else if (typeToConvert.isCompatible(_types.Types.STRING)) {
  7954. stoObj = new _storeObject.StoreObject(_types.Types.STRING, (0, _parsers.toString)(text));
  7955. }
  7956. _this.loopTimers.splice(0, _this.loopTimers.length);
  7957. store.updateStore('p1', stoObj);
  7958. return Promise.resolve(store);
  7959. });
  7960. };
  7961. var block = new Commands.CommandBlock([], [new Commands.SysCall(readFunction)]);
  7962. var func = new Commands.Function('$read', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', true)], block);
  7963. return func;
  7964. }
  7965. /***/ }),
  7966. /***/ "./js/processor/lib/lang.js":
  7967. /*!**********************************!*\
  7968. !*** ./js/processor/lib/lang.js ***!
  7969. \**********************************/
  7970. /*! no static exports found */
  7971. /***/ (function(module, exports, __webpack_require__) {
  7972. "use strict";
  7973. Object.defineProperty(exports, "__esModule", {
  7974. value: true
  7975. });
  7976. exports.createIsRealFun = createIsRealFun;
  7977. exports.createIsIntFun = createIsIntFun;
  7978. exports.createIsBoolFun = createIsBoolFun;
  7979. exports.createCastRealFun = createCastRealFun;
  7980. exports.createCastIntFun = createCastIntFun;
  7981. exports.createCastBoolFun = createCastBoolFun;
  7982. exports.createCastStringFun = createCastStringFun;
  7983. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  7984. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7985. var Commands = _interopRequireWildcard(_commands);
  7986. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7987. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7988. var _ivprogParser = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  7989. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  7990. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  7991. 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; } }
  7992. /**
  7993. *
  7994. * is_real
  7995. * is_int
  7996. * is_bool
  7997. * cast_real
  7998. * cast_int
  7999. * cast_bool
  8000. * cast_string
  8001. */
  8002. function createIsRealFun() {
  8003. var isRealFun = function isRealFun(sto, _) {
  8004. var str = sto.applyStore("str");
  8005. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8006. var result = false;
  8007. try {
  8008. var val = parser.parseTerm();
  8009. if (val instanceof _expressions.RealLiteral) {
  8010. result = true;
  8011. }
  8012. } catch (error) {}
  8013. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8014. sto.mode = _modes.Modes.RETURN;
  8015. return Promise.resolve(sto.updateStore("$", temp));
  8016. };
  8017. var block = new Commands.CommandBlock([], [new Commands.SysCall(isRealFun)]);
  8018. var func = new Commands.Function('$isReal', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8019. return func;
  8020. }
  8021. function createIsIntFun() {
  8022. var isIntFun = function isIntFun(sto, _) {
  8023. var str = sto.applyStore("str");
  8024. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8025. var result = false;
  8026. try {
  8027. var val = parser.parseTerm();
  8028. if (val instanceof _expressions.IntLiteral) {
  8029. result = true;
  8030. }
  8031. } catch (error) {}
  8032. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8033. sto.mode = _modes.Modes.RETURN;
  8034. return Promise.resolve(sto.updateStore("$", temp));
  8035. };
  8036. var block = new Commands.CommandBlock([], [new Commands.SysCall(isIntFun)]);
  8037. var func = new Commands.Function('$isInt', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8038. return func;
  8039. }
  8040. function createIsBoolFun() {
  8041. var isBoolFun = function isBoolFun(sto, _) {
  8042. var str = sto.applyStore("str");
  8043. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8044. var result = false;
  8045. try {
  8046. var val = parser.parseTerm();
  8047. if (val instanceof _expressions.BoolLiteral) {
  8048. result = true;
  8049. }
  8050. } catch (error) {}
  8051. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8052. sto.mode = _modes.Modes.RETURN;
  8053. return Promise.resolve(sto.updateStore("$", temp));
  8054. };
  8055. var block = new Commands.CommandBlock([], [new Commands.SysCall(isBoolFun)]);
  8056. var func = new Commands.Function('$isBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8057. return func;
  8058. }
  8059. function createCastRealFun() {
  8060. var castRealFun = function castRealFun(sto, _) {
  8061. var val = sto.applyStore("val");
  8062. switch (val.type.ord) {
  8063. case _types.Types.INTEGER.ord:
  8064. {
  8065. var temp = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(val.number));
  8066. sto.mode = _modes.Modes.RETURN;
  8067. return Promise.resolve(sto.updateStore("$", temp));
  8068. }
  8069. case _types.Types.STRING.ord:
  8070. {
  8071. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8072. try {
  8073. var result = parser.parseTerm();
  8074. if (result instanceof _expressions.RealLiteral) {
  8075. var _temp = new _storeObject.StoreObject(_types.Types.REAL, result.value);
  8076. sto.mode = _modes.Modes.RETURN;
  8077. return Promise.resolve(sto.updateStore("$", _temp));
  8078. }
  8079. } catch (error) {
  8080. return Promise.reject("cannot convert string to real");
  8081. }
  8082. }
  8083. }
  8084. };
  8085. var block = new Commands.CommandBlock([], [new Commands.SysCall(castRealFun)]);
  8086. var func = new Commands.Function('$castReal', _types.Types.REAL, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8087. return func;
  8088. }
  8089. function createCastIntFun() {
  8090. var castIntFun = function castIntFun(sto, _) {
  8091. var val = sto.applyStore("val");
  8092. switch (val.type.ord) {
  8093. case _types.Types.REAL.ord:
  8094. {
  8095. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, Math.floor(val.number));
  8096. sto.mode = _modes.Modes.RETURN;
  8097. return Promise.resolve(sto.updateStore("$", temp));
  8098. }
  8099. case _types.Types.STRING.ord:
  8100. {
  8101. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8102. try {
  8103. var result = parser.parseTerm();
  8104. if (result instanceof _expressions.IntLiteral) {
  8105. var _temp2 = new _storeObject.StoreObject(_types.Types.INTEGER, result.value);
  8106. sto.mode = _modes.Modes.RETURN;
  8107. return Promise.resolve(sto.updateStore("$", _temp2));
  8108. }
  8109. } catch (error) {
  8110. return Promise.reject("cannot convert string to real");
  8111. }
  8112. }
  8113. }
  8114. };
  8115. var block = new Commands.CommandBlock([], [new Commands.SysCall(castIntFun)]);
  8116. var func = new Commands.Function('$castInt', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8117. return func;
  8118. }
  8119. function createCastBoolFun() {
  8120. var castBoolFun = function castBoolFun(sto, _) {
  8121. var str = sto.applyStore("str");
  8122. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8123. try {
  8124. var val = parser.parseTerm();
  8125. if (val instanceof _expressions.BoolLiteral) {
  8126. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, val.value);
  8127. sto.mode = _modes.Modes.RETURN;
  8128. return Promise.resolve(sto.updateStore("$", temp));
  8129. }
  8130. } catch (error) {}
  8131. return Promise.reject("cannot convert " + str.value + " to boolean");
  8132. };
  8133. var block = new Commands.CommandBlock([], [new Commands.SysCall(castBoolFun)]);
  8134. var func = new Commands.Function('$castBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8135. return func;
  8136. }
  8137. function createCastStringFun() {
  8138. var castStringFun = function castStringFun(store, _) {
  8139. var val = store.applyStore('str');
  8140. var result = (0, _parsers.convertToString)(val);
  8141. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8142. sto.mode = _modes.Modes.RETURN;
  8143. return Promise.resolve(sto.updateStore("$", temp));
  8144. };
  8145. var block = new Commands.CommandBlock([], [new Commands.SysCall(castStringFun)]);
  8146. var func = new Commands.Function('$castString', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.ALL, 'str', false)], block);
  8147. return func;
  8148. }
  8149. /***/ }),
  8150. /***/ "./js/processor/lib/math.js":
  8151. /*!**********************************!*\
  8152. !*** ./js/processor/lib/math.js ***!
  8153. \**********************************/
  8154. /*! no static exports found */
  8155. /***/ (function(module, exports, __webpack_require__) {
  8156. "use strict";
  8157. Object.defineProperty(exports, "__esModule", {
  8158. value: true
  8159. });
  8160. exports.createSinFun = createSinFun;
  8161. exports.createCosFun = createCosFun;
  8162. exports.createTanFun = createTanFun;
  8163. exports.createSqrtFun = createSqrtFun;
  8164. exports.createPowFun = createPowFun;
  8165. exports.createLogFun = createLogFun;
  8166. exports.createAbsFun = createAbsFun;
  8167. exports.createNegateFun = createNegateFun;
  8168. exports.createInvertFun = createInvertFun;
  8169. exports.createMaxFun = createMaxFun;
  8170. exports.createMinFun = createMinFun;
  8171. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8172. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8173. var Commands = _interopRequireWildcard(_commands);
  8174. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8175. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8176. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8177. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8178. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8179. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8180. var _config = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8181. 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; } }
  8182. 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); } }
  8183. /**
  8184. * sin
  8185. * cos
  8186. * tan
  8187. * sqrt
  8188. * pow
  8189. * log
  8190. * abs
  8191. * negate
  8192. * invert
  8193. * max
  8194. * min
  8195. */
  8196. function convertToRadians(degrees) {
  8197. return degrees.times(_decimal.Decimal.acos(-1)).div(180);
  8198. }
  8199. function createSinFun() {
  8200. var sinFun = function sinFun(sto, _) {
  8201. var x = sto.applyStore('x');
  8202. var angle = x.value.mod(360);
  8203. var result = null;
  8204. if (angle.eq(90)) {
  8205. result = new _decimal.Decimal(1);
  8206. } else if (angle.eq(180)) {
  8207. result = new _decimal.Decimal(0);
  8208. } else if (angle.eq(270)) {
  8209. result = new _decimal.Decimal(-1);
  8210. } else {
  8211. result = _decimal.Decimal.sin(convertToRadians(angle));
  8212. }
  8213. if (result.dp() > _config.Config.decimalPlaces) {
  8214. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8215. }
  8216. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8217. sto.mode = _modes.Modes.RETURN;
  8218. return Promise.resolve(sto.updateStore('$', temp));
  8219. };
  8220. var block = new Commands.CommandBlock([], [new Commands.SysCall(sinFun)]);
  8221. var func = new Commands.Function('$sin', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8222. return func;
  8223. }
  8224. function createCosFun() {
  8225. var cosFun = function cosFun(sto, _) {
  8226. var x = sto.applyStore('x');
  8227. var angle = x.value.mod(360);
  8228. var result = null;
  8229. if (angle.eq(90)) {
  8230. result = new _decimal.Decimal(0);
  8231. } else if (angle.eq(180)) {
  8232. result = new _decimal.Decimal(-1);
  8233. } else if (angle.eq(270)) {
  8234. result = new _decimal.Decimal(0);
  8235. }
  8236. result = _decimal.Decimal.cos(convertToRadians(angle));
  8237. if (result.dp() > _config.Config.decimalPlaces) {
  8238. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8239. }
  8240. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8241. sto.mode = _modes.Modes.RETURN;
  8242. return Promise.resolve(sto.updateStore('$', temp));
  8243. };
  8244. var block = new Commands.CommandBlock([], [new Commands.SysCall(cosFun)]);
  8245. var func = new Commands.Function('$cos', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8246. return func;
  8247. }
  8248. function createTanFun() {
  8249. var tanFun = function tanFun(sto, _) {
  8250. var x = sto.applyStore('x');
  8251. var angle = x.value.mod(360);
  8252. if (angle.eq(90) || angle.eq(270)) {
  8253. return Promise.reject("Tangent of " + x.value.toNumber() + "° is undefined.");
  8254. }
  8255. var result = _decimal.Decimal.tan(convertToRadians(angle));
  8256. if (result.dp() > _config.Config.decimalPlaces) {
  8257. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8258. }
  8259. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8260. sto.mode = _modes.Modes.RETURN;
  8261. return Promise.resolve(sto.updateStore('$', temp));
  8262. };
  8263. var block = new Commands.CommandBlock([], [new Commands.SysCall(tanFun)]);
  8264. var func = new Commands.Function('$tan', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8265. return func;
  8266. }
  8267. function createSqrtFun() {
  8268. var sqrtFun = function sqrtFun(sto, _) {
  8269. var x = sto.applyStore('x');
  8270. var result = x.value.sqrt();
  8271. if (result.dp() > _config.Config.decimalPlaces) {
  8272. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8273. }
  8274. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8275. sto.mode = _modes.Modes.RETURN;
  8276. return Promise.resolve(sto.updateStore('$', temp));
  8277. };
  8278. var block = new Commands.CommandBlock([], [new Commands.SysCall(sqrtFun)]);
  8279. var func = new Commands.Function('$sqrt', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8280. return func;
  8281. }
  8282. function createPowFun() {
  8283. var powFun = function powFun(sto, _) {
  8284. var x = sto.applyStore('x');
  8285. var y = sto.applyStore('y');
  8286. var result = x.value.pow(y.value);
  8287. if (result.dp() > _config.Config.decimalPlaces) {
  8288. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8289. }
  8290. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8291. sto.mode = _modes.Modes.RETURN;
  8292. return Promise.resolve(sto.updateStore('$', temp));
  8293. };
  8294. var block = new Commands.CommandBlock([], [new Commands.SysCall(powFun)]);
  8295. 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);
  8296. return func;
  8297. }
  8298. function createLogFun() {
  8299. var logFun = function logFun(sto, _) {
  8300. var x = sto.applyStore('x');
  8301. if (x.value.isNegative()) {
  8302. return Promise.reject("the value passed to log function cannot be negative");
  8303. }
  8304. var result = _decimal.Decimal.log10(x.value);
  8305. if (result.dp() > _config.Config.decimalPlaces) {
  8306. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8307. }
  8308. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8309. sto.mode = _modes.Modes.RETURN;
  8310. return Promise.resolve(sto.updateStore('$', temp));
  8311. };
  8312. var block = new Commands.CommandBlock([], [new Commands.SysCall(logFun)]);
  8313. var func = new Commands.Function('$log', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8314. return func;
  8315. }
  8316. function createAbsFun() {
  8317. var absFun = function absFun(sto, _) {
  8318. var x = sto.applyStore('x');
  8319. var result = x.value.abs();
  8320. var temp = new _storeObject.StoreObject(x.type, result);
  8321. sto.mode = _modes.Modes.RETURN;
  8322. return Promise.resolve(sto.updateStore('$', temp));
  8323. };
  8324. var block = new Commands.CommandBlock([], [new Commands.SysCall(absFun)]);
  8325. 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);
  8326. return func;
  8327. }
  8328. function createNegateFun() {
  8329. var negateFun = function negateFun(sto, _) {
  8330. var x = sto.applyStore('x');
  8331. var result = x.value.negated();
  8332. var temp = new _storeObject.StoreObject(x.type, result);
  8333. sto.mode = _modes.Modes.RETURN;
  8334. return Promise.resolve(sto.updateStore('$', temp));
  8335. };
  8336. var block = new Commands.CommandBlock([], [new Commands.SysCall(negateFun)]);
  8337. 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);
  8338. return func;
  8339. }
  8340. function createInvertFun() {
  8341. var invertFun = function invertFun(sto, _) {
  8342. var x = sto.applyStore('x');
  8343. var result = (0, _parsers.toReal)(1).dividedBy(x.value);
  8344. if (result.dp() > _config.Config.decimalPlaces) {
  8345. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8346. }
  8347. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8348. sto.mode = _modes.Modes.RETURN;
  8349. return Promise.resolve(sto.updateStore('$', temp));
  8350. };
  8351. var block = new Commands.CommandBlock([], [new Commands.SysCall(invertFun)]);
  8352. var func = new Commands.Function('$invert', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8353. return func;
  8354. }
  8355. function createMaxFun() {
  8356. var maxFun = function maxFun(sto, _) {
  8357. var x = sto.applyStore('x');
  8358. var numbers = x.value.map(function (stoObj) {
  8359. return stoObj.value;
  8360. });
  8361. var result = _decimal.Decimal.max.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8362. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8363. sto.mode = _modes.Modes.RETURN;
  8364. return Promise.resolve(sto.updateStore('$', temp));
  8365. };
  8366. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8367. var block = new Commands.CommandBlock([], [new Commands.SysCall(maxFun)]);
  8368. var func = new Commands.Function('$max', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8369. return func;
  8370. }
  8371. function createMinFun() {
  8372. var minFun = function minFun(sto, _) {
  8373. var x = sto.applyStore('x');
  8374. var numbers = x.value.map(function (stoObj) {
  8375. return stoObj.value;
  8376. });
  8377. var result = _decimal.Decimal.min.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8378. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8379. sto.mode = _modes.Modes.RETURN;
  8380. return Promise.resolve(sto.updateStore('$', temp));
  8381. };
  8382. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8383. var block = new Commands.CommandBlock([], [new Commands.SysCall(minFun)]);
  8384. var func = new Commands.Function('$min', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8385. return func;
  8386. }
  8387. /***/ }),
  8388. /***/ "./js/processor/lib/strings.js":
  8389. /*!*************************************!*\
  8390. !*** ./js/processor/lib/strings.js ***!
  8391. \*************************************/
  8392. /*! no static exports found */
  8393. /***/ (function(module, exports, __webpack_require__) {
  8394. "use strict";
  8395. Object.defineProperty(exports, "__esModule", {
  8396. value: true
  8397. });
  8398. exports.createSubstringFun = createSubstringFun;
  8399. exports.createLengthFun = createLengthFun;
  8400. exports.createUppercaseFun = createUppercaseFun;
  8401. exports.createLowercaseFun = createLowercaseFun;
  8402. exports.createrCharAtFun = createrCharAtFun;
  8403. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8404. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8405. var Commands = _interopRequireWildcard(_commands);
  8406. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8407. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8408. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8409. 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; } }
  8410. /*
  8411. * substring
  8412. * length
  8413. * uppercase
  8414. * lowercase
  8415. * charAt
  8416. **/
  8417. function createSubstringFun() {
  8418. var substringFun = function substringFun(sto, _) {
  8419. var str = sto.applyStore("str");
  8420. var start = sto.applyStore("start");
  8421. var end = sto.applyStore("end");
  8422. var result = str.value.substring(start.value, end.value);
  8423. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8424. sto.mode = _modes.Modes.RETURN;
  8425. return Promise.resolve(sto.updateStore("$", temp));
  8426. };
  8427. var block = new Commands.CommandBlock([], [new Commands.SysCall(substringFun)]);
  8428. 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);
  8429. return func;
  8430. }
  8431. function createLengthFun() {
  8432. var lengthFun = function lengthFun(sto, _) {
  8433. var str = sto.applyStore("str");
  8434. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(str.value.length));
  8435. sto.mode = _modes.Modes.RETURN;
  8436. return Promise.resolve(sto.updateStore("$", temp));
  8437. };
  8438. var block = new Commands.CommandBlock([], [new Commands.SysCall(lengthFun)]);
  8439. var func = new Commands.Function('$length', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8440. return func;
  8441. }
  8442. function createUppercaseFun() {
  8443. var uppercaseFun = function uppercaseFun(sto, _) {
  8444. var str = sto.applyStore("str");
  8445. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toUpperCase());
  8446. sto.mode = _modes.Modes.RETURN;
  8447. return Promise.resolve(sto.updateStore("$", temp));
  8448. };
  8449. var block = new Commands.CommandBlock([], [new Commands.SysCall(uppercaseFun)]);
  8450. var func = new Commands.Function('$uppercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8451. return func;
  8452. }
  8453. function createLowercaseFun() {
  8454. var lowercaseFun = function lowercaseFun(sto, _) {
  8455. var str = sto.applyStore("str");
  8456. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toLowerCase());
  8457. sto.mode = _modes.Modes.RETURN;
  8458. return Promise.resolve(sto.updateStore("$", temp));
  8459. };
  8460. var block = new Commands.CommandBlock([], [new Commands.SysCall(lowercaseFun)]);
  8461. var func = new Commands.Function('$lowercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8462. return func;
  8463. }
  8464. function createrCharAtFun() {
  8465. var charAtFun = function charAtFun(sto, _) {
  8466. var str = sto.applyStore("str");
  8467. var idx = sto.applyStore("index");
  8468. if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
  8469. return Promise.reject(new Error("invalid string position"));
  8470. }
  8471. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.charAt(idx.value.toNumber()));
  8472. sto.mode = _modes.Modes.RETURN;
  8473. return Promise.resolve(sto.updateStore("$", temp));
  8474. };
  8475. var block = new Commands.CommandBlock([], [new Commands.SysCall(charAtFun)]);
  8476. 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);
  8477. return func;
  8478. }
  8479. /***/ }),
  8480. /***/ "./js/processor/modes.js":
  8481. /*!*******************************!*\
  8482. !*** ./js/processor/modes.js ***!
  8483. \*******************************/
  8484. /*! no static exports found */
  8485. /***/ (function(module, exports, __webpack_require__) {
  8486. "use strict";
  8487. Object.defineProperty(exports, "__esModule", {
  8488. value: true
  8489. });
  8490. var Modes = exports.Modes = Object.freeze({
  8491. RETURN: Symbol('mode:return'),
  8492. BREAK: Symbol('mode:break'),
  8493. PAUSE: Symbol('mode:pause'),
  8494. RUN: Symbol('mode:run')
  8495. });
  8496. /***/ }),
  8497. /***/ "./js/processor/semantic/semanticAnalyser.js":
  8498. /*!***************************************************!*\
  8499. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  8500. \***************************************************/
  8501. /*! no static exports found */
  8502. /***/ (function(module, exports, __webpack_require__) {
  8503. "use strict";
  8504. Object.defineProperty(exports, "__esModule", {
  8505. value: true
  8506. });
  8507. exports.SemanticAnalyser = undefined;
  8508. 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; }; }();
  8509. var _processorErrorFactory = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8510. var _definedFunctions = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  8511. var _languageService = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js");
  8512. var _commands = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  8513. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8514. var _literal = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  8515. var _compatibilityTable = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js");
  8516. var _types = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js");
  8517. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8518. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8519. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8520. var SemanticAnalyser = exports.SemanticAnalyser = function () {
  8521. function SemanticAnalyser(ast) {
  8522. _classCallCheck(this, SemanticAnalyser);
  8523. this.ast = ast;
  8524. this.lexerClass = _languageService.LanguageService.getCurrentLexer();
  8525. var lexer = new this.lexerClass(null);
  8526. this.literalNames = lexer.literalNames;
  8527. this.symbolMap = null;
  8528. this.currentFunction = null;
  8529. }
  8530. _createClass(SemanticAnalyser, [{
  8531. key: 'pushMap',
  8532. value: function pushMap() {
  8533. if (this.symbolMap === null) {
  8534. this.symbolMap = { map: {}, next: null };
  8535. } else {
  8536. var n = { map: {}, next: this.symbolMap };
  8537. this.symbolMap = n;
  8538. }
  8539. }
  8540. }, {
  8541. key: 'popMap',
  8542. value: function popMap() {
  8543. if (this.symbolMap !== null) {
  8544. this.symbolMap = this.symbolMap.next;
  8545. }
  8546. }
  8547. }, {
  8548. key: 'insertSymbol',
  8549. value: function insertSymbol(id, typeInfo) {
  8550. this.symbolMap.map[id] = typeInfo;
  8551. }
  8552. }, {
  8553. key: 'findSymbol',
  8554. value: function findSymbol(id, symMap) {
  8555. if (!symMap.map[id]) {
  8556. if (symMap.next) {
  8557. return this.findSymbol(id, symMap.next);
  8558. }
  8559. return null;
  8560. } else {
  8561. return symMap.map[id];
  8562. }
  8563. }
  8564. }, {
  8565. key: 'getMainFunction',
  8566. value: function getMainFunction() {
  8567. return this.ast.functions.find(function (v) {
  8568. return v.isMain;
  8569. });
  8570. }
  8571. }, {
  8572. key: 'findFunction',
  8573. value: function findFunction(name) {
  8574. if (name.match(/^\$.+$/)) {
  8575. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  8576. if (!!!fun) {
  8577. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  8578. }
  8579. return fun;
  8580. } else {
  8581. var val = this.ast.functions.find(function (v) {
  8582. return v.name === name;
  8583. });
  8584. if (!!!val) {
  8585. return null;
  8586. }
  8587. return val;
  8588. }
  8589. }
  8590. }, {
  8591. key: 'analyseTree',
  8592. value: function analyseTree() {
  8593. var globalVars = this.ast.global;
  8594. this.pushMap();
  8595. this.assertDeclarations(globalVars);
  8596. var functions = this.ast.functions;
  8597. var mainFunc = functions.filter(function (f) {
  8598. return f.name === null;
  8599. });
  8600. if (mainFunc.length <= 0) {
  8601. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  8602. }
  8603. for (var i = 0; i < functions.length; i++) {
  8604. var fun = functions[i];
  8605. this.assertFunction(fun);
  8606. }
  8607. return this.ast;
  8608. }
  8609. }, {
  8610. key: 'assertDeclarations',
  8611. value: function assertDeclarations(list) {
  8612. for (var i = 0; i < list.length; i++) {
  8613. this.assertDeclaration(list[i]);
  8614. }
  8615. }
  8616. }, {
  8617. key: 'assertDeclaration',
  8618. value: function assertDeclaration(declaration) {
  8619. if (declaration instanceof _commands.ArrayDeclaration) {
  8620. if (declaration.initial === null) {
  8621. var lineType = this.evaluateExpressionType(declaration.lines);
  8622. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8623. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8624. }
  8625. if (declaration.columns !== null) {
  8626. var columnType = this.evaluateExpressionType(declaration.columns);
  8627. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8628. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8629. }
  8630. }
  8631. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8632. return;
  8633. }
  8634. this.evaluateArrayLiteral(declaration.id, declaration.lines, declaration.columns, declaration.type, declaration.initial);
  8635. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8636. } else {
  8637. if (declaration.initial === null) {
  8638. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8639. return;
  8640. }
  8641. var resultType = this.evaluateExpressionType(declaration.initial);
  8642. if (resultType instanceof _multiType.MultiType) {
  8643. if (!resultType.isCompatible(declaration.type)) {
  8644. var stringInfo = declaration.type.stringInfo();
  8645. var info = stringInfo[0];
  8646. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, declaration.sourceInfo);
  8647. }
  8648. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8649. } else if (!declaration.type.isCompatible(resultType)) {
  8650. var _stringInfo = declaration.type.stringInfo();
  8651. var _info = _stringInfo[0];
  8652. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info.type, _info.dim, declaration.sourceInfo);
  8653. } else {
  8654. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8655. }
  8656. }
  8657. }
  8658. }, {
  8659. key: 'evaluateExpressionType',
  8660. value: function evaluateExpressionType(expression) {
  8661. if (expression instanceof _expressions.UnaryApp) {
  8662. var op = expression.op;
  8663. var resultType = this.evaluateExpressionType(expression.left);
  8664. return (0, _compatibilityTable.resultTypeAfterUnaryOp)(op, resultType);
  8665. } else if (expression instanceof _expressions.InfixApp) {
  8666. var _op = expression.op;
  8667. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  8668. var resultTypeRight = this.evaluateExpressionType(expression.right);
  8669. return (0, _compatibilityTable.resultTypeAfterInfixOp)(_op, resultTypeLeft, resultTypeRight);
  8670. } else if (expression instanceof _literal.Literal) {
  8671. return this.evaluateLiteralType(expression);
  8672. } else if (expression instanceof _expressions.FunctionCall) {
  8673. if (expression.isMainCall) {
  8674. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), expression.sourceInfo);
  8675. }
  8676. var fun = this.findFunction(expression.id);
  8677. if (fun === null) {
  8678. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(expression.id, expression.sourceInfo);
  8679. }
  8680. if (fun.returnType.isCompatible(_types.Types.VOID)) {
  8681. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(expression.id, expression.sourceInfo);
  8682. }
  8683. this.assertParameters(fun, expression.actualParameters);
  8684. return fun.returnType;
  8685. } else if (expression instanceof _expressions.ArrayAccess) {
  8686. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  8687. if (arrayTypeInfo === null) {
  8688. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(expression.id, expression.sourceInfo);
  8689. }
  8690. if (!(arrayTypeInfo.type instanceof _compoundType.CompoundType)) {
  8691. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(expression.id, expression.sourceInfo);
  8692. }
  8693. var lineType = this.evaluateExpressionType(expression.line);
  8694. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8695. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8696. }
  8697. if (expression.column !== null) {
  8698. if (arrayTypeInfo.columns === null) {
  8699. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(expression.id, expression.sourceInfo);
  8700. }
  8701. var columnType = this.evaluateExpressionType(expression.column);
  8702. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8703. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8704. }
  8705. }
  8706. var arrType = arrayTypeInfo.type;
  8707. if (expression.column !== null) {
  8708. // indexing matrix
  8709. return arrType.innerType;
  8710. } else {
  8711. if (arrayTypeInfo.columns === null) {
  8712. return arrType.innerType;
  8713. }
  8714. return new _compoundType.CompoundType(arrType.innerType, 1);
  8715. }
  8716. }
  8717. }
  8718. }, {
  8719. key: 'evaluateLiteralType',
  8720. value: function evaluateLiteralType(literal) {
  8721. if (literal instanceof _expressions.IntLiteral) {
  8722. return literal.type;
  8723. } else if (literal instanceof _expressions.RealLiteral) {
  8724. return literal.type;
  8725. } else if (literal instanceof _expressions.StringLiteral) {
  8726. return literal.type;
  8727. } else if (literal instanceof _expressions.BoolLiteral) {
  8728. return literal.type;
  8729. } else if (literal instanceof _expressions.VariableLiteral) {
  8730. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  8731. if (typeInfo === null) {
  8732. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(literal.id, literal.sourceInfo);
  8733. }
  8734. if (typeInfo.type instanceof _compoundType.CompoundType) {
  8735. return typeInfo.type;
  8736. }
  8737. return typeInfo.type;
  8738. } else {
  8739. console.warn("Evaluating type only for an array literal...");
  8740. var last = null;
  8741. if (literal.value.length === 1) {
  8742. last = this.evaluateExpressionType(literal.value[0]);
  8743. } else {
  8744. for (var i = 0; i < literal.value.length; i++) {
  8745. var e = this.evaluateExpressionType(literal.value[i]);
  8746. if (last === null) {
  8747. last = e;
  8748. } else if (!last.isCompatible(e)) {
  8749. var strInfo = last.stringInfo();
  8750. var info = strInfo[0];
  8751. var strExp = literal.toString();
  8752. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8753. }
  8754. }
  8755. }
  8756. if (last instanceof _compoundType.CompoundType) {
  8757. return new _compoundType.CompoundType(last.innerType, last.dimensions + 1);
  8758. }
  8759. return new _compoundType.CompoundType(last, 1);
  8760. }
  8761. }
  8762. }, {
  8763. key: 'evaluateArrayLiteral',
  8764. value: function evaluateArrayLiteral(id, lines, columns, type, literal) {
  8765. var _this = this;
  8766. if (literal instanceof _expressions.ArrayLiteral) {
  8767. if (columns === null) {
  8768. // it's a vector...
  8769. var dimType = this.evaluateExpressionType(lines);
  8770. if (!dimType.isCompatible(_types.Types.INTEGER)) {
  8771. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8772. }
  8773. if (lines instanceof _expressions.IntLiteral) {
  8774. if (!lines.value.eq(literal.value.length)) {
  8775. if (type.dimensions > 1) {
  8776. throw _processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(id, literal.value.length, lines.values.toNumber(), literal.sourceInfo);
  8777. } else {
  8778. throw _processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(id, literal.value.length, lines.values.toNumber(), literal.sourceInfo);
  8779. }
  8780. } else if (lines.value.isNeg()) {
  8781. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8782. }
  8783. }
  8784. literal.value.reduce(function (last, next) {
  8785. var eType = _this.evaluateExpressionType(next);
  8786. if (!last.canAccept(eType)) {
  8787. var strInfo = last.stringInfo();invalid;
  8788. var info = strInfo[0];
  8789. var strExp = literal.toString();
  8790. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8791. }
  8792. return last;
  8793. }, type);
  8794. return true;
  8795. } else {
  8796. var _dimType = this.evaluateExpressionType(columns);
  8797. if (!_dimType.isCompatible(_types.Types.INTEGER)) {
  8798. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8799. }
  8800. if (columns instanceof _expressions.IntLiteral) {
  8801. if (!columns.value.eq(literal.value.length)) {
  8802. if (type.dimensions > 1) {
  8803. throw _processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(id, literal.value.length, columns.values.toNumber(), literal.sourceInfo);
  8804. } else {
  8805. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(id, literal.sourceInfo);
  8806. }
  8807. } else if (columns.value.isNeg()) {
  8808. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8809. }
  8810. }
  8811. for (var i = 0; i < columns; i++) {
  8812. var anotherArray = literal.value[i];
  8813. this.evaluateArrayLiteral(id, lines, null, type, anotherArray);
  8814. }
  8815. }
  8816. } else {
  8817. var resultType = this.evaluateExpressionType(literal);
  8818. if (!(resultType instanceof _compoundType.CompoundType)) {
  8819. var strInfo = type.stringInfo();
  8820. var info = strInfo[0];
  8821. var strExp = literal.toString();
  8822. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8823. }
  8824. if (!type.isCompatible(resultType)) {
  8825. var _strInfo = type.stringInfo();
  8826. var _info2 = _strInfo[0];
  8827. var _strExp = literal.toString();
  8828. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(_strExp, _info2.type, _info2.dim, literal.sourceInfo);
  8829. }
  8830. return true;
  8831. }
  8832. }
  8833. }, {
  8834. key: 'assertFunction',
  8835. value: function assertFunction(fun) {
  8836. var _this2 = this;
  8837. this.pushMap();
  8838. this.currentFunction = fun;
  8839. fun.formalParameters.forEach(function (formalParam) {
  8840. if (formalParam.type instanceof _compoundType.CompoundType) {
  8841. if (formalParam.type.dimensions > 1) {
  8842. _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: -1, type: formalParam.type });
  8843. } else {
  8844. _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: null, type: formalParam.type });
  8845. }
  8846. } else {
  8847. _this2.insertSymbol(formalParam.id, { id: formalParam.id, type: formalParam.type });
  8848. }
  8849. });
  8850. this.assertDeclarations(fun.variablesDeclarations);
  8851. var optional = fun.returnType.isCompatible(_types.Types.VOID);
  8852. var valid = this.assertReturn(fun, optional);
  8853. if (!valid) {
  8854. throw _processorErrorFactory.ProcessorErrorFactory.function_no_return(fun.name);
  8855. }
  8856. this.popMap();
  8857. }
  8858. }, {
  8859. key: 'assertReturn',
  8860. value: function assertReturn(fun, optional) {
  8861. var _this3 = this;
  8862. return fun.commands.reduce(function (last, next) {
  8863. return _this3.checkCommand(fun.returnType, next, optional) || last;
  8864. }, optional);
  8865. }
  8866. }, {
  8867. key: 'checkCommand',
  8868. value: function checkCommand(type, cmd, optional) {
  8869. if (cmd instanceof _commands.While) {
  8870. var resultType = this.evaluateExpressionType(cmd.expression);
  8871. if (!resultType.isCompatible(_types.Types.BOOLEAN)) {
  8872. throw _processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo);
  8873. }
  8874. this.checkCommands(type, cmd.commands, optional);
  8875. return false;
  8876. } else if (cmd instanceof _commands.For) {
  8877. this.checkCommand(type, cmd.assignment, optional);
  8878. var _resultType = this.evaluateExpressionType(cmd.condition);
  8879. if (!_resultType.isCompatible(_types.Types.BOOLEAN)) {
  8880. throw _processorErrorFactory.ProcessorErrorFactory.for_condition_type_full(cmd.sourceInfo);
  8881. }
  8882. this.checkCommand(type, cmd.increment, optional);
  8883. this.checkCommands(type, cmd.commands, optional);
  8884. return false;
  8885. } else if (cmd instanceof _commands.Switch) {
  8886. var sType = this.evaluateExpressionType(cmd.expression);
  8887. var result = optional;
  8888. var hasDefault = false;
  8889. for (var i = 0; i < cmd.cases.length; i++) {
  8890. var aCase = cmd.cases[i];
  8891. if (aCase.expression !== null) {
  8892. var caseType = this.evaluateExpressionType(aCase.expression);
  8893. if (!sType.isCompatible(caseType)) {
  8894. var strInfo = sType.stringInfo();
  8895. var info = strInfo[0];
  8896. var strExp = aCase.expression.toString();
  8897. throw _processorErrorFactory.ProcessorErrorFactory.invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
  8898. }
  8899. } else {
  8900. hasDefault = true;
  8901. }
  8902. result = result && this.checkCommands(type, aCase.commands, result);
  8903. }
  8904. return result && hasDefault;
  8905. } else if (cmd instanceof _commands.ArrayIndexAssign) {
  8906. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  8907. if (typeInfo === null) {
  8908. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  8909. }
  8910. if (!(typeInfo.type instanceof _compoundType.CompoundType)) {
  8911. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo);
  8912. }
  8913. var exp = cmd.expression;
  8914. var lineExp = cmd.line;
  8915. var lineType = this.evaluateExpressionType(lineExp);
  8916. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8917. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  8918. }
  8919. var columnExp = cmd.column;
  8920. if (typeInfo.columns === null && columnExp !== null) {
  8921. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
  8922. } else if (columnExp !== null) {
  8923. var columnType = this.evaluateExpressionType(columnExp);
  8924. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8925. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  8926. }
  8927. }
  8928. // exp can be a arrayLiteral, a single value exp or an array access
  8929. if (exp instanceof _expressions.ArrayLiteral) {
  8930. this.evaluateArrayLiteral(cmd.id, typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp);
  8931. } else {
  8932. // cannot properly evaluate since type system is poorly constructed
  8933. }
  8934. return optional;
  8935. } else if (cmd instanceof _commands.Assign) {
  8936. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  8937. if (_typeInfo === null) {
  8938. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  8939. }
  8940. var _exp = cmd.expression;
  8941. if (_exp instanceof _expressions.ArrayLiteral) {
  8942. if (!(_typeInfo.type instanceof _compoundType.CompoundType)) {
  8943. var stringInfo = _typeInfo.type.stringInfo();
  8944. var _info3 = stringInfo[0];
  8945. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info3.type, _info3.dim, cmd.sourceInfo);
  8946. }
  8947. this.evaluateArrayLiteral(cmd.id, _typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp);
  8948. } else {
  8949. var _resultType2 = this.evaluateExpressionType(_exp);
  8950. if (!_resultType2.isCompatible(_typeInfo.type)) {
  8951. var _stringInfo2 = _typeInfo.type.stringInfo();
  8952. var _info4 = _stringInfo2[0];
  8953. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info4.type, _info4.dim, cmd.sourceInfo);
  8954. }
  8955. }
  8956. return optional;
  8957. } else if (cmd instanceof _commands.Break) {
  8958. return optional;
  8959. } else if (cmd instanceof _commands.IfThenElse) {
  8960. var _resultType3 = this.evaluateExpressionType(cmd.condition);
  8961. if (!_resultType3.isCompatible(_types.Types.BOOLEAN)) {
  8962. throw _processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo);
  8963. }
  8964. if (cmd.ifFalse instanceof _commands.IfThenElse) {
  8965. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  8966. } else {
  8967. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  8968. }
  8969. } else if (cmd instanceof _expressions.FunctionCall) {
  8970. var fun = null;
  8971. if (cmd.isMainCall) {
  8972. fun = this.getMainFunction();
  8973. } else {
  8974. fun = this.findFunction(cmd.id);
  8975. }
  8976. if (fun === null) {
  8977. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(cmd.id, cmd.sourceInfo);
  8978. }
  8979. this.assertParameters(fun, cmd.actualParameters);
  8980. return optional;
  8981. } else if (cmd instanceof _commands.Return) {
  8982. var funcName = this.currentFunction.isMain ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : this.currentFunction.name;
  8983. if (cmd.expression === null && !type.isCompatible(_types.Types.VOID)) {
  8984. var _stringInfo3 = type.stringInfo();
  8985. var _info5 = _stringInfo3[0];
  8986. throw _processorErrorFactory.ProcessorErrorFactory.invalid_void_return_full(funcName, _info5.type, _info5.dim, cmd.sourceInfo);
  8987. } else if (cmd.expression !== null) {
  8988. var _resultType4 = this.evaluateExpressionType(cmd.expression);
  8989. if (!type.isCompatible(_resultType4)) {
  8990. var _stringInfo4 = type.stringInfo();
  8991. var _info6 = _stringInfo4[0];
  8992. throw _processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, _info6.type, _info6.dim, cmd.sourceInfo);
  8993. } else {
  8994. return true;
  8995. }
  8996. } else {
  8997. return true;
  8998. }
  8999. }
  9000. }
  9001. }, {
  9002. key: 'checkCommands',
  9003. value: function checkCommands(type, cmds, optional) {
  9004. var _this4 = this;
  9005. return cmds.reduce(function (last, next) {
  9006. return _this4.checkCommand(type, next, optional) || last;
  9007. }, optional);
  9008. }
  9009. }, {
  9010. key: 'assertParameters',
  9011. value: function assertParameters(fun, actualParametersList) {
  9012. if (fun.formalParameters.length !== actualParametersList.length) {
  9013. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
  9014. }
  9015. for (var i = 0; i < actualParametersList.length; i++) {
  9016. var param = actualParametersList[i];
  9017. var formalParam = fun.formalParameters[i];
  9018. var id = formalParam.id;
  9019. if (formalParam.byRef) {
  9020. if (!(param instanceof _expressions.VariableLiteral || param instanceof _expressions.ArrayAccess)) {
  9021. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9022. }
  9023. }
  9024. var resultType = this.evaluateExpressionType(param);
  9025. if (resultType instanceof _multiType.MultiType && formalParam.type instanceof _multiType.MultiType) {
  9026. var shared = 0;
  9027. for (var j = 0; j < resultType.types.length; j++) {
  9028. var element = resultType.types[j];
  9029. if (formalParam.type.types.indexOf(element) !== -1) {
  9030. shared++;
  9031. }
  9032. }
  9033. if (shared <= 0) {
  9034. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9035. }
  9036. } else if (resultType instanceof _multiType.MultiType) {
  9037. if (!resultType.isCompatible(formalParam.type)) {
  9038. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9039. }
  9040. } else if (!formalParam.type.isCompatible(resultType)) {
  9041. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9042. }
  9043. }
  9044. }
  9045. }]);
  9046. return SemanticAnalyser;
  9047. }();
  9048. /***/ }),
  9049. /***/ "./js/processor/store/store.js":
  9050. /*!*************************************!*\
  9051. !*** ./js/processor/store/store.js ***!
  9052. \*************************************/
  9053. /*! no static exports found */
  9054. /***/ (function(module, exports, __webpack_require__) {
  9055. "use strict";
  9056. Object.defineProperty(exports, "__esModule", {
  9057. value: true
  9058. });
  9059. exports.Store = undefined;
  9060. 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; }; }();
  9061. var _modes = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js");
  9062. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9063. var Store = exports.Store = function () {
  9064. function Store(name) {
  9065. _classCallCheck(this, Store);
  9066. this.name = name;
  9067. this.store = {};
  9068. this.nextStore = null;
  9069. this.mode = _modes.Modes.RUN;
  9070. }
  9071. _createClass(Store, [{
  9072. key: "extendStore",
  9073. value: function extendStore(nextStore) {
  9074. this.nextStore = nextStore;
  9075. }
  9076. }, {
  9077. key: "applyStore",
  9078. value: function applyStore(id) {
  9079. if (!this.store[id]) {
  9080. if (this.nextStore !== null) {
  9081. return this.nextStore.applyStore(id);
  9082. } else {
  9083. // TODO: better error message
  9084. throw new Error("Variable " + id + " not found.");
  9085. }
  9086. }
  9087. var val = this.store[id];
  9088. if (val.isRef) {
  9089. return val.getRefObj();
  9090. }
  9091. return this.store[id];
  9092. }
  9093. }, {
  9094. key: "updateStore",
  9095. value: function updateStore(id, stoObj) {
  9096. if (!this.store[id]) {
  9097. if (this.nextStore !== null) {
  9098. this.nextStore.updateStore(id, stoObj);
  9099. return this;
  9100. } else {
  9101. // TODO: better error message
  9102. throw new Error("Variable " + id + " not found.");
  9103. }
  9104. } else {
  9105. var oldObj = this.store[id];
  9106. if (oldObj.readOnly) {
  9107. // TODO: better error message
  9108. throw new Error("Cannot change value of a read only variable: " + id);
  9109. }
  9110. if (oldObj.isRef) {
  9111. oldObj.updateRef(stoObj);
  9112. return this;
  9113. } else if (oldObj.isCompatible(stoObj)) {
  9114. stoObj.setID(id);
  9115. this.store[id] = Object.freeze(stoObj);
  9116. return this;
  9117. } else {
  9118. var oldType = oldObj.type;
  9119. var stoType = stoObj.type;
  9120. // TODO: better error message
  9121. throw new Error(oldType + " is not compatible with type " + stoType + " given");
  9122. }
  9123. }
  9124. }
  9125. //In case of future use of ref, it needs to have a special function to update the storeRefObject
  9126. // and no the StoreObject refferenced by it
  9127. // updateStoreRef(id, stoObjAddress) {...}
  9128. }, {
  9129. key: "insertStore",
  9130. value: function insertStore(id, stoObj) {
  9131. if (this.store[id]) {
  9132. // TODO: better error message
  9133. throw new Error(id + " is already defined");
  9134. }
  9135. stoObj.setID(id);
  9136. this.store[id] = Object.freeze(stoObj);
  9137. return this;
  9138. }
  9139. }]);
  9140. return Store;
  9141. }();
  9142. /***/ }),
  9143. /***/ "./js/processor/store/storeObject.js":
  9144. /*!*******************************************!*\
  9145. !*** ./js/processor/store/storeObject.js ***!
  9146. \*******************************************/
  9147. /*! no static exports found */
  9148. /***/ (function(module, exports, __webpack_require__) {
  9149. "use strict";
  9150. Object.defineProperty(exports, "__esModule", {
  9151. value: true
  9152. });
  9153. exports.StoreObject = undefined;
  9154. 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; }; }();
  9155. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9156. var _decimal2 = _interopRequireDefault(_decimal);
  9157. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9158. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9159. var StoreObject = exports.StoreObject = function () {
  9160. function StoreObject(type, value) {
  9161. var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9162. _classCallCheck(this, StoreObject);
  9163. this._type = type;
  9164. this._value = value;
  9165. this._readOnly = readOnly;
  9166. this._id = null;
  9167. }
  9168. _createClass(StoreObject, [{
  9169. key: 'setID',
  9170. value: function setID(id) {
  9171. this._id = id;
  9172. }
  9173. }, {
  9174. key: 'isCompatible',
  9175. value: function isCompatible(another) {
  9176. if (another instanceof StoreObject) {
  9177. return this.type.isCompatible(another.type);
  9178. }
  9179. return false;
  9180. }
  9181. }, {
  9182. key: 'id',
  9183. get: function get() {
  9184. return this._id;
  9185. }
  9186. }, {
  9187. key: 'inStore',
  9188. get: function get() {
  9189. return this.id !== null;
  9190. }
  9191. }, {
  9192. key: 'type',
  9193. get: function get() {
  9194. return this._type;
  9195. }
  9196. }, {
  9197. key: 'value',
  9198. get: function get() {
  9199. return this._value;
  9200. }
  9201. }, {
  9202. key: 'number',
  9203. get: function get() {
  9204. if (this._value instanceof _decimal2.default) {
  9205. return this._value.toNumber();
  9206. } else {
  9207. return null;
  9208. }
  9209. }
  9210. }, {
  9211. key: 'readOnly',
  9212. get: function get() {
  9213. return this._readOnly;
  9214. },
  9215. set: function set(value) {
  9216. this._readOnly = value;
  9217. }
  9218. }]);
  9219. return StoreObject;
  9220. }();
  9221. /***/ }),
  9222. /***/ "./js/processor/store/storeObjectArray.js":
  9223. /*!************************************************!*\
  9224. !*** ./js/processor/store/storeObjectArray.js ***!
  9225. \************************************************/
  9226. /*! no static exports found */
  9227. /***/ (function(module, exports, __webpack_require__) {
  9228. "use strict";
  9229. Object.defineProperty(exports, "__esModule", {
  9230. value: true
  9231. });
  9232. exports.StoreObjectArray = undefined;
  9233. 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); } };
  9234. 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; }; }();
  9235. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9236. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9237. 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; }
  9238. 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; }
  9239. var StoreObjectArray = exports.StoreObjectArray = function (_StoreObject) {
  9240. _inherits(StoreObjectArray, _StoreObject);
  9241. _createClass(StoreObjectArray, null, [{
  9242. key: 'WRONG_LINE_NUMBER',
  9243. get: function get() {
  9244. return 1;
  9245. }
  9246. }, {
  9247. key: 'WRONG_TYPE',
  9248. get: function get() {
  9249. return 2;
  9250. }
  9251. }, {
  9252. key: 'WRONG_COLUMN_NUMBER',
  9253. get: function get() {
  9254. return 3;
  9255. }
  9256. }]);
  9257. function StoreObjectArray(type, lines, columns) {
  9258. var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  9259. var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  9260. _classCallCheck(this, StoreObjectArray);
  9261. var _this = _possibleConstructorReturn(this, (StoreObjectArray.__proto__ || Object.getPrototypeOf(StoreObjectArray)).call(this, type, value, readOnly));
  9262. _this._lines = lines;
  9263. _this._columns = columns;
  9264. return _this;
  9265. }
  9266. _createClass(StoreObjectArray, [{
  9267. key: 'isCompatible',
  9268. value: function isCompatible(another) {
  9269. if (another instanceof _storeObject.StoreObject) {
  9270. if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) {
  9271. if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) {
  9272. return _get(StoreObjectArray.prototype.__proto__ || Object.getPrototypeOf(StoreObjectArray.prototype), 'isCompatible', this).call(this, another);
  9273. }
  9274. }
  9275. }
  9276. return false;
  9277. }
  9278. }, {
  9279. key: 'lines',
  9280. get: function get() {
  9281. return this._lines;
  9282. }
  9283. }, {
  9284. key: 'columns',
  9285. get: function get() {
  9286. return this._columns;
  9287. }
  9288. }, {
  9289. key: 'isVector',
  9290. get: function get() {
  9291. return this.type.dimensions === 1;
  9292. }
  9293. }, {
  9294. key: 'isValid',
  9295. get: function get() {
  9296. var _this2 = this;
  9297. if (this.value !== null) {
  9298. if (this.isVector) {
  9299. if (this.value.length !== this.lines) {
  9300. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];;
  9301. }
  9302. var mustBeNull = this.value.find(function (v) {
  9303. return !_this2.type.canAccept(v.type);
  9304. });
  9305. if (!!mustBeNull) {
  9306. return [StoreObjectArray.WRONG_TYPE, this.value.indexOf(mustBeNull)];;
  9307. }
  9308. }
  9309. return [];
  9310. } else {
  9311. if (this.lines !== this.value.length) {
  9312. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9313. }
  9314. for (var i = 0; i < this.lines; i++) {
  9315. for (var j = 0; j < this.columns; j++) {
  9316. var arr = this.value[i];
  9317. if (arr.length !== this.columns) {
  9318. return [StoreObjectArray.WRONG_COLUMN_NUMBER, arr.length];
  9319. }
  9320. var _mustBeNull = arr.find(function (v) {
  9321. return !_this2.type.canAccept(v.type);
  9322. });
  9323. if (!!_mustBeNull) {
  9324. return [StoreObjectArray.WRONG_TYPE, i, arr.indexOf(_mustBeNull)];
  9325. }
  9326. }
  9327. }
  9328. return [];
  9329. }
  9330. }
  9331. }]);
  9332. return StoreObjectArray;
  9333. }(_storeObject.StoreObject);
  9334. /***/ }),
  9335. /***/ "./js/processor/store/storeObjectArrayAddress.js":
  9336. /*!*******************************************************!*\
  9337. !*** ./js/processor/store/storeObjectArrayAddress.js ***!
  9338. \*******************************************************/
  9339. /*! no static exports found */
  9340. /***/ (function(module, exports, __webpack_require__) {
  9341. "use strict";
  9342. Object.defineProperty(exports, "__esModule", {
  9343. value: true
  9344. });
  9345. exports.StoreObjectArrayAddress = undefined;
  9346. 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; }; }();
  9347. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9348. var _storeObjectArray = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  9349. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  9350. var _processorErrorFactory = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  9351. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9352. 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; }
  9353. 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; }
  9354. var StoreObjectArrayAddress = exports.StoreObjectArrayAddress = function (_StoreObject) {
  9355. _inherits(StoreObjectArrayAddress, _StoreObject);
  9356. function StoreObjectArrayAddress(refID, line, column, store) {
  9357. _classCallCheck(this, StoreObjectArrayAddress);
  9358. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddress.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddress)).call(this, null, null, false));
  9359. _this.refID = refID;
  9360. _this.store = store;
  9361. _this.line = line;
  9362. _this.column = column;
  9363. return _this;
  9364. }
  9365. _createClass(StoreObjectArrayAddress, [{
  9366. key: 'getArrayObject',
  9367. value: function getArrayObject() {
  9368. return this.store.applyStore(this.refID);
  9369. }
  9370. }, {
  9371. key: 'updateArrayObject',
  9372. value: function updateArrayObject(stoObj) {
  9373. var anArray = this.getArrayObject();
  9374. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), anArray);
  9375. if (!stoObj.type.isCompatible(this.type)) {
  9376. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9377. } else if (this.type instanceof _compoundType.CompoundType && this.type.canAccept(stoObj.type)) {
  9378. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9379. }
  9380. if (this.column !== null) {
  9381. newArray.value[this.line].value[this.column] = stoObj;
  9382. return newArray;
  9383. } else {
  9384. newArray.value[this.line] = stoObj;
  9385. return newArray;
  9386. }
  9387. }
  9388. }, {
  9389. key: 'isCompatible',
  9390. value: function isCompatible(another) {
  9391. if (this.type.isCompatible(another.type)) {
  9392. if (another.type instanceof _compoundType.CompoundType) {
  9393. return this.lines === another.lines && this.columns === another.columns;
  9394. } else {
  9395. this.refValue.isCompatible(another);
  9396. }
  9397. }
  9398. }
  9399. }, {
  9400. key: 'isRef',
  9401. get: function get() {
  9402. return false;
  9403. }
  9404. }, {
  9405. key: 'inStore',
  9406. get: function get() {
  9407. return true;
  9408. }
  9409. }, {
  9410. key: 'refValue',
  9411. get: function get() {
  9412. var refLine = this.store.applyStore(this.refID).value[this.line];
  9413. if (!refLine) {
  9414. if (this.getArrayObject().isVector) {
  9415. throw _processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9416. } else {
  9417. throw _processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9418. }
  9419. }
  9420. if (this.column !== null) {
  9421. var refColumn = refLine.value[this.column];
  9422. if (!refColumn) {
  9423. if (this.getArrayObject().isVector) {
  9424. throw _processorErrorFactory.ProcessorErrorFactory.vector_not_matrix(this.refID);
  9425. } else {
  9426. throw _processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds(this.refID, this.column, this.getArrayObject().columns);
  9427. }
  9428. }
  9429. return refColumn;
  9430. }
  9431. return refLine;
  9432. }
  9433. }, {
  9434. key: 'value',
  9435. get: function get() {
  9436. return this.refValue.value;
  9437. }
  9438. }, {
  9439. key: 'type',
  9440. get: function get() {
  9441. return this.refValue.type;
  9442. }
  9443. }, {
  9444. key: 'lines',
  9445. get: function get() {
  9446. if (!(this.type instanceof _compoundType.CompoundType)) {
  9447. return null;
  9448. }
  9449. return this.refValue.value.length;
  9450. }
  9451. }, {
  9452. key: 'columns',
  9453. get: function get() {
  9454. switch (this.type.dimensions) {
  9455. case 2:
  9456. return this.refValue.value[0].value.length;
  9457. default:
  9458. return null;
  9459. }
  9460. }
  9461. }]);
  9462. return StoreObjectArrayAddress;
  9463. }(_storeObject.StoreObject);
  9464. /***/ }),
  9465. /***/ "./js/processor/store/storeObjectArrayAddressRef.js":
  9466. /*!**********************************************************!*\
  9467. !*** ./js/processor/store/storeObjectArrayAddressRef.js ***!
  9468. \**********************************************************/
  9469. /*! no static exports found */
  9470. /***/ (function(module, exports, __webpack_require__) {
  9471. "use strict";
  9472. Object.defineProperty(exports, "__esModule", {
  9473. value: true
  9474. });
  9475. exports.StoreObjectArrayAddressRef = undefined;
  9476. 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; }; }();
  9477. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9478. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9479. var _decimal2 = _interopRequireDefault(_decimal);
  9480. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9481. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9482. 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; }
  9483. 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; }
  9484. var StoreObjectArrayAddressRef = exports.StoreObjectArrayAddressRef = function (_StoreObject) {
  9485. _inherits(StoreObjectArrayAddressRef, _StoreObject);
  9486. function StoreObjectArrayAddressRef(address) {
  9487. _classCallCheck(this, StoreObjectArrayAddressRef);
  9488. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddressRef.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddressRef)).call(this, null, null, false));
  9489. _this.address = address;
  9490. return _this;
  9491. }
  9492. _createClass(StoreObjectArrayAddressRef, [{
  9493. key: 'getRefObj',
  9494. value: function getRefObj() {
  9495. return this.address.refValue;
  9496. }
  9497. }, {
  9498. key: 'updateRef',
  9499. value: function updateRef(stoObj) {
  9500. var newArray = this.address.updateArrayObject(stoObj);
  9501. this.address.store.updateStore(this.address.refID, newArray);
  9502. }
  9503. }, {
  9504. key: 'isCompatible',
  9505. value: function isCompatible(another) {
  9506. return this.address.isCompatible(another);
  9507. }
  9508. }, {
  9509. key: 'isRef',
  9510. get: function get() {
  9511. return true;
  9512. }
  9513. }, {
  9514. key: 'type',
  9515. get: function get() {
  9516. return this.address.type;
  9517. }
  9518. }, {
  9519. key: 'value',
  9520. get: function get() {
  9521. return this.address.value;
  9522. }
  9523. }, {
  9524. key: 'number',
  9525. get: function get() {
  9526. if (this.value instanceof _decimal2.default) {
  9527. return this.value.toNumber();
  9528. } else {
  9529. return null;
  9530. }
  9531. }
  9532. }]);
  9533. return StoreObjectArrayAddressRef;
  9534. }(_storeObject.StoreObject);
  9535. /***/ }),
  9536. /***/ "./js/processor/store/storeObjectRef.js":
  9537. /*!**********************************************!*\
  9538. !*** ./js/processor/store/storeObjectRef.js ***!
  9539. \**********************************************/
  9540. /*! no static exports found */
  9541. /***/ (function(module, exports, __webpack_require__) {
  9542. "use strict";
  9543. Object.defineProperty(exports, "__esModule", {
  9544. value: true
  9545. });
  9546. exports.StoreObjectRef = undefined;
  9547. 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; }; }();
  9548. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9549. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9550. var _decimal2 = _interopRequireDefault(_decimal);
  9551. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9552. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9553. 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; }
  9554. 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; }
  9555. var StoreObjectRef = exports.StoreObjectRef = function (_StoreObject) {
  9556. _inherits(StoreObjectRef, _StoreObject);
  9557. function StoreObjectRef(refID, store) {
  9558. _classCallCheck(this, StoreObjectRef);
  9559. var _this = _possibleConstructorReturn(this, (StoreObjectRef.__proto__ || Object.getPrototypeOf(StoreObjectRef)).call(this, null, null, false));
  9560. _this.refID = refID;
  9561. _this.store = store;
  9562. return _this;
  9563. }
  9564. _createClass(StoreObjectRef, [{
  9565. key: 'getRefObj',
  9566. value: function getRefObj() {
  9567. return this.store.applyStore(this.refID);
  9568. }
  9569. }, {
  9570. key: 'updateRef',
  9571. value: function updateRef(stoObj) {
  9572. this.store.updateStore(this.refID, stoObj);
  9573. }
  9574. }, {
  9575. key: 'isCompatible',
  9576. value: function isCompatible(another) {
  9577. return this.store.applyStore(this.refID).isCompatible(another);
  9578. }
  9579. }, {
  9580. key: 'isRef',
  9581. get: function get() {
  9582. return true;
  9583. }
  9584. }, {
  9585. key: 'type',
  9586. get: function get() {
  9587. return this.store.applyStore(this.refID).type;
  9588. }
  9589. }, {
  9590. key: 'value',
  9591. get: function get() {
  9592. return this.store.applyStore(this.refID).value;
  9593. }
  9594. }, {
  9595. key: 'number',
  9596. get: function get() {
  9597. if (this.value instanceof _decimal2.default) {
  9598. return this.value.toNumber();
  9599. } else {
  9600. return null;
  9601. }
  9602. }
  9603. }]);
  9604. return StoreObjectRef;
  9605. }(_storeObject.StoreObject);
  9606. /***/ }),
  9607. /***/ "./js/runner.js":
  9608. /*!**********************!*\
  9609. !*** ./js/runner.js ***!
  9610. \**********************/
  9611. /*! no static exports found */
  9612. /***/ (function(module, exports, __webpack_require__) {
  9613. "use strict";
  9614. Object.defineProperty(exports, "__esModule", {
  9615. value: true
  9616. });
  9617. exports.runner = runner;
  9618. var _ivprogParser = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  9619. var _ivprogProcessor = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  9620. var _domConsole = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
  9621. var _languageService = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js");
  9622. var _semanticAnalyser = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  9623. function runner() {
  9624. var ivprogLexer = _languageService.LanguageService.getCurrentLexer();
  9625. // const lexer = new ivprogLexer(new InputStream(input));
  9626. // const stream = new CommonTokenStream(lexer);
  9627. // stream.fill();
  9628. // let i = 1;
  9629. // let token = null;
  9630. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  9631. // console.log(`${token.type}-${token.text}`);
  9632. // console.log('\n')
  9633. // i++;
  9634. // }
  9635. // const anaSin = new IVProgParser(input, ivprogLexer);
  9636. var editor = new JsonEditor('#json-renderer', {});
  9637. var domConsole = new _domConsole.DOMConsole("#console");
  9638. // proc.interpretAST().then( sto => {
  9639. // console.log(sto.applyStore('a'));
  9640. // }).catch(e => console.log(e));
  9641. try {
  9642. $('#btn').click(function () {
  9643. var input = $('#input').val();
  9644. var analiser = new _ivprogParser.IVProgParser(input, ivprogLexer);
  9645. try {
  9646. var data = analiser.parseTree();
  9647. var semAna = new _semanticAnalyser.SemanticAnalyser(data);
  9648. var proc = new _ivprogProcessor.IVProgProcessor(semAna.analyseTree());
  9649. proc.registerInput(domConsole);
  9650. domConsole.clear();
  9651. proc.registerOutput(domConsole);
  9652. proc.interpretAST().then(function (sto) {
  9653. return editor.load(sto.store);
  9654. }).catch(function (e) {
  9655. alert(e);console.log(e);
  9656. });
  9657. } catch (error) {
  9658. alert(error);
  9659. console.log(error);
  9660. }
  9661. });
  9662. } catch (a) {
  9663. console.log(a);
  9664. }
  9665. }
  9666. /***/ }),
  9667. /***/ "./js/semantic/semantic.min.js":
  9668. /*!*************************************!*\
  9669. !*** ./js/semantic/semantic.min.js ***!
  9670. \*************************************/
  9671. /*! no static exports found */
  9672. /***/ (function(module, exports, __webpack_require__) {
  9673. "use strict";
  9674. 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; };
  9675. /*
  9676. * # Semantic UI - 2.3.3
  9677. * https://github.com/Semantic-Org/Semantic-UI
  9678. * http://www.semantic-ui.com/
  9679. *
  9680. * Copyright 2014 Contributors
  9681. * Released under the MIT license
  9682. * http://opensource.org/licenses/MIT
  9683. *
  9684. */
  9685. !function (e, t, n, i) {
  9686. e.site = e.fn.site = function (o) {
  9687. var a,
  9688. r,
  9689. s = new Date().getTime(),
  9690. l = [],
  9691. c = arguments[0],
  9692. u = "string" == typeof c,
  9693. d = [].slice.call(arguments, 1),
  9694. f = e.isPlainObject(o) ? e.extend(!0, {}, e.site.settings, o) : e.extend({}, e.site.settings),
  9695. m = f.namespace,
  9696. g = f.error,
  9697. p = "module-" + m,
  9698. h = e(n),
  9699. v = this,
  9700. b = h.data(p);return a = { initialize: function initialize() {
  9701. a.instantiate();
  9702. }, instantiate: function instantiate() {
  9703. a.verbose("Storing instance of site", a), b = a, h.data(p, a);
  9704. }, normalize: function normalize() {
  9705. a.fix.console(), a.fix.requestAnimationFrame();
  9706. }, fix: { console: function (_console) {
  9707. function console() {
  9708. return _console.apply(this, arguments);
  9709. }
  9710. console.toString = function () {
  9711. return _console.toString();
  9712. };
  9713. return console;
  9714. }(function () {
  9715. 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 () {});
  9716. }), consoleClear: function consoleClear() {
  9717. a.debug("Disabling programmatic console clearing"), t.console.clear = function () {};
  9718. }, requestAnimationFrame: function requestAnimationFrame() {
  9719. 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) {
  9720. setTimeout(e, 0);
  9721. });
  9722. } }, moduleExists: function moduleExists(t) {
  9723. return e.fn[t] !== i && e.fn[t].settings !== i;
  9724. }, enabled: { modules: function modules(t) {
  9725. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9726. a.moduleExists(t) && n.push(t);
  9727. }), n;
  9728. } }, disabled: { modules: function modules(t) {
  9729. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9730. a.moduleExists(t) || n.push(t);
  9731. }), n;
  9732. } }, change: { setting: function setting(t, n, o, r) {
  9733. o = "string" == typeof o ? "all" === o ? f.modules : [o] : o || f.modules, r = r === i || r, e.each(o, function (i, o) {
  9734. var s,
  9735. 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)));
  9736. });
  9737. }, settings: function settings(t, n, o) {
  9738. n = "string" == typeof n ? [n] : n || f.modules, o = o === i || o, e.each(n, function (n, i) {
  9739. 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)));
  9740. });
  9741. } }, enable: { console: function console() {
  9742. a.console(!0);
  9743. }, debug: function debug(e, t) {
  9744. e = e || f.modules, a.debug("Enabling debug for modules", e), a.change.setting("debug", !0, e, t);
  9745. }, verbose: function verbose(e, t) {
  9746. e = e || f.modules, a.debug("Enabling verbose debug for modules", e), a.change.setting("verbose", !0, e, t);
  9747. } }, disable: { console: function console() {
  9748. a.console(!1);
  9749. }, debug: function debug(e, t) {
  9750. e = e || f.modules, a.debug("Disabling debug for modules", e), a.change.setting("debug", !1, e, t);
  9751. }, verbose: function verbose(e, t) {
  9752. e = e || f.modules, a.debug("Disabling verbose debug for modules", e), a.change.setting("verbose", !1, e, t);
  9753. } }, console: function console(e) {
  9754. if (e) {
  9755. if (b.cache.console === i) return void a.error(g.console);a.debug("Restoring console function"), t.console = b.cache.console;
  9756. } 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() {} };
  9757. }, destroy: function destroy() {
  9758. a.verbose("Destroying previous site for", h), h.removeData(p);
  9759. }, cache: {}, setting: function setting(t, n) {
  9760. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  9761. if (n === i) return f[t];f[t] = n;
  9762. }
  9763. }, internal: function internal(t, n) {
  9764. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  9765. if (n === i) return a[t];a[t] = n;
  9766. }
  9767. }, debug: function debug() {
  9768. f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  9769. }, verbose: function verbose() {
  9770. 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)));
  9771. }, error: function error() {
  9772. a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments);
  9773. }, performance: { log: function log(e) {
  9774. 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);
  9775. }, display: function display() {
  9776. var t = f.name + ":",
  9777. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  9778. n += t["Execution Time"];
  9779. }), 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) {
  9780. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9781. }), console.groupEnd()), l = [];
  9782. } }, invoke: function invoke(t, n, o) {
  9783. var s,
  9784. l,
  9785. c,
  9786. 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) {
  9787. 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 {
  9788. 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];
  9789. }
  9790. })), 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;
  9791. } }, u ? (b === i && a.initialize(), a.invoke(c)) : (b !== i && a.destroy(), a.initialize()), r !== i ? r : this;
  9792. }, 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) {
  9793. return function (n) {
  9794. return !!e.data(n, t);
  9795. };
  9796. }) : function (t, n, i) {
  9797. return !!e.data(t, i[3]);
  9798. } });
  9799. }(jQuery, window, document), function (e, t, n, i) {
  9800. "use strict";
  9801. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.form = function (t) {
  9802. var o,
  9803. a = e(this),
  9804. r = a.selector || "",
  9805. s = new Date().getTime(),
  9806. l = [],
  9807. c = arguments[0],
  9808. u = arguments[1],
  9809. d = "string" == typeof c,
  9810. f = [].slice.call(arguments, 1);return a.each(function () {
  9811. var m,
  9812. g,
  9813. p,
  9814. h,
  9815. v,
  9816. b,
  9817. y,
  9818. x,
  9819. C,
  9820. w,
  9821. S,
  9822. k,
  9823. T,
  9824. A,
  9825. R,
  9826. P,
  9827. E = e(this),
  9828. F = this,
  9829. O = [],
  9830. D = !1;(P = { initialize: function initialize() {
  9831. 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());
  9832. }, instantiate: function instantiate() {
  9833. P.verbose("Storing instance of module", P), R = P, E.data(T, P);
  9834. }, destroy: function destroy() {
  9835. P.verbose("Destroying previous module", R), P.removeEvents(), E.removeData(T);
  9836. }, refresh: function refresh() {
  9837. 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);
  9838. }, submit: function submit() {
  9839. P.verbose("Submitting form", E), E.submit();
  9840. }, attachEvents: function attachEvents(t, n) {
  9841. n = n || "submit", e(t).on("click" + A, function (e) {
  9842. P[n](), e.preventDefault();
  9843. });
  9844. }, bindEvents: function bindEvents() {
  9845. 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 () {
  9846. var t = e(this),
  9847. n = t.prop("type"),
  9848. i = P.get.changeEvent(n, t);e(this).on(i + A, P.event.field.change);
  9849. });
  9850. }, clear: function clear() {
  9851. m.each(function () {
  9852. var t = e(this),
  9853. n = t.parent(),
  9854. i = t.closest(g),
  9855. o = i.find(x.prompt),
  9856. a = t.data(y.defaultValue) || "",
  9857. r = n.is(x.uiCheckbox),
  9858. 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(""));
  9859. });
  9860. }, reset: function reset() {
  9861. m.each(function () {
  9862. var t = e(this),
  9863. n = t.parent(),
  9864. o = t.closest(g),
  9865. a = o.find(x.prompt),
  9866. r = t.data(y.defaultValue),
  9867. s = n.is(x.uiCheckbox),
  9868. l = n.is(x.uiDropdown),
  9869. 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)));
  9870. });
  9871. }, determine: { isValid: function isValid() {
  9872. var t = !0;return e.each(b, function (e, n) {
  9873. P.validate.field(n, e, !0) || (t = !1);
  9874. }), t;
  9875. } }, is: { bracketedRule: function bracketedRule(e) {
  9876. return e.type && e.type.match(v.regExp.bracket);
  9877. }, shorthandFields: function shorthandFields(e) {
  9878. var t = e[Object.keys(e)[0]];return P.is.shorthandRules(t);
  9879. }, shorthandRules: function shorthandRules(t) {
  9880. return "string" == typeof t || e.isArray(t);
  9881. }, empty: function empty(e) {
  9882. return !e || 0 === e.length || (e.is('input[type="checkbox"]') ? !e.is(":checked") : P.is.blank(e));
  9883. }, blank: function blank(t) {
  9884. return "" === e.trim(t.val());
  9885. }, valid: function valid(t) {
  9886. 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) {
  9887. P.is.valid(e) || (n = !1);
  9888. }), n);
  9889. } }, removeEvents: function removeEvents() {
  9890. E.off(A), m.off(A), h.off(A), m.off(A);
  9891. }, event: { field: { keydown: function keydown(t) {
  9892. var n = e(this),
  9893. i = t.which,
  9894. o = n.is(x.input),
  9895. a = n.is(x.checkbox),
  9896. r = n.closest(x.uiDropdown).length > 0,
  9897. 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);
  9898. }, keyup: function keyup() {
  9899. D = !1;
  9900. }, blur: function blur(t) {
  9901. var n = e(this),
  9902. i = n.closest(g),
  9903. 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);
  9904. }, change: function change(t) {
  9905. var n = e(this),
  9906. i = n.closest(g),
  9907. o = P.get.validation(n);o && ("change" == v.on || i.hasClass(C.error) && v.revalidate) && (clearTimeout(P.timer), P.timer = setTimeout(function () {
  9908. P.debug("Revalidating field", n, P.get.validation(n)), P.validate.field(o);
  9909. }, v.delay));
  9910. } } }, get: { ancillaryValue: function ancillaryValue(e) {
  9911. return !(!e.type || !e.value && !P.is.bracketedRule(e)) && (e.value !== i ? e.value : e.type.match(v.regExp.bracket)[1] + "");
  9912. }, ruleName: function ruleName(e) {
  9913. return P.is.bracketedRule(e) ? e.type.replace(e.type.match(v.regExp.bracket)[0], "") : e.type;
  9914. }, changeEvent: function changeEvent(e, t) {
  9915. return "checkbox" == e || "radio" == e || "hidden" == e || t.is("select") ? "change" : P.get.inputEvent();
  9916. }, inputEvent: function inputEvent() {
  9917. return n.createElement("input").oninput !== i ? "input" : n.createElement("input").onpropertychange !== i ? "propertychange" : "keyup";
  9918. }, fieldsFromShorthand: function fieldsFromShorthand(t) {
  9919. var n = {};return e.each(t, function (t, i) {
  9920. "string" == typeof i && (i = [i]), n[t] = { rules: [] }, e.each(i, function (e, i) {
  9921. n[t].rules.push({ type: i });
  9922. });
  9923. }), n;
  9924. }, prompt: function prompt(t, n) {
  9925. var i,
  9926. o,
  9927. a = P.get.ruleName(t),
  9928. r = P.get.ancillaryValue(t),
  9929. s = P.get.field(n.identifier),
  9930. l = s.val(),
  9931. c = e.isFunction(t.prompt) ? t.prompt(l) : t.prompt || v.prompt[a] || v.text.unspecifiedRule,
  9932. u = -1 !== c.search("{value}"),
  9933. 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;
  9934. }, settings: function settings() {
  9935. if (e.isPlainObject(t)) {
  9936. 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));
  9937. } 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();
  9938. }, field: function field(t) {
  9939. 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/>");
  9940. }, fields: function fields(t) {
  9941. var n = e();return e.each(t, function (e, t) {
  9942. n = n.add(P.get.field(t));
  9943. }), n;
  9944. }, validation: function validation(t) {
  9945. var n, i;return !!b && (e.each(b, function (e, o) {
  9946. i = o.identifier || e, P.get.field(i)[0] == t[0] && (o.identifier = i, n = o);
  9947. }), n || !1);
  9948. }, value: function value(e) {
  9949. var t = [];return t.push(e), P.get.values.call(F, t)[e];
  9950. }, values: function values(t) {
  9951. var n = {};return (e.isArray(t) ? P.get.fields(t) : m).each(function (t, o) {
  9952. var a = e(o),
  9953. r = (a.prop("type"), a.prop("name")),
  9954. s = a.val(),
  9955. l = a.is(x.checkbox),
  9956. c = a.is(x.radio),
  9957. u = -1 !== r.indexOf("[]"),
  9958. 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);
  9959. }), n;
  9960. } }, has: { field: function field(e) {
  9961. 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;
  9962. } }, escape: { string: function string(e) {
  9963. return (e = String(e)).replace(w.escape, "\\$&");
  9964. } }, add: { rule: function rule(e, t) {
  9965. P.add.field(e, t);
  9966. }, field: function field(t, n) {
  9967. var i = {};P.is.shorthandRules(n) ? (n = e.isArray(n) ? n : [n], i[t] = { rules: [] }, e.each(n, function (e, n) {
  9968. i[t].rules.push({ type: n });
  9969. })) : i[t] = n, b = e.extend({}, b, i), P.debug("Adding rules", i, b);
  9970. }, fields: function fields(t) {
  9971. var n;n = t && P.is.shorthandFields(t) ? P.get.fieldsFromShorthand(t) : t, b = e.extend({}, b, n);
  9972. }, prompt: function prompt(t, n) {
  9973. var o = P.get.field(t).closest(g),
  9974. a = o.children(x.prompt),
  9975. 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)));
  9976. }, errors: function errors(e) {
  9977. P.debug("Adding form error messages", e), P.set.error(), p.html(v.templates.error(e));
  9978. } }, remove: { rule: function rule(t, n) {
  9979. 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) {
  9980. -1 !== o.indexOf(n.type) && (P.debug("Removed rule", n.type), b[t].rules.splice(e, 1));
  9981. });
  9982. }, field: function field(t) {
  9983. var n = e.isArray(t) ? t : [t];e.each(n, function (e, t) {
  9984. P.remove.rule(t);
  9985. });
  9986. }, rules: function rules(t, n) {
  9987. e.isArray(t) ? e.each(fields, function (e, t) {
  9988. P.remove.rule(t, n);
  9989. }) : P.remove.rule(t, n);
  9990. }, fields: function fields(e) {
  9991. P.remove.field(e);
  9992. }, prompt: function prompt(t) {
  9993. var n = P.get.field(t).closest(g),
  9994. 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 () {
  9995. o.remove();
  9996. }) : o.fadeOut(v.duration, function () {
  9997. o.remove();
  9998. }));
  9999. } }, set: { success: function success() {
  10000. E.removeClass(C.error).addClass(C.success);
  10001. }, defaults: function defaults() {
  10002. m.each(function () {
  10003. var t = e(this),
  10004. n = t.filter(x.checkbox).length > 0 ? t.is(":checked") : t.val();t.data(y.defaultValue, n);
  10005. });
  10006. }, error: function error() {
  10007. E.removeClass(C.success).addClass(C.error);
  10008. }, value: function value(e, t) {
  10009. var n = {};return n[e] = t, P.set.values.call(F, n);
  10010. }, values: function values(t) {
  10011. e.isEmptyObject(t) || e.each(t, function (t, n) {
  10012. var i,
  10013. o = P.get.field(t),
  10014. a = o.parent(),
  10015. r = e.isArray(n),
  10016. s = a.is(x.uiCheckbox),
  10017. l = a.is(x.uiDropdown),
  10018. 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) {
  10019. i = o.filter('[value="' + t + '"]'), a = i.parent(), i.length > 0 && a.checkbox("check");
  10020. })) : 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)));
  10021. });
  10022. } }, validate: { form: function form(e, t) {
  10023. var n = P.get.values();if (D) return !1;if (O = [], P.determine.isValid()) {
  10024. if (P.debug("Form has no validation errors, submitting"), P.set.success(), !0 !== t) return v.onSuccess.call(F, e, n);
  10025. } 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);
  10026. }, field: function field(t, n, o) {
  10027. o = o === i || o, "string" == typeof t && (P.verbose("Validating field", t), n = t, t = b[t]);var a = t.identifier || n,
  10028. r = P.get.field(a),
  10029. s = !!t.depends && P.get.field(t.depends),
  10030. l = !0,
  10031. 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) {
  10032. 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);
  10033. }), 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);
  10034. }, rule: function rule(t, n) {
  10035. var o = P.get.field(t.identifier),
  10036. a = (n.type, o.val()),
  10037. r = P.get.ancillaryValue(n),
  10038. s = P.get.ruleName(n),
  10039. 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);
  10040. } }, setting: function setting(t, n) {
  10041. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  10042. if (n === i) return v[t];v[t] = n;
  10043. }
  10044. }, internal: function internal(t, n) {
  10045. if (e.isPlainObject(t)) e.extend(!0, P, t);else {
  10046. if (n === i) return P[t];P[t] = n;
  10047. }
  10048. }, debug: function debug() {
  10049. !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)));
  10050. }, verbose: function verbose() {
  10051. !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)));
  10052. }, error: function error() {
  10053. v.silent || (P.error = Function.prototype.bind.call(console.error, console, v.name + ":"), P.error.apply(console, arguments));
  10054. }, performance: { log: function log(e) {
  10055. 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);
  10056. }, display: function display() {
  10057. var t = v.name + ":",
  10058. n = 0;s = !1, clearTimeout(P.performance.timer), e.each(l, function (e, t) {
  10059. n += t["Execution Time"];
  10060. }), 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) {
  10061. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10062. }), console.groupEnd()), l = [];
  10063. } }, invoke: function invoke(t, n, a) {
  10064. var r,
  10065. s,
  10066. l,
  10067. 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) {
  10068. 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 {
  10069. 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];
  10070. }
  10071. })), 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;
  10072. } }).initialize();
  10073. }), o !== i ? o : this;
  10074. }, 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() {
  10075. return !0;
  10076. }, onFailure: function onFailure() {
  10077. return !1;
  10078. }, 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) {
  10079. var n = '<ul class="list">';return e.each(t, function (e, t) {
  10080. n += "<li>" + t + "</li>";
  10081. }), e(n += "</ul>");
  10082. }, prompt: function prompt(t) {
  10083. return e("<div/>").addClass("ui basic red pointing prompt label").html(t[0]);
  10084. } }, rules: { empty: function empty(t) {
  10085. return !(t === i || "" === t || e.isArray(t) && 0 === t.length);
  10086. }, checked: function checked() {
  10087. return e(this).filter(":checked").length > 0;
  10088. }, email: function email(t) {
  10089. return e.fn.form.settings.regExp.email.test(t);
  10090. }, url: function url(t) {
  10091. return e.fn.form.settings.regExp.url.test(t);
  10092. }, regExp: function regExp(t, n) {
  10093. if (n instanceof RegExp) return t.match(n);var i,
  10094. 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));
  10095. }, integer: function integer(t, n) {
  10096. var o,
  10097. a,
  10098. r,
  10099. 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);
  10100. }, decimal: function decimal(t) {
  10101. return e.fn.form.settings.regExp.decimal.test(t);
  10102. }, number: function number(t) {
  10103. return e.fn.form.settings.regExp.number.test(t);
  10104. }, is: function is(e, t) {
  10105. return t = "string" == typeof t ? t.toLowerCase() : t, (e = "string" == typeof e ? e.toLowerCase() : e) == t;
  10106. }, isExactly: function isExactly(e, t) {
  10107. return e == t;
  10108. }, not: function not(e, t) {
  10109. return (e = "string" == typeof e ? e.toLowerCase() : e) != (t = "string" == typeof t ? t.toLowerCase() : t);
  10110. }, notExactly: function notExactly(e, t) {
  10111. return e != t;
  10112. }, contains: function contains(t, n) {
  10113. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n, "i"));
  10114. }, containsExactly: function containsExactly(t, n) {
  10115. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n));
  10116. }, doesntContain: function doesntContain(t, n) {
  10117. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n, "i"));
  10118. }, doesntContainExactly: function doesntContainExactly(t, n) {
  10119. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n));
  10120. }, minLength: function minLength(e, t) {
  10121. return e !== i && e.length >= t;
  10122. }, length: function length(e, t) {
  10123. return e !== i && e.length >= t;
  10124. }, exactLength: function exactLength(e, t) {
  10125. return e !== i && e.length == t;
  10126. }, maxLength: function maxLength(e, t) {
  10127. return e !== i && e.length <= t;
  10128. }, match: function match(t, n) {
  10129. 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();
  10130. }, different: function different(t, n) {
  10131. 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();
  10132. }, creditCard: function creditCard(t, n) {
  10133. var i,
  10134. o,
  10135. 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] } },
  10136. r = {},
  10137. s = !1,
  10138. l = "string" == typeof n && n.split(",");if ("string" == typeof t && 0 !== t.length) {
  10139. if (t = t.replace(/[\-]/g, ""), l && (e.each(l, function (n, i) {
  10140. (o = a[i]) && (r = { length: -1 !== e.inArray(t.length, o.length), pattern: -1 !== t.search(o.pattern) }).length && r.pattern && (s = !0);
  10141. }), !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--;) {
  10142. f += d[u][parseInt(t.charAt(c), 10)], u ^= 1;
  10143. }return f % 10 == 0 && f > 0;
  10144. }
  10145. }, minCount: function minCount(e, t) {
  10146. return 0 == t || (1 == t ? "" !== e : e.split(",").length >= t);
  10147. }, exactCount: function exactCount(e, t) {
  10148. return 0 == t ? "" === e : 1 == t ? "" !== e && -1 === e.search(",") : e.split(",").length == t;
  10149. }, maxCount: function maxCount(e, t) {
  10150. return 0 != t && (1 == t ? -1 === e.search(",") : e.split(",").length <= t);
  10151. } } };
  10152. }(jQuery, window, document), function (e, t, n, i) {
  10153. "use strict";
  10154. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.accordion = function (n) {
  10155. var o,
  10156. a = e(this),
  10157. r = new Date().getTime(),
  10158. s = [],
  10159. l = arguments[0],
  10160. c = "string" == typeof l,
  10161. u = [].slice.call(arguments, 1);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function () {
  10162. var d,
  10163. f,
  10164. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.accordion.settings, n) : e.extend({}, e.fn.accordion.settings),
  10165. g = m.className,
  10166. p = m.namespace,
  10167. h = m.selector,
  10168. v = m.error,
  10169. b = "." + p,
  10170. y = "module-" + p,
  10171. x = a.selector || "",
  10172. C = e(this),
  10173. w = C.find(h.title),
  10174. S = C.find(h.content),
  10175. k = this,
  10176. T = C.data(y);f = { initialize: function initialize() {
  10177. f.debug("Initializing", C), f.bind.events(), m.observeChanges && f.observeChanges(), f.instantiate();
  10178. }, instantiate: function instantiate() {
  10179. T = f, C.data(y, f);
  10180. }, destroy: function destroy() {
  10181. f.debug("Destroying previous instance", C), C.off(b).removeData(y);
  10182. }, refresh: function refresh() {
  10183. w = C.find(h.title), S = C.find(h.content);
  10184. }, observeChanges: function observeChanges() {
  10185. "MutationObserver" in t && ((d = new MutationObserver(function (e) {
  10186. f.debug("DOM tree modified, updating selector cache"), f.refresh();
  10187. })).observe(k, { childList: !0, subtree: !0 }), f.debug("Setting up mutation observer", d));
  10188. }, bind: { events: function events() {
  10189. f.debug("Binding delegated events"), C.on(m.on + b, h.trigger, f.event.click);
  10190. } }, event: { click: function click() {
  10191. f.toggle.call(this);
  10192. } }, toggle: function toggle(t) {
  10193. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10194. o = n.next(S),
  10195. a = o.hasClass(g.animating),
  10196. r = o.hasClass(g.active),
  10197. s = r && !a,
  10198. 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);
  10199. }, open: function open(t) {
  10200. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10201. o = n.next(S),
  10202. 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 () {
  10203. o.removeClass(g.animating).addClass(g.active), f.reset.display.call(this), m.onOpen.call(this), m.onChange.call(this);
  10204. }));
  10205. }, close: function close(t) {
  10206. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10207. o = n.next(S),
  10208. a = o.hasClass(g.animating),
  10209. 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 () {
  10210. o.removeClass(g.animating).removeClass(g.active), f.reset.display.call(this), m.onClose.call(this), m.onChange.call(this);
  10211. }));
  10212. }, closeOthers: function closeOthers(t) {
  10213. var n,
  10214. o,
  10215. a,
  10216. r = t !== i ? w.eq(t) : e(this).closest(h.title),
  10217. s = r.parents(h.content).prev(h.title),
  10218. l = r.closest(h.accordion),
  10219. c = h.title + "." + g.active + ":visible",
  10220. 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 () {
  10221. e(this).removeClass(g.active), f.reset.display.call(this);
  10222. }));
  10223. }, reset: { display: function display() {
  10224. f.verbose("Removing inline display from element", this), e(this).css("display", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10225. }, opacity: function opacity() {
  10226. f.verbose("Removing inline opacity from element", this), e(this).css("opacity", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10227. } }, setting: function setting(t, n) {
  10228. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  10229. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  10230. }
  10231. }, internal: function internal(t, n) {
  10232. if (f.debug("Changing internal", t, n), n === i) return f[t];e.isPlainObject(t) ? e.extend(!0, f, t) : f[t] = n;
  10233. }, debug: function debug() {
  10234. !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)));
  10235. }, verbose: function verbose() {
  10236. !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)));
  10237. }, error: function error() {
  10238. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  10239. }, performance: { log: function log(e) {
  10240. 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);
  10241. }, display: function display() {
  10242. var t = m.name + ":",
  10243. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  10244. n += t["Execution Time"];
  10245. }), 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) {
  10246. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10247. }), console.groupEnd()), s = [];
  10248. } }, invoke: function invoke(t, n, a) {
  10249. var r,
  10250. s,
  10251. l,
  10252. 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) {
  10253. 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 {
  10254. 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];
  10255. }
  10256. })), 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;
  10257. } }, c ? (T === i && f.initialize(), f.invoke(l)) : (T !== i && T.invoke("destroy"), f.initialize());
  10258. }), o !== i ? o : this;
  10259. }, 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) {
  10260. return -i * (t /= o) * (t - 2) + n;
  10261. } });
  10262. }(jQuery, window, document), function (e, t, n, i) {
  10263. "use strict";
  10264. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.checkbox = function (o) {
  10265. var a,
  10266. r = e(this),
  10267. s = r.selector || "",
  10268. l = new Date().getTime(),
  10269. c = [],
  10270. u = arguments[0],
  10271. d = "string" == typeof u,
  10272. f = [].slice.call(arguments, 1);return r.each(function () {
  10273. var r,
  10274. m,
  10275. g = e.extend(!0, {}, e.fn.checkbox.settings, o),
  10276. p = g.className,
  10277. h = g.namespace,
  10278. v = g.selector,
  10279. b = g.error,
  10280. y = "." + h,
  10281. x = "module-" + h,
  10282. C = e(this),
  10283. w = e(this).children(v.label),
  10284. S = e(this).children(v.input),
  10285. k = S[0],
  10286. T = !1,
  10287. A = !1,
  10288. R = C.data(x),
  10289. P = this;m = { initialize: function initialize() {
  10290. m.verbose("Initializing checkbox", g), m.create.label(), m.bind.events(), m.set.tabbable(), m.hide.input(), m.observeChanges(), m.instantiate(), m.setup();
  10291. }, instantiate: function instantiate() {
  10292. m.verbose("Storing instance of module", m), R = m, C.data(x, m);
  10293. }, destroy: function destroy() {
  10294. m.verbose("Destroying module"), m.unbind.events(), m.show.input(), C.removeData(x);
  10295. }, fix: { reference: function reference() {
  10296. C.is(v.input) && (m.debug("Behavior called on <input> adjusting invoked element"), C = C.closest(v.checkbox), m.refresh());
  10297. } }, setup: function setup() {
  10298. 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();
  10299. }, refresh: function refresh() {
  10300. w = C.children(v.label), S = C.children(v.input), k = S[0];
  10301. }, hide: { input: function input() {
  10302. m.verbose("Modifying <input> z-index to be unselectable"), S.addClass(p.hidden);
  10303. } }, show: { input: function input() {
  10304. m.verbose("Modifying <input> z-index to be selectable"), S.removeClass(p.hidden);
  10305. } }, observeChanges: function observeChanges() {
  10306. "MutationObserver" in t && ((r = new MutationObserver(function (e) {
  10307. m.debug("DOM tree modified, updating selector cache"), m.refresh();
  10308. })).observe(P, { childList: !0, subtree: !0 }), m.debug("Setting up mutation observer", r));
  10309. }, attachEvents: function attachEvents(t, n) {
  10310. 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);
  10311. }, event: { click: function click(t) {
  10312. 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());
  10313. }, keydown: function keydown(e) {
  10314. var t = e.which,
  10315. n = 13,
  10316. 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);
  10317. }, keyup: function keyup(e) {
  10318. A && e.preventDefault();
  10319. } }, check: function check() {
  10320. m.should.allowCheck() && (m.debug("Checking checkbox", S), m.set.checked(), m.should.ignoreCallbacks() || (g.onChecked.call(k), g.onChange.call(k)));
  10321. }, uncheck: function uncheck() {
  10322. m.should.allowUncheck() && (m.debug("Unchecking checkbox"), m.set.unchecked(), m.should.ignoreCallbacks() || (g.onUnchecked.call(k), g.onChange.call(k)));
  10323. }, indeterminate: function indeterminate() {
  10324. 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)));
  10325. }, determinate: function determinate() {
  10326. 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)));
  10327. }, enable: function enable() {
  10328. m.is.enabled() ? m.debug("Checkbox is already enabled") : (m.debug("Enabling checkbox"), m.set.enabled(), g.onEnable.call(k), g.onEnabled.call(k));
  10329. }, disable: function disable() {
  10330. m.is.disabled() ? m.debug("Checkbox is already disabled") : (m.debug("Disabling checkbox"), m.set.disabled(), g.onDisable.call(k), g.onDisabled.call(k));
  10331. }, get: { radios: function radios() {
  10332. var t = m.get.name();return e('input[name="' + t + '"]').closest(v.checkbox);
  10333. }, otherRadios: function otherRadios() {
  10334. return m.get.radios().not(C);
  10335. }, name: function name() {
  10336. return S.attr("name");
  10337. } }, is: { initialLoad: function initialLoad() {
  10338. return T;
  10339. }, radio: function radio() {
  10340. return S.hasClass(p.radio) || "radio" == S.attr("type");
  10341. }, indeterminate: function indeterminate() {
  10342. return S.prop("indeterminate") !== i && S.prop("indeterminate");
  10343. }, checked: function checked() {
  10344. return S.prop("checked") !== i && S.prop("checked");
  10345. }, disabled: function disabled() {
  10346. return S.prop("disabled") !== i && S.prop("disabled");
  10347. }, enabled: function enabled() {
  10348. return !m.is.disabled();
  10349. }, determinate: function determinate() {
  10350. return !m.is.indeterminate();
  10351. }, unchecked: function unchecked() {
  10352. return !m.is.checked();
  10353. } }, should: { allowCheck: function allowCheck() {
  10354. 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);
  10355. }, allowUncheck: function allowUncheck() {
  10356. 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);
  10357. }, allowIndeterminate: function allowIndeterminate() {
  10358. 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);
  10359. }, allowDeterminate: function allowDeterminate() {
  10360. 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);
  10361. }, forceCallbacks: function forceCallbacks() {
  10362. return m.is.initialLoad() && g.fireOnInit;
  10363. }, ignoreCallbacks: function ignoreCallbacks() {
  10364. return T && !g.fireOnInit;
  10365. } }, can: { change: function change() {
  10366. return !(C.hasClass(p.disabled) || C.hasClass(p.readOnly) || S.prop("disabled") || S.prop("readonly"));
  10367. }, uncheck: function uncheck() {
  10368. return "boolean" == typeof g.uncheckable ? g.uncheckable : !m.is.radio();
  10369. } }, set: { initialLoad: function initialLoad() {
  10370. T = !0;
  10371. }, checked: function checked() {
  10372. 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");
  10373. }, unchecked: function unchecked() {
  10374. 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");
  10375. }, indeterminate: function indeterminate() {
  10376. 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());
  10377. }, determinate: function determinate() {
  10378. 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));
  10379. }, disabled: function disabled() {
  10380. 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());
  10381. }, enabled: function enabled() {
  10382. 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());
  10383. }, tabbable: function tabbable() {
  10384. m.verbose("Adding tabindex to checkbox"), S.attr("tabindex") === i && S.attr("tabindex", 0);
  10385. } }, remove: { initialLoad: function initialLoad() {
  10386. T = !1;
  10387. } }, trigger: { change: function change() {
  10388. var e = n.createEvent("HTMLEvents"),
  10389. t = S[0];t && (m.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  10390. } }, create: { label: function label() {
  10391. 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));
  10392. } }, has: { label: function label() {
  10393. return w.length > 0;
  10394. } }, bind: { events: function events() {
  10395. 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);
  10396. } }, unbind: { events: function events() {
  10397. m.debug("Removing events"), C.off(y);
  10398. } }, uncheckOthers: function uncheckOthers() {
  10399. var e = m.get.otherRadios();m.debug("Unchecking other radios", e), e.removeClass(p.checked);
  10400. }, toggle: function toggle() {
  10401. 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");
  10402. }, setting: function setting(t, n) {
  10403. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10404. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10405. }
  10406. }, internal: function internal(t, n) {
  10407. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10408. if (n === i) return m[t];m[t] = n;
  10409. }
  10410. }, debug: function debug() {
  10411. !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)));
  10412. }, verbose: function verbose() {
  10413. !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)));
  10414. }, error: function error() {
  10415. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10416. }, performance: { log: function log(e) {
  10417. 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);
  10418. }, display: function display() {
  10419. var t = g.name + ":",
  10420. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  10421. n += t["Execution Time"];
  10422. }), 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) {
  10423. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10424. }), console.groupEnd()), c = [];
  10425. } }, invoke: function invoke(t, n, o) {
  10426. var r,
  10427. s,
  10428. l,
  10429. 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) {
  10430. 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 {
  10431. 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];
  10432. }
  10433. })), 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;
  10434. } }, d ? (R === i && m.initialize(), m.invoke(u)) : (R !== i && R.invoke("destroy"), m.initialize());
  10435. }), a !== i ? a : this;
  10436. }, 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]" } };
  10437. }(jQuery, window, document), function (e, t, n, i) {
  10438. "use strict";
  10439. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dimmer = function (t) {
  10440. var o,
  10441. a = e(this),
  10442. r = new Date().getTime(),
  10443. s = [],
  10444. l = arguments[0],
  10445. c = "string" == typeof l,
  10446. u = [].slice.call(arguments, 1);return a.each(function () {
  10447. var d,
  10448. f,
  10449. m,
  10450. g = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.dimmer.settings, t) : e.extend({}, e.fn.dimmer.settings),
  10451. p = g.selector,
  10452. h = g.namespace,
  10453. v = g.className,
  10454. b = g.error,
  10455. y = "." + h,
  10456. x = "module-" + h,
  10457. C = a.selector || "",
  10458. w = "ontouchstart" in n.documentElement ? "touchstart" : "click",
  10459. S = e(this),
  10460. k = this,
  10461. T = S.data(x);(m = { preinitialize: function preinitialize() {
  10462. 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());
  10463. }, initialize: function initialize() {
  10464. m.debug("Initializing dimmer", g), m.bind.events(), m.set.dimmable(), m.instantiate();
  10465. }, instantiate: function instantiate() {
  10466. m.verbose("Storing instance of module", m), T = m, S.data(x, T);
  10467. }, destroy: function destroy() {
  10468. m.verbose("Destroying previous module", d), m.unbind.events(), m.remove.variation(), f.off(y);
  10469. }, bind: { events: function events() {
  10470. 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));
  10471. } }, unbind: { events: function events() {
  10472. m.is.page() && f.get(0).removeEventListener("touchmove", m.event.preventScroll, { passive: !1 }), S.removeData(x), f.off(y);
  10473. } }, event: { click: function click(t) {
  10474. 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());
  10475. }, preventScroll: function preventScroll(e) {
  10476. e.preventDefault();
  10477. } }, addContent: function addContent(t) {
  10478. var n = e(t);m.debug("Add content to dimmer", n), n.parent()[0] !== d[0] && n.detach().appendTo(d);
  10479. }, create: function create() {
  10480. var t = e(g.template.dimmer());return g.dimmerName && (m.debug("Creating named dimmer", g.dimmerName), t.addClass(g.dimmerName)), t.appendTo(f), t;
  10481. }, show: function show(t) {
  10482. 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));
  10483. }, hide: function hide(t) {
  10484. 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");
  10485. }, toggle: function toggle() {
  10486. m.verbose("Toggling dimmer visibility", d), m.is.dimmed() ? m.hide() : m.show();
  10487. }, animate: { show: function show(t) {
  10488. 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() {
  10489. m.set.dimmed();
  10490. }, onComplete: function onComplete() {
  10491. m.set.active(), t();
  10492. } })) : (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 () {
  10493. d.removeAttr("style"), m.set.active(), t();
  10494. }));
  10495. }, hide: function hide(t) {
  10496. 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() {
  10497. m.remove.dimmed();
  10498. }, onComplete: function onComplete() {
  10499. m.remove.active(), t();
  10500. } })) : (m.verbose("Hiding dimmer with javascript"), m.remove.dimmed(), d.stop().fadeOut(m.get.duration(), function () {
  10501. m.remove.active(), d.removeAttr("style"), t();
  10502. }));
  10503. } }, get: { dimmer: function dimmer() {
  10504. return d;
  10505. }, duration: function duration() {
  10506. return "object" == _typeof(g.duration) ? m.is.active() ? g.duration.hide : g.duration.show : g.duration;
  10507. } }, has: { dimmer: function dimmer() {
  10508. return g.dimmerName ? S.find(p.dimmer).filter("." + g.dimmerName).length > 0 : S.find(p.dimmer).length > 0;
  10509. } }, is: { active: function active() {
  10510. return d.hasClass(v.active);
  10511. }, animating: function animating() {
  10512. return d.is(":animated") || d.hasClass(v.animating);
  10513. }, closable: function closable() {
  10514. return "auto" == g.closable ? "hover" != g.on : g.closable;
  10515. }, dimmer: function dimmer() {
  10516. return S.hasClass(v.dimmer);
  10517. }, dimmable: function dimmable() {
  10518. return S.hasClass(v.dimmable);
  10519. }, dimmed: function dimmed() {
  10520. return f.hasClass(v.dimmed);
  10521. }, disabled: function disabled() {
  10522. return f.hasClass(v.disabled);
  10523. }, enabled: function enabled() {
  10524. return !m.is.disabled();
  10525. }, page: function page() {
  10526. return f.is("body");
  10527. }, pageDimmer: function pageDimmer() {
  10528. return d.hasClass(v.pageDimmer);
  10529. } }, can: { show: function show() {
  10530. return !d.hasClass(v.disabled);
  10531. } }, set: { opacity: function opacity(e) {
  10532. var t = d.css("background-color"),
  10533. n = t.split(","),
  10534. i = n && 3 == n.length,
  10535. 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);
  10536. }, active: function active() {
  10537. d.addClass(v.active);
  10538. }, dimmable: function dimmable() {
  10539. f.addClass(v.dimmable);
  10540. }, dimmed: function dimmed() {
  10541. f.addClass(v.dimmed);
  10542. }, pageDimmer: function pageDimmer() {
  10543. d.addClass(v.pageDimmer);
  10544. }, disabled: function disabled() {
  10545. d.addClass(v.disabled);
  10546. }, variation: function variation(e) {
  10547. (e = e || g.variation) && d.addClass(e);
  10548. } }, remove: { active: function active() {
  10549. d.removeClass(v.active);
  10550. }, dimmed: function dimmed() {
  10551. f.removeClass(v.dimmed);
  10552. }, disabled: function disabled() {
  10553. d.removeClass(v.disabled);
  10554. }, variation: function variation(e) {
  10555. (e = e || g.variation) && d.removeClass(e);
  10556. } }, setting: function setting(t, n) {
  10557. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10558. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10559. }
  10560. }, internal: function internal(t, n) {
  10561. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10562. if (n === i) return m[t];m[t] = n;
  10563. }
  10564. }, debug: function debug() {
  10565. !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)));
  10566. }, verbose: function verbose() {
  10567. !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)));
  10568. }, error: function error() {
  10569. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10570. }, performance: { log: function log(e) {
  10571. 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);
  10572. }, display: function display() {
  10573. var t = g.name + ":",
  10574. n = 0;r = !1, clearTimeout(m.performance.timer), e.each(s, function (e, t) {
  10575. n += t["Execution Time"];
  10576. }), 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) {
  10577. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10578. }), console.groupEnd()), s = [];
  10579. } }, invoke: function invoke(t, n, a) {
  10580. var r,
  10581. s,
  10582. l,
  10583. 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) {
  10584. 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 {
  10585. 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];
  10586. }
  10587. })), 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;
  10588. } }).preinitialize(), c ? (T === i && m.initialize(), m.invoke(l)) : (T !== i && T.invoke("destroy"), m.initialize());
  10589. }), o !== i ? o : this;
  10590. }, 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() {
  10591. return e("<div />").attr("class", "ui dimmer");
  10592. } } };
  10593. }(jQuery, window, document), function (e, t, n, i) {
  10594. "use strict";
  10595. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dropdown = function (o) {
  10596. var a,
  10597. r = e(this),
  10598. s = e(n),
  10599. l = r.selector || "",
  10600. c = "ontouchstart" in n.documentElement,
  10601. u = new Date().getTime(),
  10602. d = [],
  10603. f = arguments[0],
  10604. m = "string" == typeof f,
  10605. g = [].slice.call(arguments, 1);return r.each(function (p) {
  10606. var h,
  10607. v,
  10608. b,
  10609. y,
  10610. x,
  10611. C,
  10612. w,
  10613. S,
  10614. k = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.dropdown.settings, o) : e.extend({}, e.fn.dropdown.settings),
  10615. T = k.className,
  10616. A = k.message,
  10617. R = k.fields,
  10618. P = k.keys,
  10619. E = k.metadata,
  10620. F = k.namespace,
  10621. O = k.regExp,
  10622. D = k.selector,
  10623. q = k.error,
  10624. j = k.templates,
  10625. z = "." + F,
  10626. I = "module-" + F,
  10627. M = e(this),
  10628. L = e(k.context),
  10629. V = M.find(D.text),
  10630. N = M.find(D.search),
  10631. H = M.find(D.sizer),
  10632. U = M.find(D.input),
  10633. W = M.find(D.icon),
  10634. B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(),
  10635. Q = M.children(D.menu),
  10636. X = Q.find(D.item),
  10637. $ = !1,
  10638. Y = !1,
  10639. Z = !1,
  10640. K = this,
  10641. J = M.data(I);S = { initialize: function initialize() {
  10642. 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());
  10643. }, instantiate: function instantiate() {
  10644. S.verbose("Storing instance of dropdown", S), J = S, M.data(I, S);
  10645. }, destroy: function destroy() {
  10646. 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();
  10647. }, observeChanges: function observeChanges() {
  10648. "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());
  10649. }, disconnect: { menuObserver: function menuObserver() {
  10650. w && w.disconnect();
  10651. }, selectObserver: function selectObserver() {
  10652. C && C.disconnect();
  10653. } }, observe: { select: function select() {
  10654. S.has.input() && C.observe(M[0], { childList: !0, subtree: !0 });
  10655. }, menu: function menu() {
  10656. S.has.menu() && w.observe(Q[0], { childList: !0, subtree: !0 });
  10657. } }, create: { id: function id() {
  10658. x = (Math.random().toString(16) + "000000000").substr(2, 8), y = "." + x, S.verbose("Creating unique id for element", x);
  10659. }, userChoice: function userChoice(t) {
  10660. var n, o, a;return !!(t = t || S.get.userValues()) && (t = e.isArray(t) ? t : [t], e.each(t, function (t, r) {
  10661. !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));
  10662. }), n);
  10663. }, userLabels: function userLabels(t) {
  10664. var n = S.get.userValues();n && (S.debug("Adding user labels", n), e.each(n, function (e, t) {
  10665. S.verbose("Adding custom user value"), S.add.label(t, t);
  10666. }));
  10667. }, menu: function menu() {
  10668. Q = e("<div />").addClass(T.menu).appendTo(M);
  10669. }, sizer: function sizer() {
  10670. H = e("<span />").addClass(T.sizer).insertAfter(N);
  10671. } }, search: function search(e) {
  10672. e = e !== i ? e : S.get.query(), S.verbose("Searching for query", e), S.has.minCharacters(e) ? S.filter(e) : S.hide();
  10673. }, select: { firstUnfiltered: function firstUnfiltered() {
  10674. S.verbose("Selecting first non-filtered element"), S.remove.selectedItem(), X.not(D.unselectable).not(D.addition + D.hidden).eq(0).addClass(T.selected);
  10675. }, nextAvailable: function nextAvailable(e) {
  10676. var t = (e = e.eq(0)).nextAll(D.item).not(D.unselectable).eq(0),
  10677. 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));
  10678. } }, setup: { api: function api() {
  10679. 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);
  10680. }, layout: function layout() {
  10681. 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();
  10682. }, select: function select() {
  10683. 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();
  10684. }, menu: function menu(e) {
  10685. Q.html(j.menu(e, R)), X = Q.find(D.item);
  10686. }, reference: function reference() {
  10687. 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();
  10688. }, returnedObject: function returnedObject() {
  10689. var e = r.slice(0, p),
  10690. t = r.slice(p + 1);r = e.add(M).add(t);
  10691. } }, refresh: function refresh() {
  10692. S.refreshSelectors(), S.refreshData();
  10693. }, refreshItems: function refreshItems() {
  10694. X = Q.find(D.item);
  10695. }, refreshSelectors: function refreshSelectors() {
  10696. 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);
  10697. }, refreshData: function refreshData() {
  10698. S.verbose("Refreshing cached metadata"), X.removeData(E.text).removeData(E.value);
  10699. }, clearData: function clearData() {
  10700. S.verbose("Clearing metadata"), X.removeData(E.text).removeData(E.value), M.removeData(E.defaultText).removeData(E.defaultValue).removeData(E.placeholderText);
  10701. }, toggle: function toggle() {
  10702. S.verbose("Toggling menu visibility"), S.is.active() ? S.hide() : S.show();
  10703. }, show: function show(t) {
  10704. 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()) {
  10705. 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 () {
  10706. S.can.click() && S.bind.intent(), S.has.menuSearch() && S.focusSearch(), S.set.visible(), t.call(K);
  10707. });
  10708. }
  10709. }, hide: function hide(t) {
  10710. 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 () {
  10711. S.remove.visible(), t.call(K);
  10712. }));
  10713. }, hideOthers: function hideOthers() {
  10714. S.verbose("Finding other dropdowns to hide"), r.not(M).has(D.menu + "." + T.visible).dropdown("hide");
  10715. }, hideMenu: function hideMenu() {
  10716. S.verbose("Hiding menu instantaneously"), S.remove.active(), S.remove.visible(), Q.transition("hide");
  10717. }, hideSubMenus: function hideSubMenus() {
  10718. var e = Q.children(D.item).find(D.menu);S.verbose("Hiding sub menus", e), e.transition("hide");
  10719. }, bind: { events: function events() {
  10720. c && S.bind.touchEvents(), S.bind.keyboardEvents(), S.bind.inputEvents(), S.bind.mouseEvents();
  10721. }, touchEvents: function touchEvents() {
  10722. 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);
  10723. }, keyboardEvents: function keyboardEvents() {
  10724. 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);
  10725. }, inputEvents: function inputEvents() {
  10726. S.verbose("Binding input change events"), M.on("change" + z, D.input, S.event.change);
  10727. }, mouseEvents: function mouseEvents() {
  10728. 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);
  10729. }, intent: function intent() {
  10730. 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);
  10731. } }, unbind: { intent: function intent() {
  10732. S.verbose("Removing hide intent event from document"), c && s.off("touchstart" + y).off("touchmove" + y), s.off("click" + y);
  10733. } }, filter: function filter(e) {
  10734. var t = e !== i ? e : S.get.query(),
  10735. n = function n() {
  10736. 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();
  10737. };k.useLabels && S.has.maxSelections() || (k.apiSettings ? S.can.useAPI() ? S.queryRemote(t, function () {
  10738. k.filterRemoteData && S.filterItems(t), n();
  10739. }) : S.error(q.noAPI) : (S.filterItems(t), n()));
  10740. }, queryRemote: function queryRemote(t, n) {
  10741. var i = { errorDuration: !1, cache: "local", throttle: k.throttle, urlData: { query: t }, onError: function onError() {
  10742. S.add.message(A.serverError), n();
  10743. }, onFailure: function onFailure() {
  10744. S.add.message(A.serverError), n();
  10745. }, onSuccess: function onSuccess(t) {
  10746. 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();
  10747. } };M.api("get request") || S.setup.api(), i = e.extend(!0, {}, i, k.apiSettings), M.api("setting", i).api("query");
  10748. }, filterItems: function filterItems(t) {
  10749. var n = t !== i ? t : S.get.query(),
  10750. o = null,
  10751. a = S.escape.string(n),
  10752. r = new RegExp("^" + a, "igm");S.has.query() && (o = [], S.verbose("Searching for matching values", n), X.each(function () {
  10753. var t,
  10754. i,
  10755. a = e(this);if ("both" == k.match || "text" == k.match) {
  10756. 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;
  10757. }if ("both" == k.match || "value" == k.match) {
  10758. 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;
  10759. }
  10760. })), S.debug("Showing only matched items", n), S.remove.filteredItem(), o && X.not(o).addClass(T.filtered);
  10761. }, fuzzySearch: function fuzzySearch(e, t) {
  10762. var n = t.length,
  10763. 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++) {
  10764. for (var r = e.charCodeAt(o); a < n;) {
  10765. if (t.charCodeAt(a++) === r) continue e;
  10766. }return !1;
  10767. }return !0;
  10768. }, exactSearch: function exactSearch(e, t) {
  10769. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  10770. }, filterActive: function filterActive() {
  10771. k.useLabels && X.filter("." + T.active).addClass(T.filtered);
  10772. }, focusSearch: function focusSearch(e) {
  10773. 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());
  10774. }, forceSelection: function forceSelection() {
  10775. var e = X.not(T.filtered).filter("." + T.selected).eq(0),
  10776. t = X.not(T.filtered).filter("." + T.active).eq(0),
  10777. 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();
  10778. }, change: { values: function values(t) {
  10779. k.allowAdditions || S.clear(), S.debug("Creating dropdown with specified values", t), S.setup.menu({ values: t }), e.each(t, function (e, t) {
  10780. if (1 == t.selected) return S.debug("Setting initial selection to", t.value), S.set.selected(t.value), !0;
  10781. });
  10782. } }, event: { change: function change() {
  10783. Z || (S.debug("Input changed, updating selection"), S.set.selected());
  10784. }, focus: function focus() {
  10785. k.showOnFocus && !$ && S.is.hidden() && !v && S.show();
  10786. }, blur: function blur(e) {
  10787. v = n.activeElement === this, $ || v || (S.remove.activeLabel(), S.hide());
  10788. }, mousedown: function mousedown() {
  10789. S.is.searchSelection() ? b = !0 : $ = !0;
  10790. }, mouseup: function mouseup() {
  10791. S.is.searchSelection() ? b = !1 : $ = !1;
  10792. }, click: function click(t) {
  10793. e(t.target).is(M) && (S.is.focusedOnSearch() ? S.show() : S.focusSearch());
  10794. }, search: { focus: function focus() {
  10795. $ = !0, S.is.multiple() && S.remove.activeLabel(), k.showOnFocus && S.search();
  10796. }, blur: function blur(e) {
  10797. v = n.activeElement === this, S.is.searchSelection() && !b && (Y || v || (k.forceSelection && S.forceSelection(), S.hide())), b = !1;
  10798. } }, icon: { click: function click(e) {
  10799. S.toggle();
  10800. } }, text: { focus: function focus(e) {
  10801. $ = !0, S.focusSearch();
  10802. } }, input: function input(e) {
  10803. (S.is.multiple() || S.is.searchSelection()) && S.set.filtered(), clearTimeout(S.timer), S.timer = setTimeout(S.search, k.delay.search);
  10804. }, label: { click: function click(t) {
  10805. var n = e(this),
  10806. i = M.find(D.label),
  10807. o = i.filter("." + T.active),
  10808. a = n.nextAll("." + T.active),
  10809. r = n.prevAll("." + T.active),
  10810. 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));
  10811. } }, remove: { click: function click() {
  10812. var t = e(this).parent();t.hasClass(T.active) ? S.remove.activeLabels() : S.remove.activeLabels(t);
  10813. } }, test: { toggle: function toggle(e) {
  10814. var t = S.is.multiple() ? S.show : S.toggle;S.is.bubbledLabelClick(e) || S.is.bubbledIconClick(e) || S.determine.eventOnElement(e, t) && e.preventDefault();
  10815. }, touch: function touch(e) {
  10816. S.determine.eventOnElement(e, function () {
  10817. "touchstart" == e.type ? S.timer = setTimeout(function () {
  10818. S.hide();
  10819. }, k.delay.touch) : "touchmove" == e.type && clearTimeout(S.timer);
  10820. }), e.stopPropagation();
  10821. }, hide: function hide(e) {
  10822. S.determine.eventInModule(e, S.hide);
  10823. } }, select: { mutation: function mutation(t) {
  10824. S.debug("<select> modified, recreating menu");var n = !1;e.each(t, function (t, i) {
  10825. if (e(i.target).is("select") || e(i.addedNodes).is("select")) return n = !0, !0;
  10826. }), n && (S.disconnect.selectObserver(), S.refresh(), S.setup.select(), S.set.selected(), S.observe.select());
  10827. } }, menu: { mutation: function mutation(t) {
  10828. var n = t[0],
  10829. i = n.addedNodes ? e(n.addedNodes[0]) : e(!1),
  10830. o = n.removedNodes ? e(n.removedNodes[0]) : e(!1),
  10831. a = i.add(o),
  10832. r = a.is(D.addition) || a.closest(D.addition).length > 0,
  10833. 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());
  10834. }, mousedown: function mousedown() {
  10835. Y = !0;
  10836. }, mouseup: function mouseup() {
  10837. Y = !1;
  10838. } }, item: { mouseenter: function mouseenter(t) {
  10839. var n = e(t.target),
  10840. i = e(this),
  10841. o = i.children(D.menu),
  10842. a = i.siblings(D.item).children(D.menu),
  10843. r = o.length > 0;!(o.find(n).length > 0) && r && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  10844. S.verbose("Showing sub-menu", o), e.each(a, function () {
  10845. S.animate.hide(!1, e(this));
  10846. }), S.animate.show(!1, o);
  10847. }, k.delay.show), t.preventDefault());
  10848. }, mouseleave: function mouseleave(t) {
  10849. var n = e(this).children(D.menu);n.length > 0 && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  10850. S.verbose("Hiding sub-menu", n), S.animate.hide(!1, n);
  10851. }, k.delay.hide));
  10852. }, click: function click(t, i) {
  10853. var o = e(this),
  10854. a = e(t ? t.target : ""),
  10855. r = o.find(D.menu),
  10856. s = S.get.choiceText(o),
  10857. l = S.get.choiceValue(o, s),
  10858. c = r.length > 0,
  10859. 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));
  10860. } }, document: { keydown: function keydown(e) {
  10861. var t = e.which;if (S.is.inObject(t, P)) {
  10862. var n = M.find(D.label),
  10863. i = n.filter("." + T.active),
  10864. o = (i.data(E.value), n.index(i)),
  10865. a = n.length,
  10866. r = i.length > 0,
  10867. s = i.length > 1,
  10868. l = 0 === o,
  10869. c = o + 1 == a,
  10870. u = S.is.searchSelection(),
  10871. d = S.is.focusedOnSearch(),
  10872. f = S.is.focused(),
  10873. 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);
  10874. }
  10875. } }, keydown: function keydown(e) {
  10876. var t = e.which;if (S.is.inObject(t, P)) {
  10877. var n,
  10878. i = X.not(D.unselectable).filter("." + T.selected).eq(0),
  10879. o = Q.children("." + T.active).eq(0),
  10880. a = i.length > 0 ? i : o,
  10881. r = a.length > 0 ? a.siblings(":not(." + T.filtered + ")").addBack() : Q.children(":not(." + T.filtered + ")"),
  10882. s = a.children(D.menu),
  10883. l = a.closest(D.menu),
  10884. c = l.hasClass(T.visible) || l.hasClass(T.animating) || l.parent(D.menu).length > 0,
  10885. u = s.length > 0,
  10886. d = a.length > 0,
  10887. f = a.not(D.unselectable).length > 0,
  10888. 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()) {
  10889. 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) {
  10890. 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();
  10891. }if (t == P.downArrow) {
  10892. 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();
  10893. }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());
  10894. } else m && e.preventDefault(), t != P.downArrow || S.is.visible() || (S.verbose("Down key pressed, showing dropdown"), S.show(), e.preventDefault());
  10895. } else S.has.search() || S.set.selectedLetter(String.fromCharCode(t));
  10896. } }, trigger: { change: function change() {
  10897. var e = n.createEvent("HTMLEvents"),
  10898. t = U[0];t && (S.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  10899. } }, determine: { selectAction: function selectAction(t, n) {
  10900. 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);
  10901. }, eventInModule: function eventInModule(t, i) {
  10902. var o = e(t.target),
  10903. a = o.closest(n.documentElement).length > 0,
  10904. 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);
  10905. }, eventOnElement: function eventOnElement(t, i) {
  10906. var o = e(t.target),
  10907. a = o.closest(D.siblingLabel),
  10908. r = n.body.contains(t.target),
  10909. s = 0 === M.find(a).length,
  10910. 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);
  10911. } }, action: { nothing: function nothing() {}, activate: function activate(t, n, o) {
  10912. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  10913. if (S.set.selected(n, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  10914. }
  10915. }, select: function select(t, n, o) {
  10916. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  10917. if (S.set.value(n, t, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  10918. }
  10919. }, combo: function combo(t, n, o) {
  10920. n = n !== i ? n : t, S.set.selected(n, e(o)), S.hideAndClear();
  10921. }, hide: function hide(e, t, n) {
  10922. S.set.value(t, e), S.hideAndClear();
  10923. } }, get: { id: function id() {
  10924. return x;
  10925. }, defaultText: function defaultText() {
  10926. return M.data(E.defaultText);
  10927. }, defaultValue: function defaultValue() {
  10928. return M.data(E.defaultValue);
  10929. }, placeholderText: function placeholderText() {
  10930. return "auto" != k.placeholder && "string" == typeof k.placeholder ? k.placeholder : M.data(E.placeholderText) || "";
  10931. }, text: function text() {
  10932. return V.text();
  10933. }, query: function query() {
  10934. return e.trim(N.val());
  10935. }, searchWidth: function searchWidth(e) {
  10936. return e = e !== i ? e : N.val(), H.text(e), Math.ceil(H.width() + 1);
  10937. }, selectionCount: function selectionCount() {
  10938. var t = S.get.values();return S.is.multiple() ? e.isArray(t) ? t.length : 0 : "" !== S.get.value() ? 1 : 0;
  10939. }, transition: function transition(e) {
  10940. return "auto" == k.transition ? S.is.upward(e) ? "slide up" : "slide down" : k.transition;
  10941. }, userValues: function userValues() {
  10942. var t = S.get.values();return !!t && (t = e.isArray(t) ? t : [t], e.grep(t, function (e) {
  10943. return !1 === S.get.item(e);
  10944. }));
  10945. }, uniqueArray: function uniqueArray(t) {
  10946. return e.grep(t, function (n, i) {
  10947. return e.inArray(n, t) === i;
  10948. });
  10949. }, caretPosition: function caretPosition() {
  10950. var e,
  10951. t,
  10952. 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;
  10953. }, value: function value() {
  10954. var t = U.length > 0 ? U.val() : M.data(E.value),
  10955. n = e.isArray(t) && 1 === t.length && "" === t[0];return t === i || n ? "" : t;
  10956. }, values: function values() {
  10957. var e = S.get.value();return "" === e ? "" : !S.has.selectInput() && S.is.multiple() ? "string" == typeof e ? e.split(k.delimiter) : "" : e;
  10958. }, remoteValues: function remoteValues() {
  10959. var t = S.get.values(),
  10960. n = !1;return t && ("string" == typeof t && (t = [t]), e.each(t, function (e, t) {
  10961. var i = S.read.remoteData(t);S.verbose("Restoring value from session data", i, t), i && (n || (n = {}), n[t] = i);
  10962. })), n;
  10963. }, choiceText: function choiceText(t, n) {
  10964. 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());
  10965. }, choiceValue: function choiceValue(t, n) {
  10966. 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));
  10967. }, inputEvent: function inputEvent() {
  10968. var e = N[0];return !!e && (e.oninput !== i ? "input" : e.onpropertychange !== i ? "propertychange" : "keyup");
  10969. }, selectValues: function selectValues() {
  10970. var t = { values: [] };return M.find("option").each(function () {
  10971. var n = e(this),
  10972. o = n.html(),
  10973. a = n.attr("disabled"),
  10974. 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 });
  10975. }), 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) {
  10976. return e.name > t.name ? 1 : -1;
  10977. }), S.debug("Retrieved and sorted values from select", t)) : S.debug("Retrieved values from select", t), t;
  10978. }, activeItem: function activeItem() {
  10979. return X.filter("." + T.active);
  10980. }, selectedItem: function selectedItem() {
  10981. var e = X.not(D.unselectable).filter("." + T.selected);return e.length > 0 ? e : X.eq(0);
  10982. }, itemWithAdditions: function itemWithAdditions(e) {
  10983. var t = S.get.item(e),
  10984. n = S.create.userChoice(e);return n && n.length > 0 && (t = t.length > 0 ? t.add(n) : n), t;
  10985. }, item: function item(t, n) {
  10986. var o,
  10987. a,
  10988. 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 () {
  10989. var o = e(this),
  10990. s = S.get.choiceText(o),
  10991. 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) {
  10992. if (S.verbose("Ambiguous dropdown value using strict type check", o, t), l === t || s === t) return r = o, !0;
  10993. } else if (String(l) == String(t) || s == t) return S.verbose("Found select item by value", l, t), r = o, !0;
  10994. }), r;
  10995. } }, check: { maxSelections: function maxSelections(e) {
  10996. 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));
  10997. } }, restore: { defaults: function defaults() {
  10998. S.clear(), S.restore.defaultText(), S.restore.defaultValue();
  10999. }, defaultText: function defaultText() {
  11000. 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));
  11001. }, placeholderText: function placeholderText() {
  11002. S.set.placeholderText();
  11003. }, defaultValue: function defaultValue() {
  11004. 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()));
  11005. }, labels: function labels() {
  11006. k.allowAdditions && (k.useLabels || (S.error(q.labels), k.useLabels = !0), S.debug("Restoring selected values"), S.create.userLabels()), S.check.maxSelections();
  11007. }, selected: function selected() {
  11008. S.restore.values(), S.is.multiple() ? (S.debug("Restoring previously selected values and labels"), S.restore.labels()) : S.debug("Restoring previously selected values");
  11009. }, values: function values() {
  11010. S.set.initialLoad(), k.apiSettings && k.saveRemoteData && S.get.remoteValues() ? S.restore.remoteValues() : S.set.selected(), S.remove.initialLoad();
  11011. }, remoteValues: function remoteValues() {
  11012. var t = S.get.remoteValues();S.debug("Recreating selected from session data", t), t && (S.is.single() ? e.each(t, function (e, t) {
  11013. S.set.text(t);
  11014. }) : e.each(t, function (e, t) {
  11015. S.add.label(e, t);
  11016. }));
  11017. } }, read: { remoteData: function remoteData(e) {
  11018. var n;if (t.Storage !== i) return (n = sessionStorage.getItem(e)) !== i && n;S.error(q.noStorage);
  11019. } }, save: { defaults: function defaults() {
  11020. S.save.defaultText(), S.save.placeholderText(), S.save.defaultValue();
  11021. }, defaultValue: function defaultValue() {
  11022. var e = S.get.value();S.verbose("Saving default value as", e), M.data(E.defaultValue, e);
  11023. }, defaultText: function defaultText() {
  11024. var e = S.get.text();S.verbose("Saving default text as", e), M.data(E.defaultText, e);
  11025. }, placeholderText: function placeholderText() {
  11026. 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));
  11027. }, remoteData: function remoteData(e, n) {
  11028. t.Storage !== i ? (S.verbose("Saving remote data to session storage", n, e), sessionStorage.setItem(n, e)) : S.error(q.noStorage);
  11029. } }, clear: function clear() {
  11030. S.is.multiple() && k.useLabels ? S.remove.labels() : (S.remove.activeItem(), S.remove.selectedItem()), S.set.placeholderText(), S.clearValue();
  11031. }, clearValue: function clearValue() {
  11032. S.set.value("");
  11033. }, scrollPage: function scrollPage(e, t) {
  11034. var n,
  11035. i,
  11036. o = t || S.get.selectedItem(),
  11037. a = o.closest(D.menu),
  11038. r = a.outerHeight(),
  11039. s = a.scrollTop(),
  11040. l = X.eq(0).outerHeight(),
  11041. c = Math.floor(r / l),
  11042. u = (a.prop("scrollHeight"), "up" == e ? s - l * c : s + l * c),
  11043. 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));
  11044. }, set: { filtered: function filtered() {
  11045. var e = S.is.multiple(),
  11046. t = S.is.searchSelection(),
  11047. n = e && t,
  11048. i = t ? S.get.query() : "",
  11049. o = "string" == typeof i && i.length > 0,
  11050. a = S.get.searchWidth(),
  11051. 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));
  11052. }, empty: function empty() {
  11053. M.addClass(T.empty);
  11054. }, loading: function loading() {
  11055. M.addClass(T.loading);
  11056. }, placeholderText: function placeholderText(e) {
  11057. e = e || S.get.placeholderText(), S.debug("Setting placeholder text", e), S.set.text(e), V.addClass(T.placeholder);
  11058. }, tabbable: function tabbable() {
  11059. 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)));
  11060. }, initialLoad: function initialLoad() {
  11061. S.verbose("Setting initial load"), h = !0;
  11062. }, activeItem: function activeItem(e) {
  11063. k.allowAdditions && e.filter(D.addition).length > 0 ? e.addClass(T.filtered) : e.addClass(T.active);
  11064. }, partialSearch: function partialSearch(e) {
  11065. var t = S.get.query().length;N.val(e.substr(0, t));
  11066. }, scrollPosition: function scrollPosition(e, t) {
  11067. 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));
  11068. }, text: function text(e) {
  11069. "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)));
  11070. }, selectedItem: function selectedItem(e) {
  11071. var t = S.get.choiceValue(e),
  11072. n = S.get.choiceText(e, !1),
  11073. 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);
  11074. }, selectedLetter: function selectedLetter(t) {
  11075. var n,
  11076. i = X.filter("." + T.selected),
  11077. 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 () {
  11078. if (S.has.firstLetter(e(this), t)) return o = e(this), !1;
  11079. }), 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));
  11080. }, direction: function direction(e) {
  11081. "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);
  11082. }, upward: function upward(e) {
  11083. (e || M).addClass(T.upward);
  11084. }, leftward: function leftward(e) {
  11085. (e || Q).addClass(T.leftward);
  11086. }, value: function value(e, t, n) {
  11087. var o = S.escape.value(e),
  11088. a = U.length > 0,
  11089. r = S.get.values(),
  11090. s = e !== i ? String(e) : e;if (a) {
  11091. 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;
  11092. } 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);
  11093. }, active: function active() {
  11094. M.addClass(T.active);
  11095. }, multiple: function multiple() {
  11096. M.addClass(T.multiple);
  11097. }, visible: function visible() {
  11098. M.addClass(T.visible);
  11099. }, exactly: function exactly(e, t) {
  11100. S.debug("Setting selected to exact values"), S.clear(), S.set.selected(e, t);
  11101. }, selected: function selected(t, n) {
  11102. 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 () {
  11103. var t = e(this),
  11104. o = S.get.choiceText(t),
  11105. a = S.get.choiceValue(t, o),
  11106. r = t.hasClass(T.filtered),
  11107. s = t.hasClass(T.active),
  11108. l = t.hasClass(T.addition),
  11109. 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));
  11110. }));
  11111. } }, add: { label: function label(t, n, i) {
  11112. var o,
  11113. a = S.is.searchSelection() ? N : V,
  11114. 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)));
  11115. }, message: function message(t) {
  11116. var n = Q.children(D.message),
  11117. i = k.templates.message(S.add.variables(t));n.length > 0 ? n.html(i) : n = e("<div/>").html(i).addClass(T.message).appendTo(Q);
  11118. }, optionValue: function optionValue(t) {
  11119. 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());
  11120. }, userSuggestion: function userSuggestion(e) {
  11121. var t,
  11122. n = Q.children(D.addition),
  11123. i = S.get.item(e),
  11124. o = i && i.not(D.addition).length,
  11125. 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()));
  11126. }, variables: function variables(e, t) {
  11127. var n,
  11128. i,
  11129. o = -1 !== e.search("{count}"),
  11130. a = -1 !== e.search("{maxCount}"),
  11131. 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;
  11132. }, value: function value(t, n, i) {
  11133. var o,
  11134. 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");
  11135. } }, remove: { active: function active() {
  11136. M.removeClass(T.active);
  11137. }, activeLabel: function activeLabel() {
  11138. M.find(D.label).removeClass(T.active);
  11139. }, empty: function empty() {
  11140. M.removeClass(T.empty);
  11141. }, loading: function loading() {
  11142. M.removeClass(T.loading);
  11143. }, initialLoad: function initialLoad() {
  11144. h = !1;
  11145. }, upward: function upward(e) {
  11146. (e || M).removeClass(T.upward);
  11147. }, leftward: function leftward(e) {
  11148. (e || Q).removeClass(T.leftward);
  11149. }, visible: function visible() {
  11150. M.removeClass(T.visible);
  11151. }, activeItem: function activeItem() {
  11152. X.removeClass(T.active);
  11153. }, filteredItem: function filteredItem() {
  11154. k.useLabels && S.has.maxSelections() || (k.useLabels && S.is.multiple() ? X.not("." + T.active).removeClass(T.filtered) : X.removeClass(T.filtered), S.remove.empty());
  11155. }, optionValue: function optionValue(e) {
  11156. var t = S.escape.value(e),
  11157. 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 }));
  11158. }, message: function message() {
  11159. Q.children(D.message).remove();
  11160. }, searchWidth: function searchWidth() {
  11161. N.css("width", "");
  11162. }, searchTerm: function searchTerm() {
  11163. S.verbose("Cleared search term"), N.val(""), S.set.filtered();
  11164. }, userAddition: function userAddition() {
  11165. X.filter(D.addition).remove();
  11166. }, selected: function selected(t, n) {
  11167. if (!(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t))) return !1;n.each(function () {
  11168. var t = e(this),
  11169. n = S.get.choiceText(t),
  11170. 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);
  11171. });
  11172. }, selectedItem: function selectedItem() {
  11173. X.removeClass(T.selected);
  11174. }, value: function value(e, t, n) {
  11175. var i,
  11176. 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();
  11177. }, arrayValue: function arrayValue(t, n) {
  11178. return e.isArray(n) || (n = [n]), n = e.grep(n, function (e) {
  11179. return t != e;
  11180. }), S.verbose("Removed value from delimited string", t, n), n;
  11181. }, label: function label(e, t) {
  11182. var n = M.find(D.label).filter("[data-" + E.value + '="' + S.escape.string(e) + '"]');S.verbose("Removing label", n), n.remove();
  11183. }, activeLabels: function activeLabels(e) {
  11184. e = e || M.find(D.label).filter("." + T.active), S.verbose("Removing active label selections", e), S.remove.labels(e);
  11185. }, labels: function labels(t) {
  11186. t = t || M.find(D.label), S.verbose("Removing labels", t), t.each(function () {
  11187. var t = e(this),
  11188. n = t.data(E.value),
  11189. o = n !== i ? String(n) : n,
  11190. 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");
  11191. });
  11192. }, tabbable: function tabbable() {
  11193. 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"));
  11194. } }, has: { menuSearch: function menuSearch() {
  11195. return S.has.search() && N.closest(Q).length > 0;
  11196. }, search: function search() {
  11197. return N.length > 0;
  11198. }, sizer: function sizer() {
  11199. return H.length > 0;
  11200. }, selectInput: function selectInput() {
  11201. return U.is("select");
  11202. }, minCharacters: function minCharacters(e) {
  11203. return !k.minCharacters || (e = e !== i ? String(e) : String(S.get.query())).length >= k.minCharacters;
  11204. }, firstLetter: function firstLetter(e, t) {
  11205. var n;return !(!e || 0 === e.length || "string" != typeof t) && (n = S.get.choiceText(e, !1), (t = t.toLowerCase()) == String(n).charAt(0).toLowerCase());
  11206. }, input: function input() {
  11207. return U.length > 0;
  11208. }, items: function items() {
  11209. return X.length > 0;
  11210. }, menu: function menu() {
  11211. return Q.length > 0;
  11212. }, message: function message() {
  11213. return 0 !== Q.children(D.message).length;
  11214. }, label: function label(e) {
  11215. var t = S.escape.value(e),
  11216. n = M.find(D.label);return k.ignoreCase && (t = t.toLowerCase()), n.filter("[data-" + E.value + '="' + S.escape.string(t) + '"]').length > 0;
  11217. }, maxSelections: function maxSelections() {
  11218. return k.maxSelections && S.get.selectionCount() >= k.maxSelections;
  11219. }, allResultsFiltered: function allResultsFiltered() {
  11220. var e = X.not(D.addition);return e.filter(D.unselectable).length === e.length;
  11221. }, userSuggestion: function userSuggestion() {
  11222. return Q.children(D.addition).length > 0;
  11223. }, query: function query() {
  11224. return "" !== S.get.query();
  11225. }, value: function value(e) {
  11226. return k.ignoreCase ? S.has.valueIgnoringCase(e) : S.has.valueMatchingCase(e);
  11227. }, valueMatchingCase: function valueMatchingCase(t) {
  11228. var n = S.get.values();return !!(e.isArray(n) ? n && -1 !== e.inArray(t, n) : n == t);
  11229. }, valueIgnoringCase: function valueIgnoringCase(t) {
  11230. var n = S.get.values(),
  11231. i = !1;return e.isArray(n) || (n = [n]), e.each(n, function (e, n) {
  11232. if (String(t).toLowerCase() == String(n).toLowerCase()) return i = !0, !1;
  11233. }), i;
  11234. } }, is: { active: function active() {
  11235. return M.hasClass(T.active);
  11236. }, animatingInward: function animatingInward() {
  11237. return Q.transition("is inward");
  11238. }, animatingOutward: function animatingOutward() {
  11239. return Q.transition("is outward");
  11240. }, bubbledLabelClick: function bubbledLabelClick(t) {
  11241. return e(t.target).is("select, input") && M.closest("label").length > 0;
  11242. }, bubbledIconClick: function bubbledIconClick(t) {
  11243. return e(t.target).closest(W).length > 0;
  11244. }, alreadySetup: function alreadySetup() {
  11245. return M.is("select") && M.parent(D.dropdown).data(I) !== i && 0 === M.prev().length;
  11246. }, animating: function animating(e) {
  11247. return e ? e.transition && e.transition("is animating") : Q.transition && Q.transition("is animating");
  11248. }, leftward: function leftward(e) {
  11249. return (e || Q).hasClass(T.leftward);
  11250. }, disabled: function disabled() {
  11251. return M.hasClass(T.disabled);
  11252. }, focused: function focused() {
  11253. return n.activeElement === M[0];
  11254. }, focusedOnSearch: function focusedOnSearch() {
  11255. return n.activeElement === N[0];
  11256. }, allFiltered: function allFiltered() {
  11257. return (S.is.multiple() || S.has.search()) && !(0 == k.hideAdditions && S.has.userSuggestion()) && !S.has.message() && S.has.allResultsFiltered();
  11258. }, hidden: function hidden(e) {
  11259. return !S.is.visible(e);
  11260. }, initialLoad: function initialLoad() {
  11261. return h;
  11262. }, inObject: function inObject(t, n) {
  11263. var i = !1;return e.each(n, function (e, n) {
  11264. if (n == t) return i = !0, !0;
  11265. }), i;
  11266. }, multiple: function multiple() {
  11267. return M.hasClass(T.multiple);
  11268. }, remote: function remote() {
  11269. return k.apiSettings && S.can.useAPI();
  11270. }, single: function single() {
  11271. return !S.is.multiple();
  11272. }, selectMutation: function selectMutation(t) {
  11273. var n = !1;return e.each(t, function (t, i) {
  11274. if (i.target && e(i.target).is("select")) return n = !0, !0;
  11275. }), n;
  11276. }, search: function search() {
  11277. return M.hasClass(T.search);
  11278. }, searchSelection: function searchSelection() {
  11279. return S.has.search() && 1 === N.parent(D.dropdown).length;
  11280. }, selection: function selection() {
  11281. return M.hasClass(T.selection);
  11282. }, userValue: function userValue(t) {
  11283. return -1 !== e.inArray(t, S.get.userValues());
  11284. }, upward: function upward(e) {
  11285. return (e || M).hasClass(T.upward);
  11286. }, visible: function visible(e) {
  11287. return e ? e.hasClass(T.visible) : Q.hasClass(T.visible);
  11288. }, verticallyScrollableContext: function verticallyScrollableContext() {
  11289. var e = L.get(0) !== t && L.css("overflow-y");return "auto" == e || "scroll" == e;
  11290. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  11291. var e = L.get(0) !== t && L.css("overflow-X");return "auto" == e || "scroll" == e;
  11292. } }, can: { activate: function activate(e) {
  11293. return !!k.useLabels || !S.has.maxSelections() || !(!S.has.maxSelections() || !e.hasClass(T.active));
  11294. }, openDownward: function openDownward(e) {
  11295. var n,
  11296. i,
  11297. o = e || Q,
  11298. 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;
  11299. }, openRightward: function openRightward(e) {
  11300. var n,
  11301. i,
  11302. o = e || Q,
  11303. 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;
  11304. }, click: function click() {
  11305. return c || "click" == k.on;
  11306. }, extendSelect: function extendSelect() {
  11307. return k.allowAdditions || k.apiSettings;
  11308. }, show: function show() {
  11309. return !S.is.disabled() && (S.has.items() || S.has.message());
  11310. }, useAPI: function useAPI() {
  11311. return e.fn.api !== i;
  11312. } }, animate: { show: function show(t, n) {
  11313. var o,
  11314. a = n || Q,
  11315. r = n ? function () {} : function () {
  11316. S.hideSubMenus(), S.hideOthers(), S.set.active();
  11317. };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() {
  11318. t.call(K);
  11319. } }) : S.error(q.noTransition, o));
  11320. }, hide: function hide(t, n) {
  11321. var o = n || Q,
  11322. a = (n ? k.duration : k.duration, n ? function () {} : function () {
  11323. S.can.click() && S.unbind.intent(), S.remove.active();
  11324. }),
  11325. 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() {
  11326. t.call(K);
  11327. } }) : S.error(q.transition));
  11328. } }, hideAndClear: function hideAndClear() {
  11329. S.remove.searchTerm(), S.has.maxSelections() || (S.has.search() ? S.hide(function () {
  11330. S.remove.filteredItem();
  11331. }) : S.hide());
  11332. }, delay: { show: function show() {
  11333. S.verbose("Delaying show event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.show, k.delay.show);
  11334. }, hide: function hide() {
  11335. S.verbose("Delaying hide event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.hide, k.delay.hide);
  11336. } }, escape: { value: function value(t) {
  11337. var n = e.isArray(t),
  11338. i = "string" == typeof t,
  11339. o = !i && !n,
  11340. a = i && -1 !== t.search(O.quote),
  11341. r = [];return o || !a ? t : (S.debug("Encoding quote values for use in select", t), n ? (e.each(t, function (e, t) {
  11342. r.push(t.replace(O.quote, "&quot;"));
  11343. }), r) : t.replace(O.quote, "&quot;"));
  11344. }, string: function string(e) {
  11345. return (e = String(e)).replace(O.escape, "\\$&");
  11346. } }, setting: function setting(t, n) {
  11347. if (S.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, k, t);else {
  11348. if (n === i) return k[t];e.isPlainObject(k[t]) ? e.extend(!0, k[t], n) : k[t] = n;
  11349. }
  11350. }, internal: function internal(t, n) {
  11351. if (e.isPlainObject(t)) e.extend(!0, S, t);else {
  11352. if (n === i) return S[t];S[t] = n;
  11353. }
  11354. }, debug: function debug() {
  11355. !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)));
  11356. }, verbose: function verbose() {
  11357. !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)));
  11358. }, error: function error() {
  11359. k.silent || (S.error = Function.prototype.bind.call(console.error, console, k.name + ":"), S.error.apply(console, arguments));
  11360. }, performance: { log: function log(e) {
  11361. 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);
  11362. }, display: function display() {
  11363. var t = k.name + ":",
  11364. n = 0;u = !1, clearTimeout(S.performance.timer), e.each(d, function (e, t) {
  11365. n += t["Execution Time"];
  11366. }), 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) {
  11367. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11368. }), console.groupEnd()), d = [];
  11369. } }, invoke: function invoke(t, n, o) {
  11370. var r,
  11371. s,
  11372. l,
  11373. 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) {
  11374. 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 {
  11375. 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];
  11376. }
  11377. })), 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;
  11378. } }, m ? (J === i && S.initialize(), S.invoke(f)) : (J !== i && J.invoke("destroy"), S.initialize());
  11379. }), a !== i ? a : r;
  11380. }, 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) {
  11381. return e(this);
  11382. }, onLabelRemove: function onLabelRemove(e) {
  11383. return !0;
  11384. }, onNoResults: function onNoResults(e) {
  11385. return !0;
  11386. }, 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) {
  11387. var n = t.placeholder || !1,
  11388. 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) {
  11389. i += t.disabled ? '<div class="disabled item" data-value="' + t.value + '">' + t.name + "</div>" : '<div class="item" data-value="' + t.value + '">' + t.name + "</div>";
  11390. }), i += "</div>";
  11391. }, menu: function menu(t, n) {
  11392. var i = t[n.values] || {},
  11393. o = "";return e.each(i, function (e, t) {
  11394. var i = t[n.text] ? 'data-text="' + t[n.text] + '"' : "",
  11395. a = t[n.disabled] ? "disabled " : "";o += '<div class="' + a + 'item" data-value="' + t[n.value] + '"' + i + ">", o += t[n.name], o += "</div>";
  11396. }), o;
  11397. }, label: function label(e, t) {
  11398. return t + '<i class="delete icon"></i>';
  11399. }, message: function message(e) {
  11400. return e;
  11401. }, addition: function addition(e) {
  11402. return e;
  11403. } };
  11404. }(jQuery, window, document), function (e, t, n, i) {
  11405. "use strict";
  11406. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.embed = function (n) {
  11407. var o,
  11408. a = e(this),
  11409. r = a.selector || "",
  11410. s = new Date().getTime(),
  11411. l = [],
  11412. c = arguments[0],
  11413. u = "string" == typeof c,
  11414. d = [].slice.call(arguments, 1);return a.each(function () {
  11415. var f,
  11416. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.embed.settings, n) : e.extend({}, e.fn.embed.settings),
  11417. g = m.selector,
  11418. p = m.className,
  11419. h = m.sources,
  11420. v = m.error,
  11421. b = m.metadata,
  11422. y = m.namespace,
  11423. x = m.templates,
  11424. C = "." + y,
  11425. w = "module-" + y,
  11426. S = (e(t), e(this)),
  11427. k = (S.find(g.placeholder), S.find(g.icon), S.find(g.embed)),
  11428. T = this,
  11429. A = S.data(w);f = { initialize: function initialize() {
  11430. f.debug("Initializing embed"), f.determine.autoplay(), f.create(), f.bind.events(), f.instantiate();
  11431. }, instantiate: function instantiate() {
  11432. f.verbose("Storing instance of module", f), A = f, S.data(w, f);
  11433. }, destroy: function destroy() {
  11434. f.verbose("Destroying previous instance of embed"), f.reset(), S.removeData(w).off(C);
  11435. }, refresh: function refresh() {
  11436. f.verbose("Refreshing selector cache"), S.find(g.placeholder), S.find(g.icon), k = S.find(g.embed);
  11437. }, bind: { events: function events() {
  11438. f.has.placeholder() && (f.debug("Adding placeholder events"), S.on("click" + C, g.placeholder, f.createAndShow).on("click" + C, g.icon, f.createAndShow));
  11439. } }, create: function create() {
  11440. f.get.placeholder() ? f.createPlaceholder() : f.createAndShow();
  11441. }, createPlaceholder: function createPlaceholder(e) {
  11442. var t = f.get.icon(),
  11443. 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);
  11444. }, createEmbed: function createEmbed(t) {
  11445. 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);
  11446. }, changeEmbed: function changeEmbed(e) {
  11447. k.html(f.generate.embed(e));
  11448. }, createAndShow: function createAndShow() {
  11449. f.createEmbed(), f.show();
  11450. }, change: function change(e, t, n) {
  11451. 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();
  11452. }, reset: function reset() {
  11453. f.debug("Clearing embed and showing placeholder"), f.remove.active(), f.remove.embed(), f.showPlaceholder(), m.onReset.call(T);
  11454. }, show: function show() {
  11455. f.debug("Showing embed"), f.set.active(), m.onDisplay.call(T);
  11456. }, hide: function hide() {
  11457. f.debug("Hiding embed"), f.showPlaceholder();
  11458. }, showPlaceholder: function showPlaceholder() {
  11459. f.debug("Showing placeholder image"), f.remove.active(), m.onPlaceholderDisplay.call(T);
  11460. }, get: { id: function id() {
  11461. return m.id || S.data(b.id);
  11462. }, placeholder: function placeholder() {
  11463. return m.placeholder || S.data(b.placeholder);
  11464. }, icon: function icon() {
  11465. return m.icon ? m.icon : S.data(b.icon) !== i ? S.data(b.icon) : f.determine.icon();
  11466. }, source: function source(e) {
  11467. return m.source ? m.source : S.data(b.source) !== i ? S.data(b.source) : f.determine.source();
  11468. }, type: function type() {
  11469. var e = f.get.source();return h[e] !== i && h[e].type;
  11470. }, url: function url() {
  11471. return m.url ? m.url : S.data(b.url) !== i ? S.data(b.url) : f.determine.url();
  11472. } }, determine: { autoplay: function autoplay() {
  11473. f.should.autoplay() && (m.autoplay = !0);
  11474. }, source: function source(t) {
  11475. var n = !1;return (t = t || f.get.url()) && e.each(h, function (e, i) {
  11476. if (-1 !== t.search(i.domain)) return n = e, !1;
  11477. }), n;
  11478. }, icon: function icon() {
  11479. var e = f.get.source();return h[e] !== i && h[e].icon;
  11480. }, url: function url() {
  11481. var e,
  11482. t = m.id || S.data(b.id),
  11483. n = m.source || S.data(b.source);return (e = h[n] !== i && h[n].url.replace("{id}", t)) && S.data(b.url, e), e;
  11484. } }, set: { active: function active() {
  11485. S.addClass(p.active);
  11486. } }, remove: { active: function active() {
  11487. S.removeClass(p.active);
  11488. }, embed: function embed() {
  11489. k.empty();
  11490. } }, encode: { parameters: function parameters(e) {
  11491. var t,
  11492. n = [];for (t in e) {
  11493. n.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t]));
  11494. }return n.join("&amp;");
  11495. } }, generate: { embed: function embed(e) {
  11496. f.debug("Generating embed html");var t,
  11497. n,
  11498. 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;
  11499. }, parameters: function parameters(t, n) {
  11500. 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);
  11501. } }, has: { embed: function embed() {
  11502. return k.length > 0;
  11503. }, placeholder: function placeholder() {
  11504. return m.placeholder || S.data(b.placeholder);
  11505. } }, should: { autoplay: function autoplay() {
  11506. return "auto" === m.autoplay ? m.placeholder || S.data(b.placeholder) !== i : m.autoplay;
  11507. } }, is: { video: function video() {
  11508. return "video" == f.get.type();
  11509. } }, setting: function setting(t, n) {
  11510. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  11511. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  11512. }
  11513. }, internal: function internal(t, n) {
  11514. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  11515. if (n === i) return f[t];f[t] = n;
  11516. }
  11517. }, debug: function debug() {
  11518. !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)));
  11519. }, verbose: function verbose() {
  11520. !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)));
  11521. }, error: function error() {
  11522. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  11523. }, performance: { log: function log(e) {
  11524. 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);
  11525. }, display: function display() {
  11526. var t = m.name + ":",
  11527. n = 0;s = !1, clearTimeout(f.performance.timer), e.each(l, function (e, t) {
  11528. n += t["Execution Time"];
  11529. }), 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) {
  11530. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11531. }), console.groupEnd()), l = [];
  11532. } }, invoke: function invoke(t, n, a) {
  11533. var r,
  11534. s,
  11535. l,
  11536. 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) {
  11537. 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 {
  11538. 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];
  11539. }
  11540. })), 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;
  11541. } }, u ? (A === i && f.initialize(), f.invoke(c)) : (A !== i && A.invoke("destroy"), f.initialize());
  11542. }), o !== i ? o : this;
  11543. }, 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) {
  11544. return e;
  11545. }, 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) {
  11546. return { autohide: !e.brandedUI, autoplay: e.autoplay, color: e.color || i, hq: e.hd, jsapi: e.api, modestbranding: !e.brandedUI };
  11547. } }, vimeo: { name: "vimeo", type: "video", icon: "video play", domain: "vimeo.com", url: "//player.vimeo.com/video/{id}", parameters: function parameters(e) {
  11548. return { api: e.api, autoplay: e.autoplay, byline: e.brandedUI, color: e.color || i, portrait: e.brandedUI, title: e.brandedUI };
  11549. } } }, templates: { iframe: function iframe(e, t) {
  11550. var n = e;return t && (n += "?" + t), '<iframe src="' + n + '" width="100%" height="100%" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  11551. }, placeholder: function placeholder(e, t) {
  11552. var n = "";return t && (n += '<i class="' + t + ' icon"></i>'), e && (n += '<img class="placeholder" src="' + e + '">'), n;
  11553. } }, api: !1, onPause: function onPause() {}, onPlay: function onPlay() {}, onStop: function onStop() {} };
  11554. }(jQuery, window, document), function (e, t, n, i) {
  11555. "use strict";
  11556. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.modal = function (o) {
  11557. var a,
  11558. r = e(this),
  11559. s = e(t),
  11560. l = e(n),
  11561. c = e("body"),
  11562. u = r.selector || "",
  11563. d = new Date().getTime(),
  11564. f = [],
  11565. m = arguments[0],
  11566. g = "string" == typeof m,
  11567. p = [].slice.call(arguments, 1),
  11568. h = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  11569. setTimeout(e, 0);
  11570. };return r.each(function () {
  11571. var r,
  11572. v,
  11573. b,
  11574. y,
  11575. x,
  11576. C,
  11577. w,
  11578. S,
  11579. k,
  11580. T = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.modal.settings, o) : e.extend({}, e.fn.modal.settings),
  11581. A = T.selector,
  11582. R = T.className,
  11583. P = T.namespace,
  11584. E = T.error,
  11585. F = "." + P,
  11586. O = "module-" + P,
  11587. D = e(this),
  11588. q = e(T.context),
  11589. j = D.find(A.close),
  11590. z = this,
  11591. I = D.data(O),
  11592. M = !1;k = { initialize: function initialize() {
  11593. k.verbose("Initializing dimmer", q), k.create.id(), k.create.dimmer(), k.refreshModals(), k.bind.events(), T.observeChanges && k.observeChanges(), k.instantiate();
  11594. }, instantiate: function instantiate() {
  11595. k.verbose("Storing instance of modal"), I = k, D.data(O, I);
  11596. }, create: { dimmer: function dimmer() {
  11597. var t = { debug: T.debug, variation: !T.centered && "top aligned", dimmerName: "modals" },
  11598. 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);
  11599. }, id: function id() {
  11600. w = (Math.random().toString(16) + "000000000").substr(2, 8), C = "." + w, k.verbose("Creating unique id for element", w);
  11601. } }, destroy: function destroy() {
  11602. k.verbose("Destroying previous modal"), D.removeData(O).off(F), s.off(C), x.off(C), j.off(F), q.dimmer("destroy");
  11603. }, observeChanges: function observeChanges() {
  11604. "MutationObserver" in t && ((S = new MutationObserver(function (e) {
  11605. k.debug("DOM tree modified, refreshing"), k.refresh();
  11606. })).observe(z, { childList: !0, subtree: !0 }), k.debug("Setting up mutation observer", S));
  11607. }, refresh: function refresh() {
  11608. k.remove.scrolling(), k.cacheSizes(), k.set.screenHeight(), k.set.type();
  11609. }, refreshModals: function refreshModals() {
  11610. v = D.siblings(A.modal), r = v.add(D);
  11611. }, attachEvents: function attachEvents(t, n) {
  11612. 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);
  11613. }, bind: { events: function events() {
  11614. 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);
  11615. } }, get: { id: function id() {
  11616. return (Math.random().toString(16) + "000000000").substr(2, 8);
  11617. } }, event: { approve: function approve() {
  11618. M || !1 === T.onApprove.call(z, e(this)) ? k.verbose("Approve callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11619. M = !1;
  11620. }));
  11621. }, deny: function deny() {
  11622. M || !1 === T.onDeny.call(z, e(this)) ? k.verbose("Deny callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11623. M = !1;
  11624. }));
  11625. }, close: function close() {
  11626. k.hide();
  11627. }, click: function click(t) {
  11628. if (T.closable) {
  11629. var i = e(t.target).closest(A.modal).length > 0,
  11630. 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());
  11631. } else k.verbose("Dimmer clicked but closable setting is disabled");
  11632. }, debounce: function debounce(e, t) {
  11633. clearTimeout(k.timer), k.timer = setTimeout(e, t);
  11634. }, keyboard: function keyboard(e) {
  11635. 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());
  11636. }, resize: function resize() {
  11637. y.dimmer("is active") && (k.is.animating() || k.is.active()) && h(k.refresh);
  11638. } }, toggle: function toggle() {
  11639. k.is.active() || k.is.animating() ? k.hide() : k.show();
  11640. }, show: function show(t) {
  11641. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.set.dimmerSettings(), k.showModal(t);
  11642. }, hide: function hide(t) {
  11643. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.hideModal(t);
  11644. }, showModal: function showModal(t) {
  11645. 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() {
  11646. T.onVisible.apply(z), T.keyboardShortcuts && k.add.keyboardShortcuts(), k.save.focus(), k.set.active(), T.autofocus && k.set.autofocus(), t();
  11647. } })) : k.error(E.noTransition))) : k.debug("Modal is already visible");
  11648. }, hideModal: function hideModal(t, n) {
  11649. 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() {
  11650. k.others.active() || n || k.hideDimmer(), T.keyboardShortcuts && k.remove.keyboardShortcuts();
  11651. }, onComplete: function onComplete() {
  11652. T.onHidden.call(z), k.restore.focus(), t();
  11653. } })) : k.error(E.noTransition)) : k.verbose("Hide callback returned false cancelling hide");
  11654. }, showDimmer: function showDimmer() {
  11655. y.dimmer("is animating") || !y.dimmer("is active") ? (k.debug("Showing dimmer"), y.dimmer("show")) : k.debug("Dimmer already visible");
  11656. }, hideDimmer: function hideDimmer() {
  11657. y.dimmer("is animating") || y.dimmer("is active") ? y.dimmer("hide", function () {
  11658. k.remove.clickaway(), k.remove.screenHeight();
  11659. }) : k.debug("Dimmer is not visible cannot hide");
  11660. }, hideAll: function hideAll(t) {
  11661. 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));
  11662. }, hideOthers: function hideOthers(t) {
  11663. 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));
  11664. }, others: { active: function active() {
  11665. return v.filter("." + R.active).length > 0;
  11666. }, animating: function animating() {
  11667. return v.filter("." + R.animating).length > 0;
  11668. } }, add: { keyboardShortcuts: function keyboardShortcuts() {
  11669. k.verbose("Adding keyboard shortcuts"), l.on("keyup" + F, k.event.keyboard);
  11670. } }, save: { focus: function focus() {
  11671. e(n.activeElement).closest(D).length > 0 || (b = e(n.activeElement).blur());
  11672. } }, restore: { focus: function focus() {
  11673. b && b.length > 0 && b.focus();
  11674. } }, remove: { active: function active() {
  11675. D.removeClass(R.active);
  11676. }, clickaway: function clickaway() {
  11677. x.off("click" + C);
  11678. }, bodyStyle: function bodyStyle() {
  11679. "" === c.attr("style") && (k.verbose("Removing style attribute"), c.removeAttr("style"));
  11680. }, screenHeight: function screenHeight() {
  11681. k.debug("Removing page height"), c.css("height", "");
  11682. }, keyboardShortcuts: function keyboardShortcuts() {
  11683. k.verbose("Removing keyboard shortcuts"), l.off("keyup" + F);
  11684. }, scrolling: function scrolling() {
  11685. y.removeClass(R.scrolling), D.removeClass(R.scrolling);
  11686. } }, cacheSizes: function cacheSizes() {
  11687. D.addClass(R.loading);var o = D.prop("scrollHeight"),
  11688. 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);
  11689. }, can: { fit: function fit() {
  11690. var e = k.cache.contextHeight,
  11691. t = k.cache.contextHeight / 2,
  11692. n = k.cache.topOffset,
  11693. i = k.cache.scrollHeight,
  11694. o = k.cache.height,
  11695. a = T.padding;return i > o ? t + n + i + a < e : o + 2 * a < e;
  11696. } }, is: { active: function active() {
  11697. return D.hasClass(R.active);
  11698. }, animating: function animating() {
  11699. return D.transition("is supported") ? D.transition("is animating") : D.is(":visible");
  11700. }, scrolling: function scrolling() {
  11701. return y.hasClass(R.scrolling);
  11702. }, modernBrowser: function modernBrowser() {
  11703. return !(t.ActiveXObject || "ActiveXObject" in t);
  11704. } }, set: { autofocus: function autofocus() {
  11705. var e = D.find("[tabindex], :input").filter(":visible"),
  11706. t = e.filter("[autofocus]"),
  11707. n = t.length > 0 ? t.first() : e.first();n.length > 0 && n.focus();
  11708. }, clickaway: function clickaway() {
  11709. x.on("click" + C, k.event.click);
  11710. }, dimmerSettings: function dimmerSettings() {
  11711. if (e.fn.dimmer !== i) {
  11712. var t = { debug: T.debug, dimmerName: "modals", closable: "auto", variation: !T.centered && "top aligned", duration: { show: T.duration, hide: T.duration } },
  11713. 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);
  11714. } else k.error(E.dimmer);
  11715. }, screenHeight: function screenHeight() {
  11716. 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));
  11717. }, active: function active() {
  11718. D.addClass(R.active);
  11719. }, scrolling: function scrolling() {
  11720. y.addClass(R.scrolling), D.addClass(R.scrolling);
  11721. }, type: function type() {
  11722. 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());
  11723. }, undetached: function undetached() {
  11724. y.addClass(R.undetached);
  11725. } }, setting: function setting(t, n) {
  11726. if (k.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, T, t);else {
  11727. if (n === i) return T[t];e.isPlainObject(T[t]) ? e.extend(!0, T[t], n) : T[t] = n;
  11728. }
  11729. }, internal: function internal(t, n) {
  11730. if (e.isPlainObject(t)) e.extend(!0, k, t);else {
  11731. if (n === i) return k[t];k[t] = n;
  11732. }
  11733. }, debug: function debug() {
  11734. !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)));
  11735. }, verbose: function verbose() {
  11736. !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)));
  11737. }, error: function error() {
  11738. T.silent || (k.error = Function.prototype.bind.call(console.error, console, T.name + ":"), k.error.apply(console, arguments));
  11739. }, performance: { log: function log(e) {
  11740. 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);
  11741. }, display: function display() {
  11742. var t = T.name + ":",
  11743. n = 0;d = !1, clearTimeout(k.performance.timer), e.each(f, function (e, t) {
  11744. n += t["Execution Time"];
  11745. }), 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) {
  11746. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11747. }), console.groupEnd()), f = [];
  11748. } }, invoke: function invoke(t, n, o) {
  11749. var r,
  11750. s,
  11751. l,
  11752. 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) {
  11753. 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 {
  11754. 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];
  11755. }
  11756. })), 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;
  11757. } }, g ? (I === i && k.initialize(), k.invoke(m)) : (I !== i && I.invoke("destroy"), k.initialize());
  11758. }), a !== i ? a : this;
  11759. }, 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() {
  11760. return !0;
  11761. }, onHidden: function onHidden() {}, onApprove: function onApprove() {
  11762. return !0;
  11763. }, onDeny: function onDeny() {
  11764. return !0;
  11765. }, 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" } };
  11766. }(jQuery, window, document), function (e, t, n, i) {
  11767. "use strict";
  11768. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.nag = function (n) {
  11769. var o,
  11770. a = e(this),
  11771. r = a.selector || "",
  11772. s = new Date().getTime(),
  11773. l = [],
  11774. c = arguments[0],
  11775. u = "string" == typeof c,
  11776. d = [].slice.call(arguments, 1);return a.each(function () {
  11777. var a,
  11778. f = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.nag.settings, n) : e.extend({}, e.fn.nag.settings),
  11779. m = (f.className, f.selector),
  11780. g = f.error,
  11781. p = f.namespace,
  11782. h = "." + p,
  11783. v = p + "-module",
  11784. b = e(this),
  11785. y = (b.find(m.close), f.context ? e(f.context) : e("body")),
  11786. x = this,
  11787. C = b.data(v);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;a = { initialize: function initialize() {
  11788. 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();
  11789. }, destroy: function destroy() {
  11790. a.verbose("Destroying instance"), b.removeData(v).off(h);
  11791. }, show: function show() {
  11792. 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));
  11793. }, hide: function hide() {
  11794. a.debug("Showing nag", f.animation.hide), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideUp(f.duration, f.easing);
  11795. }, onHide: function onHide() {
  11796. a.debug("Removing nag", f.animation.hide), b.remove(), f.onHide && f.onHide();
  11797. }, dismiss: function dismiss(e) {
  11798. f.storageMethod && a.storage.set(f.key, f.value), a.hide(), e.stopImmediatePropagation(), e.preventDefault();
  11799. }, should: { show: function show() {
  11800. 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);
  11801. } }, get: { storageOptions: function storageOptions() {
  11802. var e = {};return f.expires && (e.expires = f.expires), f.domain && (e.domain = f.domain), f.path && (e.path = f.path), e;
  11803. } }, clear: function clear() {
  11804. a.storage.remove(f.key);
  11805. }, storage: { set: function set(n, o) {
  11806. 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 {
  11807. if (e.cookie === i) return void a.error(g.noCookieStorage);e.cookie(n, o, r), a.debug("Value stored using cookie", n, o, r);
  11808. }
  11809. }, get: function get(n, o) {
  11810. 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;
  11811. }, remove: function remove(n) {
  11812. 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);
  11813. } }, setting: function setting(t, n) {
  11814. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  11815. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  11816. }
  11817. }, internal: function internal(t, n) {
  11818. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  11819. if (n === i) return a[t];a[t] = n;
  11820. }
  11821. }, debug: function debug() {
  11822. !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)));
  11823. }, verbose: function verbose() {
  11824. !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)));
  11825. }, error: function error() {
  11826. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  11827. }, performance: { log: function log(e) {
  11828. 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);
  11829. }, display: function display() {
  11830. var t = f.name + ":",
  11831. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  11832. n += t["Execution Time"];
  11833. }), 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) {
  11834. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11835. }), console.groupEnd()), l = [];
  11836. } }, invoke: function invoke(t, n, r) {
  11837. var s,
  11838. l,
  11839. c,
  11840. 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) {
  11841. 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 {
  11842. 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];
  11843. }
  11844. })), 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;
  11845. } }, u ? (C === i && a.initialize(), a.invoke(c)) : (C !== i && C.invoke("destroy"), a.initialize());
  11846. }), o !== i ? o : this;
  11847. }, 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) {
  11848. return -i * (t /= o) * (t - 2) + n;
  11849. } });
  11850. }(jQuery, window, document), function (e, t, n, i) {
  11851. "use strict";
  11852. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.popup = function (o) {
  11853. var a,
  11854. r = e(this),
  11855. s = e(n),
  11856. l = e(t),
  11857. c = e("body"),
  11858. u = r.selector || "",
  11859. d = new Date().getTime(),
  11860. f = [],
  11861. m = arguments[0],
  11862. g = "string" == typeof m,
  11863. p = [].slice.call(arguments, 1);return r.each(function () {
  11864. var r,
  11865. h,
  11866. v,
  11867. b,
  11868. y,
  11869. x,
  11870. C = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.popup.settings, o) : e.extend({}, e.fn.popup.settings),
  11871. w = C.selector,
  11872. S = C.className,
  11873. k = C.error,
  11874. T = C.metadata,
  11875. A = C.namespace,
  11876. R = "." + C.namespace,
  11877. P = "module-" + A,
  11878. E = e(this),
  11879. F = e(C.context),
  11880. O = e(C.scrollContext),
  11881. D = e(C.boundary),
  11882. q = C.target ? e(C.target) : E,
  11883. j = 0,
  11884. z = !1,
  11885. I = !1,
  11886. M = this,
  11887. L = E.data(P);x = { initialize: function initialize() {
  11888. x.debug("Initializing", E), x.createID(), x.bind.events(), !x.exists() && C.preserve && x.create(), C.observeChanges && x.observeChanges(), x.instantiate();
  11889. }, instantiate: function instantiate() {
  11890. x.verbose("Storing instance", x), L = x, E.data(P, L);
  11891. }, observeChanges: function observeChanges() {
  11892. "MutationObserver" in t && ((v = new MutationObserver(x.event.documentChanged)).observe(n, { childList: !0, subtree: !0 }), x.debug("Setting up mutation observer", v));
  11893. }, refresh: function refresh() {
  11894. 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();
  11895. }, reposition: function reposition() {
  11896. x.refresh(), x.set.position();
  11897. }, destroy: function destroy() {
  11898. 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);
  11899. }, event: { start: function start(t) {
  11900. var n = e.isPlainObject(C.delay) ? C.delay.show : C.delay;clearTimeout(x.hideTimer), I || (x.showTimer = setTimeout(x.show, n));
  11901. }, end: function end() {
  11902. var t = e.isPlainObject(C.delay) ? C.delay.hide : C.delay;clearTimeout(x.showTimer), x.hideTimer = setTimeout(x.hide, t);
  11903. }, touchstart: function touchstart(e) {
  11904. I = !0, x.show();
  11905. }, resize: function resize() {
  11906. x.is.visible() && x.set.position();
  11907. }, documentChanged: function documentChanged(t) {
  11908. [].forEach.call(t, function (t) {
  11909. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  11910. (t == M || e(t).find(M).length > 0) && (x.debug("Element removed from DOM, tearing down events"), x.destroy());
  11911. });
  11912. });
  11913. }, hideGracefully: function hideGracefully(t) {
  11914. var i = e(t.target),
  11915. o = e.contains(n.documentElement, t.target),
  11916. 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");
  11917. } }, create: function create() {
  11918. var t = x.get.html(),
  11919. n = x.get.title(),
  11920. 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);
  11921. }, createID: function createID() {
  11922. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, x.verbose("Creating unique id for element", y);
  11923. }, toggle: function toggle() {
  11924. 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());
  11925. }, show: function show(e) {
  11926. if (e = e || function () {}, x.debug("Showing pop-up", C.transition), x.is.hidden() && (!x.is.active() || !x.is.dropdown())) {
  11927. 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));
  11928. }
  11929. }, hide: function hide(e) {
  11930. if (e = e || function () {}, x.is.visible() || x.is.animating()) {
  11931. 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);
  11932. }
  11933. }, hideAll: function hideAll() {
  11934. e(w.popup).filter("." + S.popupVisible).each(function () {
  11935. e(this).data(T.activator).popup("hide");
  11936. });
  11937. }, exists: function exists() {
  11938. return !!r && (C.inline || C.popup ? x.has.popup() : r.closest(F).length >= 1);
  11939. }, removePopup: function removePopup() {
  11940. x.has.popup() && !C.popup && (x.debug("Removing popup", r), r.remove(), r = i, C.onRemove.call(r, M));
  11941. }, save: { conditions: function conditions() {
  11942. x.cache = { title: E.attr("title") }, x.cache.title && E.removeAttr("title"), x.verbose("Saving original attributes", x.cache.title);
  11943. } }, restore: { conditions: function conditions() {
  11944. return x.cache && x.cache.title && (E.attr("title", x.cache.title), x.verbose("Restoring original attributes", x.cache.title)), !0;
  11945. } }, supports: { svg: function svg() {
  11946. return "undefined" == typeof SVGGraphicsElement;
  11947. } }, animate: { show: function show(t) {
  11948. 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() {
  11949. x.bind.close(), t.call(r, M), C.onVisible.call(r, M);
  11950. } })) : x.error(k.noTransition);
  11951. }, hide: function hide(t) {
  11952. 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() {
  11953. x.reset(), t.call(r, M), C.onHidden.call(r, M);
  11954. } }) : x.error(k.noTransition) : x.debug("onHide callback returned false, cancelling popup animation");
  11955. } }, change: { content: function content(e) {
  11956. r.html(e);
  11957. } }, get: { html: function html() {
  11958. return E.removeData(T.html), E.data(T.html) || C.html;
  11959. }, title: function title() {
  11960. return E.removeData(T.title), E.data(T.title) || C.title;
  11961. }, content: function content() {
  11962. return E.removeData(T.content), E.data(T.content) || C.content || E.attr("title");
  11963. }, variation: function variation() {
  11964. return E.removeData(T.variation), E.data(T.variation) || C.variation;
  11965. }, popup: function popup() {
  11966. return r;
  11967. }, popupOffset: function popupOffset() {
  11968. return r.offset();
  11969. }, calculations: function calculations() {
  11970. var e,
  11971. n = x.get.offsetParent(r),
  11972. i = q[0],
  11973. o = D[0] == t,
  11974. a = C.inline || C.popup && C.movePopup ? q.position() : q.offset(),
  11975. s = o ? { top: 0, left: 0 } : D.offset(),
  11976. c = {},
  11977. 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)) {
  11978. var d = n.offset();c.target.top -= d.top, c.target.left -= d.left, c.parent.width = n.outerWidth(), c.parent.height = n.outerHeight();
  11979. }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;
  11980. }, id: function id() {
  11981. return y;
  11982. }, startEvent: function startEvent() {
  11983. return "hover" == C.on ? "mouseenter" : "focus" == C.on && "focus";
  11984. }, scrollEvent: function scrollEvent() {
  11985. return "scroll";
  11986. }, endEvent: function endEvent() {
  11987. return "hover" == C.on ? "mouseleave" : "focus" == C.on && "blur";
  11988. }, distanceFromBoundary: function distanceFromBoundary(e, t) {
  11989. var n,
  11990. i,
  11991. 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;
  11992. }, offsetParent: function offsetParent(t) {
  11993. var n = (t !== i ? t[0] : q[0]).parentNode,
  11994. 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;) {
  11995. n = n.parentNode, a = "none" === (o = e(n)).css("transform"), r = "static" === o.css("position"), s = o.is("body");
  11996. }return o && o.length > 0 ? o : e();
  11997. }, positions: function positions() {
  11998. 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 };
  11999. }, nextPosition: function nextPosition(e) {
  12000. var t = e.split(" "),
  12001. n = t[0],
  12002. i = t[1],
  12003. o = "top" == n || "bottom" == n,
  12004. a = !1,
  12005. r = !1,
  12006. 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;
  12007. } }, set: { position: function position(e, t) {
  12008. if (0 !== q.length && 0 !== r.length) {
  12009. 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) {
  12010. return "left" == e ? "right" : "left";
  12011. }), x.debug("RTL: Popup position updated", e)), j == C.maxSearchDepth && "string" == typeof C.lastResort && (e = C.lastResort), e) {case "top left":
  12012. c = { top: "auto", bottom: l.height - a.top + o, left: a.left + n, right: "auto" };break;case "top center":
  12013. 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":
  12014. c = { bottom: l.height - a.top + o, right: l.width - a.left - a.width - n, top: "auto", left: "auto" };break;case "left center":
  12015. 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":
  12016. 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":
  12017. c = { top: a.top + a.height + o, left: a.left + n, bottom: "auto", right: "auto" };break;case "bottom center":
  12018. 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":
  12019. 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)) {
  12020. 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");
  12021. }return x.debug("Position is on stage", e), x.remove.attempts(), x.remove.loading(), C.setFluidWidth && x.is.fluid() && x.set.fluidWidth(t), !0;
  12022. }x.error(k.notFound);
  12023. }, fluidWidth: function fluidWidth(e) {
  12024. e = e || x.get.calculations(), x.debug("Automatically setting element width to parent width", e.parent.width), r.css("width", e.container.width);
  12025. }, variation: function variation(e) {
  12026. (e = e || x.get.variation()) && x.has.popup() && (x.verbose("Adding variation to popup", e), r.addClass(e));
  12027. }, visible: function visible() {
  12028. E.addClass(S.visible);
  12029. } }, remove: { loading: function loading() {
  12030. r.removeClass(S.loading);
  12031. }, variation: function variation(e) {
  12032. (e = e || x.get.variation()) && (x.verbose("Removing variation", e), r.removeClass(e));
  12033. }, visible: function visible() {
  12034. E.removeClass(S.visible);
  12035. }, attempts: function attempts() {
  12036. x.verbose("Resetting all searched positions"), j = 0, z = !1;
  12037. } }, bind: { events: function events() {
  12038. 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);
  12039. }, popup: function popup() {
  12040. 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);
  12041. }, close: function close() {
  12042. (!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();
  12043. }, closeOnScroll: function closeOnScroll() {
  12044. x.verbose("Binding scroll close event to document"), O.one(x.get.scrollEvent() + b, x.event.hideGracefully);
  12045. }, touchClose: function touchClose() {
  12046. x.verbose("Binding popup touchclose event to document"), s.on("touchstart" + b, function (e) {
  12047. x.verbose("Touched away from popup"), x.event.hideGracefully.call(M, e);
  12048. });
  12049. }, clickaway: function clickaway() {
  12050. x.verbose("Binding popup close event to document"), s.on("click" + b, function (e) {
  12051. x.verbose("Clicked away from popup"), x.event.hideGracefully.call(M, e);
  12052. });
  12053. } }, unbind: { events: function events() {
  12054. l.off(b), E.off(R);
  12055. }, close: function close() {
  12056. s.off(b), O.off(b);
  12057. } }, has: { popup: function popup() {
  12058. return r && r.length > 0;
  12059. } }, should: { centerArrow: function centerArrow(e) {
  12060. return !x.is.basic() && e.target.width <= 2 * C.arrowPixelsFromEdge;
  12061. } }, is: { offstage: function offstage(t, n) {
  12062. var i = [];return e.each(t, function (e, t) {
  12063. t < -C.jitter && (x.debug("Position exceeds allowable distance from edge", e, t, n), i.push(e));
  12064. }), i.length > 0;
  12065. }, svg: function svg(e) {
  12066. return x.supports.svg() && e instanceof SVGGraphicsElement;
  12067. }, basic: function basic() {
  12068. return E.hasClass(S.basic);
  12069. }, active: function active() {
  12070. return E.hasClass(S.active);
  12071. }, animating: function animating() {
  12072. return r !== i && r.hasClass(S.animating);
  12073. }, fluid: function fluid() {
  12074. return r !== i && r.hasClass(S.fluid);
  12075. }, visible: function visible() {
  12076. return r !== i && r.hasClass(S.popupVisible);
  12077. }, dropdown: function dropdown() {
  12078. return E.hasClass(S.dropdown);
  12079. }, hidden: function hidden() {
  12080. return !x.is.visible();
  12081. }, rtl: function rtl() {
  12082. return "rtl" == E.css("direction");
  12083. } }, reset: function reset() {
  12084. x.remove.visible(), C.preserve ? e.fn.transition !== i && r.transition("remove transition") : x.removePopup();
  12085. }, setting: function setting(t, n) {
  12086. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  12087. if (n === i) return C[t];C[t] = n;
  12088. }
  12089. }, internal: function internal(t, n) {
  12090. if (e.isPlainObject(t)) e.extend(!0, x, t);else {
  12091. if (n === i) return x[t];x[t] = n;
  12092. }
  12093. }, debug: function debug() {
  12094. !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)));
  12095. }, verbose: function verbose() {
  12096. !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)));
  12097. }, error: function error() {
  12098. C.silent || (x.error = Function.prototype.bind.call(console.error, console, C.name + ":"), x.error.apply(console, arguments));
  12099. }, performance: { log: function log(e) {
  12100. 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);
  12101. }, display: function display() {
  12102. var t = C.name + ":",
  12103. n = 0;d = !1, clearTimeout(x.performance.timer), e.each(f, function (e, t) {
  12104. n += t["Execution Time"];
  12105. }), 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) {
  12106. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12107. }), console.groupEnd()), f = [];
  12108. } }, invoke: function invoke(t, n, o) {
  12109. var r,
  12110. s,
  12111. l,
  12112. 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) {
  12113. 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 {
  12114. 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];
  12115. }
  12116. })), 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;
  12117. } }, g ? (L === i && x.initialize(), x.invoke(m)) : (L !== i && L.invoke("destroy"), x.initialize());
  12118. }), a !== i ? a : this;
  12119. }, 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) {
  12120. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12121. return t[e];
  12122. }) : e
  12123. );
  12124. }, popup: function popup(t) {
  12125. var n = "",
  12126. 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;
  12127. } } };
  12128. }(jQuery, window, document), function (e, t, n, i) {
  12129. "use strict";
  12130. 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) {
  12131. var o,
  12132. a = e(this),
  12133. r = a.selector || "",
  12134. s = new Date().getTime(),
  12135. l = [],
  12136. c = arguments[0],
  12137. u = "string" == typeof c,
  12138. d = [].slice.call(arguments, 1);return a.each(function () {
  12139. var a,
  12140. f = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.progress.settings, t) : e.extend({}, e.fn.progress.settings),
  12141. m = f.className,
  12142. g = f.metadata,
  12143. p = f.namespace,
  12144. h = f.selector,
  12145. v = f.error,
  12146. b = "." + p,
  12147. y = "module-" + p,
  12148. x = e(this),
  12149. C = e(this).find(h.bar),
  12150. w = e(this).find(h.progress),
  12151. S = e(this).find(h.label),
  12152. k = this,
  12153. T = x.data(y),
  12154. A = !1;a = { initialize: function initialize() {
  12155. a.debug("Initializing progress bar", f), a.set.duration(), a.set.transitionEvent(), a.read.metadata(), a.read.settings(), a.instantiate();
  12156. }, instantiate: function instantiate() {
  12157. a.verbose("Storing instance of progress", a), T = a, x.data(y, a);
  12158. }, destroy: function destroy() {
  12159. a.verbose("Destroying previous progress for", x), clearInterval(T.interval), a.remove.state(), x.removeData(y), T = i;
  12160. }, reset: function reset() {
  12161. a.remove.nextValue(), a.update.progress(0);
  12162. }, complete: function complete() {
  12163. (a.percent === i || a.percent < 100) && (a.remove.progressPoll(), a.set.percent(100));
  12164. }, read: { metadata: function metadata() {
  12165. 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));
  12166. }, settings: function settings() {
  12167. !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));
  12168. } }, bind: { transitionEnd: function transitionEnd(e) {
  12169. var t = a.get.transitionEnd();C.one(t + b, function (t) {
  12170. clearTimeout(a.failSafeTimer), e.call(this, t);
  12171. }), a.failSafeTimer = setTimeout(function () {
  12172. C.triggerHandler(t);
  12173. }, f.duration + f.failSafeDelay), a.verbose("Adding fail safe timer", a.timer);
  12174. } }, increment: function increment(e) {
  12175. 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);
  12176. }, decrement: function decrement(e) {
  12177. 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);
  12178. }, has: { progressPoll: function progressPoll() {
  12179. return a.progressPoll;
  12180. }, total: function total() {
  12181. return !1 !== a.get.total();
  12182. } }, get: { text: function text(e) {
  12183. var t = a.value || 0,
  12184. n = a.total || 0,
  12185. i = A ? a.get.displayPercent() : a.percent || 0,
  12186. 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;
  12187. }, normalizedValue: function normalizedValue(e) {
  12188. if (e < 0) return a.debug("Value cannot decrement below 0"), 0;if (a.has.total()) {
  12189. if (e > a.total) return a.debug("Value cannot increment above total", a.total), a.total;
  12190. } else if (e > 100) return a.debug("Value cannot increment above 100 percent"), 100;return e;
  12191. }, updateInterval: function updateInterval() {
  12192. return "auto" == f.updateInterval ? f.duration : f.updateInterval;
  12193. }, randomValue: function randomValue() {
  12194. return a.debug("Generating random increment percentage"), Math.floor(Math.random() * f.random.max + f.random.min);
  12195. }, numericValue: function numericValue(e) {
  12196. return "string" == typeof e ? "" !== e.replace(/[^\d.]/g, "") && +e.replace(/[^\d.]/g, "") : e;
  12197. }, transitionEnd: function transitionEnd() {
  12198. var e,
  12199. t = n.createElement("element"),
  12200. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  12201. if (t.style[e] !== i) return o[e];
  12202. }
  12203. }, displayPercent: function displayPercent() {
  12204. var e = C.width(),
  12205. t = x.width(),
  12206. 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);
  12207. }, percent: function percent() {
  12208. return a.percent || 0;
  12209. }, value: function value() {
  12210. return a.nextValue || a.value || 0;
  12211. }, total: function total() {
  12212. return a.total || !1;
  12213. } }, create: { progressPoll: function progressPoll() {
  12214. a.progressPoll = setTimeout(function () {
  12215. a.update.toNextValue(), a.remove.progressPoll();
  12216. }, a.get.updateInterval());
  12217. } }, is: { complete: function complete() {
  12218. return a.is.success() || a.is.warning() || a.is.error();
  12219. }, success: function success() {
  12220. return x.hasClass(m.success);
  12221. }, warning: function warning() {
  12222. return x.hasClass(m.warning);
  12223. }, error: function error() {
  12224. return x.hasClass(m.error);
  12225. }, active: function active() {
  12226. return x.hasClass(m.active);
  12227. }, visible: function visible() {
  12228. return x.is(":visible");
  12229. } }, remove: { progressPoll: function progressPoll() {
  12230. a.verbose("Removing progress poll timer"), a.progressPoll && (clearTimeout(a.progressPoll), delete a.progressPoll);
  12231. }, nextValue: function nextValue() {
  12232. a.verbose("Removing progress value stored for next update"), delete a.nextValue;
  12233. }, state: function state() {
  12234. a.verbose("Removing stored state"), delete a.total, delete a.percent, delete a.value;
  12235. }, active: function active() {
  12236. a.verbose("Removing active state"), x.removeClass(m.active);
  12237. }, success: function success() {
  12238. a.verbose("Removing success state"), x.removeClass(m.success);
  12239. }, warning: function warning() {
  12240. a.verbose("Removing warning state"), x.removeClass(m.warning);
  12241. }, error: function error() {
  12242. a.verbose("Removing error state"), x.removeClass(m.error);
  12243. } }, set: { barWidth: function barWidth(e) {
  12244. 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)));
  12245. }, duration: function duration(e) {
  12246. e = "number" == typeof (e = e || f.duration) ? e + "ms" : e, a.verbose("Setting progress bar transition duration", e), C.css({ "transition-duration": e });
  12247. }, percent: function percent(e) {
  12248. 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);
  12249. }, labelInterval: function labelInterval() {
  12250. clearInterval(a.interval), a.bind.transitionEnd(function () {
  12251. a.verbose("Bar finished animating, removing continuous label updates"), clearInterval(a.interval), A = !1, a.set.labels();
  12252. }), A = !0, a.interval = setInterval(function () {
  12253. e.contains(n.documentElement, k) || (clearInterval(a.interval), A = !1), a.set.labels();
  12254. }, f.framerate);
  12255. }, labels: function labels() {
  12256. a.verbose("Setting both bar progress and outer label text"), a.set.barLabel(), a.set.state();
  12257. }, label: function label(e) {
  12258. (e = e || "") && (e = a.get.text(e), a.verbose("Setting label to text", e), S.text(e));
  12259. }, state: function state(e) {
  12260. 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));
  12261. }, barLabel: function barLabel(e) {
  12262. 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)));
  12263. }, active: function active(e) {
  12264. 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 () {
  12265. f.onActive.call(k, a.value, a.total);
  12266. });
  12267. }, success: function success(e) {
  12268. 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 () {
  12269. f.onSuccess.call(k, a.total);
  12270. });
  12271. }, warning: function warning(e) {
  12272. 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 () {
  12273. f.onWarning.call(k, a.value, a.total);
  12274. });
  12275. }, error: function error(e) {
  12276. 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 () {
  12277. f.onError.call(k, a.value, a.total);
  12278. });
  12279. }, transitionEvent: function transitionEvent() {
  12280. a.get.transitionEnd();
  12281. }, total: function total(e) {
  12282. a.total = e;
  12283. }, value: function value(e) {
  12284. a.value = e;
  12285. }, progress: function progress(e) {
  12286. 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());
  12287. }, nextValue: function nextValue(e) {
  12288. a.nextValue = e;
  12289. } }, update: { toNextValue: function toNextValue() {
  12290. var e = a.nextValue;e && (a.debug("Update interval complete using last updated value", e), a.update.progress(e), a.remove.nextValue());
  12291. }, progress: function progress(e) {
  12292. 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));
  12293. } }, setting: function setting(t, n) {
  12294. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  12295. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  12296. }
  12297. }, internal: function internal(t, n) {
  12298. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  12299. if (n === i) return a[t];a[t] = n;
  12300. }
  12301. }, debug: function debug() {
  12302. !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)));
  12303. }, verbose: function verbose() {
  12304. !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)));
  12305. }, error: function error() {
  12306. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  12307. }, performance: { log: function log(e) {
  12308. 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);
  12309. }, display: function display() {
  12310. var t = f.name + ":",
  12311. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  12312. n += t["Execution Time"];
  12313. }), 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) {
  12314. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12315. }), console.groupEnd()), l = [];
  12316. } }, invoke: function invoke(t, n, r) {
  12317. var s,
  12318. l,
  12319. c,
  12320. 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) {
  12321. 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 {
  12322. 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];
  12323. }
  12324. })), 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;
  12325. } }, u ? (T === i && a.initialize(), a.invoke(c)) : (T !== i && T.invoke("destroy"), a.initialize());
  12326. }), o !== i ? o : this;
  12327. }, 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) {
  12328. return t;
  12329. }, 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" } };
  12330. }(jQuery, window, document), function (e, t, n, i) {
  12331. "use strict";
  12332. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.rating = function (t) {
  12333. var n,
  12334. o = e(this),
  12335. a = o.selector || "",
  12336. r = new Date().getTime(),
  12337. s = [],
  12338. l = arguments[0],
  12339. c = "string" == typeof l,
  12340. u = [].slice.call(arguments, 1);return o.each(function () {
  12341. var d,
  12342. f,
  12343. m = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.rating.settings, t) : e.extend({}, e.fn.rating.settings),
  12344. g = m.namespace,
  12345. p = m.className,
  12346. h = m.metadata,
  12347. v = m.selector,
  12348. b = (m.error, "." + g),
  12349. y = "module-" + g,
  12350. x = this,
  12351. C = e(this).data(y),
  12352. w = e(this),
  12353. S = w.find(v.icon);f = { initialize: function initialize() {
  12354. 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();
  12355. }, instantiate: function instantiate() {
  12356. f.verbose("Instantiating module", m), C = f, w.data(y, f);
  12357. }, destroy: function destroy() {
  12358. f.verbose("Destroying previous instance", C), f.remove.events(), w.removeData(y);
  12359. }, refresh: function refresh() {
  12360. S = w.find(v.icon);
  12361. }, setup: { layout: function layout() {
  12362. var t = f.get.maxRating(),
  12363. n = e.fn.rating.settings.templates.icon(t);f.debug("Generating icon html dynamically"), w.html(n), f.refresh();
  12364. } }, event: { mouseenter: function mouseenter() {
  12365. var t = e(this);t.nextAll().removeClass(p.selected), w.addClass(p.selected), t.addClass(p.selected).prevAll().addClass(p.selected);
  12366. }, mouseleave: function mouseleave() {
  12367. w.removeClass(p.selected), S.removeClass(p.selected);
  12368. }, click: function click() {
  12369. var t = e(this),
  12370. n = f.get.rating(),
  12371. i = S.index(t) + 1;("auto" == m.clearable ? 1 === S.length : m.clearable) && n == i ? f.clearRating() : f.set.rating(i);
  12372. } }, clearRating: function clearRating() {
  12373. f.debug("Clearing current rating"), f.set.rating(0);
  12374. }, bind: { events: function events() {
  12375. 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);
  12376. } }, remove: { events: function events() {
  12377. f.verbose("Removing events"), w.off(b);
  12378. }, initialLoad: function initialLoad() {
  12379. d = !1;
  12380. } }, enable: function enable() {
  12381. f.debug("Setting rating to interactive mode"), f.bind.events(), w.removeClass(p.disabled);
  12382. }, disable: function disable() {
  12383. f.debug("Setting rating to read-only mode"), f.remove.events(), w.addClass(p.disabled);
  12384. }, is: { initialLoad: function initialLoad() {
  12385. return d;
  12386. } }, get: { initialRating: function initialRating() {
  12387. return w.data(h.rating) !== i ? (w.removeData(h.rating), w.data(h.rating)) : m.initialRating;
  12388. }, maxRating: function maxRating() {
  12389. return w.data(h.maxRating) !== i ? (w.removeData(h.maxRating), w.data(h.maxRating)) : m.maxRating;
  12390. }, rating: function rating() {
  12391. var e = S.filter("." + p.active).length;return f.verbose("Current rating retrieved", e), e;
  12392. } }, set: { rating: function rating(e) {
  12393. var t = e - 1 >= 0 ? e - 1 : 0,
  12394. 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);
  12395. }, initialLoad: function initialLoad() {
  12396. d = !0;
  12397. } }, setting: function setting(t, n) {
  12398. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  12399. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  12400. }
  12401. }, internal: function internal(t, n) {
  12402. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  12403. if (n === i) return f[t];f[t] = n;
  12404. }
  12405. }, debug: function debug() {
  12406. !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)));
  12407. }, verbose: function verbose() {
  12408. !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)));
  12409. }, error: function error() {
  12410. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  12411. }, performance: { log: function log(e) {
  12412. 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);
  12413. }, display: function display() {
  12414. var t = m.name + ":",
  12415. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  12416. n += t["Execution Time"];
  12417. }), 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) {
  12418. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12419. }), console.groupEnd()), s = [];
  12420. } }, invoke: function invoke(t, o, a) {
  12421. var r,
  12422. s,
  12423. l,
  12424. 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) {
  12425. 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 {
  12426. 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];
  12427. }
  12428. })), 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;
  12429. } }, c ? (C === i && f.initialize(), f.invoke(l)) : (C !== i && C.invoke("destroy"), f.initialize());
  12430. }), n !== i ? n : this;
  12431. }, 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) {
  12432. for (var t = 1, n = ""; t <= e;) {
  12433. n += '<i class="icon"></i>', t++;
  12434. }return n;
  12435. } } };
  12436. }(jQuery, window, document), function (e, t, n, i) {
  12437. "use strict";
  12438. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.search = function (o) {
  12439. var a,
  12440. r = e(this),
  12441. s = r.selector || "",
  12442. l = new Date().getTime(),
  12443. c = [],
  12444. u = arguments[0],
  12445. d = "string" == typeof u,
  12446. f = [].slice.call(arguments, 1);return e(this).each(function () {
  12447. var m,
  12448. g = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.search.settings, o) : e.extend({}, e.fn.search.settings),
  12449. p = g.className,
  12450. h = g.metadata,
  12451. v = g.regExp,
  12452. b = g.fields,
  12453. y = g.selector,
  12454. x = g.error,
  12455. C = g.namespace,
  12456. w = "." + C,
  12457. S = C + "-module",
  12458. k = e(this),
  12459. T = k.find(y.prompt),
  12460. A = k.find(y.searchButton),
  12461. R = k.find(y.results),
  12462. P = k.find(y.result),
  12463. E = (k.find(y.category), this),
  12464. F = k.data(S),
  12465. O = !1,
  12466. D = !1;m = { initialize: function initialize() {
  12467. m.verbose("Initializing module"), m.get.settings(), m.determine.searchFields(), m.bind.events(), m.set.type(), m.create.results(), m.instantiate();
  12468. }, instantiate: function instantiate() {
  12469. m.verbose("Storing instance of module", m), F = m, k.data(S, m);
  12470. }, destroy: function destroy() {
  12471. m.verbose("Destroying instance"), k.off(w).removeData(S);
  12472. }, refresh: function refresh() {
  12473. 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);
  12474. }, refreshResults: function refreshResults() {
  12475. R = k.find(y.results), P = k.find(y.result);
  12476. }, bind: { events: function events() {
  12477. 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);
  12478. } }, determine: { searchFields: function searchFields() {
  12479. o && o.searchFields !== i && (g.searchFields = o.searchFields);
  12480. } }, event: { input: function input() {
  12481. g.searchDelay ? (clearTimeout(m.timer), m.timer = setTimeout(function () {
  12482. m.is.focused() && m.query();
  12483. }, g.searchDelay)) : m.query();
  12484. }, focus: function focus() {
  12485. m.set.focus(), g.searchOnFocus && m.has.minimumCharacters() && m.query(function () {
  12486. m.can.show() && m.showResults();
  12487. });
  12488. }, blur: function blur(e) {
  12489. var t = function t() {
  12490. m.cancel.query(), m.remove.focus(), m.timer = setTimeout(m.hideResults, g.hideDelay);
  12491. };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) {
  12492. m.is.inMessage(e) || O ? T.focus() : (O = !1, m.is.animating() || m.is.hidden() || t());
  12493. })) : (m.debug("Input blurred without user action, closing results"), t()));
  12494. }, result: { mousedown: function mousedown() {
  12495. m.resultsClicked = !0;
  12496. }, mouseup: function mouseup() {
  12497. m.resultsClicked = !1;
  12498. }, click: function click(n) {
  12499. m.debug("Search result selected");var i = e(this),
  12500. o = i.find(y.title).eq(0),
  12501. a = i.is("a[href]") ? i : i.find("a[href]").eq(0),
  12502. r = a.attr("href") || !1,
  12503. s = a.attr("target") || !1,
  12504. l = (o.html(), o.length > 0 && o.text()),
  12505. c = m.get.results(),
  12506. 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);
  12507. } } }, handleKeyboard: function handleKeyboard(e) {
  12508. var t,
  12509. n = k.find(y.result),
  12510. i = k.find(y.category),
  12511. o = n.filter("." + p.active),
  12512. a = n.index(o),
  12513. r = n.length,
  12514. s = o.length > 0,
  12515. l = e.which,
  12516. c = 13,
  12517. u = 38,
  12518. d = 40;if (l == 27 && (m.verbose("Escape key pressed, blurring search field"), m.hideResults(), D = !0), m.is.visible()) {
  12519. if (l == c) {
  12520. 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;
  12521. } 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());
  12522. } else l == c && (m.verbose("Enter key pressed, executing query"), m.query(), m.set.buttonPressed(), T.one("keyup", m.remove.buttonFocus));
  12523. }, setup: { api: function api(t, n) {
  12524. var i = { debug: g.debug, on: !1, cache: g.cache, action: "search", urlData: { query: t }, onSuccess: function onSuccess(e) {
  12525. m.parse.response.call(E, e, t), n();
  12526. }, onFailure: function onFailure() {
  12527. m.displayMessage(x.serverError), n();
  12528. }, onAbort: function onAbort(e) {}, onError: m.error };e.extend(!0, i, g.apiSettings), m.verbose("Setting up API request", i), k.api(i);
  12529. } }, can: { useAPI: function useAPI() {
  12530. return e.fn.api !== i;
  12531. }, show: function show() {
  12532. return m.is.focused() && !m.is.visible() && !m.is.empty();
  12533. }, transition: function transition() {
  12534. return g.transition && e.fn.transition !== i && k.transition("is supported");
  12535. } }, is: { animating: function animating() {
  12536. return R.hasClass(p.animating);
  12537. }, hidden: function hidden() {
  12538. return R.hasClass(p.hidden);
  12539. }, inMessage: function inMessage(t) {
  12540. if (t.target) {
  12541. var i = e(t.target);return e.contains(n.documentElement, t.target) && i.closest(y.message).length > 0;
  12542. }
  12543. }, empty: function empty() {
  12544. return "" === R.html();
  12545. }, visible: function visible() {
  12546. return R.filter(":visible").length > 0;
  12547. }, focused: function focused() {
  12548. return T.filter(":focus").length > 0;
  12549. } }, get: { settings: function settings() {
  12550. e.isPlainObject(o) && o.searchFullText && (g.fullTextSearch = o.searchFullText, m.error(g.error.oldSearchSyntax, E));
  12551. }, inputEvent: function inputEvent() {
  12552. var e = T[0];return e !== i && e.oninput !== i ? "input" : e !== i && e.onpropertychange !== i ? "propertychange" : "keyup";
  12553. }, value: function value() {
  12554. return T.val();
  12555. }, results: function results() {
  12556. return k.data(h.results);
  12557. }, result: function result(t, n) {
  12558. var o = ["title", "id"],
  12559. 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) {
  12560. if (e.isArray(i.results) && (a = m.search.object(t, i.results, o)[0])) return !1;
  12561. })) : (m.debug("Finding result in results object", t), a = m.search.object(t, n, o)[0]), a || !1;
  12562. } }, select: { firstResult: function firstResult() {
  12563. m.verbose("Selecting first result"), P.first().addClass(p.active);
  12564. } }, set: { focus: function focus() {
  12565. k.addClass(p.focus);
  12566. }, loading: function loading() {
  12567. k.addClass(p.loading);
  12568. }, value: function value(e) {
  12569. m.verbose("Setting search input value", e), T.val(e);
  12570. }, type: function type(e) {
  12571. e = e || g.type, "category" == g.type && k.addClass(g.type);
  12572. }, buttonPressed: function buttonPressed() {
  12573. A.addClass(p.pressed);
  12574. } }, remove: { loading: function loading() {
  12575. k.removeClass(p.loading);
  12576. }, focus: function focus() {
  12577. k.removeClass(p.focus);
  12578. }, buttonPressed: function buttonPressed() {
  12579. A.removeClass(p.pressed);
  12580. } }, query: function query(t) {
  12581. t = e.isFunction(t) ? t : function () {};var n = m.get.value(),
  12582. 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();
  12583. }, search: { local: function local(e) {
  12584. var t,
  12585. 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 });
  12586. }, remote: function remote(t, n) {
  12587. n = e.isFunction(n) ? n : function () {}, k.api("is loading") && k.api("abort"), m.setup.api(t, n), k.api("query");
  12588. }, object: function object(t, n, o) {
  12589. var a = [],
  12590. r = [],
  12591. s = [],
  12592. l = t.toString().replace(v.escape, "\\$&"),
  12593. c = new RegExp(v.beginsWith + l, "i"),
  12594. u = function u(t, n) {
  12595. var i = -1 == e.inArray(n, a),
  12596. o = -1 == e.inArray(n, s),
  12597. l = -1 == e.inArray(n, r);i && o && l && t.push(n);
  12598. };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) {
  12599. e.each(n, function (e, n) {
  12600. "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));
  12601. });
  12602. }), e.merge(r, s), e.merge(a, r), a);
  12603. } }, exactSearch: function exactSearch(e, t) {
  12604. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  12605. }, fuzzySearch: function fuzzySearch(e, t) {
  12606. var n = t.length,
  12607. 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++) {
  12608. for (var r = e.charCodeAt(o); a < n;) {
  12609. if (t.charCodeAt(a++) === r) continue e;
  12610. }return !1;
  12611. }return !0;
  12612. }, parse: { response: function response(e, t) {
  12613. 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]));
  12614. } }, cancel: { query: function query() {
  12615. m.can.useAPI() && k.api("abort");
  12616. } }, has: { minimumCharacters: function minimumCharacters() {
  12617. return m.get.value().length >= g.minCharacters;
  12618. }, results: function results() {
  12619. return 0 !== R.length && "" != R.html();
  12620. } }, clear: { cache: function cache(e) {
  12621. 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));
  12622. } }, read: { cache: function cache(e) {
  12623. 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]);
  12624. } }, create: { categoryResults: function categoryResults(t) {
  12625. var n = {};return e.each(t, function (e, t) {
  12626. 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));
  12627. }), n;
  12628. }, id: function id(e, t) {
  12629. var n,
  12630. 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;
  12631. }, results: function results() {
  12632. 0 === R.length && (R = e("<div />").addClass(p.results).appendTo(k));
  12633. } }, inject: { result: function result(e, t, n) {
  12634. 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);
  12635. }, id: function id(t) {
  12636. m.debug("Injecting unique ids into results");var n = 0,
  12637. o = 0;return "category" === g.type ? e.each(t, function (t, a) {
  12638. o = 0, e.each(a.results, function (e, t) {
  12639. var r = a.results[e];r.id === i && (r.id = m.create.id(o, n)), m.inject.result(r, o, n), o++;
  12640. }), n++;
  12641. }) : e.each(t, function (e, n) {
  12642. var a = t[e];a.id === i && (a.id = m.create.id(o)), m.inject.result(a, o), o++;
  12643. }), t;
  12644. } }, save: { results: function results(e) {
  12645. m.verbose("Saving current search results to metadata", e), k.data(h.results, e);
  12646. } }, write: { cache: function cache(e, t) {
  12647. 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));
  12648. } }, addResults: function addResults(t) {
  12649. 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 () {
  12650. R.empty();
  12651. });
  12652. }, showResults: function showResults(t) {
  12653. 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() {
  12654. t();
  12655. }, queue: !0 })) : (m.debug("Showing results with javascript"), R.stop().fadeIn(g.duration, g.easing)), g.onResultsOpen.call(R));
  12656. }, hideResults: function hideResults(t) {
  12657. 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() {
  12658. t();
  12659. }, queue: !0 })) : (m.debug("Hiding results with javascript"), R.stop().fadeOut(g.duration, g.easing)), g.onResultsClose.call(R));
  12660. }, generateResults: function generateResults(t) {
  12661. m.debug("Generating html from response", t);var n = g.templates[g.type],
  12662. i = e.isPlainObject(t[b.results]) && !e.isEmptyObject(t[b.results]),
  12663. o = e.isArray(t[b.results]) && t[b.results].length > 0,
  12664. 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;
  12665. }, displayMessage: function displayMessage(e, t) {
  12666. return t = t || "standard", m.debug("Displaying message", e, t), m.addResults(g.templates.message(e, t)), g.templates.message(e, t);
  12667. }, setting: function setting(t, n) {
  12668. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  12669. if (n === i) return g[t];g[t] = n;
  12670. }
  12671. }, internal: function internal(t, n) {
  12672. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  12673. if (n === i) return m[t];m[t] = n;
  12674. }
  12675. }, debug: function debug() {
  12676. !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)));
  12677. }, verbose: function verbose() {
  12678. !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)));
  12679. }, error: function error() {
  12680. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  12681. }, performance: { log: function log(e) {
  12682. 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);
  12683. }, display: function display() {
  12684. var t = g.name + ":",
  12685. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  12686. n += t["Execution Time"];
  12687. }), 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) {
  12688. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12689. }), console.groupEnd()), c = [];
  12690. } }, invoke: function invoke(t, n, o) {
  12691. var r,
  12692. s,
  12693. l,
  12694. 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) {
  12695. 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 {
  12696. 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];
  12697. }
  12698. })), 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;
  12699. } }, d ? (F === i && m.initialize(), m.invoke(u)) : (F !== i && F.invoke("destroy"), m.initialize());
  12700. }), a !== i ? a : this;
  12701. }, 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) {
  12702. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12703. return t[e];
  12704. }) : e
  12705. );
  12706. }, message: function message(e, t) {
  12707. 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;
  12708. }, category: function category(t, n) {
  12709. var o = "";e.fn.search.settings.templates.escape;return t[n.categoryResults] !== i && (e.each(t[n.categoryResults], function (t, a) {
  12710. 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) {
  12711. 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>";
  12712. }), o += "</div>", o += "</div>");
  12713. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12714. }, standard: function standard(t, n) {
  12715. var o = "";return t[n.results] !== i && (e.each(t[n.results], function (e, t) {
  12716. 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>";
  12717. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12718. } } };
  12719. }(jQuery, window, document), function (e, t, n, i) {
  12720. "use strict";
  12721. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.shape = function (o) {
  12722. var a,
  12723. r = e(this),
  12724. s = (e("body"), new Date().getTime()),
  12725. l = [],
  12726. c = arguments[0],
  12727. u = "string" == typeof c,
  12728. d = [].slice.call(arguments, 1),
  12729. f = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  12730. setTimeout(e, 0);
  12731. };return r.each(function () {
  12732. var t,
  12733. m,
  12734. g,
  12735. p = r.selector || "",
  12736. h = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.shape.settings, o) : e.extend({}, e.fn.shape.settings),
  12737. v = h.namespace,
  12738. b = h.selector,
  12739. y = h.error,
  12740. x = h.className,
  12741. C = "." + v,
  12742. w = "module-" + v,
  12743. S = e(this),
  12744. k = S.find(b.sides),
  12745. T = S.find(b.side),
  12746. A = !1,
  12747. R = this,
  12748. P = S.data(w);g = { initialize: function initialize() {
  12749. g.verbose("Initializing module for", R), g.set.defaultSide(), g.instantiate();
  12750. }, instantiate: function instantiate() {
  12751. g.verbose("Storing instance of module", g), P = g, S.data(w, P);
  12752. }, destroy: function destroy() {
  12753. g.verbose("Destroying previous module for", R), S.removeData(w).off(C);
  12754. }, refresh: function refresh() {
  12755. g.verbose("Refreshing selector cache for", R), S = e(R), k = e(this).find(b.shape), T = e(this).find(b.side);
  12756. }, repaint: function repaint() {
  12757. g.verbose("Forcing repaint event");(k[0] || n.createElement("div")).offsetWidth;
  12758. }, animate: function animate(e, n) {
  12759. g.verbose("Animating box with properties", e), n = n || function (e) {
  12760. g.verbose("Executing animation callback"), e !== i && e.stopPropagation(), g.reset(), g.set.active();
  12761. }, 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 () {
  12762. S.addClass(x.animating), t.addClass(x.hidden);
  12763. })) : n();
  12764. }, queue: function queue(e) {
  12765. g.debug("Queueing animation of", e), k.one(g.get.transitionEvent(), function () {
  12766. g.debug("Executing queued animation"), setTimeout(function () {
  12767. S.shape(e);
  12768. }, 0);
  12769. });
  12770. }, reset: function reset() {
  12771. 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");
  12772. }, is: { complete: function complete() {
  12773. return T.filter("." + x.active)[0] == m[0];
  12774. }, animating: function animating() {
  12775. return S.hasClass(x.animating);
  12776. } }, set: { defaultSide: function defaultSide() {
  12777. 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);
  12778. }, duration: function duration(e) {
  12779. 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 });
  12780. }, currentStageSize: function currentStageSize() {
  12781. var e = S.find("." + h.className.active),
  12782. t = e.outerWidth(!0),
  12783. n = e.outerHeight(!0);S.css({ width: t, height: n });
  12784. }, stageSize: function stageSize() {
  12785. var e = S.clone().addClass(x.loading),
  12786. t = e.find("." + h.className.active),
  12787. n = A ? e.find(b.side).eq(A) : t.next(b.side).length > 0 ? t.next(b.side) : e.find(b.side).first(),
  12788. i = "next" == h.width ? n.outerWidth(!0) : "initial" == h.width ? S.width() : h.width,
  12789. 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));
  12790. }, nextSide: function nextSide(e) {
  12791. 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);
  12792. }, active: function active() {
  12793. g.verbose("Setting new side to active", m), T.removeClass(x.active), m.addClass(x.active), h.onChange.call(m[0]), g.set.defaultSide();
  12794. } }, flip: { up: function up() {
  12795. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12796. if (g.is.animating()) g.queue("flip up");else {
  12797. g.debug("Flipping up", m);var e = g.get.transform.up();g.set.stageSize(), g.stage.above(), g.animate(e);
  12798. }
  12799. } else g.debug("Side already visible", m);
  12800. }, down: function down() {
  12801. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12802. if (g.is.animating()) g.queue("flip down");else {
  12803. g.debug("Flipping down", m);var e = g.get.transform.down();g.set.stageSize(), g.stage.below(), g.animate(e);
  12804. }
  12805. } else g.debug("Side already visible", m);
  12806. }, left: function left() {
  12807. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12808. if (g.is.animating()) g.queue("flip left");else {
  12809. g.debug("Flipping left", m);var e = g.get.transform.left();g.set.stageSize(), g.stage.left(), g.animate(e);
  12810. }
  12811. } else g.debug("Side already visible", m);
  12812. }, right: function right() {
  12813. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12814. if (g.is.animating()) g.queue("flip right");else {
  12815. g.debug("Flipping right", m);var e = g.get.transform.right();g.set.stageSize(), g.stage.right(), g.animate(e);
  12816. }
  12817. } else g.debug("Side already visible", m);
  12818. }, over: function over() {
  12819. !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);
  12820. }, back: function back() {
  12821. !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);
  12822. } }, get: { transform: { up: function up() {
  12823. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(-90deg)" };
  12824. }, down: function down() {
  12825. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(90deg)" };
  12826. }, left: function left() {
  12827. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(90deg)" };
  12828. }, right: function right() {
  12829. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(-90deg)" };
  12830. }, over: function over() {
  12831. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(180deg)" };
  12832. }, back: function back() {
  12833. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(-180deg)" };
  12834. } }, transitionEvent: function transitionEvent() {
  12835. var e,
  12836. t = n.createElement("element"),
  12837. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  12838. if (t.style[e] !== i) return o[e];
  12839. }
  12840. }, nextSide: function nextSide() {
  12841. return t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first();
  12842. } }, stage: { above: function above() {
  12843. 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)" });
  12844. }, below: function below() {
  12845. 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)" });
  12846. }, left: function left() {
  12847. var e = t.outerWidth(!0),
  12848. n = m.outerWidth(!0),
  12849. 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)" });
  12850. }, right: function right() {
  12851. var e = t.outerWidth(!0),
  12852. n = m.outerWidth(!0),
  12853. 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)" });
  12854. }, behind: function behind() {
  12855. var e = t.outerWidth(!0),
  12856. n = m.outerWidth(!0),
  12857. 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)" });
  12858. } }, setting: function setting(t, n) {
  12859. if (g.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, h, t);else {
  12860. if (n === i) return h[t];e.isPlainObject(h[t]) ? e.extend(!0, h[t], n) : h[t] = n;
  12861. }
  12862. }, internal: function internal(t, n) {
  12863. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  12864. if (n === i) return g[t];g[t] = n;
  12865. }
  12866. }, debug: function debug() {
  12867. !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)));
  12868. }, verbose: function verbose() {
  12869. !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)));
  12870. }, error: function error() {
  12871. h.silent || (g.error = Function.prototype.bind.call(console.error, console, h.name + ":"), g.error.apply(console, arguments));
  12872. }, performance: { log: function log(e) {
  12873. 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);
  12874. }, display: function display() {
  12875. var t = h.name + ":",
  12876. n = 0;s = !1, clearTimeout(g.performance.timer), e.each(l, function (e, t) {
  12877. n += t["Execution Time"];
  12878. }), 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) {
  12879. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12880. }), console.groupEnd()), l = [];
  12881. } }, invoke: function invoke(t, n, o) {
  12882. var r,
  12883. s,
  12884. l,
  12885. 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) {
  12886. 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 {
  12887. 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];
  12888. }
  12889. })), 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;
  12890. } }, u ? (P === i && g.initialize(), g.invoke(c)) : (P !== i && P.invoke("destroy"), g.initialize());
  12891. }), a !== i ? a : this;
  12892. }, 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" } };
  12893. }(jQuery, window, document), function (e, t, n, i) {
  12894. "use strict";
  12895. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sidebar = function (o) {
  12896. var a,
  12897. r = e(this),
  12898. s = e(t),
  12899. l = e(n),
  12900. c = e("html"),
  12901. u = e("head"),
  12902. d = r.selector || "",
  12903. f = new Date().getTime(),
  12904. m = [],
  12905. g = arguments[0],
  12906. p = "string" == typeof g,
  12907. h = [].slice.call(arguments, 1),
  12908. v = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  12909. setTimeout(e, 0);
  12910. };return r.each(function () {
  12911. var r,
  12912. b,
  12913. y,
  12914. x,
  12915. C,
  12916. w,
  12917. S = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sidebar.settings, o) : e.extend({}, e.fn.sidebar.settings),
  12918. k = S.selector,
  12919. T = S.className,
  12920. A = S.namespace,
  12921. R = S.regExp,
  12922. P = S.error,
  12923. E = "." + A,
  12924. F = "module-" + A,
  12925. O = e(this),
  12926. D = e(S.context),
  12927. q = O.children(k.sidebar),
  12928. j = (D.children(k.fixed), D.children(k.pusher)),
  12929. z = this,
  12930. I = O.data(F);w = { initialize: function initialize() {
  12931. w.debug("Initializing sidebar", o), w.create.id(), C = w.get.transitionEvent(), S.delaySetup ? v(w.setup.layout) : w.setup.layout(), v(function () {
  12932. w.setup.cache();
  12933. }), w.instantiate();
  12934. }, instantiate: function instantiate() {
  12935. w.verbose("Storing instance of module", w), I = w, O.data(F, w);
  12936. }, create: { id: function id() {
  12937. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, w.verbose("Creating unique id for element", y);
  12938. } }, destroy: function destroy() {
  12939. 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);
  12940. }, event: { clickaway: function clickaway(e) {
  12941. var t = j.find(e.target).length > 0 || j.is(e.target),
  12942. 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());
  12943. }, touch: function touch(e) {}, containScroll: function containScroll(e) {
  12944. z.scrollTop <= 0 && (z.scrollTop = 1), z.scrollTop + z.offsetHeight >= z.scrollHeight && (z.scrollTop = z.scrollHeight - z.offsetHeight - 1);
  12945. }, scroll: function scroll(t) {
  12946. 0 === e(t.target).closest(k.sidebar).length && t.preventDefault();
  12947. } }, bind: { clickaway: function clickaway() {
  12948. w.verbose("Adding clickaway events to context", D), S.closable && D.on("click" + b, w.event.clickaway).on("touchend" + b, w.event.clickaway);
  12949. }, scrollLock: function scrollLock() {
  12950. 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);
  12951. } }, unbind: { clickaway: function clickaway() {
  12952. w.verbose("Removing clickaway events from context", D), D.off(b);
  12953. }, scrollLock: function scrollLock() {
  12954. w.verbose("Removing scroll lock from page"), l.off(b), s.off(b), O.off("scroll" + E);
  12955. } }, add: { inlineCSS: function inlineCSS() {
  12956. var t,
  12957. n = w.cache.width || O.outerWidth(),
  12958. i = w.cache.height || O.outerHeight(),
  12959. o = w.is.rtl(),
  12960. a = w.get.direction(),
  12961. 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);
  12962. } }, refresh: function refresh() {
  12963. 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();
  12964. }, refreshSidebars: function refreshSidebars() {
  12965. w.verbose("Refreshing other sidebars"), q = D.children(k.sidebar);
  12966. }, repaint: function repaint() {
  12967. w.verbose("Forcing repaint event"), z.style.display = "none";z.offsetHeight;z.scrollTop = z.scrollTop, z.style.display = "";
  12968. }, setup: { cache: function cache() {
  12969. w.cache = { width: O.outerWidth(), height: O.outerHeight(), rtl: "rtl" == O.css("direction") };
  12970. }, layout: function layout() {
  12971. 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();
  12972. } }, attachEvents: function attachEvents(t, n) {
  12973. 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);
  12974. }, show: function show(t) {
  12975. if (t = e.isFunction(t) ? t : function () {}, w.is.hidden()) {
  12976. 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) {
  12977. if ("overlay" != S.transition) return void w.hideOthers(w.show);w.hideOthers();
  12978. } else S.transition = "overlay";w.pushPage(function () {
  12979. t.call(z), S.onShow.call(z);
  12980. }), S.onChange.call(z), S.onVisible.call(z);
  12981. } else w.debug("Sidebar is already visible");
  12982. }, hide: function hide(t) {
  12983. t = e.isFunction(t) ? t : function () {}, (w.is.visible() || w.is.animating()) && (w.debug("Hiding sidebar", t), w.refreshSidebars(), w.pullPage(function () {
  12984. t.call(z), S.onHidden.call(z);
  12985. }), S.onChange.call(z), S.onHide.call(z));
  12986. }, othersAnimating: function othersAnimating() {
  12987. return q.not(O).filter("." + T.animating).length > 0;
  12988. }, othersVisible: function othersVisible() {
  12989. return q.not(O).filter("." + T.visible).length > 0;
  12990. }, othersActive: function othersActive() {
  12991. return w.othersVisible() || w.othersAnimating();
  12992. }, hideOthers: function hideOthers(e) {
  12993. var t = q.not(O).filter("." + T.visible),
  12994. n = t.length,
  12995. i = 0;e = e || function () {}, t.sidebar("hide", function () {
  12996. ++i == n && e();
  12997. });
  12998. }, toggle: function toggle() {
  12999. w.verbose("Determining toggled direction"), w.is.hidden() ? w.show() : w.hide();
  13000. }, pushPage: function pushPage(t) {
  13001. var n,
  13002. i,
  13003. _o,
  13004. a = w.get.transition(),
  13005. 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() {
  13006. w.bind.clickaway(), w.add.inlineCSS(), w.set.animating(), w.set.visible();
  13007. }, i = function i() {
  13008. w.set.dimmed();
  13009. }, _o = function o(e) {
  13010. e.target == r[0] && (r.off(C + b, _o), w.remove.animating(), w.bind.scrollLock(), t.call(z));
  13011. }, r.off(C + b), r.on(C + b, _o), v(n), S.dimPage && !w.othersVisible() && v(i);
  13012. }, pullPage: function pullPage(t) {
  13013. var n,
  13014. _i,
  13015. o = w.get.transition(),
  13016. 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() {
  13017. w.set.transition(o), w.set.animating(), w.remove.visible(), S.dimPage && !w.othersVisible() && j.removeClass(T.dimmed);
  13018. }, _i = function i(e) {
  13019. 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));
  13020. }, a.off(C + b), a.on(C + b, _i), v(n);
  13021. }, scrollToTop: function scrollToTop() {
  13022. w.verbose("Scrolling to top of page to avoid animation issues"), x = e(t).scrollTop(), O.scrollTop(0), t.scrollTo(0, 0);
  13023. }, scrollBack: function scrollBack() {
  13024. w.verbose("Scrolling back to original page position"), t.scrollTo(0, x);
  13025. }, clear: { cache: function cache() {
  13026. w.verbose("Clearing cached dimensions"), w.cache = {};
  13027. } }, set: { ios: function ios() {
  13028. c.addClass(T.ios);
  13029. }, pushed: function pushed() {
  13030. D.addClass(T.pushed);
  13031. }, pushable: function pushable() {
  13032. D.addClass(T.pushable);
  13033. }, dimmed: function dimmed() {
  13034. j.addClass(T.dimmed);
  13035. }, active: function active() {
  13036. O.addClass(T.active);
  13037. }, animating: function animating() {
  13038. O.addClass(T.animating);
  13039. }, transition: function transition(e) {
  13040. e = e || w.get.transition(), O.addClass(e);
  13041. }, direction: function direction(e) {
  13042. e = e || w.get.direction(), O.addClass(T[e]);
  13043. }, visible: function visible() {
  13044. O.addClass(T.visible);
  13045. }, overlay: function overlay() {
  13046. O.addClass(T.overlay);
  13047. } }, remove: { inlineCSS: function inlineCSS() {
  13048. w.debug("Removing inline css styles", r), r && r.length > 0 && r.remove();
  13049. }, ios: function ios() {
  13050. c.removeClass(T.ios);
  13051. }, pushed: function pushed() {
  13052. D.removeClass(T.pushed);
  13053. }, pushable: function pushable() {
  13054. D.removeClass(T.pushable);
  13055. }, active: function active() {
  13056. O.removeClass(T.active);
  13057. }, animating: function animating() {
  13058. O.removeClass(T.animating);
  13059. }, transition: function transition(e) {
  13060. e = e || w.get.transition(), O.removeClass(e);
  13061. }, direction: function direction(e) {
  13062. e = e || w.get.direction(), O.removeClass(T[e]);
  13063. }, visible: function visible() {
  13064. O.removeClass(T.visible);
  13065. }, overlay: function overlay() {
  13066. O.removeClass(T.overlay);
  13067. } }, get: { direction: function direction() {
  13068. return O.hasClass(T.top) ? T.top : O.hasClass(T.right) ? T.right : O.hasClass(T.bottom) ? T.bottom : T.left;
  13069. }, transition: function transition() {
  13070. var e,
  13071. 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;
  13072. }, transitionEvent: function transitionEvent() {
  13073. var e,
  13074. t = n.createElement("element"),
  13075. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  13076. if (t.style[e] !== i) return o[e];
  13077. }
  13078. } }, is: { ie: function ie() {
  13079. return !t.ActiveXObject && "ActiveXObject" in t || "ActiveXObject" in t;
  13080. }, ios: function ios() {
  13081. var e = navigator.userAgent,
  13082. t = e.match(R.ios),
  13083. n = e.match(R.mobileChrome);return !(!t || n) && (w.verbose("Browser was found to be iOS", e), !0);
  13084. }, mobile: function mobile() {
  13085. 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);
  13086. }, hidden: function hidden() {
  13087. return !w.is.visible();
  13088. }, visible: function visible() {
  13089. return O.hasClass(T.visible);
  13090. }, open: function open() {
  13091. return w.is.visible();
  13092. }, closed: function closed() {
  13093. return w.is.hidden();
  13094. }, vertical: function vertical() {
  13095. return O.hasClass(T.top);
  13096. }, animating: function animating() {
  13097. return D.hasClass(T.animating);
  13098. }, rtl: function rtl() {
  13099. return w.cache.rtl === i && (w.cache.rtl = "rtl" == O.css("direction")), w.cache.rtl;
  13100. } }, setting: function setting(t, n) {
  13101. if (w.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, S, t);else {
  13102. if (n === i) return S[t];e.isPlainObject(S[t]) ? e.extend(!0, S[t], n) : S[t] = n;
  13103. }
  13104. }, internal: function internal(t, n) {
  13105. if (e.isPlainObject(t)) e.extend(!0, w, t);else {
  13106. if (n === i) return w[t];w[t] = n;
  13107. }
  13108. }, debug: function debug() {
  13109. !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)));
  13110. }, verbose: function verbose() {
  13111. !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)));
  13112. }, error: function error() {
  13113. S.silent || (w.error = Function.prototype.bind.call(console.error, console, S.name + ":"), w.error.apply(console, arguments));
  13114. }, performance: { log: function log(e) {
  13115. 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);
  13116. }, display: function display() {
  13117. var t = S.name + ":",
  13118. n = 0;f = !1, clearTimeout(w.performance.timer), e.each(m, function (e, t) {
  13119. n += t["Execution Time"];
  13120. }), 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) {
  13121. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13122. }), console.groupEnd()), m = [];
  13123. } }, invoke: function invoke(t, n, o) {
  13124. var r,
  13125. s,
  13126. l,
  13127. 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) {
  13128. 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 {
  13129. 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];
  13130. }
  13131. })), 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;
  13132. } }, p ? (I === i && w.initialize(), w.invoke(g)) : (I !== i && w.invoke("destroy"), w.initialize());
  13133. }), a !== i ? a : this;
  13134. }, 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" } };
  13135. }(jQuery, window, document), function (e, t, n, i) {
  13136. "use strict";
  13137. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sticky = function (o) {
  13138. var a,
  13139. r = e(this),
  13140. s = r.selector || "",
  13141. l = new Date().getTime(),
  13142. c = [],
  13143. u = arguments[0],
  13144. d = "string" == typeof u,
  13145. f = [].slice.call(arguments, 1);return r.each(function () {
  13146. var r,
  13147. m,
  13148. g,
  13149. p,
  13150. h,
  13151. v = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sticky.settings, o) : e.extend({}, e.fn.sticky.settings),
  13152. b = v.className,
  13153. y = v.namespace,
  13154. x = v.error,
  13155. C = "." + y,
  13156. w = "module-" + y,
  13157. S = e(this),
  13158. k = e(t),
  13159. T = e(v.scrollContext),
  13160. A = (S.selector, S.data(w)),
  13161. R = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13162. setTimeout(e, 0);
  13163. },
  13164. P = this;h = { initialize: function initialize() {
  13165. h.determineContainer(), h.determineContext(), h.verbose("Initializing sticky", v, r), h.save.positions(), h.checkErrors(), h.bind.events(), v.observeChanges && h.observeChanges(), h.instantiate();
  13166. }, instantiate: function instantiate() {
  13167. h.verbose("Storing instance of module", h), A = h, S.data(w, h);
  13168. }, destroy: function destroy() {
  13169. 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);
  13170. }, observeChanges: function observeChanges() {
  13171. "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));
  13172. }, determineContainer: function determineContainer() {
  13173. r = v.container ? e(v.container) : S.offsetParent();
  13174. }, determineContext: function determineContext() {
  13175. 0 !== (m = v.context ? e(v.context) : r).length || h.error(x.invalidContext, v.context, S);
  13176. }, checkErrors: function checkErrors() {
  13177. 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);
  13178. }, bind: { events: function events() {
  13179. 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);
  13180. } }, event: { changed: function changed(e) {
  13181. clearTimeout(h.timer), h.timer = setTimeout(function () {
  13182. h.verbose("DOM tree modified, updating sticky menu", e), h.refresh();
  13183. }, 100);
  13184. }, documentChanged: function documentChanged(t) {
  13185. [].forEach.call(t, function (t) {
  13186. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  13187. (t == P || e(t).find(P).length > 0) && (h.debug("Element removed from DOM, tearing down events"), h.destroy());
  13188. });
  13189. });
  13190. }, load: function load() {
  13191. h.verbose("Page contents finished loading"), R(h.refresh);
  13192. }, resize: function resize() {
  13193. h.verbose("Window resized"), R(h.refresh);
  13194. }, scroll: function scroll() {
  13195. R(function () {
  13196. T.triggerHandler("scrollchange" + C, T.scrollTop());
  13197. });
  13198. }, scrollchange: function scrollchange(e, t) {
  13199. h.stick(t), v.onScroll.call(P);
  13200. } }, refresh: function refresh(e) {
  13201. h.reset(), v.context || h.determineContext(), e && h.determineContainer(), h.save.positions(), h.stick(), v.onReposition.call(P);
  13202. }, supports: { sticky: function sticky() {
  13203. var t = e("<div/>");t[0];return t.addClass(b.supported), t.css("position").match("sticky");
  13204. } }, save: { lastScroll: function lastScroll(e) {
  13205. h.lastScroll = e;
  13206. }, elementScroll: function elementScroll(e) {
  13207. h.elementScroll = e;
  13208. }, positions: function positions() {
  13209. var e = { height: T.height() },
  13210. 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() },
  13211. 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);
  13212. } }, get: { direction: function direction(e) {
  13213. var t = "down";return e = e || T.scrollTop(), h.lastScroll !== i && (h.lastScroll < e ? t = "down" : h.lastScroll > e && (t = "up")), t;
  13214. }, scrollChange: function scrollChange(e) {
  13215. return e = e || T.scrollTop(), h.lastScroll ? e - h.lastScroll : 0;
  13216. }, currentElementScroll: function currentElementScroll() {
  13217. return h.elementScroll ? h.elementScroll : h.is.top() ? Math.abs(parseInt(S.css("top"), 10)) || 0 : Math.abs(parseInt(S.css("bottom"), 10)) || 0;
  13218. }, elementScroll: function elementScroll(e) {
  13219. e = e || T.scrollTop();var t = h.cache.element,
  13220. n = h.cache.scrollContext,
  13221. i = h.get.scrollChange(e),
  13222. o = t.height - n.height + v.offset,
  13223. a = h.get.currentElementScroll(),
  13224. r = a + i;return a = h.cache.fits || r < 0 ? 0 : r > o ? o : r;
  13225. } }, remove: { lastScroll: function lastScroll() {
  13226. delete h.lastScroll;
  13227. }, elementScroll: function elementScroll(e) {
  13228. delete h.elementScroll;
  13229. }, minimumSize: function minimumSize() {
  13230. r.css("min-height", "");
  13231. }, offset: function offset() {
  13232. S.css("margin-top", "");
  13233. } }, set: { offset: function offset() {
  13234. h.verbose("Setting offset on element", v.offset), S.css("margin-top", v.offset);
  13235. }, containerSize: function containerSize() {
  13236. 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 }));
  13237. }, minimumSize: function minimumSize() {
  13238. var e = h.cache.element;r.css("min-height", e.height);
  13239. }, scroll: function scroll(e) {
  13240. 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));
  13241. }, size: function size() {
  13242. 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"));
  13243. } }, is: { standardScroll: function standardScroll() {
  13244. return T[0] == t;
  13245. }, top: function top() {
  13246. return S.hasClass(b.top);
  13247. }, bottom: function bottom() {
  13248. return S.hasClass(b.bottom);
  13249. }, initialPosition: function initialPosition() {
  13250. return !h.is.fixed() && !h.is.bound();
  13251. }, hidden: function hidden() {
  13252. return !S.is(":visible");
  13253. }, bound: function bound() {
  13254. return S.hasClass(b.bound);
  13255. }, fixed: function fixed() {
  13256. return S.hasClass(b.fixed);
  13257. } }, stick: function stick(e) {
  13258. var t = e || T.scrollTop(),
  13259. n = h.cache,
  13260. i = n.fits,
  13261. o = n.sameHeight,
  13262. a = n.element,
  13263. r = n.scrollContext,
  13264. s = n.context,
  13265. l = h.is.bottom() && v.pushing ? v.bottomOffset : v.offset,
  13266. c = (e = { top: t + l, bottom: t + l + r.height }, h.get.direction(e.top), i ? 0 : h.get.elementScroll(e.top)),
  13267. 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())));
  13268. }, bindTop: function bindTop() {
  13269. 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);
  13270. }, bindBottom: function bindBottom() {
  13271. 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);
  13272. }, setInitialPosition: function setInitialPosition() {
  13273. h.debug("Returning to initial position"), h.unfix(), h.unbind();
  13274. }, fixTop: function fixTop() {
  13275. 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);
  13276. }, fixBottom: function fixBottom() {
  13277. 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);
  13278. }, unbind: function unbind() {
  13279. h.is.bound() && (h.debug("Removing container bound position on element"), h.remove.offset(), S.removeClass(b.bound).removeClass(b.top).removeClass(b.bottom));
  13280. }, unfix: function unfix() {
  13281. 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));
  13282. }, reset: function reset() {
  13283. h.debug("Resetting elements position"), h.unbind(), h.unfix(), h.resetCSS(), h.remove.offset(), h.remove.lastScroll();
  13284. }, resetCSS: function resetCSS() {
  13285. S.css({ width: "", height: "" }), r.css({ height: "" });
  13286. }, setting: function setting(t, n) {
  13287. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  13288. if (n === i) return v[t];v[t] = n;
  13289. }
  13290. }, internal: function internal(t, n) {
  13291. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  13292. if (n === i) return h[t];h[t] = n;
  13293. }
  13294. }, debug: function debug() {
  13295. !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)));
  13296. }, verbose: function verbose() {
  13297. !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)));
  13298. }, error: function error() {
  13299. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  13300. }, performance: { log: function log(e) {
  13301. 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);
  13302. }, display: function display() {
  13303. var t = v.name + ":",
  13304. n = 0;l = !1, clearTimeout(h.performance.timer), e.each(c, function (e, t) {
  13305. n += t["Execution Time"];
  13306. }), 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) {
  13307. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13308. }), console.groupEnd()), c = [];
  13309. } }, invoke: function invoke(t, n, o) {
  13310. var r,
  13311. s,
  13312. l,
  13313. 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) {
  13314. 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 {
  13315. 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];
  13316. }
  13317. })), 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;
  13318. } }, d ? (A === i && h.initialize(), h.invoke(u)) : (A !== i && A.invoke("destroy"), h.initialize());
  13319. }), a !== i ? a : this;
  13320. }, 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" } };
  13321. }(jQuery, window, document), function (e, t, n, i) {
  13322. "use strict";
  13323. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.tab = function (o) {
  13324. var a,
  13325. r = e.isFunction(this) ? e(t) : e(this),
  13326. s = r.selector || "",
  13327. l = new Date().getTime(),
  13328. c = [],
  13329. u = arguments[0],
  13330. d = "string" == typeof u,
  13331. f = [].slice.call(arguments, 1),
  13332. m = !1;return r.each(function () {
  13333. var g,
  13334. p,
  13335. h,
  13336. v,
  13337. b,
  13338. y,
  13339. x = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.tab.settings, o) : e.extend({}, e.fn.tab.settings),
  13340. C = x.className,
  13341. w = x.metadata,
  13342. S = x.selector,
  13343. k = x.error,
  13344. T = "." + x.namespace,
  13345. A = "module-" + x.namespace,
  13346. R = e(this),
  13347. P = {},
  13348. E = !0,
  13349. F = 0,
  13350. O = this,
  13351. D = R.data(A);b = { initialize: function initialize() {
  13352. 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();
  13353. }, instantiate: function instantiate() {
  13354. b.verbose("Storing instance of module", b), D = b, R.data(A, b);
  13355. }, destroy: function destroy() {
  13356. b.debug("Destroying tabs", R), R.removeData(A).off(T);
  13357. }, bind: { events: function events() {
  13358. e.isWindow(O) || (b.debug("Attaching tab activation events to element", R), R.on("click" + T, b.event.click));
  13359. } }, determineTabs: function determineTabs() {
  13360. 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));
  13361. }, fix: { callbacks: function callbacks() {
  13362. 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));
  13363. } }, initializeHistory: function initializeHistory() {
  13364. if (b.debug("Initializing page state"), e.address === i) return b.error(k.state), !1;if ("state" == x.historyType) {
  13365. if (b.debug("Using HTML5 to manage state"), !1 === x.path) return b.error(k.path), !1;e.address.history(!0).state(x.path);
  13366. }e.address.bind("change", b.event.history.change);
  13367. }, event: { click: function click(t) {
  13368. 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");
  13369. }, history: { change: function change(t) {
  13370. var n = t.pathNames.join("/") || b.get.initialPath(),
  13371. 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);
  13372. } } }, refresh: function refresh() {
  13373. h && (b.debug("Refreshing tab", h), b.changeTab(h));
  13374. }, cache: { read: function read(e) {
  13375. return e !== i && P[e];
  13376. }, add: function add(e, t) {
  13377. e = e || h, b.debug("Adding cached content for", e), P[e] = t;
  13378. }, remove: function remove(e) {
  13379. e = e || h, b.debug("Removing cached content for", e), delete P[e];
  13380. } }, set: { auto: function auto() {
  13381. 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 };
  13382. }, loading: function loading(e) {
  13383. 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));
  13384. }, state: function state(t) {
  13385. e.address.value(t);
  13386. } }, changeTab: function changeTab(n) {
  13387. var i = t.history && t.history.pushState && x.ignoreFirstLoad && E,
  13388. o = x.auto || e.isPlainObject(x.apiSettings),
  13389. a = o && !i ? b.utilities.pathToArray(n) : b.get.defaultPathArray(n);n = b.utilities.arrayToPath(a), e.each(a, function (t, r) {
  13390. var s,
  13391. l,
  13392. c,
  13393. u,
  13394. d = a.slice(0, t + 1),
  13395. f = b.utilities.arrayToPath(d),
  13396. m = b.is.tab(f),
  13397. p = t + 1 == a.length,
  13398. S = b.get.tabElement(f);if (b.verbose("Looking for tab", r), m) {
  13399. 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);
  13400. } else {
  13401. 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 () {
  13402. b.scrollTo(s);
  13403. }, 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;
  13404. }
  13405. });
  13406. }, scrollTo: function scrollTo(t) {
  13407. 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));
  13408. }, update: { content: function content(t, n, o) {
  13409. var a = b.get.tabElement(t),
  13410. 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);
  13411. } }, fetch: { content: function content(t, n) {
  13412. var o,
  13413. a,
  13414. r = b.get.tabElement(t),
  13415. s = { dataType: "html", encodeParameters: !1, on: "now", cache: x.alwaysRefresh, headers: { "X-Remote": !0 }, onSuccess: function onSuccess(e) {
  13416. "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 () {
  13417. var e = r.children().clone(!0);e = e.not("script"), b.cache.add(n, e);
  13418. }, 0) : b.cache.add(n, r.html());
  13419. }, urlData: { tab: n } },
  13420. l = r.api("get request") || !1,
  13421. 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);
  13422. } }, activate: { all: function all(e) {
  13423. b.activate.tab(e), b.activate.navigation(e);
  13424. }, tab: function tab(e) {
  13425. var t = b.get.tabElement(e),
  13426. n = "siblings" == x.deactivate ? t.siblings(p) : p.not(t),
  13427. 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));
  13428. }, navigation: function navigation(e) {
  13429. var t = b.get.navElement(e),
  13430. n = "siblings" == x.deactivate ? t.siblings(r) : r.not(t),
  13431. i = t.hasClass(C.active);b.verbose("Activating tab navigation for", t, e), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading));
  13432. } }, deactivate: { all: function all() {
  13433. b.deactivate.navigation(), b.deactivate.tabs();
  13434. }, navigation: function navigation() {
  13435. r.removeClass(C.active);
  13436. }, tabs: function tabs() {
  13437. p.removeClass(C.active + " " + C.loading);
  13438. } }, is: { tab: function tab(e) {
  13439. return e !== i && b.get.tabElement(e).length > 0;
  13440. } }, get: { initialPath: function initialPath() {
  13441. return r.eq(0).data(w.tab) || p.eq(0).data(w.tab);
  13442. }, path: function path() {
  13443. return e.address.value();
  13444. }, defaultPathArray: function defaultPathArray(e) {
  13445. return b.utilities.pathToArray(b.get.defaultPath(e));
  13446. }, defaultPath: function defaultPath(e) {
  13447. var t = r.filter("[data-" + w.tab + '^="' + e + '/"]').eq(0).data(w.tab) || !1;if (t) {
  13448. if (b.debug("Found default tab", t), F < x.maxDepth) return F++, b.get.defaultPath(t);b.error(k.recursion);
  13449. } else b.debug("No default tabs found for", e, p);return F = 0, e;
  13450. }, navElement: function navElement(e) {
  13451. return e = e || h, r.filter("[data-" + w.tab + '="' + e + '"]');
  13452. }, tabElement: function tabElement(e) {
  13453. 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;
  13454. }, tab: function tab() {
  13455. return h;
  13456. } }, utilities: { filterArray: function filterArray(t, n) {
  13457. return e.grep(t, function (t) {
  13458. return -1 == e.inArray(t, n);
  13459. });
  13460. }, last: function last(t) {
  13461. return !!e.isArray(t) && t[t.length - 1];
  13462. }, pathToArray: function pathToArray(e) {
  13463. return e === i && (e = h), "string" == typeof e ? e.split("/") : [e];
  13464. }, arrayToPath: function arrayToPath(t) {
  13465. return !!e.isArray(t) && t.join("/");
  13466. } }, setting: function setting(t, n) {
  13467. if (b.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, x, t);else {
  13468. if (n === i) return x[t];e.isPlainObject(x[t]) ? e.extend(!0, x[t], n) : x[t] = n;
  13469. }
  13470. }, internal: function internal(t, n) {
  13471. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  13472. if (n === i) return b[t];b[t] = n;
  13473. }
  13474. }, debug: function debug() {
  13475. !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)));
  13476. }, verbose: function verbose() {
  13477. !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)));
  13478. }, error: function error() {
  13479. x.silent || (b.error = Function.prototype.bind.call(console.error, console, x.name + ":"), b.error.apply(console, arguments));
  13480. }, performance: { log: function log(e) {
  13481. 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);
  13482. }, display: function display() {
  13483. var t = x.name + ":",
  13484. n = 0;l = !1, clearTimeout(b.performance.timer), e.each(c, function (e, t) {
  13485. n += t["Execution Time"];
  13486. }), 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) {
  13487. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13488. }), console.groupEnd()), c = [];
  13489. } }, invoke: function invoke(t, n, o) {
  13490. var r,
  13491. s,
  13492. l,
  13493. 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) {
  13494. 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 {
  13495. 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];
  13496. }
  13497. })), 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;
  13498. } }, d ? (D === i && b.initialize(), b.invoke(u)) : (D !== i && D.invoke("destroy"), b.initialize());
  13499. }), a !== i ? a : this;
  13500. }, e.tab = function () {
  13501. e(t).tab.apply(this, arguments);
  13502. }, 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" } };
  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.transition = function () {
  13506. var o,
  13507. a = e(this),
  13508. r = a.selector || "",
  13509. s = new Date().getTime(),
  13510. l = [],
  13511. c = arguments,
  13512. u = c[0],
  13513. d = [].slice.call(arguments, 1),
  13514. f = "string" == typeof u;t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function (t) {
  13515. var m,
  13516. g,
  13517. p,
  13518. h,
  13519. v,
  13520. b,
  13521. y,
  13522. x,
  13523. C,
  13524. w = e(this),
  13525. S = this;(C = { initialize: function initialize() {
  13526. 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());
  13527. }, instantiate: function instantiate() {
  13528. C.verbose("Storing instance of module", C), g = C, w.data(y, g);
  13529. }, destroy: function destroy() {
  13530. C.verbose("Destroying previous module for", S), w.removeData(y);
  13531. }, refresh: function refresh() {
  13532. C.verbose("Refreshing display type on next animation"), delete C.displayType;
  13533. }, forceRepaint: function forceRepaint() {
  13534. C.verbose("Forcing element repaint");var e = w.parent(),
  13535. t = w.next();0 === t.length ? w.detach().appendTo(e) : w.detach().insertBefore(t);
  13536. }, repaint: function repaint() {
  13537. C.verbose("Repainting element");S.offsetWidth;
  13538. }, delay: function delay(e) {
  13539. var n,
  13540. 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);
  13541. }, animate: function animate(e) {
  13542. if (m = e || m, !C.is.supported()) return C.error(p.support), !1;if (C.debug("Preparing animation", m.animation), C.is.animating()) {
  13543. 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();
  13544. }C.can.animate() ? C.set.animating(m.animation) : C.error(p.noAnimation, m.animation, S);
  13545. }, reset: function reset() {
  13546. C.debug("Resetting animation to beginning conditions"), C.remove.animationCallbacks(), C.restore.conditions(), C.remove.animating();
  13547. }, queue: function queue(e) {
  13548. C.debug("Queueing animation of", e), C.queuing = !0, w.one(b + ".queue" + x, function () {
  13549. C.queuing = !1, C.repaint(), C.animate.apply(this, m);
  13550. });
  13551. }, complete: function complete(e) {
  13552. 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)));
  13553. }, force: { visible: function visible() {
  13554. var e = w.attr("style"),
  13555. t = C.get.userStyle(),
  13556. n = C.get.displayType(),
  13557. o = t + "display: " + n + " !important;",
  13558. a = w.css("display"),
  13559. r = e === i || "" === e;a !== n ? (C.verbose("Overriding default display to show element", n), w.attr("style", o)) : r && w.removeAttr("style");
  13560. }, hidden: function hidden() {
  13561. var e = w.attr("style"),
  13562. t = w.css("display"),
  13563. 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"));
  13564. } }, has: { direction: function direction(t) {
  13565. var n = !1;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13566. t !== h.inward && t !== h.outward || (n = !0);
  13567. })), n;
  13568. }, inlineDisplay: function inlineDisplay() {
  13569. var t = w.attr("style") || "";return e.isArray(t.match(/display.*?;/, ""));
  13570. } }, set: { animating: function animating(e) {
  13571. 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);
  13572. }, duration: function duration(e, t) {
  13573. ((t = "number" == typeof (t = t || m.duration) ? t + "ms" : t) || 0 === t) && (C.verbose("Setting animation duration", t), w.css({ "animation-duration": t }));
  13574. }, direction: function direction(e) {
  13575. (e = e || C.get.direction()) == h.inward ? C.set.inward() : C.set.outward();
  13576. }, looping: function looping() {
  13577. C.debug("Transition set to loop"), w.addClass(h.looping);
  13578. }, hidden: function hidden() {
  13579. w.addClass(h.transition).addClass(h.hidden);
  13580. }, inward: function inward() {
  13581. C.debug("Setting direction to inward"), w.removeClass(h.outward).addClass(h.inward);
  13582. }, outward: function outward() {
  13583. C.debug("Setting direction to outward"), w.removeClass(h.inward).addClass(h.outward);
  13584. }, visible: function visible() {
  13585. w.addClass(h.transition).addClass(h.visible);
  13586. } }, start: { animation: function animation(e) {
  13587. 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);
  13588. } }, save: { animation: function animation(e) {
  13589. C.cache || (C.cache = {}), C.cache.animation = e;
  13590. }, displayType: function displayType(e) {
  13591. "none" !== e && w.data(v.displayType, e);
  13592. }, transitionExists: function transitionExists(t, n) {
  13593. e.fn.transition.exists[t] = n, C.verbose("Saving existence of transition", t, n);
  13594. } }, restore: { conditions: function conditions() {
  13595. var e = C.get.currentAnimation();e && (w.removeClass(e), C.verbose("Removing animation class", C.cache)), C.remove.duration();
  13596. } }, add: { failSafe: function failSafe() {
  13597. var e = C.get.duration();C.timer = setTimeout(function () {
  13598. w.triggerHandler(b);
  13599. }, e + m.failSafeDelay), C.verbose("Adding fail safe timer", C.timer);
  13600. } }, remove: { animating: function animating() {
  13601. w.removeClass(h.animating);
  13602. }, animationCallbacks: function animationCallbacks() {
  13603. C.remove.queueCallback(), C.remove.completeCallback();
  13604. }, queueCallback: function queueCallback() {
  13605. w.off(".queue" + x);
  13606. }, completeCallback: function completeCallback() {
  13607. w.off(".complete" + x);
  13608. }, display: function display() {
  13609. w.css("display", "");
  13610. }, direction: function direction() {
  13611. w.removeClass(h.inward).removeClass(h.outward);
  13612. }, duration: function duration() {
  13613. w.css("animation-duration", "");
  13614. }, failSafe: function failSafe() {
  13615. C.verbose("Removing fail safe timer", C.timer), C.timer && clearTimeout(C.timer);
  13616. }, hidden: function hidden() {
  13617. w.removeClass(h.hidden);
  13618. }, visible: function visible() {
  13619. w.removeClass(h.visible);
  13620. }, looping: function looping() {
  13621. C.debug("Transitions are no longer looping"), C.is.looping() && (C.reset(), w.removeClass(h.looping));
  13622. }, transition: function transition() {
  13623. w.removeClass(h.visible).removeClass(h.hidden);
  13624. } }, get: { settings: function settings(t, n, i) {
  13625. 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 });
  13626. }, animationClass: function animationClass(e) {
  13627. var t = e || m.animation,
  13628. n = C.can.transition() && !C.has.direction() ? C.get.direction() + " " : "";return h.animating + " " + h.transition + " " + n + t;
  13629. }, currentAnimation: function currentAnimation() {
  13630. return !(!C.cache || C.cache.animation === i) && C.cache.animation;
  13631. }, currentDirection: function currentDirection() {
  13632. return C.is.inward() ? h.inward : h.outward;
  13633. }, direction: function direction() {
  13634. return C.is.hidden() || !C.is.visible() ? h.inward : h.outward;
  13635. }, animationDirection: function animationDirection(t) {
  13636. var n;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13637. t === h.inward ? n = h.inward : t === h.outward && (n = h.outward);
  13638. })), n || !1;
  13639. }, duration: function duration(e) {
  13640. 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;
  13641. }, displayType: function displayType(e) {
  13642. return e = e === i || e, m.displayType ? m.displayType : (e && w.data(v.displayType) === i && C.can.transition(!0), w.data(v.displayType));
  13643. }, userStyle: function userStyle(e) {
  13644. return (e = e || w.attr("style") || "").replace(/display.*?;/, "");
  13645. }, transitionExists: function transitionExists(t) {
  13646. return e.fn.transition.exists[t];
  13647. }, animationStartEvent: function animationStartEvent() {
  13648. var e,
  13649. t = n.createElement("div"),
  13650. o = { animation: "animationstart", OAnimation: "oAnimationStart", MozAnimation: "mozAnimationStart", WebkitAnimation: "webkitAnimationStart" };for (e in o) {
  13651. if (t.style[e] !== i) return o[e];
  13652. }return !1;
  13653. }, animationEndEvent: function animationEndEvent() {
  13654. var e,
  13655. t = n.createElement("div"),
  13656. o = { animation: "animationend", OAnimation: "oAnimationEnd", MozAnimation: "mozAnimationEnd", WebkitAnimation: "webkitAnimationEnd" };for (e in o) {
  13657. if (t.style[e] !== i) return o[e];
  13658. }return !1;
  13659. } }, can: { transition: function transition(t) {
  13660. var n,
  13661. o,
  13662. a,
  13663. r,
  13664. s,
  13665. l,
  13666. c = m.animation,
  13667. u = C.get.transitionExists(c),
  13668. d = C.get.displayType(!1);if (u === i || t) {
  13669. 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 {
  13670. if ("none" == r || !r) return void C.debug("No animation defined in css", c);C.debug("Static animation found", c, d), l = !1;
  13671. }C.save.transitionExists(c, l);
  13672. }return u !== i ? u : l;
  13673. }, animate: function animate() {
  13674. return C.can.transition() !== i;
  13675. } }, is: { animating: function animating() {
  13676. return w.hasClass(h.animating);
  13677. }, inward: function inward() {
  13678. return w.hasClass(h.inward);
  13679. }, outward: function outward() {
  13680. return w.hasClass(h.outward);
  13681. }, looping: function looping() {
  13682. return w.hasClass(h.looping);
  13683. }, occurring: function occurring(e) {
  13684. return e = "." + (e = e || m.animation).replace(" ", "."), w.filter(e).length > 0;
  13685. }, visible: function visible() {
  13686. return w.is(":visible");
  13687. }, hidden: function hidden() {
  13688. return "hidden" === w.css("visibility");
  13689. }, supported: function supported() {
  13690. return !1 !== b;
  13691. } }, hide: function hide() {
  13692. 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);
  13693. }, show: function show(e) {
  13694. C.verbose("Showing element", e), C.remove.hidden(), C.set.visible(), C.force.visible(), m.onShow.call(S), m.onComplete.call(S);
  13695. }, toggle: function toggle() {
  13696. C.is.visible() ? C.hide() : C.show();
  13697. }, stop: function stop() {
  13698. C.debug("Stopping current animation"), w.triggerHandler(b);
  13699. }, stopAll: function stopAll() {
  13700. C.debug("Stopping all animation"), C.remove.queueCallback(), w.triggerHandler(b);
  13701. }, clear: { queue: function queue() {
  13702. C.debug("Clearing animation queue"), C.remove.queueCallback();
  13703. } }, enable: function enable() {
  13704. C.verbose("Starting animation"), w.removeClass(h.disabled);
  13705. }, disable: function disable() {
  13706. C.debug("Stopping animation"), w.addClass(h.disabled);
  13707. }, setting: function setting(t, n) {
  13708. if (C.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  13709. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  13710. }
  13711. }, internal: function internal(t, n) {
  13712. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  13713. if (n === i) return C[t];C[t] = n;
  13714. }
  13715. }, debug: function debug() {
  13716. !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)));
  13717. }, verbose: function verbose() {
  13718. !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)));
  13719. }, error: function error() {
  13720. m.silent || (C.error = Function.prototype.bind.call(console.error, console, m.name + ":"), C.error.apply(console, arguments));
  13721. }, performance: { log: function log(e) {
  13722. 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);
  13723. }, display: function display() {
  13724. var t = m.name + ":",
  13725. n = 0;s = !1, clearTimeout(C.performance.timer), e.each(l, function (e, t) {
  13726. n += t["Execution Time"];
  13727. }), 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) {
  13728. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13729. }), console.groupEnd()), l = [];
  13730. } }, invoke: function invoke(t, n, a) {
  13731. var r,
  13732. s,
  13733. l,
  13734. 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) {
  13735. 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 {
  13736. 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];
  13737. }
  13738. })), 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;
  13739. } }).initialize();
  13740. }), o !== i ? o : this;
  13741. }, 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" } };
  13742. }(jQuery, window, document), function (e, t, n, i) {
  13743. "use strict";
  13744. 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) {
  13745. var o,
  13746. a = e.isFunction(this) ? e(t) : e(this),
  13747. r = a.selector || "",
  13748. s = new Date().getTime(),
  13749. l = [],
  13750. c = arguments[0],
  13751. u = "string" == typeof c,
  13752. d = [].slice.call(arguments, 1);return a.each(function () {
  13753. var a,
  13754. f,
  13755. m,
  13756. g,
  13757. p,
  13758. h,
  13759. v = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.api.settings, n) : e.extend({}, e.fn.api.settings),
  13760. b = v.namespace,
  13761. y = v.metadata,
  13762. x = v.selector,
  13763. C = v.error,
  13764. w = v.className,
  13765. S = "." + b,
  13766. k = "module-" + b,
  13767. T = e(this),
  13768. A = T.closest(x.form),
  13769. R = v.stateContext ? e(v.stateContext) : T,
  13770. P = this,
  13771. E = R[0],
  13772. F = T.data(k);h = { initialize: function initialize() {
  13773. u || h.bind.events(), h.instantiate();
  13774. }, instantiate: function instantiate() {
  13775. h.verbose("Storing instance of module", h), F = h, T.data(k, F);
  13776. }, destroy: function destroy() {
  13777. h.verbose("Destroying previous module for", P), T.removeData(k).off(S);
  13778. }, bind: { events: function events() {
  13779. 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());
  13780. } }, decode: { json: function json(e) {
  13781. if (e !== i && "string" == typeof e) try {
  13782. e = JSON.parse(e);
  13783. } catch (e) {}return e;
  13784. } }, read: { cachedResponse: function cachedResponse(e) {
  13785. 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);
  13786. } }, write: { cachedResponse: function cachedResponse(n, o) {
  13787. 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);
  13788. } }, query: function query() {
  13789. if (h.is.disabled()) h.debug("Element is disabled API request aborted");else {
  13790. if (h.is.loading()) {
  13791. if (!v.interruptRequests) return void h.debug("Cancelling request, previous request is still pending");h.debug("Interrupting previous request"), h.abort();
  13792. }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()) {
  13793. if ((m = h.add.urlData(m)) || h.is.mocked()) {
  13794. 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 () {
  13795. h.timer && delete h.timer, h.debug("Sending throttled request", g, a.method), h.send.request();
  13796. }, 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());
  13797. }
  13798. } else h.error(C.missingURL);
  13799. }
  13800. }, should: { removeError: function removeError() {
  13801. return !0 === v.hideError || "auto" === v.hideError && !h.is.form();
  13802. } }, is: { disabled: function disabled() {
  13803. return T.filter(x.disabled).length > 0;
  13804. }, expectingJSON: function expectingJSON() {
  13805. return "json" === v.dataType || "jsonp" === v.dataType;
  13806. }, form: function form() {
  13807. return T.is("form") || R.is("form");
  13808. }, mocked: function mocked() {
  13809. return v.mockResponse || v.mockResponseAsync || v.response || v.responseAsync;
  13810. }, input: function input() {
  13811. return T.is("input");
  13812. }, loading: function loading() {
  13813. return !!h.request && "pending" == h.request.state();
  13814. }, abortedRequest: function abortedRequest(e) {
  13815. 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);
  13816. }, validResponse: function validResponse(t) {
  13817. 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);
  13818. } }, was: { cancelled: function cancelled() {
  13819. return h.cancelled || !1;
  13820. }, succesful: function succesful() {
  13821. return h.request && "resolved" == h.request.state();
  13822. }, failure: function failure() {
  13823. return h.request && "rejected" == h.request.state();
  13824. }, complete: function complete() {
  13825. return h.request && ("resolved" == h.request.state() || "rejected" == h.request.state());
  13826. } }, add: { urlData: function urlData(t, n) {
  13827. 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) {
  13828. var r = -1 !== a.indexOf("$") ? a.substr(2, a.length - 3) : a.substr(1, a.length - 2),
  13829. 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);
  13830. })), a && (h.debug("Looking for optional URL variables", o), e.each(a, function (o, a) {
  13831. var r = -1 !== a.indexOf("$") ? a.substr(3, a.length - 4) : a.substr(2, a.length - 3),
  13832. 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, ""));
  13833. }))), t;
  13834. }, formData: function formData(t) {
  13835. var n = e.fn.serializeObject !== i,
  13836. 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;
  13837. } }, send: { request: function request() {
  13838. 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);
  13839. } }, event: { trigger: function trigger(e) {
  13840. h.query(), "submit" != e.type && "click" != e.type || e.preventDefault();
  13841. }, xhr: { always: function always() {}, done: function done(t, n, i) {
  13842. var o = this,
  13843. a = new Date().getTime() - p,
  13844. r = v.loadingDuration - a,
  13845. 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 () {
  13846. h.is.validResponse(t) ? h.request.resolveWith(o, [t, i]) : h.request.rejectWith(o, [i, "invalid"]);
  13847. }, r);
  13848. }, fail: function fail(e, t, n) {
  13849. var i = this,
  13850. o = new Date().getTime() - p,
  13851. a = v.loadingDuration - o;(a = a > 0 ? a : 0) > 0 && h.debug("Response completed early delaying state change by", a), setTimeout(function () {
  13852. h.is.abortedRequest(e) ? h.request.rejectWith(i, [e, "aborted", n]) : h.request.rejectWith(i, [e, "error", t, n]);
  13853. }, a);
  13854. } }, request: { done: function done(e, t) {
  13855. 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);
  13856. }, complete: function complete(e, t) {
  13857. 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);
  13858. }, fail: function fail(e, t, n) {
  13859. var o = h.get.responseFromXHR(e),
  13860. 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);
  13861. } } }, create: { request: function request() {
  13862. return e.Deferred().always(h.event.request.complete).done(h.event.request.done).fail(h.event.request.fail);
  13863. }, mockedXHR: function mockedXHR() {
  13864. var t,
  13865. n,
  13866. i,
  13867. o = v.mockResponse || v.response,
  13868. 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) {
  13869. h.debug("Async callback returned response", e), e ? i.resolveWith(E, [e, !1, { responseText: e }]) : i.rejectWith(E, [{ responseText: e }, !1, !1]);
  13870. }, h.debug("Using specified async response callback", a), a.call(E, f, t)), i;
  13871. }, xhr: function xhr() {
  13872. 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;
  13873. } }, set: { error: function error() {
  13874. h.verbose("Adding error state to element", R), R.addClass(w.error);
  13875. }, loading: function loading() {
  13876. h.verbose("Adding loading state to element", R), R.addClass(w.loading), p = new Date().getTime();
  13877. } }, remove: { error: function error() {
  13878. h.verbose("Removing error state from element", R), R.removeClass(w.error);
  13879. }, loading: function loading() {
  13880. h.verbose("Removing loading state from element", R), R.removeClass(w.loading);
  13881. } }, get: { responseFromXHR: function responseFromXHR(t) {
  13882. return !!e.isPlainObject(t) && (h.is.expectingJSON() ? h.decode.json(t.responseText) : t.responseText);
  13883. }, errorFromRequest: function errorFromRequest(t, n, o) {
  13884. return e.isPlainObject(t) && t.error !== i ? t.error : v.error[n] !== i ? v.error[n] : o;
  13885. }, request: function request() {
  13886. return h.request || !1;
  13887. }, xhr: function xhr() {
  13888. return h.xhr || !1;
  13889. }, settings: function settings() {
  13890. 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);
  13891. }, urlEncodedValue: function urlEncodedValue(e) {
  13892. var n = t.decodeURIComponent(e),
  13893. 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);
  13894. }, defaultData: function defaultData() {
  13895. var t = {};return e.isWindow(P) || (h.is.input() ? t.value = T.val() : h.is.form() || (t.text = T.text())), t;
  13896. }, event: function event() {
  13897. 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;
  13898. }, templatedURL: function templatedURL(e) {
  13899. 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) {
  13900. 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];
  13901. } 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;
  13902. } }, abort: function abort() {
  13903. var e = h.get.xhr();e && "resolved" !== e.state() && (h.debug("Cancelling API request"), e.abort());
  13904. }, reset: function reset() {
  13905. h.remove.error(), h.remove.loading();
  13906. }, setting: function setting(t, n) {
  13907. if (h.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, v, t);else {
  13908. if (n === i) return v[t];e.isPlainObject(v[t]) ? e.extend(!0, v[t], n) : v[t] = n;
  13909. }
  13910. }, internal: function internal(t, n) {
  13911. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  13912. if (n === i) return h[t];h[t] = n;
  13913. }
  13914. }, debug: function debug() {
  13915. !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)));
  13916. }, verbose: function verbose() {
  13917. !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)));
  13918. }, error: function error() {
  13919. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  13920. }, performance: { log: function log(e) {
  13921. 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);
  13922. }, display: function display() {
  13923. var t = v.name + ":",
  13924. n = 0;s = !1, clearTimeout(h.performance.timer), e.each(l, function (e, t) {
  13925. n += t["Execution Time"];
  13926. }), 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) {
  13927. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13928. }), console.groupEnd()), l = [];
  13929. } }, invoke: function invoke(t, n, a) {
  13930. var r,
  13931. s,
  13932. l,
  13933. 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) {
  13934. 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 {
  13935. 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];
  13936. }
  13937. })), 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;
  13938. } }, u ? (F === i && h.initialize(), h.invoke(c)) : (F !== i && F.invoke("destroy"), h.initialize());
  13939. }), o !== i ? o : this;
  13940. }, 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) {
  13941. return e;
  13942. }, 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" } };
  13943. }(jQuery, window, document), function (e, t, n, i) {
  13944. "use strict";
  13945. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.visibility = function (o) {
  13946. var a,
  13947. r = e(this),
  13948. s = r.selector || "",
  13949. l = new Date().getTime(),
  13950. c = [],
  13951. u = arguments[0],
  13952. d = "string" == typeof u,
  13953. f = [].slice.call(arguments, 1),
  13954. m = r.length,
  13955. g = 0;return r.each(function () {
  13956. var r,
  13957. p,
  13958. h,
  13959. v,
  13960. b = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.visibility.settings, o) : e.extend({}, e.fn.visibility.settings),
  13961. y = b.className,
  13962. x = b.namespace,
  13963. C = b.error,
  13964. w = b.metadata,
  13965. S = "." + x,
  13966. k = "module-" + x,
  13967. T = e(t),
  13968. A = e(this),
  13969. R = e(b.context),
  13970. P = (A.selector, A.data(k)),
  13971. E = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13972. setTimeout(e, 0);
  13973. },
  13974. F = this,
  13975. O = !1;v = { initialize: function initialize() {
  13976. 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();
  13977. }, instantiate: function instantiate() {
  13978. v.debug("Storing instance", v), A.data(k, v), P = v;
  13979. }, destroy: function destroy() {
  13980. 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);
  13981. }, observeChanges: function observeChanges() {
  13982. "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));
  13983. }, bind: { events: function events() {
  13984. 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);
  13985. } }, event: { changed: function changed(e) {
  13986. v.verbose("DOM tree modified, updating visibility calculations"), v.timer = setTimeout(function () {
  13987. v.verbose("DOM tree modified, updating sticky menu"), v.refresh();
  13988. }, 100);
  13989. }, contextChanged: function contextChanged(t) {
  13990. [].forEach.call(t, function (t) {
  13991. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  13992. (t == F || e(t).find(F).length > 0) && (v.debug("Element removed from DOM, tearing down events"), v.destroy());
  13993. });
  13994. });
  13995. }, resize: function resize() {
  13996. v.debug("Window resized"), b.refreshOnResize && E(v.refresh);
  13997. }, load: function load() {
  13998. v.debug("Page finished loading"), E(v.refresh);
  13999. }, scroll: function scroll() {
  14000. b.throttle ? (clearTimeout(v.timer), v.timer = setTimeout(function () {
  14001. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14002. }, b.throttle)) : E(function () {
  14003. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14004. });
  14005. }, scrollchange: function scrollchange(e, t) {
  14006. v.checkVisibility(t);
  14007. } }, precache: function precache(t, i) {
  14008. t instanceof Array || (t = [t]);for (var o = t.length, a = 0, r = [], s = n.createElement("img"), l = function l() {
  14009. ++a >= t.length && e.isFunction(i) && i();
  14010. }; o--;) {
  14011. (s = n.createElement("img")).onload = l, s.onerror = l, s.src = t[o], r.push(s);
  14012. }
  14013. }, enableCallbacks: function enableCallbacks() {
  14014. v.debug("Allowing callbacks to occur"), O = !1;
  14015. }, disableCallbacks: function disableCallbacks() {
  14016. v.debug("Disabling all callbacks temporarily"), O = !0;
  14017. }, should: { trackChanges: function trackChanges() {
  14018. return d ? (v.debug("One time query, no need to bind events"), !1) : (v.debug("Callbacks being attached"), !0);
  14019. } }, setup: { cache: function cache() {
  14020. v.cache = { occurred: {}, screen: {}, element: {} };
  14021. }, image: function image() {
  14022. var e = A.data(w.src);e && (v.verbose("Lazy loading image", e), b.once = !0, b.observeChanges = !1, b.onOnScreen = function () {
  14023. v.debug("Image on screen", F), v.precache(e, function () {
  14024. v.set.image(e, function () {
  14025. ++g == m && b.onAllLoaded.call(this), b.onLoad.call(this);
  14026. });
  14027. });
  14028. });
  14029. }, fixed: function fixed() {
  14030. 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 () {
  14031. 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);
  14032. }, b.onTopPassedReverse = function () {
  14033. v.debug("Element returned to position, removing fixed", A), v.hide.placeholder(), v.remove.fixed();
  14034. };
  14035. } }, create: { placeholder: function placeholder() {
  14036. v.verbose("Creating fixed position placeholder"), r = A.clone(!1).css("display", "none").addClass(y.placeholder).insertAfter(A);
  14037. } }, show: { placeholder: function placeholder() {
  14038. v.verbose("Showing placeholder"), r.css("display", "block").css("visibility", "hidden");
  14039. } }, hide: { placeholder: function placeholder() {
  14040. v.verbose("Hiding placeholder"), r.css("display", "none").css("visibility", "");
  14041. } }, set: { fixed: function fixed() {
  14042. 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);
  14043. }, image: function image(t, n) {
  14044. if (A.attr("src", t), b.transition) {
  14045. if (e.fn.transition !== i) {
  14046. if (A.hasClass(y.visible)) return void v.debug("Transition already occurred on this image, skipping animation");A.transition(b.transition, b.duration, n);
  14047. } else A.fadeIn(b.duration, n);
  14048. } else A.show();
  14049. } }, is: { onScreen: function onScreen() {
  14050. return v.get.elementCalculations().onScreen;
  14051. }, offScreen: function offScreen() {
  14052. return v.get.elementCalculations().offScreen;
  14053. }, visible: function visible() {
  14054. return !(!v.cache || !v.cache.element) && !(0 === v.cache.element.width && 0 === v.cache.element.offset.top);
  14055. }, verticallyScrollableContext: function verticallyScrollableContext() {
  14056. var e = R.get(0) !== t && R.css("overflow-y");return "auto" == e || "scroll" == e;
  14057. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  14058. var e = R.get(0) !== t && R.css("overflow-x");return "auto" == e || "scroll" == e;
  14059. } }, refresh: function refresh() {
  14060. v.debug("Refreshing constants (width/height)"), "fixed" == b.type && v.resetFixed(), v.reset(), v.save.position(), b.checkOnRefresh && v.checkVisibility(), b.onRefresh.call(F);
  14061. }, resetFixed: function resetFixed() {
  14062. v.remove.fixed(), v.remove.occurred();
  14063. }, reset: function reset() {
  14064. v.verbose("Resetting all cached values"), e.isPlainObject(v.cache) && (v.cache.screen = {}, v.cache.element = {});
  14065. }, checkVisibility: function checkVisibility(e) {
  14066. 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()));
  14067. }, passed: function passed(t, n) {
  14068. var o = v.get.elementCalculations();if (t && n) b.onPassed[t] = n;else {
  14069. if (t !== i) return v.get.pixelsPassed(t) > o.pixelsPassed;o.passing && e.each(b.onPassed, function (e, t) {
  14070. o.bottomVisible || o.pixelsPassed > v.get.pixelsPassed(e) ? v.execute(t, e) : b.once || v.remove.occurred(t);
  14071. });
  14072. }
  14073. }, onScreen: function onScreen(e) {
  14074. var t = v.get.elementCalculations(),
  14075. n = e || b.onOnScreen,
  14076. 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;
  14077. }, offScreen: function offScreen(e) {
  14078. var t = v.get.elementCalculations(),
  14079. n = e || b.onOffScreen,
  14080. 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;
  14081. }, passing: function passing(e) {
  14082. var t = v.get.elementCalculations(),
  14083. n = e || b.onPassing,
  14084. 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;
  14085. }, topVisible: function topVisible(e) {
  14086. var t = v.get.elementCalculations(),
  14087. n = e || b.onTopVisible,
  14088. 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;
  14089. }, bottomVisible: function bottomVisible(e) {
  14090. var t = v.get.elementCalculations(),
  14091. n = e || b.onBottomVisible,
  14092. 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;
  14093. }, topPassed: function topPassed(e) {
  14094. var t = v.get.elementCalculations(),
  14095. n = e || b.onTopPassed,
  14096. 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;
  14097. }, bottomPassed: function bottomPassed(e) {
  14098. var t = v.get.elementCalculations(),
  14099. n = e || b.onBottomPassed,
  14100. 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;
  14101. }, passingReverse: function passingReverse(e) {
  14102. var t = v.get.elementCalculations(),
  14103. n = e || b.onPassingReverse,
  14104. 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;
  14105. }, topVisibleReverse: function topVisibleReverse(e) {
  14106. var t = v.get.elementCalculations(),
  14107. n = e || b.onTopVisibleReverse,
  14108. 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;
  14109. }, bottomVisibleReverse: function bottomVisibleReverse(e) {
  14110. var t = v.get.elementCalculations(),
  14111. n = e || b.onBottomVisibleReverse,
  14112. 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;
  14113. }, topPassedReverse: function topPassedReverse(e) {
  14114. var t = v.get.elementCalculations(),
  14115. n = e || b.onTopPassedReverse,
  14116. 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;
  14117. }, bottomPassedReverse: function bottomPassedReverse(e) {
  14118. var t = v.get.elementCalculations(),
  14119. n = e || b.onBottomPassedReverse,
  14120. 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;
  14121. }, execute: function execute(e, t) {
  14122. var n = v.get.elementCalculations(),
  14123. 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);
  14124. }, remove: { fixed: function fixed() {
  14125. v.debug("Removing fixed position"), A.removeClass(y.fixed).css({ position: "", top: "", left: "", zIndex: "" }), b.onUnfixed.call(F);
  14126. }, placeholder: function placeholder() {
  14127. v.debug("Removing placeholder content"), r && r.remove();
  14128. }, occurred: function occurred(e) {
  14129. if (e) {
  14130. 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);
  14131. } else v.cache.occurred = {};
  14132. } }, save: { calculations: function calculations() {
  14133. v.verbose("Saving all calculations necessary to determine positioning"), v.save.direction(), v.save.screenCalculations(), v.save.elementCalculations();
  14134. }, occurred: function occurred(e) {
  14135. e && (v.cache.occurred[e] !== i && !0 === v.cache.occurred[e] || (v.verbose("Saving callback occurred", e), v.cache.occurred[e] = !0));
  14136. }, scroll: function scroll(e) {
  14137. e = e + b.offset || R.scrollTop() + b.offset, v.cache.scroll = e;
  14138. }, direction: function direction() {
  14139. var e,
  14140. t = v.get.scroll(),
  14141. n = v.get.lastScroll();return e = t > n && n ? "down" : t < n && n ? "up" : "static", v.cache.direction = e, v.cache.direction;
  14142. }, elementPosition: function elementPosition() {
  14143. var e = v.cache.element,
  14144. 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;
  14145. }, elementCalculations: function elementCalculations() {
  14146. var e = v.get.screenCalculations(),
  14147. 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;
  14148. }, screenCalculations: function screenCalculations() {
  14149. 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;
  14150. }, screenSize: function screenSize() {
  14151. v.verbose("Saving window position"), v.cache.screen = { height: R.height() };
  14152. }, position: function position() {
  14153. v.save.screenSize(), v.save.elementPosition();
  14154. } }, get: { pixelsPassed: function pixelsPassed(e) {
  14155. var t = v.get.elementCalculations();return e.search("%") > -1 ? t.height * (parseInt(e, 10) / 100) : parseInt(e, 10);
  14156. }, occurred: function occurred(e) {
  14157. return v.cache.occurred !== i && v.cache.occurred[e] || !1;
  14158. }, direction: function direction() {
  14159. return v.cache.direction === i && v.save.direction(), v.cache.direction;
  14160. }, elementPosition: function elementPosition() {
  14161. return v.cache.element === i && v.save.elementPosition(), v.cache.element;
  14162. }, elementCalculations: function elementCalculations() {
  14163. return v.cache.element === i && v.save.elementCalculations(), v.cache.element;
  14164. }, screenCalculations: function screenCalculations() {
  14165. return v.cache.screen === i && v.save.screenCalculations(), v.cache.screen;
  14166. }, screenSize: function screenSize() {
  14167. return v.cache.screen === i && v.save.screenSize(), v.cache.screen;
  14168. }, scroll: function scroll() {
  14169. return v.cache.scroll === i && v.save.scroll(), v.cache.scroll;
  14170. }, lastScroll: function lastScroll() {
  14171. return v.cache.screen === i ? (v.debug("First scroll event, no last scroll could be found"), !1) : v.cache.screen.top;
  14172. } }, setting: function setting(t, n) {
  14173. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  14174. if (n === i) return b[t];b[t] = n;
  14175. }
  14176. }, internal: function internal(t, n) {
  14177. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  14178. if (n === i) return v[t];v[t] = n;
  14179. }
  14180. }, debug: function debug() {
  14181. !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)));
  14182. }, verbose: function verbose() {
  14183. !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)));
  14184. }, error: function error() {
  14185. b.silent || (v.error = Function.prototype.bind.call(console.error, console, b.name + ":"), v.error.apply(console, arguments));
  14186. }, performance: { log: function log(e) {
  14187. 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);
  14188. }, display: function display() {
  14189. var t = b.name + ":",
  14190. n = 0;l = !1, clearTimeout(v.performance.timer), e.each(c, function (e, t) {
  14191. n += t["Execution Time"];
  14192. }), 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) {
  14193. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14194. }), console.groupEnd()), c = [];
  14195. } }, invoke: function invoke(t, n, o) {
  14196. var r,
  14197. s,
  14198. l,
  14199. 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) {
  14200. 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 {
  14201. 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];
  14202. }
  14203. })), 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;
  14204. } }, d ? (P === i && v.initialize(), P.save.scroll(), P.save.calculations(), v.invoke(u)) : (P !== i && P.invoke("destroy"), v.initialize());
  14205. }), a !== i ? a : this;
  14206. }, 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" } };
  14207. }(jQuery, window, document);
  14208. /***/ }),
  14209. /***/ "./js/services/i18nHelper.js":
  14210. /*!***********************************!*\
  14211. !*** ./js/services/i18nHelper.js ***!
  14212. \***********************************/
  14213. /*! no static exports found */
  14214. /***/ (function(module, exports, __webpack_require__) {
  14215. "use strict";
  14216. Object.defineProperty(exports, "__esModule", {
  14217. value: true
  14218. });
  14219. exports.i18nHelper = undefined;
  14220. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14221. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14222. var _localizedStringsService = __webpack_require__(/*! ./localizedStringsService */ "./js/services/localizedStringsService.js");
  14223. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14224. var StringTypes = _lineI18n2.default.StringTypes;
  14225. var i18nHelper = exports.i18nHelper = Object.freeze({
  14226. i18n: function i18n(identifier) {
  14227. var opts = identifier.split(':');
  14228. var type = opts[0].toLowerCase();
  14229. var id = opts[1];
  14230. if (StringTypes.ERROR === type) {
  14231. return _localizedStringsService.LocalizedStrings.getError(id);
  14232. } else if (StringTypes.MESSAGE === type) {
  14233. return _localizedStringsService.LocalizedStrings.getMessage(id);
  14234. } else if (StringTypes.UI === type) {
  14235. return _localizedStringsService.LocalizedStrings.getUI(id);
  14236. } else {
  14237. console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> " + identifier);
  14238. return _localizedStringsService.LocalizedStrings.getString(identifier, type);
  14239. }
  14240. }
  14241. });
  14242. /***/ }),
  14243. /***/ "./js/services/languageService.js":
  14244. /*!****************************************!*\
  14245. !*** ./js/services/languageService.js ***!
  14246. \****************************************/
  14247. /*! no static exports found */
  14248. /***/ (function(module, exports, __webpack_require__) {
  14249. "use strict";
  14250. Object.defineProperty(exports, "__esModule", {
  14251. value: true
  14252. });
  14253. exports.LanguageService = undefined;
  14254. 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; }; }();
  14255. var _grammar = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.js");
  14256. var _grammar2 = _interopRequireDefault(_grammar);
  14257. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14258. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14259. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14260. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14261. 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; }
  14262. 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; }
  14263. // This is for LanguageService with localStorage
  14264. // const DEFAULT_LANG = "pt";
  14265. var LanguageServiceExtended = function (_line_i18n$LanguageSe) {
  14266. _inherits(LanguageServiceExtended, _line_i18n$LanguageSe);
  14267. function LanguageServiceExtended() {
  14268. _classCallCheck(this, LanguageServiceExtended);
  14269. return _possibleConstructorReturn(this, (LanguageServiceExtended.__proto__ || Object.getPrototypeOf(LanguageServiceExtended)).call(this, iLMparameters.lang));
  14270. }
  14271. _createClass(LanguageServiceExtended, [{
  14272. key: 'getCurrentLexer',
  14273. value: function getCurrentLexer() {
  14274. var langInfo = _grammar2.default[this.getLang()];
  14275. if (langInfo === null || langInfo === undefined) {
  14276. return _grammar2.default[this.getDefaultLang()].lexer;
  14277. } else {
  14278. return langInfo.lexer;
  14279. }
  14280. }
  14281. }, {
  14282. key: 'getCurrentLangFuncs',
  14283. value: function getCurrentLangFuncs() {
  14284. var langInfo = _grammar2.default[this.getLang()];
  14285. if (langInfo === null || langInfo === undefined) {
  14286. return _grammar2.default[this.getDefaultLang()].langFuncs;
  14287. } else {
  14288. return langInfo.langFuncs;
  14289. }
  14290. }
  14291. }, {
  14292. key: 'getCurrentLangLibs',
  14293. value: function getCurrentLangLibs() {
  14294. var langInfo = _grammar2.default[this.getLang()];
  14295. if (langInfo === null || langInfo === undefined) {
  14296. return _grammar2.default[this.getDefaultLang()].langLibs;
  14297. }
  14298. return langInfo.langLibs;
  14299. }
  14300. }]);
  14301. return LanguageServiceExtended;
  14302. }(_lineI18n2.default.LanguageServiceNoLS);
  14303. var LanguageService = exports.LanguageService = new LanguageServiceExtended();
  14304. /***/ }),
  14305. /***/ "./js/services/localizedStringsService.js":
  14306. /*!************************************************!*\
  14307. !*** ./js/services/localizedStringsService.js ***!
  14308. \************************************************/
  14309. /*! no static exports found */
  14310. /***/ (function(module, exports, __webpack_require__) {
  14311. "use strict";
  14312. Object.defineProperty(exports, "__esModule", {
  14313. value: true
  14314. });
  14315. exports.LocalizedStrings = undefined;
  14316. var _languageService = __webpack_require__(/*! ./languageService */ "./js/services/languageService.js");
  14317. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14318. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14319. var _i18n = __webpack_require__(/*! ./../../i18n */ "./i18n/index.js");
  14320. var _i18n2 = _interopRequireDefault(_i18n);
  14321. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14322. var LocalizedStrings = exports.LocalizedStrings = Object.freeze(new _lineI18n2.default.LocalizedStrings(_languageService.LanguageService, _i18n2.default, true));
  14323. /***/ }),
  14324. /***/ "./js/typeSystem/baseTypes.js":
  14325. /*!************************************!*\
  14326. !*** ./js/typeSystem/baseTypes.js ***!
  14327. \************************************/
  14328. /*! no static exports found */
  14329. /***/ (function(module, exports, __webpack_require__) {
  14330. "use strict";
  14331. Object.defineProperty(exports, "__esModule", {
  14332. value: true
  14333. });
  14334. 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; }; }();
  14335. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14336. var BaseType = function () {
  14337. function BaseType(name, ord) {
  14338. _classCallCheck(this, BaseType);
  14339. this.name = name;
  14340. this.ord = ord;
  14341. }
  14342. _createClass(BaseType, [{
  14343. key: "isCompatible",
  14344. value: function isCompatible(another) {
  14345. if (another instanceof BaseType) {
  14346. return this.name === another.name && this.ord === another.ord;
  14347. }
  14348. return false;
  14349. }
  14350. }, {
  14351. key: "value",
  14352. get: function get() {
  14353. return this.name;
  14354. }
  14355. }]);
  14356. return BaseType;
  14357. }();
  14358. // Base types names are the same as i18n ui type keys
  14359. var BaseTypes = exports.BaseTypes = Object.freeze({
  14360. INTEGER: new BaseType("integer", 0),
  14361. REAL: new BaseType("real", 1),
  14362. STRING: new BaseType("text", 2),
  14363. BOOLEAN: new BaseType("boolean", 3),
  14364. VOID: new BaseType("void", 4),
  14365. UNDEFINED: new BaseType("undefined", 5)
  14366. });
  14367. /***/ }),
  14368. /***/ "./js/typeSystem/compoundType.js":
  14369. /*!***************************************!*\
  14370. !*** ./js/typeSystem/compoundType.js ***!
  14371. \***************************************/
  14372. /*! no static exports found */
  14373. /***/ (function(module, exports, __webpack_require__) {
  14374. "use strict";
  14375. Object.defineProperty(exports, "__esModule", {
  14376. value: true
  14377. });
  14378. exports.CompoundType = undefined;
  14379. 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; }; }();
  14380. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14381. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14382. 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; }
  14383. 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; }
  14384. var CompoundType = exports.CompoundType = function (_Type) {
  14385. _inherits(CompoundType, _Type);
  14386. function CompoundType(type, dimensions) {
  14387. _classCallCheck(this, CompoundType);
  14388. var _this = _possibleConstructorReturn(this, (CompoundType.__proto__ || Object.getPrototypeOf(CompoundType)).call(this, null));
  14389. _this.innerType = type;
  14390. _this.dimensions = dimensions;
  14391. return _this;
  14392. }
  14393. _createClass(CompoundType, [{
  14394. key: "isCompatible",
  14395. value: function isCompatible(another) {
  14396. if (another instanceof CompoundType) {
  14397. if (this.dimensions !== another.dimensions) {
  14398. return false;
  14399. }
  14400. return this.innerType.isCompatible(another.innerType);
  14401. }
  14402. return false;
  14403. }
  14404. }, {
  14405. key: "stringInfo",
  14406. value: function stringInfo() {
  14407. var _this2 = this;
  14408. var list = this.innerType.stringInfo();
  14409. list.forEach(function (v) {
  14410. v.dim = _this2.dimensions;
  14411. });
  14412. return list;
  14413. }
  14414. }, {
  14415. key: "canAccept",
  14416. value: function canAccept(another) {
  14417. if (another instanceof CompoundType) {
  14418. return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
  14419. } else {
  14420. return this.innerType.isCompatible(another);
  14421. }
  14422. }
  14423. }]);
  14424. return CompoundType;
  14425. }(_type.Type);
  14426. /***/ }),
  14427. /***/ "./js/typeSystem/multiType.js":
  14428. /*!************************************!*\
  14429. !*** ./js/typeSystem/multiType.js ***!
  14430. \************************************/
  14431. /*! no static exports found */
  14432. /***/ (function(module, exports, __webpack_require__) {
  14433. "use strict";
  14434. Object.defineProperty(exports, "__esModule", {
  14435. value: true
  14436. });
  14437. exports.MultiType = undefined;
  14438. 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; }; }();
  14439. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14440. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14441. 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; }
  14442. 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; }
  14443. var MultiType = exports.MultiType = function (_Type) {
  14444. _inherits(MultiType, _Type);
  14445. function MultiType(types) {
  14446. _classCallCheck(this, MultiType);
  14447. var _this = _possibleConstructorReturn(this, (MultiType.__proto__ || Object.getPrototypeOf(MultiType)).call(this, null));
  14448. _this.types = types;
  14449. return _this;
  14450. }
  14451. _createClass(MultiType, [{
  14452. key: "stringInfo",
  14453. value: function stringInfo() {
  14454. var list = [];
  14455. for (var i = 0; i < this.types.length; i++) {
  14456. var t = this.types[i];
  14457. list = list.concat(t.stringInfo());
  14458. }
  14459. return list;
  14460. }
  14461. }, {
  14462. key: "isCompatible",
  14463. value: function isCompatible(another) {
  14464. if (another instanceof _type.Type) {
  14465. for (var i = 0; i < this.types.length; i++) {
  14466. var t = this.types[i];
  14467. if (t.isCompatible(another)) {
  14468. return true;
  14469. }
  14470. }
  14471. }
  14472. return false;
  14473. }
  14474. }, {
  14475. key: "value",
  14476. get: function get() {
  14477. return null;
  14478. }
  14479. }, {
  14480. key: "ord",
  14481. get: function get() {
  14482. return null;
  14483. }
  14484. }]);
  14485. return MultiType;
  14486. }(_type.Type);
  14487. /***/ }),
  14488. /***/ "./js/typeSystem/parsers.js":
  14489. /*!**********************************!*\
  14490. !*** ./js/typeSystem/parsers.js ***!
  14491. \**********************************/
  14492. /*! no static exports found */
  14493. /***/ (function(module, exports, __webpack_require__) {
  14494. "use strict";
  14495. Object.defineProperty(exports, "__esModule", {
  14496. value: true
  14497. });
  14498. exports.toInt = toInt;
  14499. exports.toString = toString;
  14500. exports.toReal = toReal;
  14501. exports.toBool = toBool;
  14502. exports.convertToString = convertToString;
  14503. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14504. var _types = __webpack_require__(/*! ./types */ "./js/typeSystem/types.js");
  14505. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  14506. var _decimal2 = _interopRequireDefault(_decimal);
  14507. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14508. function toInt(str) {
  14509. return new _decimal2.default(str);
  14510. }
  14511. function toString(str) {
  14512. var value = str.replace(/^"/, '');
  14513. value = value.replace(/"$/, '');
  14514. value = value.replace(/\\b/g, "\b");
  14515. value = value.replace(/\\t/g, "\t");
  14516. value = value.replace(/\\n/g, "\n");
  14517. value = value.replace(/\\r/g, "\r");
  14518. value = value.replace(/\\\"/g, "\"");
  14519. value = value.replace(/\\\'/g, "\'");
  14520. value = value.replace(/\\\\/g, "\\");
  14521. return value;
  14522. }
  14523. function toReal(value) {
  14524. return new _decimal2.default(value);
  14525. }
  14526. function toBool(str) {
  14527. var val = "'" + str + "'";
  14528. var lexer = _languageService.LanguageService.getCurrentLexer();
  14529. var instance = new lexer(null);
  14530. if (instance.literalNames[lexer.RK_TRUE] === val) {
  14531. return true;
  14532. } else if (instance.literalNames[lexer.RK_FALSE] === val) {
  14533. return false;
  14534. } else {
  14535. // TODO: better error message
  14536. throw new Error(str + "not a valid boolean");
  14537. }
  14538. }
  14539. function convertBoolToString(bool) {
  14540. var lexer = _languageService.LanguageService.getCurrentLexer();
  14541. var instance = new lexer(null);
  14542. if (bool) {
  14543. return instance.literalNames[lexer.RK_TRUE];
  14544. } else {
  14545. return instance.literalNames[lexer.RK_FALSE];
  14546. }
  14547. }
  14548. function convertToString(stoObj, type) {
  14549. switch (type.ord) {
  14550. case _types.Types.INTEGER.ord:
  14551. return stoObj.toString();
  14552. case _types.Types.REAL.ord:
  14553. {
  14554. if (stoObj.dp() <= 0) {
  14555. return stoObj.toFixed(1);
  14556. } else {
  14557. return stoObj.toNumber();
  14558. }
  14559. }
  14560. case _types.Types.BOOLEAN.ord:
  14561. return convertBoolToString(stoObj);
  14562. default:
  14563. return stoObj;
  14564. }
  14565. }
  14566. /***/ }),
  14567. /***/ "./js/typeSystem/type.js":
  14568. /*!*******************************!*\
  14569. !*** ./js/typeSystem/type.js ***!
  14570. \*******************************/
  14571. /*! no static exports found */
  14572. /***/ (function(module, exports, __webpack_require__) {
  14573. "use strict";
  14574. Object.defineProperty(exports, "__esModule", {
  14575. value: true
  14576. });
  14577. 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; }; }();
  14578. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14579. var Type = exports.Type = function () {
  14580. function Type(baseType) {
  14581. _classCallCheck(this, Type);
  14582. this.baseType = baseType;
  14583. }
  14584. _createClass(Type, [{
  14585. key: "stringInfo",
  14586. value: function stringInfo() {
  14587. return [{ type: this.baseType.name, dim: 0 }];
  14588. }
  14589. }, {
  14590. key: "isCompatible",
  14591. value: function isCompatible(another) {
  14592. if (another instanceof Type) {
  14593. return this.baseType.isCompatible(another.baseType);
  14594. }
  14595. return false;
  14596. }
  14597. }, {
  14598. key: "value",
  14599. get: function get() {
  14600. return this.baseType.value;
  14601. }
  14602. }, {
  14603. key: "ord",
  14604. get: function get() {
  14605. return this.baseType.ord;
  14606. }
  14607. }]);
  14608. return Type;
  14609. }();
  14610. /***/ }),
  14611. /***/ "./js/typeSystem/types.js":
  14612. /*!********************************!*\
  14613. !*** ./js/typeSystem/types.js ***!
  14614. \********************************/
  14615. /*! no static exports found */
  14616. /***/ (function(module, exports, __webpack_require__) {
  14617. "use strict";
  14618. Object.defineProperty(exports, "__esModule", {
  14619. value: true
  14620. });
  14621. exports.Types = undefined;
  14622. var _baseTypes = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  14623. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14624. var _multiType = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.js");
  14625. var INTEGER = new _type.Type(_baseTypes.BaseTypes.INTEGER);
  14626. var REAL = new _type.Type(_baseTypes.BaseTypes.REAL);
  14627. var STRING = new _type.Type(_baseTypes.BaseTypes.STRING);
  14628. var BOOLEAN = new _type.Type(_baseTypes.BaseTypes.BOOLEAN);
  14629. var VOID = new _type.Type(_baseTypes.BaseTypes.VOID);
  14630. var UNDEFINED = new _type.Type(_baseTypes.BaseTypes.UNDEFINED);
  14631. var ALL = new _multiType.MultiType([INTEGER, REAL, STRING, BOOLEAN]);
  14632. var Types = exports.Types = Object.freeze({
  14633. INTEGER: INTEGER,
  14634. REAL: REAL,
  14635. STRING: STRING,
  14636. BOOLEAN: BOOLEAN,
  14637. VOID: VOID,
  14638. UNDEFINED: UNDEFINED,
  14639. ALL: ALL
  14640. });
  14641. /***/ }),
  14642. /***/ "./js/util/config.js":
  14643. /*!***************************!*\
  14644. !*** ./js/util/config.js ***!
  14645. \***************************/
  14646. /*! no static exports found */
  14647. /***/ (function(module, exports, __webpack_require__) {
  14648. "use strict";
  14649. Object.defineProperty(exports, "__esModule", {
  14650. value: true
  14651. });
  14652. 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; }; }();
  14653. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14654. var ConfigObject = function () {
  14655. function ConfigObject() {
  14656. _classCallCheck(this, ConfigObject);
  14657. this.loopTimeout = 5000;
  14658. this.decimalPlaces = 5;
  14659. this.intConvertRoundMode = 2;
  14660. }
  14661. _createClass(ConfigObject, [{
  14662. key: "setConfig",
  14663. value: function setConfig(opts) {
  14664. for (var key in opts) {
  14665. if (this.hasOwnProperty(key)) {
  14666. this[key] = opts[key];
  14667. }
  14668. }
  14669. }
  14670. }]);
  14671. return ConfigObject;
  14672. }();
  14673. var config = new ConfigObject();
  14674. var Config = exports.Config = config;
  14675. /***/ }),
  14676. /***/ "./js/util/inputTest.js":
  14677. /*!******************************!*\
  14678. !*** ./js/util/inputTest.js ***!
  14679. \******************************/
  14680. /*! no static exports found */
  14681. /***/ (function(module, exports, __webpack_require__) {
  14682. "use strict";
  14683. Object.defineProperty(exports, "__esModule", {
  14684. value: true
  14685. });
  14686. exports.InputTest = undefined;
  14687. 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; }; }();
  14688. var _input = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  14689. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14690. 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; }
  14691. 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; }
  14692. var InputTest = exports.InputTest = function (_Input) {
  14693. _inherits(InputTest, _Input);
  14694. function InputTest(inputList) {
  14695. _classCallCheck(this, InputTest);
  14696. var _this = _possibleConstructorReturn(this, (InputTest.__proto__ || Object.getPrototypeOf(InputTest)).call(this));
  14697. _this.index = 0;
  14698. _this.inputList = inputList;
  14699. return _this;
  14700. }
  14701. _createClass(InputTest, [{
  14702. key: 'requestInput',
  14703. value: function requestInput(callback) {
  14704. if (this.index < this.inputList.length) {
  14705. callback(this.inputList[this.index]);
  14706. this.index++;
  14707. } else {
  14708. throw new Error('The amount of requests exceeded the amount of available inputs');
  14709. }
  14710. }
  14711. }]);
  14712. return InputTest;
  14713. }(_input.Input);
  14714. /***/ }),
  14715. /***/ "./js/util/outputTest.js":
  14716. /*!*******************************!*\
  14717. !*** ./js/util/outputTest.js ***!
  14718. \*******************************/
  14719. /*! no static exports found */
  14720. /***/ (function(module, exports, __webpack_require__) {
  14721. "use strict";
  14722. Object.defineProperty(exports, "__esModule", {
  14723. value: true
  14724. });
  14725. exports.OutputTest = undefined;
  14726. 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; }; }();
  14727. var _output = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  14728. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14729. 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; }
  14730. 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; }
  14731. var OutputTest = exports.OutputTest = function (_Output) {
  14732. _inherits(OutputTest, _Output);
  14733. function OutputTest() {
  14734. _classCallCheck(this, OutputTest);
  14735. var _this = _possibleConstructorReturn(this, (OutputTest.__proto__ || Object.getPrototypeOf(OutputTest)).call(this));
  14736. _this.list = [];
  14737. return _this;
  14738. }
  14739. _createClass(OutputTest, [{
  14740. key: 'sendOutput',
  14741. value: function sendOutput(text) {
  14742. this.list.push(text);
  14743. }
  14744. }]);
  14745. return OutputTest;
  14746. }(_output.Output);
  14747. /***/ }),
  14748. /***/ "./js/visualUI/algorithm.js":
  14749. /*!**********************************!*\
  14750. !*** ./js/visualUI/algorithm.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.renderAlgorithm = renderAlgorithm;
  14759. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14760. var _jquery2 = _interopRequireDefault(_jquery);
  14761. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  14762. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14763. var Models = _interopRequireWildcard(_ivprog_elements);
  14764. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14765. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  14766. var GlobalsManagement = _interopRequireWildcard(_globals);
  14767. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  14768. var VariablesManagement = _interopRequireWildcard(_variables);
  14769. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  14770. var CommandsManagement = _interopRequireWildcard(_commands);
  14771. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  14772. var CodeManagement = _interopRequireWildcard(_code_generator);
  14773. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14774. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  14775. var _functions = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
  14776. var FunctionsManagement = _interopRequireWildcard(_functions);
  14777. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  14778. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  14779. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  14780. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14781. 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; } }
  14782. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14783. var block_render = false;
  14784. function renderAlgorithm() {
  14785. console.log('rendering algorithm...');
  14786. if (block_render) {
  14787. return;
  14788. }
  14789. block_render = true;
  14790. (0, _jquery2.default)('.all_functions').children().off();
  14791. (0, _jquery2.default)('.all_functions').empty();
  14792. (0, _jquery2.default)('.list_globals').children().off();
  14793. (0, _jquery2.default)('.list_globals').empty();
  14794. for (var i = 0; i < window.program_obj.functions.length; i++) {
  14795. FunctionsManagement.renderFunction(window.program_obj.functions[i]);
  14796. }
  14797. for (var i = 0; i < window.program_obj.globals.length; i++) {
  14798. GlobalsManagement.renderGlobal(window.program_obj.globals[i]);
  14799. }
  14800. setTimeout(function () {
  14801. block_render = false;
  14802. }, 500);
  14803. }
  14804. /***/ }),
  14805. /***/ "./js/visualUI/code_generator.js":
  14806. /*!***************************************!*\
  14807. !*** ./js/visualUI/code_generator.js ***!
  14808. \***************************************/
  14809. /*! no static exports found */
  14810. /***/ (function(module, exports, __webpack_require__) {
  14811. "use strict";
  14812. Object.defineProperty(exports, "__esModule", {
  14813. value: true
  14814. });
  14815. exports.generate = generate;
  14816. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14817. var _jquery2 = _interopRequireDefault(_jquery);
  14818. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  14819. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14820. var Models = _interopRequireWildcard(_ivprog_elements);
  14821. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14822. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  14823. var GlobalsManagement = _interopRequireWildcard(_globals);
  14824. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  14825. var VariablesManagement = _interopRequireWildcard(_variables);
  14826. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  14827. var CommandsManagement = _interopRequireWildcard(_commands);
  14828. 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; } }
  14829. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14830. function generate() {
  14831. (0, _jquery2.default)('.ivprog_visual_panel').find('.error_icon').remove();
  14832. var code = _localizedStringsService.LocalizedStrings.getUI('program') + ' { ';
  14833. code += globalsCode();
  14834. code += '\n';
  14835. var has_error = false;
  14836. for (var i = 0; i < window.program_obj.functions.length; i++) {
  14837. var n_code = functionsCode(window.program_obj.functions[i]);
  14838. if (n_code == null) {
  14839. has_error = true;
  14840. }
  14841. code += n_code;
  14842. code += '\n';
  14843. }
  14844. code += '\n}';
  14845. if (has_error) {
  14846. return null;
  14847. } else {
  14848. return code;
  14849. }
  14850. }
  14851. function functionsCode(function_obj) {
  14852. var ret = '\n\t' + _localizedStringsService.LocalizedStrings.getUI('function') + ' ';
  14853. var has_error = false;
  14854. switch (function_obj.return_type) {
  14855. case _types.Types.INTEGER:
  14856. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  14857. break;
  14858. case _types.Types.REAL:
  14859. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  14860. break;
  14861. case _types.Types.TEXT:
  14862. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  14863. break;
  14864. case _types.Types.BOOLEAN:
  14865. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  14866. break;
  14867. case _types.Types.VOID:
  14868. ret += _localizedStringsService.LocalizedStrings.getUI('void');
  14869. break;
  14870. }
  14871. ret += ' ';
  14872. if (function_obj.return_dimensions == 1) {
  14873. ret += '[] ';
  14874. } else if (function_obj.return_dimensions == 2) {
  14875. ret += '[][] ';
  14876. }
  14877. ret += function_obj.name + ' ( ';
  14878. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  14879. ret += parametersCode(function_obj.parameters_list[j]);
  14880. if (j + 1 < function_obj.parameters_list.length) {
  14881. ret += ',';
  14882. }
  14883. }
  14884. ret += ' ) {';
  14885. for (var j = 0; j < function_obj.variables_list.length; j++) {
  14886. ret += variablesCode(function_obj.variables_list[j]);
  14887. }
  14888. for (var j = 0; j < function_obj.commands.length; j++) {
  14889. //try {
  14890. ret += commandsCode(function_obj.commands[j]);
  14891. /*} catch (err) {
  14892. has_error = true;
  14893. console.error(err.message);
  14894. var todos = $('body').find('.command_container');
  14895. for (var i = 0; i < todos.length; i++) {
  14896. if ($(todos[i]).data('command') == function_obj.commands[j]) {
  14897. $( todos[i] ).prepend( ' <i class="ui icon red exclamation triangle error_icon"></i> ' );
  14898. break;
  14899. }
  14900. }
  14901. }*/
  14902. }
  14903. ret += '\n\t}';
  14904. if (has_error) {
  14905. return null;
  14906. } else {
  14907. return ret;
  14908. }
  14909. }
  14910. function commandsCode(command_obj) {
  14911. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  14912. switch (command_obj.type) {
  14913. case Models.COMMAND_TYPES.break:
  14914. return breaksCode(command_obj, indentation);
  14915. case Models.COMMAND_TYPES.comment:
  14916. return commentsCode(command_obj, indentation);
  14917. case Models.COMMAND_TYPES.reader:
  14918. return readersCode(command_obj, indentation);
  14919. case Models.COMMAND_TYPES.writer:
  14920. return writersCode(command_obj, indentation);
  14921. case Models.COMMAND_TYPES.functioncall:
  14922. return functioncallsCode(command_obj, indentation);
  14923. case Models.COMMAND_TYPES.attribution:
  14924. return attributionsCode(command_obj, indentation);
  14925. case Models.COMMAND_TYPES.whiletrue:
  14926. return whiletruesCode(command_obj, indentation);
  14927. case Models.COMMAND_TYPES.dowhiletrue:
  14928. return doWhilesCode(command_obj, indentation);
  14929. case Models.COMMAND_TYPES.iftrue:
  14930. return iftruesCode(command_obj, indentation);
  14931. case Models.COMMAND_TYPES.repeatNtimes:
  14932. return repeatNtimesCode(command_obj, indentation);
  14933. case Models.COMMAND_TYPES.switch:
  14934. return switchsCode(command_obj, indentation);
  14935. case Models.COMMAND_TYPES.return:
  14936. return returnsCode(command_obj, indentation);
  14937. }
  14938. }
  14939. function returnsCode(command_obj, indentation) {
  14940. var ret = '\n';
  14941. for (var i = 0; i < indentation; i++) {
  14942. ret += '\t';
  14943. }
  14944. ret += _localizedStringsService.LocalizedStrings.getUI('text_return');
  14945. if (command_obj.variable_value_menu) {
  14946. try {
  14947. ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu);
  14948. } catch (err) {}
  14949. }
  14950. return ret;
  14951. }
  14952. function breaksCode(command_obj, indentation) {
  14953. var ret = '\n';
  14954. for (var i = 0; i < indentation; i++) {
  14955. ret += '\t';
  14956. }
  14957. ret += _localizedStringsService.LocalizedStrings.getUI('text_break');
  14958. return ret;
  14959. }
  14960. function switchsCode(command_obj, indentation) {
  14961. var ret = '\n';
  14962. for (var i = 0; i < indentation; i++) {
  14963. ret += '\t';
  14964. }
  14965. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( ';
  14966. ret += variableValueMenuCode(command_obj.variable);
  14967. ret += ' ) { ';
  14968. if (command_obj.cases) {
  14969. for (var i = 0; i < command_obj.cases.length; i++) {
  14970. ret += switchcasesCode(command_obj.cases[i], indentation + 1);
  14971. }
  14972. }
  14973. ret += '\n';
  14974. for (var i = 0; i < indentation; i++) {
  14975. ret += '\t';
  14976. }
  14977. ret += '} ';
  14978. return ret;
  14979. }
  14980. function switchcasesCode(switchcase, indentation) {
  14981. var ret = '\n';
  14982. for (var i = 0; i < indentation; i++) {
  14983. ret += '\t';
  14984. }
  14985. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' ';
  14986. ret += variableValueMenuCode(switchcase.variable_value_menu);
  14987. ret += ' :';
  14988. if (switchcase.commands_block) {
  14989. for (var i = 0; i < switchcase.commands_block.length; i++) {
  14990. ret += commandsCode(switchcase.commands_block[i], indentation + 1);
  14991. }
  14992. }
  14993. return ret;
  14994. }
  14995. function repeatNtimesCode(command_obj, indentation) {
  14996. var ret = '\n';
  14997. for (var i = 0; i < indentation; i++) {
  14998. ret += '\t';
  14999. }
  15000. ret += _localizedStringsService.LocalizedStrings.getUI('text_for') + ' ( ';
  15001. if (command_obj.var_attribution) {
  15002. ret += variableValueMenuCode(command_obj.var_attribution);
  15003. ret += ' = ';
  15004. ret += variableValueMenuCode(command_obj.expression1);
  15005. }
  15006. ret += ' ; ';
  15007. if (command_obj.expression2) {
  15008. switch (command_obj.expression2.expression.type) {
  15009. case Models.EXPRESSION_TYPES.exp_logic:
  15010. ret += logicExpressionCode(command_obj.expression2.expression);
  15011. break;
  15012. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15013. ret += arithmeticExpressionCode(command_obj.expression2.expression);
  15014. break;
  15015. }
  15016. }
  15017. ret += ' ; ';
  15018. if (command_obj.var_incrementation) {
  15019. ret += variableValueMenuCode(command_obj.var_incrementation);
  15020. ret += ' = ';
  15021. ret += variableValueMenuCode(command_obj.expression3.itens[0]);
  15022. switch (command_obj.expression3.itens[1]) {
  15023. case Models.ARITHMETIC_TYPES.plus:
  15024. ret += ' + ';
  15025. break;
  15026. case Models.ARITHMETIC_TYPES.minus:
  15027. ret += ' - ';
  15028. break;
  15029. case Models.ARITHMETIC_TYPES.multiplication:
  15030. ret += ' * ';
  15031. break;
  15032. case Models.ARITHMETIC_TYPES.division:
  15033. ret += ' / ';
  15034. break;
  15035. case Models.ARITHMETIC_TYPES.module:
  15036. ret += ' % ';
  15037. break;
  15038. }
  15039. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  15040. }
  15041. ret += ' ) { ';
  15042. if (command_obj.commands_block) {
  15043. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15044. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15045. }
  15046. }
  15047. ret += '\n';
  15048. for (var i = 0; i < indentation; i++) {
  15049. ret += '\t';
  15050. }
  15051. ret += '}';
  15052. return ret;
  15053. }
  15054. function iftruesCode(command_obj, indentation) {
  15055. var ret = '\n';
  15056. for (var i = 0; i < indentation; i++) {
  15057. ret += '\t';
  15058. }
  15059. ret += _localizedStringsService.LocalizedStrings.getUI('text_if');
  15060. switch (command_obj.expression.expression.type) {
  15061. case Models.EXPRESSION_TYPES.exp_logic:
  15062. ret += logicExpressionCode(command_obj.expression.expression);
  15063. break;
  15064. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15065. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15066. break;
  15067. }
  15068. ret += ' { ';
  15069. if (command_obj.commands_block) {
  15070. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15071. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15072. }
  15073. }
  15074. ret += '\n';
  15075. for (var i = 0; i < indentation; i++) {
  15076. ret += '\t';
  15077. }
  15078. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' {';
  15079. if (command_obj.commands_else) {
  15080. for (var i = 0; i < command_obj.commands_else.length; i++) {
  15081. ret += commandsCode(command_obj.commands_else[i], indentation + 1);
  15082. }
  15083. }
  15084. ret += '\n';
  15085. for (var i = 0; i < indentation; i++) {
  15086. ret += '\t';
  15087. }
  15088. ret += '}';
  15089. return ret;
  15090. }
  15091. function doWhilesCode(command_obj, indentation) {
  15092. var ret = '\n';
  15093. for (var i = 0; i < indentation; i++) {
  15094. ret += '\t';
  15095. }
  15096. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_do') + ' { ';
  15097. if (command_obj.commands_block) {
  15098. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15099. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15100. }
  15101. }
  15102. ret += '\n';
  15103. for (var i = 0; i < indentation; i++) {
  15104. ret += '\t';
  15105. }
  15106. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15107. switch (command_obj.expression.expression.type) {
  15108. case Models.EXPRESSION_TYPES.exp_logic:
  15109. ret += logicExpressionCode(command_obj.expression.expression);
  15110. break;
  15111. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15112. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15113. break;
  15114. }
  15115. return ret;
  15116. }
  15117. function whiletruesCode(command_obj, indentation) {
  15118. var ret = '\n';
  15119. for (var i = 0; i < indentation; i++) {
  15120. ret += '\t';
  15121. }
  15122. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15123. switch (command_obj.expression.expression.type) {
  15124. case Models.EXPRESSION_TYPES.exp_logic:
  15125. ret += logicExpressionCode(command_obj.expression.expression);
  15126. break;
  15127. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15128. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15129. break;
  15130. }
  15131. ret += ' { ';
  15132. if (command_obj.commands_block) {
  15133. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15134. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15135. }
  15136. }
  15137. ret += '\n';
  15138. for (var i = 0; i < indentation; i++) {
  15139. ret += '\t';
  15140. }
  15141. ret += '}';
  15142. return ret;
  15143. }
  15144. function logicExpressionCode(expression) {
  15145. var ret = ' ( ';
  15146. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15147. ret += logicExpressionCode(expression.first_operand);
  15148. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15149. ret += arithmeticExpressionCode(expression.first_operand);
  15150. } else {
  15151. ret += variableValueMenuCode(expression.first_operand);
  15152. }
  15153. if (expression.operator) {
  15154. switch (expression.operator) {
  15155. case Models.LOGIC_COMPARISON.equals_to:
  15156. ret += ' == ';
  15157. break;
  15158. case Models.LOGIC_COMPARISON.not_equals_to:
  15159. ret += ' != ';
  15160. break;
  15161. case Models.LOGIC_COMPARISON.and:
  15162. ret += ' && ';
  15163. break;
  15164. case Models.LOGIC_COMPARISON.or:
  15165. ret += ' || ';
  15166. break;
  15167. }
  15168. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15169. ret += logicExpressionCode(expression.second_operand);
  15170. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15171. ret += arithmeticExpressionCode(expression.second_operand);
  15172. } else {
  15173. ret += variableValueMenuCode(expression.second_operand);
  15174. }
  15175. }
  15176. ret += ' ) ';
  15177. return ret;
  15178. }
  15179. function arithmeticExpressionCode(expression) {
  15180. var ret = ' ( ';
  15181. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15182. ret += logicExpressionCode(expression.first_operand);
  15183. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15184. ret += arithmeticExpressionCode(expression.first_operand);
  15185. } else {
  15186. ret += variableValueMenuCode(expression.first_operand);
  15187. }
  15188. switch (expression.operator) {
  15189. case Models.ARITHMETIC_COMPARISON.greater_than:
  15190. ret += ' > ';
  15191. break;
  15192. case Models.ARITHMETIC_COMPARISON.less_than:
  15193. ret += ' < ';
  15194. break;
  15195. case Models.ARITHMETIC_COMPARISON.equals_to:
  15196. ret += ' == ';
  15197. break;
  15198. case Models.ARITHMETIC_COMPARISON.not_equals_to:
  15199. ret += ' != ';
  15200. break;
  15201. case Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
  15202. ret += ' >= ';
  15203. break;
  15204. case Models.ARITHMETIC_COMPARISON.less_than_or_equals_to:
  15205. ret += ' <= ';
  15206. break;
  15207. }
  15208. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15209. ret += logicExpressionCode(expression.second_operand);
  15210. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15211. ret += arithmeticExpressionCode(expression.second_operand);
  15212. } else {
  15213. ret += variableValueMenuCode(expression.second_operand);
  15214. }
  15215. ret += ' ) ';
  15216. return ret;
  15217. }
  15218. function attributionsCode(command_obj, indentation) {
  15219. var ret = '\n';
  15220. for (var i = 0; i < indentation; i++) {
  15221. ret += '\t';
  15222. }
  15223. ret += variableValueMenuCode(command_obj.variable) + ' = ';
  15224. for (var i = 0; i < command_obj.expression.length; i++) {
  15225. ret += elementExpressionCode(command_obj.expression[i]);
  15226. }
  15227. return ret;
  15228. }
  15229. function elementExpressionCode(expression_obj) {
  15230. var ret = '';
  15231. for (var i = 0; i < expression_obj.itens.length; i++) {
  15232. if (expression_obj.itens[i].type) {
  15233. ret += variableValueMenuCode(expression_obj.itens[i]);
  15234. } else if (expression_obj.itens[i].type_exp) {
  15235. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15236. ret += ' ( ';
  15237. }
  15238. ret += elementExpressionCode(expression_obj.itens[i]);
  15239. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15240. ret += ' ) ';
  15241. }
  15242. } else {
  15243. switch (expression_obj.itens[i]) {
  15244. case Models.ARITHMETIC_TYPES.plus:
  15245. ret += ' + ';
  15246. break;
  15247. case Models.ARITHMETIC_TYPES.minus:
  15248. ret += ' - ';
  15249. break;
  15250. case Models.ARITHMETIC_TYPES.multiplication:
  15251. ret += ' * ';
  15252. break;
  15253. case Models.ARITHMETIC_TYPES.division:
  15254. ret += ' / ';
  15255. break;
  15256. case Models.ARITHMETIC_TYPES.module:
  15257. ret += ' % ';
  15258. break;
  15259. }
  15260. }
  15261. }
  15262. return ret;
  15263. }
  15264. function functioncallsCode(command_obj, indentation) {
  15265. var ret = '\n';
  15266. for (var i = 0; i < indentation; i++) {
  15267. ret += '\t';
  15268. }
  15269. ret += variableValueMenuCode(command_obj.function_called);
  15270. return ret;
  15271. }
  15272. function readersCode(command_obj, indentation) {
  15273. var ret = '\n';
  15274. for (var i = 0; i < indentation; i++) {
  15275. ret += '\t';
  15276. }
  15277. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( ';
  15278. ret += variableValueMenuCode(command_obj.variable_value_menu);
  15279. ret += ' ) ';
  15280. return ret;
  15281. }
  15282. function variableValueMenuCode(variable_obj) {
  15283. var ret = '';
  15284. if (variable_obj.function_called) {
  15285. if (variable_obj.function_called.name) {
  15286. ret += variable_obj.function_called.name + ' ( ';
  15287. } else {
  15288. ret += _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + ' ( ';
  15289. }
  15290. if (variable_obj.parameters_list) {
  15291. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  15292. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  15293. if (i + 1 < variable_obj.parameters_list.length) {
  15294. ret += ', ';
  15295. }
  15296. }
  15297. }
  15298. ret += ' )';
  15299. } else if (variable_obj.content.type) {
  15300. ret += variable_obj.content.name;
  15301. if (variable_obj.content.dimensions == 1) {
  15302. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15303. }
  15304. if (variable_obj.content.dimensions == 2) {
  15305. ret += ' [ ' + variableValueMenuCode(variable_obj.row) + ' ] ';
  15306. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15307. }
  15308. } else {
  15309. if (isNaN(variable_obj.content)) {
  15310. ret += '"' + variable_obj.content + '"';
  15311. } else {
  15312. ret += variable_obj.content;
  15313. }
  15314. }
  15315. return ret;
  15316. }
  15317. function writersCode(command_obj, indentation) {
  15318. var ret = '\n';
  15319. for (var i = 0; i < indentation; i++) {
  15320. ret += '\t';
  15321. }
  15322. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( ';
  15323. for (var i = 0; i < command_obj.content.length; i++) {
  15324. ret += variableValueMenuCode(command_obj.content[i]);
  15325. if (i + 1 < command_obj.content.length) {
  15326. ret += ' + ';
  15327. }
  15328. }
  15329. ret += ' ) ';
  15330. return ret;
  15331. }
  15332. function commentsCode(command_obj, indentation) {
  15333. var ret = '\n';
  15334. for (var i = 0; i < indentation; i++) {
  15335. ret += '\t';
  15336. }
  15337. ret += '// ';
  15338. ret += command_obj.comment_text.content;
  15339. return ret;
  15340. }
  15341. function parametersCode(parameter_obj) {
  15342. var ret = '';
  15343. switch (parameter_obj.type) {
  15344. case _types.Types.INTEGER:
  15345. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15346. break;
  15347. case _types.Types.REAL:
  15348. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15349. break;
  15350. case _types.Types.TEXT:
  15351. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15352. break;
  15353. case _types.Types.BOOLEAN:
  15354. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15355. break;
  15356. }
  15357. ret += parameter_obj.name + '';
  15358. if (parameter_obj.dimensions == 1) {
  15359. ret += ' []';
  15360. } else if (parameter_obj.dimensions == 2) {
  15361. ret += ' [][]';
  15362. }
  15363. return ret;
  15364. }
  15365. function variablesCode(variable_obj) {
  15366. var ret = '';
  15367. var temp = variable_obj;
  15368. ret += '\n\t\t';
  15369. if (temp.is_constant) {
  15370. ret += 'const ';
  15371. }
  15372. switch (temp.type) {
  15373. case _types.Types.INTEGER:
  15374. ret += _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15375. break;
  15376. case _types.Types.REAL:
  15377. ret += _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15378. break;
  15379. case _types.Types.TEXT:
  15380. ret += _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15381. break;
  15382. case _types.Types.BOOLEAN:
  15383. ret += _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15384. break;
  15385. }
  15386. ret += temp.name + ' ';
  15387. if (temp.dimensions == 1) {
  15388. ret += '[' + temp.columns + '] ';
  15389. switch (temp.type) {
  15390. case _types.Types.INTEGER:
  15391. ret += '= {' + temp.value + '}';
  15392. break;
  15393. case _types.Types.REAL:
  15394. ret += '= {' + temp.value.toFixed(2) + '}';
  15395. break;
  15396. case _types.Types.TEXT:
  15397. ret += '= {';
  15398. for (var j = 0; j < temp.value.length; j++) {
  15399. ret += '"' + temp.value[j] + '"';
  15400. if (j + 1 < temp.value.length) {
  15401. ret += ',';
  15402. }
  15403. }
  15404. ret += '}';
  15405. break;
  15406. case _types.Types.BOOLEAN:
  15407. ret += '= {';
  15408. for (var j = 0; j < temp.value.length; j++) {
  15409. if (temp.value[j]) {
  15410. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15411. } else {
  15412. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15413. }
  15414. if (j + 1 < temp.value.length) {
  15415. ret += ',';
  15416. }
  15417. }
  15418. ret += '}';
  15419. break;
  15420. }
  15421. } else if (temp.dimensions == 2) {
  15422. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15423. switch (temp.type) {
  15424. case _types.Types.INTEGER:
  15425. ret += '= {';
  15426. for (var j = 0; j < temp.rows; j++) {
  15427. ret += '{' + temp.value[j] + '}';
  15428. if (j + 1 < temp.rows) {
  15429. ret += ',';
  15430. }
  15431. }
  15432. ret += '}';
  15433. break;
  15434. case _types.Types.REAL:
  15435. ret += '= {';
  15436. for (var j = 0; j < temp.rows; j++) {
  15437. ret += '{' + temp.value[j].toFixed(2) + '}';
  15438. if (j + 1 < temp.rows) {
  15439. ret += ',';
  15440. }
  15441. }
  15442. ret += '}';
  15443. break;
  15444. case _types.Types.TEXT:
  15445. ret += '= {';
  15446. for (var j = 0; j < temp.rows; j++) {
  15447. ret += '{';
  15448. for (var k = 0; k < temp.columns; k++) {
  15449. ret += '"' + temp.value[j][k] + '"';
  15450. if (k + 1 < temp.columns) {
  15451. ret += ',';
  15452. }
  15453. }
  15454. ret += '}';
  15455. if (j + 1 < temp.rows) {
  15456. ret += ',';
  15457. }
  15458. }
  15459. ret += '}';
  15460. break;
  15461. case _types.Types.BOOLEAN:
  15462. ret += '= {';
  15463. for (var j = 0; j < temp.rows; j++) {
  15464. ret += '{';
  15465. for (var k = 0; k < temp.columns; k++) {
  15466. if (temp.value[j][k]) {
  15467. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15468. } else {
  15469. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15470. }
  15471. if (k + 1 < temp.columns) {
  15472. ret += ',';
  15473. }
  15474. }
  15475. ret += '}';
  15476. if (j + 1 < temp.rows) {
  15477. ret += ',';
  15478. }
  15479. }
  15480. ret += '}';
  15481. break;
  15482. }
  15483. } else {
  15484. switch (temp.type) {
  15485. case _types.Types.INTEGER:
  15486. ret += '= ' + temp.value;
  15487. break;
  15488. case _types.Types.REAL:
  15489. ret += '= ' + temp.value.toFixed(2);
  15490. break;
  15491. case _types.Types.TEXT:
  15492. ret += '= "' + temp.value + '"';
  15493. break;
  15494. case _types.Types.BOOLEAN:
  15495. ret += '= ';
  15496. if (temp.value) {
  15497. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15498. } else {
  15499. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15500. }
  15501. break;
  15502. }
  15503. }
  15504. return ret;
  15505. }
  15506. function globalsCode() {
  15507. var ret = '';
  15508. if (window.program_obj.globals) {
  15509. for (var i = 0; i < window.program_obj.globals.length; i++) {
  15510. var temp = window.program_obj.globals[i];
  15511. ret += '\n\t';
  15512. if (temp.is_constant) {
  15513. ret += 'const ';
  15514. }
  15515. switch (temp.type) {
  15516. case _types.Types.INTEGER:
  15517. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  15518. break;
  15519. case _types.Types.REAL:
  15520. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  15521. break;
  15522. case _types.Types.TEXT:
  15523. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  15524. break;
  15525. case _types.Types.BOOLEAN:
  15526. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  15527. break;
  15528. }
  15529. ret += ' ' + temp.name + ' ';
  15530. if (temp.dimensions == 1) {
  15531. ret += '[' + temp.columns + '] ';
  15532. switch (temp.type) {
  15533. case _types.Types.INTEGER:
  15534. ret += '= {' + temp.value + '}';
  15535. break;
  15536. case _types.Types.REAL:
  15537. ret += '= {';
  15538. for (var j = 0; j < temp.value.length; j++) {
  15539. ret += temp.value[j].toFixed(2);
  15540. if (j + 1 < temp.value.length) {
  15541. ret += ',';
  15542. }
  15543. }
  15544. ret += '}';
  15545. break;
  15546. case _types.Types.TEXT:
  15547. ret += '= {';
  15548. for (var j = 0; j < temp.value.length; j++) {
  15549. ret += '"' + temp.value[j] + '"';
  15550. if (j + 1 < temp.value.length) {
  15551. ret += ',';
  15552. }
  15553. }
  15554. ret += '}';
  15555. break;
  15556. case _types.Types.BOOLEAN:
  15557. ret += '= {';
  15558. for (var j = 0; j < temp.value.length; j++) {
  15559. if (temp.value[j]) {
  15560. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15561. } else {
  15562. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15563. }
  15564. if (j + 1 < temp.value.length) {
  15565. ret += ',';
  15566. }
  15567. }
  15568. ret += '}';
  15569. break;
  15570. }
  15571. } else if (temp.dimensions == 2) {
  15572. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15573. switch (temp.type) {
  15574. case _types.Types.INTEGER:
  15575. ret += '= {';
  15576. for (var j = 0; j < temp.rows; j++) {
  15577. ret += '{' + temp.value[j] + '}';
  15578. if (j + 1 < temp.rows) {
  15579. ret += ',';
  15580. }
  15581. }
  15582. ret += '}';
  15583. break;
  15584. case _types.Types.REAL:
  15585. ret += '= {';
  15586. for (var j = 0; j < temp.rows; j++) {
  15587. ret += '{';
  15588. for (var k = 0; k < temp.columns; k++) {
  15589. ret += temp.value[j][k].toFixed(2);
  15590. if (k + 1 < temp.columns) {
  15591. ret += ',';
  15592. }
  15593. }
  15594. ret += '}';
  15595. if (j + 1 < temp.rows) {
  15596. ret += ',';
  15597. }
  15598. }
  15599. ret += '}';
  15600. break;
  15601. case _types.Types.TEXT:
  15602. ret += '= {';
  15603. for (var j = 0; j < temp.rows; j++) {
  15604. ret += '{';
  15605. for (var k = 0; k < temp.columns; k++) {
  15606. ret += '"' + temp.value[j][k] + '"';
  15607. if (k + 1 < temp.columns) {
  15608. ret += ',';
  15609. }
  15610. }
  15611. ret += '}';
  15612. if (j + 1 < temp.rows) {
  15613. ret += ',';
  15614. }
  15615. }
  15616. ret += '}';
  15617. break;
  15618. case _types.Types.BOOLEAN:
  15619. ret += '= {';
  15620. for (var j = 0; j < temp.rows; j++) {
  15621. ret += '{';
  15622. for (var k = 0; k < temp.columns; k++) {
  15623. if (temp.value[j][k]) {
  15624. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15625. } else {
  15626. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15627. }
  15628. if (k + 1 < temp.columns) {
  15629. ret += ',';
  15630. }
  15631. }
  15632. ret += '}';
  15633. if (j + 1 < temp.rows) {
  15634. ret += ',';
  15635. }
  15636. }
  15637. ret += '}';
  15638. break;
  15639. }
  15640. } else {
  15641. switch (temp.type) {
  15642. case _types.Types.INTEGER:
  15643. ret += '= ' + temp.value;
  15644. break;
  15645. case _types.Types.REAL:
  15646. ret += '= ' + temp.value.toFixed(2);
  15647. break;
  15648. case _types.Types.TEXT:
  15649. ret += '= "' + temp.value + '"';
  15650. break;
  15651. case _types.Types.BOOLEAN:
  15652. ret += '= ';
  15653. if (temp.value) {
  15654. ret += _localizedStringsService.LocalizedStrings.getUI("true");;
  15655. } else {
  15656. ret += _localizedStringsService.LocalizedStrings.getUI("false");;
  15657. }
  15658. break;
  15659. }
  15660. }
  15661. }
  15662. }
  15663. return ret;
  15664. }
  15665. /***/ }),
  15666. /***/ "./js/visualUI/commands.js":
  15667. /*!*********************************!*\
  15668. !*** ./js/visualUI/commands.js ***!
  15669. \*********************************/
  15670. /*! no static exports found */
  15671. /***/ (function(module, exports, __webpack_require__) {
  15672. "use strict";
  15673. Object.defineProperty(exports, "__esModule", {
  15674. value: true
  15675. });
  15676. exports.removeCommand = removeCommand;
  15677. exports.createFloatingCommand = createFloatingCommand;
  15678. exports.renderCommand = renderCommand;
  15679. exports.genericCreateCommand = genericCreateCommand;
  15680. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15681. var _jquery2 = _interopRequireDefault(_jquery);
  15682. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  15683. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15684. var Models = _interopRequireWildcard(_ivprog_elements);
  15685. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15686. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  15687. var GlobalsManagement = _interopRequireWildcard(_globals);
  15688. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  15689. var VariablesManagement = _interopRequireWildcard(_variables);
  15690. var _comment = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  15691. var CommentsManagement = _interopRequireWildcard(_comment);
  15692. var _reader = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  15693. var ReadersManagement = _interopRequireWildcard(_reader);
  15694. var _writer = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  15695. var WritersManagement = _interopRequireWildcard(_writer);
  15696. var _attribution = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  15697. var AttributionsManagement = _interopRequireWildcard(_attribution);
  15698. var _iftrue = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  15699. var IftruesManagement = _interopRequireWildcard(_iftrue);
  15700. var _repeatNtimes = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  15701. var RepeatNtimesManagement = _interopRequireWildcard(_repeatNtimes);
  15702. var _whiletrue = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  15703. var WhiletruesManagement = _interopRequireWildcard(_whiletrue);
  15704. var _dowhiletrue = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  15705. var DowhiletruesManagement = _interopRequireWildcard(_dowhiletrue);
  15706. var _switch = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  15707. var SwitchesManagement = _interopRequireWildcard(_switch);
  15708. var _functioncall = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  15709. var FunctioncallsManagement = _interopRequireWildcard(_functioncall);
  15710. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15711. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  15712. var _break = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  15713. var BreaksManagement = _interopRequireWildcard(_break);
  15714. var _return = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  15715. var ReturnsManagement = _interopRequireWildcard(_return);
  15716. 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; } }
  15717. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15718. var has_element_created_draged = false;
  15719. var which_element_is_draged = null;
  15720. function removeCommand(command, function_obj, dom_obj) {
  15721. if (function_obj.commands.indexOf(command) > -1) {
  15722. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  15723. return true;
  15724. }
  15725. // Utilize dois parantNode, pois o primeiro é o div de comandos
  15726. try {
  15727. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  15728. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  15729. return true;
  15730. }
  15731. } catch (err) {}
  15732. try {
  15733. if (dom_obj.parent().parent().data('command').type == Models.COMMAND_TYPES.iftrue) {
  15734. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  15735. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  15736. return true;
  15737. }
  15738. }
  15739. } catch (err) {}
  15740. if (dom_obj.parent().data('switchcase')) {
  15741. console.log("o que encontrei: ");
  15742. console.log(dom_obj.parent().data('switchcase'));
  15743. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  15744. return true;
  15745. }
  15746. return false;
  15747. }
  15748. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  15749. var floatingObject;
  15750. switch (command_type) {
  15751. case Models.COMMAND_TYPES.break:
  15752. floatingObject = BreaksManagement.createFloatingCommand();
  15753. break;
  15754. case Models.COMMAND_TYPES.comment:
  15755. floatingObject = CommentsManagement.createFloatingCommand();
  15756. break;
  15757. case Models.COMMAND_TYPES.reader:
  15758. floatingObject = ReadersManagement.createFloatingCommand();
  15759. break;
  15760. case Models.COMMAND_TYPES.writer:
  15761. floatingObject = WritersManagement.createFloatingCommand();
  15762. break;
  15763. case Models.COMMAND_TYPES.attribution:
  15764. floatingObject = AttributionsManagement.createFloatingCommand();
  15765. break;
  15766. case Models.COMMAND_TYPES.iftrue:
  15767. floatingObject = IftruesManagement.createFloatingCommand();
  15768. break;
  15769. case Models.COMMAND_TYPES.repeatNtimes:
  15770. floatingObject = RepeatNtimesManagement.createFloatingCommand();
  15771. break;
  15772. case Models.COMMAND_TYPES.whiletrue:
  15773. floatingObject = WhiletruesManagement.createFloatingCommand();
  15774. break;
  15775. case Models.COMMAND_TYPES.dowhiletrue:
  15776. floatingObject = DowhiletruesManagement.createFloatingCommand();
  15777. break;
  15778. case Models.COMMAND_TYPES.switch:
  15779. floatingObject = SwitchesManagement.createFloatingCommand();
  15780. break;
  15781. case Models.COMMAND_TYPES.functioncall:
  15782. floatingObject = FunctioncallsManagement.createFloatingCommand();
  15783. break;
  15784. case Models.COMMAND_TYPES.return:
  15785. floatingObject = ReturnsManagement.createFloatingCommand();
  15786. break;
  15787. }
  15788. floatingObject.draggable({
  15789. drag: function drag(evt) {
  15790. borderMouseDragCommand(function_obj, function_container, evt);
  15791. },
  15792. stop: function stop(evt) {
  15793. function_container.find('.over_command_drag').each(function (index) {
  15794. (0, _jquery2.default)(this).removeClass('over_command_drag');
  15795. });
  15796. }
  15797. }).appendTo("body");
  15798. floatingObject.mouseup(function (evt) {
  15799. manageCommand(function_obj, function_container, evt, command_type);
  15800. });
  15801. floatingObject.css("position", "absolute");
  15802. mouse_event.type = "mousedown.draggable";
  15803. mouse_event.target = floatingObject[0];
  15804. floatingObject.css("left", mouse_event.pageX - 15);
  15805. floatingObject.css("top", mouse_event.pageY - 15);
  15806. floatingObject.trigger(mouse_event);
  15807. }
  15808. function borderMouseDragCommand(function_obj, function_container, evt) {
  15809. function_container.find('.over_command_drag').each(function (index) {
  15810. (0, _jquery2.default)(this).removeClass('over_command_drag');
  15811. });
  15812. var prev = null;
  15813. function_container.find('.commands_list_div').each(function (index) {
  15814. prev = (0, _jquery2.default)(this);
  15815. var objLeft = prev.offset().left;
  15816. var objTop = prev.offset().top;
  15817. var objRight = objLeft + prev.width();
  15818. var objBottom = objTop + prev.height();
  15819. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  15820. prev.addClass("over_command_drag");
  15821. }
  15822. });
  15823. function_container.find('.command_container').each(function (index) {
  15824. var obj = (0, _jquery2.default)(this);
  15825. var objLeft = obj.offset().left;
  15826. var objTop = obj.offset().top;
  15827. var objRight = objLeft + obj.width();
  15828. var objBottom = objTop + obj.height();
  15829. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  15830. prev.removeClass('over_command_drag');
  15831. obj.addClass("over_command_drag");
  15832. return;
  15833. }
  15834. });
  15835. }
  15836. // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  15837. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  15838. var createdElement;
  15839. switch (command.type) {
  15840. case Models.COMMAND_TYPES.comment:
  15841. createdElement = CommentsManagement.renderCommand(command, function_obj);
  15842. break;
  15843. case Models.COMMAND_TYPES.break:
  15844. createdElement = BreaksManagement.renderCommand(command, function_obj);
  15845. break;
  15846. case Models.COMMAND_TYPES.reader:
  15847. createdElement = ReadersManagement.renderCommand(command, function_obj);
  15848. break;
  15849. case Models.COMMAND_TYPES.writer:
  15850. createdElement = WritersManagement.renderCommand(command, function_obj);
  15851. break;
  15852. case Models.COMMAND_TYPES.attribution:
  15853. createdElement = AttributionsManagement.renderCommand(command, function_obj);
  15854. break;
  15855. case Models.COMMAND_TYPES.functioncall:
  15856. createdElement = FunctioncallsManagement.renderCommand(command, function_obj);
  15857. break;
  15858. case Models.COMMAND_TYPES.iftrue:
  15859. createdElement = IftruesManagement.renderCommand(command, function_obj);
  15860. break;
  15861. case Models.COMMAND_TYPES.repeatNtimes:
  15862. createdElement = RepeatNtimesManagement.renderCommand(command, function_obj);
  15863. break;
  15864. case Models.COMMAND_TYPES.whiletrue:
  15865. createdElement = WhiletruesManagement.renderCommand(command, function_obj);
  15866. break;
  15867. case Models.COMMAND_TYPES.dowhiletrue:
  15868. createdElement = DowhiletruesManagement.renderCommand(command, function_obj);
  15869. break;
  15870. case Models.COMMAND_TYPES.switch:
  15871. createdElement = SwitchesManagement.renderCommand(command, function_obj);
  15872. break;
  15873. case Models.COMMAND_TYPES.return:
  15874. createdElement = ReturnsManagement.renderCommand(command, function_obj);
  15875. break;
  15876. }
  15877. switch (before_after_inside) {
  15878. case 1:
  15879. createdElement.insertBefore(element_reference);
  15880. break;
  15881. case 2:
  15882. createdElement.insertAfter(element_reference);
  15883. break;
  15884. case 3:
  15885. element_reference.append(createdElement);
  15886. break;
  15887. }
  15888. }
  15889. function genericCreateCommand(command_type) {
  15890. switch (command_type) {
  15891. case Models.COMMAND_TYPES.break:
  15892. return new Models.Break();
  15893. case Models.COMMAND_TYPES.comment:
  15894. return new Models.Comment(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_value, _localizedStringsService.LocalizedStrings.getUI('text_comment'), null, null, false));
  15895. case Models.COMMAND_TYPES.reader:
  15896. return new Models.Reader(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false));
  15897. case Models.COMMAND_TYPES.writer:
  15898. return new Models.Writer([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  15899. case Models.COMMAND_TYPES.attribution:
  15900. return new Models.Attribution(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), []);
  15901. case Models.COMMAND_TYPES.functioncall:
  15902. return new Models.FunctionCall(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_function, null, null, null, false), null);
  15903. case Models.COMMAND_TYPES.iftrue:
  15904. return new Models.IfTrue(new Models.ConditionalExpression(null), null, null);
  15905. case Models.COMMAND_TYPES.repeatNtimes:
  15906. 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);
  15907. case Models.COMMAND_TYPES.whiletrue:
  15908. return new Models.WhileTrue(new Models.ConditionalExpression(null), null);
  15909. case Models.COMMAND_TYPES.dowhiletrue:
  15910. return new Models.DoWhileTrue(new Models.ConditionalExpression(null), null);
  15911. case Models.COMMAND_TYPES.switch:
  15912. var sc = [new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true))];
  15913. return new Models.Switch(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true), sc);
  15914. case Models.COMMAND_TYPES.return:
  15915. return new Models.Return(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  15916. }
  15917. }
  15918. function manageCommand(function_obj, function_container, event, command_type) {
  15919. (0, _jquery2.default)(".created_element").each(function (index) {
  15920. (0, _jquery2.default)(this).remove();
  15921. });
  15922. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  15923. console.log('soltou no: ');
  15924. console.log(el);
  15925. console.log(el.data('fun'));
  15926. // Primeiro verificar se ele soltou no espaço da função correta:
  15927. var hier = el.parentsUntil(".all_functions");
  15928. var esta_correto = false;
  15929. var esta_na_div_correta = false;
  15930. if (el.hasClass("commands_list_div")) {
  15931. esta_na_div_correta = true;
  15932. }
  15933. for (var i = 0; i < hier.length; i++) {
  15934. var temp = (0, _jquery2.default)(hier[i]);
  15935. if (temp.hasClass("commands_list_div")) {
  15936. esta_na_div_correta = true;
  15937. }
  15938. if (temp.data('fun') == function_obj) {
  15939. esta_correto = true;
  15940. break;
  15941. }
  15942. }
  15943. if (!esta_correto) {
  15944. has_element_created_draged = false;
  15945. which_element_is_draged = null;
  15946. return;
  15947. } else {
  15948. if (!esta_na_div_correta) {
  15949. has_element_created_draged = false;
  15950. which_element_is_draged = null;
  15951. return;
  15952. }
  15953. }
  15954. // Agora é descobrir qual o escopo para adicionar o comando:
  15955. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  15956. if (typeof el.data('fun') !== 'undefined') {
  15957. // Se a lista de comandos estiver vazia, então é o primeiro.
  15958. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  15959. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  15960. // pode adicionar
  15961. el.data('fun').commands = [];
  15962. var new_cmd = genericCreateCommand(command_type);
  15963. el.data('fun').commands.push(new_cmd);
  15964. renderCommand(new_cmd, (0, _jquery2.default)(function_container).find('.commands_list_div'), 3, function_obj);
  15965. } else {
  15966. // Entra nesse else, caso já existam outros comandos no bloco:
  15967. findNearbyCommandToAddInFunctionScope(el, event, (0, _jquery2.default)(function_container).find('.commands_list_div'), function_obj, command_type);
  15968. }
  15969. } else {
  15970. console.log("soltou em um comando");
  15971. // descobrir em qual comando ele soltou:
  15972. var hier_find = el.parentsUntil(".commands_list_div");
  15973. var hierarquia_bottom_up = [];
  15974. if (typeof el.data('command') !== 'undefined') {
  15975. hierarquia_bottom_up.push(el.data('command'));
  15976. }
  15977. for (var i = 0; i < hier_find.length; i++) {
  15978. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  15979. hierarquia_bottom_up.push((0, _jquery2.default)(hier_find[i]).data('command'));
  15980. }
  15981. }
  15982. console.log("comando em que soltou: ");
  15983. console.log(hierarquia_bottom_up[0]);
  15984. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  15985. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  15986. console.log(hierarquia_bottom_up[i]);
  15987. }
  15988. // Se for do tipo break, verificar se está no contexto correto:
  15989. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  15990. var is_correct_context = false;
  15991. if (command_type == Models.COMMAND_TYPES.break) {
  15992. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  15993. 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) {
  15994. is_correct_context = true;
  15995. break;
  15996. }
  15997. }
  15998. if (!is_correct_context) {
  15999. console.error("Context not allowed to insert BREAK COMMAND!");
  16000. return;
  16001. }
  16002. }
  16003. // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  16004. if (hierarquia_bottom_up.length == 1) {
  16005. console.log('QQ1');
  16006. var sub_elemento = false;
  16007. for (var i = 0; i < hier_find.length; i++) {
  16008. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16009. console.log('QQ2');
  16010. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  16011. sub_elemento = true;
  16012. break;
  16013. }
  16014. }
  16015. if (!sub_elemento) {
  16016. console.log('QQ3');
  16017. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  16018. }
  16019. } else {
  16020. console.log('QQ4');
  16021. // caso exista mais de um elemento na hierarquia:
  16022. if (typeof (0, _jquery2.default)(el).data('command') !== 'undefined') {
  16023. console.log('QQ5');
  16024. console.log("PPP1");
  16025. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  16026. } else {
  16027. console.log('QQ6');
  16028. var sub_elemento = false;
  16029. for (var i = 0; i < hier_find.length; i++) {
  16030. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16031. console.log('QQ7');
  16032. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  16033. sub_elemento = true;
  16034. break;
  16035. }
  16036. }
  16037. }
  16038. }
  16039. }
  16040. has_element_created_draged = false;
  16041. which_element_is_draged = null;
  16042. }
  16043. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  16044. var el_jq = (0, _jquery2.default)(el);
  16045. var command_parent = el_jq.data('command');
  16046. 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) {
  16047. console.log('QQ17');
  16048. 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) {
  16049. console.log('QQ18');
  16050. // Se não tiver outro comando ainda no bloco, só adiciona:
  16051. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16052. command_parent.commands_block = [];
  16053. var recentComand = genericCreateCommand(command_type);
  16054. command_parent.commands_block.push(recentComand);
  16055. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16056. } else {
  16057. // Se já tem algum comando no bloco:
  16058. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  16059. }
  16060. } else {
  16061. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  16062. addCommandToSwitchCase(event, function_obj, command_type);
  16063. }
  16064. } else {
  16065. console.log('QQ19');
  16066. // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  16067. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  16068. }
  16069. }
  16070. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  16071. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16072. var menor_distancia = 999999999;
  16073. var elemento_menor_distancia = null;
  16074. var antes = true;
  16075. var t_bot;
  16076. var t_top;
  16077. // Descobrindo o elemento mais próximo:
  16078. for (var i = 0; i < all_sub.length; i++) {
  16079. t_top = all_sub[i].getBoundingClientRect().top;
  16080. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16081. if (t_top - event.clientY < menor_distancia) {
  16082. menor_distancia = event.clientY - t_top;
  16083. elemento_menor_distancia = all_sub[i];
  16084. }
  16085. }
  16086. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16087. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16088. if (borda_inferior - event.clientY < menor_distancia) {
  16089. var recentComand = genericCreateCommand(command_type);
  16090. command_parent.commands_block.push(recentComand);
  16091. //
  16092. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16093. } else {
  16094. var recentComand = genericCreateCommand(command_type);
  16095. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16096. if (index > -1) {
  16097. command_parent.commands_block.splice(index, 0, recentComand);
  16098. }
  16099. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16100. }
  16101. }
  16102. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  16103. var el_jq = (0, _jquery2.default)(el);
  16104. var command_parent = (0, _jquery2.default)(el.parentNode.parentNode).data('command');
  16105. var command_target = el_jq.data('command');
  16106. var temp_parent = (0, _jquery2.default)(el.parentNode.parentNode);
  16107. var is_in_else = false;
  16108. if (!command_parent) {
  16109. command_parent = el_jq.data('command');
  16110. temp_parent = el_jq;
  16111. var hier = el_jq.parentsUntil(".command_container");
  16112. for (var i = 0; i < hier.length; i++) {
  16113. var temp = (0, _jquery2.default)(hier[i]);
  16114. if (typeof temp.data('else') != 'undefined') {
  16115. is_in_else = true;
  16116. }
  16117. if (typeof temp.data('command') != 'undefined') {
  16118. command_parent = temp.data('command');
  16119. temp_parent = temp;
  16120. }
  16121. }
  16122. }
  16123. var hier = el_jq.parentsUntil(".command_container");
  16124. for (var i = 0; i < hier.length; i++) {
  16125. var temp = (0, _jquery2.default)(hier[i]);
  16126. if (typeof temp.data('else') != 'undefined') {
  16127. is_in_else = true;
  16128. }
  16129. }
  16130. if (command_parent == command_target) {
  16131. var hier = el_jq.parentsUntil(".command_container");
  16132. for (var i = 0; i < hier.length; i++) {
  16133. var temp = (0, _jquery2.default)(hier[i]);
  16134. if (typeof temp.data('else') !== 'undefined') {
  16135. is_in_else = true;
  16136. break;
  16137. }
  16138. }
  16139. }
  16140. if (command_parent.type != Models.COMMAND_TYPES.iftrue && command_parent.type != Models.COMMAND_TYPES.switch) {
  16141. var hier = temp_parent.parentsUntil(".all_cases_div");
  16142. console.log("vou procurar!!");
  16143. for (var i = 0; i < hier.length; i++) {
  16144. console.log("estou vasculhando...");
  16145. var temp = (0, _jquery2.default)(hier[i]);
  16146. if (typeof temp.data('switchcase') !== 'undefined') {
  16147. console.log("encontrei");
  16148. command_parent = temp.data('switchcase');
  16149. is_in_else = false;
  16150. break;
  16151. }
  16152. }
  16153. }
  16154. console.log('debugging:');
  16155. console.log('el_jq');
  16156. console.log(el_jq);
  16157. console.log('command_parent');
  16158. console.log(command_parent);
  16159. console.log('command_target');
  16160. console.log(command_target);
  16161. var menor_distancia = 999999999;
  16162. var antes = true;
  16163. var t_bot;
  16164. var t_top;
  16165. t_top = el.getBoundingClientRect().top;
  16166. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16167. var d_top = event.clientY - t_top; // distancia topo
  16168. var d_bot = t_bot - event.clientY; // distancia baixo
  16169. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16170. if (d_top < d_bot) {
  16171. var recentComand = genericCreateCommand(command_type);
  16172. console.log('MMM1');
  16173. if (is_in_else) {
  16174. console.log('MMM2');
  16175. if (command_parent == command_target) {
  16176. console.log('MMM3');
  16177. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16178. command_parent.commands_else = [];
  16179. var recentComand = genericCreateCommand(command_type);
  16180. command_parent.commands_else.push(recentComand);
  16181. renderCommand(recentComand, el_jq, 3, function_obj);
  16182. } else {
  16183. // Se já tem algum comando no bloco:
  16184. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16185. }
  16186. return;
  16187. }
  16188. console.log('MMM7');
  16189. var index = command_parent.commands_else.indexOf(command_target);
  16190. if (index > -1) {
  16191. command_parent.commands_else.splice(index, 0, recentComand);
  16192. }
  16193. renderCommand(recentComand, el, 1, function_obj);
  16194. } else {
  16195. console.log('MMM4');
  16196. if (command_parent == command_target) {
  16197. console.log('Nxxxx5');
  16198. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16199. command_parent.commands_block = [];
  16200. console.log('SSS4');
  16201. var recentComand = genericCreateCommand(command_type);
  16202. command_parent.commands_block.push(recentComand);
  16203. renderCommand(recentComand, el_jq, 3, function_obj);
  16204. } else {
  16205. console.log('SSS5');
  16206. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16207. }
  16208. return;
  16209. }
  16210. console.log('MMM6');
  16211. var index = command_parent.commands_block.indexOf(command_target);
  16212. if (index > -1) {
  16213. command_parent.commands_block.splice(index, 0, recentComand);
  16214. }
  16215. renderCommand(recentComand, el, 1, function_obj);
  16216. }
  16217. } else {
  16218. console.log('XXX1');
  16219. var recentComand = genericCreateCommand(command_type);
  16220. if (is_in_else) {
  16221. if (command_parent == command_target) {
  16222. console.log('MMM3');
  16223. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16224. command_parent.commands_else = [];
  16225. console.log('SSS1');
  16226. var recentComand = genericCreateCommand(command_type);
  16227. command_parent.commands_else.push(recentComand);
  16228. renderCommand(recentComand, el_jq, 3, function_obj);
  16229. } else {
  16230. // Se já tem algum comando no bloco:
  16231. console.log('SSS2');
  16232. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16233. }
  16234. return;
  16235. }
  16236. console.log('XXX2');
  16237. var index = command_parent.commands_else.indexOf(command_target);
  16238. if (index > -1) {
  16239. command_parent.commands_else.splice(index + 1, 0, recentComand);
  16240. }
  16241. renderCommand(recentComand, el, 2, function_obj);
  16242. } else {
  16243. if (command_parent == command_target) {
  16244. console.log('Nxxxx78');
  16245. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16246. command_parent.commands_block = [];
  16247. var recentComand = genericCreateCommand(command_type);
  16248. command_parent.commands_block.push(recentComand);
  16249. console.log('SSS6');
  16250. renderCommand(recentComand, el_jq, 3, function_obj);
  16251. } else {
  16252. console.log('SSS7');
  16253. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16254. }
  16255. return;
  16256. }
  16257. console.log('XXX3');
  16258. var index = command_parent.commands_block.indexOf(command_target);
  16259. if (index > -1) {
  16260. command_parent.commands_block.splice(index + 1, 0, recentComand);
  16261. }
  16262. renderCommand(recentComand, el, 2, function_obj);
  16263. }
  16264. }
  16265. }
  16266. function insertCommandInBlock(el, event, function_obj, command_type) {
  16267. var el_jq = (0, _jquery2.default)(el);
  16268. var command_parent = el_jq.data('command');
  16269. 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) {
  16270. // Se não tiver outro comando ainda no bloco, só adiciona:
  16271. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16272. command_parent.commands_block = [];
  16273. var recentComand = genericCreateCommand(command_type);
  16274. command_parent.commands_block.push(recentComand);
  16275. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16276. } else {
  16277. // Se já tem algum comando no bloco:
  16278. findInBlockCorrectPlace(el, event, function_obj, command_type);
  16279. }
  16280. } else if (el_jq.data('command').type == Models.COMMAND_TYPES.iftrue) {
  16281. console.log('QQ9');
  16282. // no if ou no else?
  16283. var correct_div = (0, _jquery2.default)(document.elementFromPoint(event.pageX, event.pageY));
  16284. var is_in_if = true;
  16285. if (correct_div.data('if')) {
  16286. is_in_if = true;
  16287. } else if (correct_div.data('else')) {
  16288. is_in_if = false;
  16289. } else {
  16290. var hier = correct_div.parentsUntil(".command_container");
  16291. for (var i = 0; i < hier.length; i++) {
  16292. var temp = (0, _jquery2.default)(hier[i]);
  16293. if (typeof temp.data('if') !== 'undefined') {
  16294. is_in_if = true;
  16295. break;
  16296. }
  16297. if (typeof temp.data('else') !== 'undefined') {
  16298. is_in_if = false;
  16299. break;
  16300. }
  16301. }
  16302. }
  16303. if (is_in_if) {
  16304. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16305. command_parent.commands_block = [];
  16306. var recentComand = genericCreateCommand(command_type);
  16307. command_parent.commands_block.push(recentComand);
  16308. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  16309. } else {
  16310. // Se já tem algum comando no bloco:
  16311. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  16312. }
  16313. } else {
  16314. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16315. command_parent.commands_else = [];
  16316. var recentComand = genericCreateCommand(command_type);
  16317. command_parent.commands_else.push(recentComand);
  16318. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  16319. } else {
  16320. // Se já tem algum comando no bloco:
  16321. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  16322. }
  16323. }
  16324. } else {
  16325. // é do tipo switch
  16326. console.log("está tentando inserir em um switch que está na raiz!");
  16327. addCommandToSwitchCase(event, function_obj, command_type);
  16328. }
  16329. }
  16330. function addCommandToSwitchCase(event, function_obj, command_type) {
  16331. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  16332. var which_case = el.data('switchcase');
  16333. var case_div = el;
  16334. if (!which_case) {
  16335. var hier_find = el.parentsUntil(".all_cases_div");
  16336. for (var i = 0; i < hier_find.length; i++) {
  16337. if (typeof (0, _jquery2.default)(hier_find[i]).data('switchcase') !== 'undefined') {
  16338. which_case = (0, _jquery2.default)(hier_find[i]).data('switchcase');
  16339. case_div = (0, _jquery2.default)(hier_find[i]);
  16340. break;
  16341. }
  16342. }
  16343. }
  16344. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  16345. which_case.commands_block = [];
  16346. var recentComand = genericCreateCommand(command_type);
  16347. which_case.commands_block.push(recentComand);
  16348. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  16349. } else {
  16350. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  16351. }
  16352. }
  16353. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  16354. var all_sub = case_div.find('div.command_container');
  16355. var menor_distancia = 999999999;
  16356. var elemento_menor_distancia = null;
  16357. var antes = true;
  16358. var t_bot;
  16359. var t_top;
  16360. // Descobrindo o elemento mais próximo:
  16361. for (var i = 0; i < all_sub.length; i++) {
  16362. t_top = all_sub[i].getBoundingClientRect().top;
  16363. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16364. if (t_top - event.clientY < menor_distancia) {
  16365. menor_distancia = event.clientY - t_top;
  16366. elemento_menor_distancia = all_sub[i];
  16367. }
  16368. }
  16369. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16370. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16371. if (borda_inferior - event.clientY < menor_distancia) {
  16372. var recentComand = genericCreateCommand(command_type);
  16373. which_case.commands_block.push(recentComand);
  16374. renderCommand(recentComand, (0, _jquery2.default)(case_div.find('.case_commands_block')[0]), 3, function_obj);
  16375. } else {
  16376. var recentComand = genericCreateCommand(command_type);
  16377. var index = which_case.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16378. if (index > -1) {
  16379. which_case.commands_block.splice(index, 0, recentComand);
  16380. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16381. }
  16382. }
  16383. }
  16384. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  16385. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  16386. var el_jq = (0, _jquery2.default)(el);
  16387. var all_sub = el_jq.find('div.command_container');
  16388. var menor_distancia = 999999999;
  16389. var elemento_menor_distancia = null;
  16390. var antes = true;
  16391. var t_bot;
  16392. var t_top;
  16393. // Descobrindo o elemento mais próximo:
  16394. for (var i = 0; i < all_sub.length; i++) {
  16395. t_top = all_sub[i].getBoundingClientRect().top;
  16396. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16397. if (t_top - event.clientY < menor_distancia) {
  16398. menor_distancia = event.clientY - t_top;
  16399. elemento_menor_distancia = all_sub[i];
  16400. }
  16401. }
  16402. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16403. console.log("menor_distancia: ");
  16404. console.log(elemento_menor_distancia);
  16405. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16406. if (borda_inferior - event.clientY < menor_distancia) {
  16407. console.log('QQ11');
  16408. var recentComand = genericCreateCommand(command_type);
  16409. var command_parent = el_jq.data('command');
  16410. if (is_in_else) {
  16411. console.log('QQ15');
  16412. command_parent.commands_else.push(recentComand);
  16413. console.log('el_jq');
  16414. console.log(el_jq);
  16415. console.log("$(el_jq.find('.commands_else')[0]):: ");
  16416. console.log((0, _jquery2.default)(el_jq.find('.commands_else')[0]));
  16417. renderCommand(recentComand, el_jq, 3, function_obj);
  16418. } else {
  16419. console.log('QQ16');
  16420. command_parent.commands_block.push(recentComand);
  16421. renderCommand(recentComand, (0, _jquery2.default)(el_jq.find('.block_commands')[0]), 3, function_obj);
  16422. }
  16423. } else {
  16424. console.log('QQ12');
  16425. var recentComand = genericCreateCommand(command_type);
  16426. var command_parent = el_jq.data('command');
  16427. if (is_in_else) {
  16428. var index = command_parent.commands_else.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16429. if (index > -1) {
  16430. command_parent.commands_else.splice(index, 0, recentComand);
  16431. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16432. }
  16433. } else {
  16434. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16435. if (index > -1) {
  16436. command_parent.commands_block.splice(index, 0, recentComand);
  16437. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16438. }
  16439. }
  16440. }
  16441. }
  16442. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  16443. switch ((0, _jquery2.default)(el).data('command').type) {
  16444. case Models.COMMAND_TYPES.iftrue:
  16445. case Models.COMMAND_TYPES.switch:
  16446. case Models.COMMAND_TYPES.repeatNtimes:
  16447. case Models.COMMAND_TYPES.whiletrue:
  16448. case Models.COMMAND_TYPES.dowhiletrue:
  16449. insertCommandInBlock(el, event, function_obj, command_type);
  16450. return;
  16451. }
  16452. var menor_distancia = 999999999;
  16453. var antes = true;
  16454. var t_bot;
  16455. var t_top;
  16456. t_top = el.getBoundingClientRect().top;
  16457. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16458. var d_top = event.clientY - t_top; // distancia topo
  16459. var d_bot = t_bot - event.clientY; // distancia baixo
  16460. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16461. if (d_top < d_bot) {
  16462. var recentComand = genericCreateCommand(command_type);
  16463. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16464. if (index > -1) {
  16465. function_obj.commands.splice(index, 0, recentComand);
  16466. }
  16467. renderCommand(recentComand, el, 1, function_obj);
  16468. } else {
  16469. var recentComand = genericCreateCommand(command_type);
  16470. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16471. if (index > -1) {
  16472. function_obj.commands.splice(index + 1, 0, recentComand);
  16473. }
  16474. renderCommand(recentComand, el, 2, function_obj);
  16475. }
  16476. }
  16477. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  16478. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16479. var menor_distancia = 999999999;
  16480. var elemento_menor_distancia = null;
  16481. var antes = true;
  16482. var t_bot;
  16483. var t_top;
  16484. // Descobrindo o elemento mais próximo:
  16485. for (var i = 0; i < all_sub.length; i++) {
  16486. t_top = all_sub[i].getBoundingClientRect().top;
  16487. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16488. if (t_top - event.clientY < menor_distancia) {
  16489. menor_distancia = event.clientY - t_top;
  16490. elemento_menor_distancia = all_sub[i];
  16491. }
  16492. }
  16493. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16494. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16495. if (borda_inferior - event.clientY < menor_distancia) {
  16496. var recentComand = genericCreateCommand(command_type);
  16497. function_obj.commands.push(recentComand);
  16498. //
  16499. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16500. } else {
  16501. var recentComand = genericCreateCommand(command_type);
  16502. var index = function_obj.commands.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16503. if (index > -1) {
  16504. function_obj.commands.splice(index, 0, recentComand);
  16505. }
  16506. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16507. }
  16508. }
  16509. /***/ }),
  16510. /***/ "./js/visualUI/commands/attribution.js":
  16511. /*!*********************************************!*\
  16512. !*** ./js/visualUI/commands/attribution.js ***!
  16513. \*********************************************/
  16514. /*! no static exports found */
  16515. /***/ (function(module, exports, __webpack_require__) {
  16516. "use strict";
  16517. Object.defineProperty(exports, "__esModule", {
  16518. value: true
  16519. });
  16520. exports.createFloatingCommand = createFloatingCommand;
  16521. exports.renderCommand = renderCommand;
  16522. exports.manageExpressionElements = manageExpressionElements;
  16523. exports.renderMenuOperations = renderMenuOperations;
  16524. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16525. var _jquery2 = _interopRequireDefault(_jquery);
  16526. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16527. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16528. var Models = _interopRequireWildcard(_ivprog_elements);
  16529. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16530. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16531. var GlobalsManagement = _interopRequireWildcard(_globals);
  16532. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16533. var VariablesManagement = _interopRequireWildcard(_variables);
  16534. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16535. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16536. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16537. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16538. var CommandsManagement = _interopRequireWildcard(_commands);
  16539. 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; } }
  16540. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16541. function createFloatingCommand() {
  16542. return (0, _jquery2.default)('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
  16543. }
  16544. function renderCommand(command, function_obj) {
  16545. 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>');
  16546. el.data('command', command);
  16547. VariableValueMenu.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
  16548. if (!command.expression || command.expression.length < 1) {
  16549. 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)]);
  16550. command.expression.push(exp);
  16551. }
  16552. addHandlers(command, function_obj, el);
  16553. renderExpressionElements(command, function_obj, el);
  16554. return el;
  16555. }
  16556. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  16557. var index_to_move = expression_element.itens.indexOf(ref_object);
  16558. switch (selectedItem.data('exp')) {
  16559. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16560. 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)]);
  16561. expression_element.itens[index_to_move] = exp;
  16562. break;
  16563. case Models.EXPRESSION_ELEMENTS.op_exp:
  16564. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, expression_element.itens[index_to_move]]);
  16565. expression_element.itens[index_to_move] = exp;
  16566. break;
  16567. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16568. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [expression_element.itens[index_to_move]]);
  16569. expression_element.itens[index_to_move] = exp;
  16570. break;
  16571. }
  16572. renderExpressionElements(command, function_obj, dom_object);
  16573. }
  16574. function renderExpressionElements(command, function_obj, el) {
  16575. var expression_div = el.find('.expression_elements');
  16576. var command_container;
  16577. if (el.hasClass("command_container") == false) {
  16578. var hier = el.parentsUntil(".command_container");
  16579. for (var i = 0; i < hier.length; i++) {
  16580. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16581. command_container = (0, _jquery2.default)(hier[i]);
  16582. break;
  16583. }
  16584. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16585. expression_div = (0, _jquery2.default)(hier[i]);
  16586. break;
  16587. }
  16588. }
  16589. }
  16590. if (command_container) {
  16591. expression_div = command_container.find('.expression_elements');
  16592. }
  16593. expression_div.text('');
  16594. for (var i = 0; i < command.expression.length; i++) {
  16595. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16596. temp.data('ref_element', command.expression[i]);
  16597. temp.data('ref_index', i);
  16598. expression_div.append(temp);
  16599. renderElement(command, function_obj, temp, command.expression[i]);
  16600. }
  16601. }
  16602. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  16603. var context_menu = '<div class="ui dropdown"><div class="text">';
  16604. switch (expression_element.itens[index_op]) {
  16605. case Models.ARITHMETIC_TYPES.plus:
  16606. context_menu += '+';
  16607. break;
  16608. case Models.ARITHMETIC_TYPES.minus:
  16609. context_menu += '-';
  16610. break;
  16611. case Models.ARITHMETIC_TYPES.multiplication:
  16612. context_menu += '*';
  16613. break;
  16614. case Models.ARITHMETIC_TYPES.division:
  16615. context_menu += '/';
  16616. break;
  16617. case Models.ARITHMETIC_TYPES.module:
  16618. context_menu += '%';
  16619. break;
  16620. case Models.ARITHMETIC_TYPES.none:
  16621. context_menu += '...';
  16622. break;
  16623. }
  16624. context_menu += '</div><div class="menu">';
  16625. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.plus + '">+</div>';
  16626. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.minus + '">-</div>';
  16627. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.multiplication + '">*</div>';
  16628. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.division + '">/</div>';
  16629. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.module + '">%</div>';
  16630. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.none + '" data-text="...">Nenhum</div>';
  16631. context_menu += '</div></div>';
  16632. context_menu = (0, _jquery2.default)(context_menu);
  16633. temp_op.append(context_menu);
  16634. context_menu.dropdown({
  16635. onChange: function onChange(value, text, $selectedItem) {
  16636. expression_element.itens[index_op] = value;
  16637. }
  16638. });
  16639. }
  16640. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  16641. if (el.hasClass("command_container") == false) {
  16642. var hier = el.parentsUntil(".commands_list_div");
  16643. for (var i = 0; i < hier.length; i++) {
  16644. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16645. el = (0, _jquery2.default)(hier[i]);
  16646. break;
  16647. }
  16648. }
  16649. }
  16650. if (dom_append_menu.hasClass("expression_elements") == false) {
  16651. var hier = el.parentsUntil(".commands_list_div");
  16652. for (var i = 0; i < hier.length; i++) {
  16653. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16654. dom_append_menu = (0, _jquery2.default)(hier[i]);
  16655. break;
  16656. }
  16657. }
  16658. }
  16659. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  16660. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16661. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16662. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16663. context_menu += '</div></div>';
  16664. context_menu = (0, _jquery2.default)(context_menu);
  16665. dom_append_menu.append(context_menu);
  16666. context_menu.dropdown({
  16667. onChange: function onChange(value, text, $selectedItem) {
  16668. switch (value) {
  16669. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16670. 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)]);
  16671. expression_append_new_expression.push(exp);
  16672. break;
  16673. case Models.EXPRESSION_ELEMENTS.op_exp:
  16674. 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)]);
  16675. expression_append_new_expression.push(exp);
  16676. break;
  16677. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16678. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16679. expression_append_new_expression.push(exp);
  16680. break;
  16681. }
  16682. renderExpressionElements(command, function_obj, el);
  16683. }
  16684. });
  16685. }
  16686. function renderElement(command, function_obj, el, expression_element) {
  16687. switch (expression_element.type_exp) {
  16688. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16689. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16690. var temp_exp_1 = (0, _jquery2.default)('<div class="component_element"></div>');
  16691. var temp_exp_2 = (0, _jquery2.default)('<div class="component_element"></div>');
  16692. el.append(temp_exp_1);
  16693. el.append(temp_op);
  16694. el.append(temp_exp_2);
  16695. if (expression_element.itens[0].type) {
  16696. VariableValueMenu.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  16697. } else {
  16698. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  16699. }
  16700. renderOperator(command, function_obj, temp_op, expression_element, 1);
  16701. if (expression_element.itens[2].type) {
  16702. VariableValueMenu.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  16703. } else {
  16704. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  16705. }
  16706. break;
  16707. case Models.EXPRESSION_ELEMENTS.op_exp:
  16708. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16709. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16710. el.append(temp_op);
  16711. el.append(temp_exp);
  16712. renderOperator(command, function_obj, temp_op, expression_element, 0);
  16713. if (expression_element.itens[1].type) {
  16714. VariableValueMenu.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  16715. } else {
  16716. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  16717. }
  16718. break;
  16719. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16720. var temp_par_1 = (0, _jquery2.default)('<div class="component_element"> ( </div>');
  16721. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16722. var temp_par_2 = (0, _jquery2.default)('<div class="component_element"> ) </div>');
  16723. el.append(temp_par_1);
  16724. el.append(temp_exp);
  16725. for (var j = 0; j < expression_element.itens.length; j++) {
  16726. if (expression_element.itens[j].type) {
  16727. VariableValueMenu.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  16728. } else {
  16729. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  16730. }
  16731. }
  16732. //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  16733. el.append(temp_par_2);
  16734. break;
  16735. }
  16736. }
  16737. function renderExpression(command, function_obj, el) {
  16738. var expression_div = el.find('.expression_elements');
  16739. expression_div.text('');
  16740. var menu_add_item = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16741. menu_add_item.data('index_add', 0);
  16742. expression_div.append(menu_add_item);
  16743. for (var i = 0; i < command.expression.length; i++) {
  16744. if (command.expression[i].type) {
  16745. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16746. temp.data('ref_element', command.expression[i]);
  16747. temp.data('ref_index', i);
  16748. expression_div.append(temp);
  16749. VariableValueMenu.renderMenu(command, command.expression[i], temp, function_obj);
  16750. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  16751. var temp = (0, _jquery2.default)('<div class="expression_element">' + command.expression[i] + '</div>');
  16752. temp.data('ref_element', command.expression[i]);
  16753. temp.data('ref_index', i);
  16754. expression_div.append(temp);
  16755. } else {
  16756. var temp = '<div class="expression_element">';
  16757. switch (command.expression[i]) {
  16758. case Models.ARITHMETIC_TYPES.plus:
  16759. temp += '+';
  16760. break;
  16761. case Models.ARITHMETIC_TYPES.minus:
  16762. temp += '-';
  16763. break;
  16764. case Models.ARITHMETIC_TYPES.multiplication:
  16765. temp += '*';
  16766. break;
  16767. case Models.ARITHMETIC_TYPES.division:
  16768. temp += '/';
  16769. break;
  16770. case Models.ARITHMETIC_TYPES.module:
  16771. temp += '%';
  16772. break;
  16773. }
  16774. temp += '</div>';
  16775. temp = (0, _jquery2.default)(temp);
  16776. temp.data('ref_element', command.expression[i]);
  16777. temp.data('ref_index', i);
  16778. expression_div.append(temp);
  16779. }
  16780. var menu_add_item_seq = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16781. var index_temp = i + 1;
  16782. menu_add_item_seq.data('index_add', index_temp);
  16783. expression_div.append(menu_add_item_seq);
  16784. }
  16785. addMenuItens(command, function_obj, el);
  16786. }
  16787. function addMenuItens(command, function_obj, expression_div) {
  16788. var divs_expression = expression_div.find('.menu_add_item');
  16789. for (var i = 0; i < divs_expression.length; i++) {
  16790. var temp = (0, _jquery2.default)(divs_expression[i]).data('index_add');
  16791. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  16792. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  16793. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_operator') + '</div>';
  16794. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_parentheses') + '</div>';
  16795. context_menu += '</div></div>';
  16796. context_menu = (0, _jquery2.default)(context_menu);
  16797. (0, _jquery2.default)(divs_expression[i]).append(context_menu);
  16798. context_menu.dropdown({
  16799. on: 'hover',
  16800. onChange: function onChange(value, text, $selectedItem) {
  16801. switch ($selectedItem.data('option')) {
  16802. case "value":
  16803. command.expression.splice($selectedItem.data('index'), 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16804. renderExpression(command, function_obj, expression_div);
  16805. break;
  16806. case "operator":
  16807. command.expression.splice($selectedItem.data('index'), 0, Models.ARITHMETIC_TYPES.plus);
  16808. renderExpression(command, function_obj, expression_div);
  16809. break;
  16810. case "parentheses":
  16811. command.expression.splice($selectedItem.data('index'), 0, "(");
  16812. command.expression.splice($selectedItem.data('index') + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16813. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  16814. renderExpression(command, function_obj, expression_div);
  16815. break;
  16816. }
  16817. }
  16818. });
  16819. }
  16820. }
  16821. function addHandlers(command, function_obj, attribution_dom) {
  16822. attribution_dom.find('.button_remove_command').on('click', function () {
  16823. if (CommandsManagement.removeCommand(command, function_obj, attribution_dom)) {
  16824. attribution_dom.fadeOut();
  16825. }
  16826. });
  16827. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  16828. renderExpressionElements(command, function_obj, attribution_dom);
  16829. });
  16830. }
  16831. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  16832. /*console.log("recebido o seguinte DOM: ");
  16833. console.log(dom_object);
  16834. if (dom_object.hasClass('var_attributed')) {
  16835. return;
  16836. } else {
  16837. var hier = dom_object.parentsUntil(".command_container");
  16838. for (var i = 0; i < hier.length; i++) {
  16839. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  16840. return;
  16841. }
  16842. }
  16843. }
  16844. dom_object.find('.context_menu_clear').remove();
  16845. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16846. for (var tm in Models.ARITHMETIC_TYPES) {
  16847. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  16848. }
  16849. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  16850. menu_operations += '</div></div>';
  16851. menu_operations = $(menu_operations);
  16852. dom_object.append(menu_operations);
  16853. menu_operations.dropdown({
  16854. onChange: function(value, text, $selectedItem) {
  16855. switch ($($selectedItem).data('option')) {
  16856. case "clear":
  16857. $(dom_object).text('');
  16858. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  16859. break;
  16860. default:
  16861. createExpressionAround(command, ref_object, dom_object, function_obj);
  16862. menu_operations.find('.text').text('');
  16863. }
  16864. }
  16865. });*/
  16866. }
  16867. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  16868. (0, _jquery2.default)('<span> ( </span>').insertBefore(dom_object);
  16869. (0, _jquery2.default)('<span> ) </span>').insertAfter(dom_object);
  16870. VariableValueMenu.renderMenu(command, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), dom_object, function_obj);
  16871. }
  16872. /***/ }),
  16873. /***/ "./js/visualUI/commands/break.js":
  16874. /*!***************************************!*\
  16875. !*** ./js/visualUI/commands/break.js ***!
  16876. \***************************************/
  16877. /*! no static exports found */
  16878. /***/ (function(module, exports, __webpack_require__) {
  16879. "use strict";
  16880. Object.defineProperty(exports, "__esModule", {
  16881. value: true
  16882. });
  16883. exports.createFloatingCommand = createFloatingCommand;
  16884. exports.renderCommand = renderCommand;
  16885. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16886. var _jquery2 = _interopRequireDefault(_jquery);
  16887. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16888. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16889. var Models = _interopRequireWildcard(_ivprog_elements);
  16890. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16891. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16892. var CommandsManagement = _interopRequireWildcard(_commands);
  16893. 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; } }
  16894. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16895. function createFloatingCommand() {
  16896. 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>');
  16897. }
  16898. function renderCommand(command, function_obj) {
  16899. 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>');
  16900. el.data('command', command);
  16901. addHandlers(command, function_obj, el);
  16902. return el;
  16903. }
  16904. function addHandlers(command, function_obj, break_dom) {
  16905. break_dom.find('.button_remove_command').on('click', function () {
  16906. if (CommandsManagement.removeCommand(command, function_obj, break_dom)) {
  16907. break_dom.fadeOut();
  16908. }
  16909. });
  16910. }
  16911. /***/ }),
  16912. /***/ "./js/visualUI/commands/comment.js":
  16913. /*!*****************************************!*\
  16914. !*** ./js/visualUI/commands/comment.js ***!
  16915. \*****************************************/
  16916. /*! no static exports found */
  16917. /***/ (function(module, exports, __webpack_require__) {
  16918. "use strict";
  16919. Object.defineProperty(exports, "__esModule", {
  16920. value: true
  16921. });
  16922. exports.createFloatingCommand = createFloatingCommand;
  16923. exports.renderCommand = renderCommand;
  16924. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16925. var _jquery2 = _interopRequireDefault(_jquery);
  16926. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16927. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16928. var Models = _interopRequireWildcard(_ivprog_elements);
  16929. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16930. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16931. var GlobalsManagement = _interopRequireWildcard(_globals);
  16932. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16933. var VariablesManagement = _interopRequireWildcard(_variables);
  16934. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16935. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16936. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16937. var CommandsManagement = _interopRequireWildcard(_commands);
  16938. 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; } }
  16939. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16940. function createFloatingCommand() {
  16941. 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>');
  16942. }
  16943. function renderCommand(command, function_obj) {
  16944. 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>');
  16945. el.data('command', command);
  16946. addHandlers(command, function_obj, el);
  16947. renderTextComment(command, function_obj, el);
  16948. return el;
  16949. }
  16950. function renderTextComment(command, function_obj, el) {
  16951. VariableValueMenu.renderMenu(command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  16952. }
  16953. function addHandlers(command, function_obj, comment_dom) {
  16954. comment_dom.find('.button_remove_command').on('click', function () {
  16955. if (CommandsManagement.removeCommand(command, function_obj, comment_dom)) {
  16956. comment_dom.fadeOut();
  16957. }
  16958. });
  16959. }
  16960. /***/ }),
  16961. /***/ "./js/visualUI/commands/conditional_expression.js":
  16962. /*!********************************************************!*\
  16963. !*** ./js/visualUI/commands/conditional_expression.js ***!
  16964. \********************************************************/
  16965. /*! no static exports found */
  16966. /***/ (function(module, exports, __webpack_require__) {
  16967. "use strict";
  16968. Object.defineProperty(exports, "__esModule", {
  16969. value: true
  16970. });
  16971. exports.renderExpression = renderExpression;
  16972. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16973. var _jquery2 = _interopRequireDefault(_jquery);
  16974. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16975. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16976. var Models = _interopRequireWildcard(_ivprog_elements);
  16977. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16978. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16979. var GlobalsManagement = _interopRequireWildcard(_globals);
  16980. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16981. var VariablesManagement = _interopRequireWildcard(_variables);
  16982. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16983. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16984. 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; } }
  16985. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16986. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  16987. if (expression.expression == null || expression.expression.length < 1) {
  16988. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  16989. } else {
  16990. var main_div = (0, _jquery2.default)('<div class="expression_elements"></div>');
  16991. switch (expression.expression.type) {
  16992. case Models.EXPRESSION_TYPES.exp_logic:
  16993. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  16994. break;
  16995. case Models.EXPRESSION_TYPES.exp_arithmetic:
  16996. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  16997. break;
  16998. }
  16999. initial_el_to_render.append(main_div);
  17000. }
  17001. }
  17002. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  17003. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  17004. menu_operator.dropdown({
  17005. values: [{
  17006. name: '>',
  17007. value: Models.ARITHMETIC_COMPARISON.greater_than,
  17008. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than
  17009. }, {
  17010. name: '<',
  17011. value: Models.ARITHMETIC_COMPARISON.less_than,
  17012. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than
  17013. }, {
  17014. name: '==',
  17015. value: Models.ARITHMETIC_COMPARISON.equals_to,
  17016. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.equals_to
  17017. }, {
  17018. name: '!=',
  17019. value: Models.ARITHMETIC_COMPARISON.not_equals_to,
  17020. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.not_equals_to
  17021. }, {
  17022. name: '>=',
  17023. value: Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to,
  17024. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to
  17025. }, {
  17026. name: '<=',
  17027. value: Models.ARITHMETIC_COMPARISON.less_than_or_equals_to,
  17028. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than_or_equals_to
  17029. }],
  17030. onChange: function onChange(value, text, $selectedItem) {
  17031. expression_arithmetic.operator = value;
  17032. }
  17033. });
  17034. element_to_append.append(menu_operator);
  17035. }
  17036. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  17037. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  17038. menu_operator.dropdown({
  17039. values: [{
  17040. name: '==',
  17041. value: Models.LOGIC_COMPARISON.equals_to,
  17042. selected: logic_operator == Models.LOGIC_COMPARISON.equals_to
  17043. }, {
  17044. name: '!=',
  17045. value: Models.LOGIC_COMPARISON.not_equals_to,
  17046. selected: logic_operator == Models.LOGIC_COMPARISON.not_equals_to
  17047. }, {
  17048. name: '&&',
  17049. value: Models.LOGIC_COMPARISON.and,
  17050. selected: logic_operator == Models.LOGIC_COMPARISON.and
  17051. }, {
  17052. name: '||',
  17053. value: Models.LOGIC_COMPARISON.or,
  17054. selected: logic_operator == Models.LOGIC_COMPARISON.or
  17055. }],
  17056. onChange: function onChange(value, text, $selectedItem) {
  17057. if ($selectedItem) {
  17058. expression_logic.operator = value;
  17059. if (expression_logic.second_operand == null) {
  17060. expression_logic.second_operand = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  17061. initial_el_to_render.empty();
  17062. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  17063. }
  17064. }
  17065. }
  17066. });
  17067. element_to_append.append(menu_operator);
  17068. }
  17069. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  17070. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17071. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17072. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17073. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17074. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17075. if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17076. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17077. } else if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17078. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17079. } else {
  17080. VariableValueMenuManagement.renderMenu(command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  17081. }
  17082. element_to_append.append(exp_el_par_1);
  17083. element_to_append.append(exp_el_expr_el_1);
  17084. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  17085. element_to_append.append(exp_el_expr_operand);
  17086. if (expression_logic.second_operand) {
  17087. if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17088. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17089. } else if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17090. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17091. } else {
  17092. VariableValueMenuManagement.renderMenu(command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  17093. }
  17094. element_to_append.append(exp_el_expr_el_2);
  17095. }
  17096. element_to_append.append(exp_el_par_2);
  17097. }
  17098. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  17099. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17100. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17101. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17102. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17103. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17104. if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17105. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17106. } else if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17107. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17108. } else {
  17109. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  17110. }
  17111. if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17112. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17113. } else if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17114. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17115. } else {
  17116. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  17117. }
  17118. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  17119. element_to_append.append(exp_el_par_1);
  17120. element_to_append.append(exp_el_expr_el_1);
  17121. element_to_append.append(exp_el_expr_operand);
  17122. element_to_append.append(exp_el_expr_el_2);
  17123. element_to_append.append(exp_el_par_2);
  17124. }
  17125. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  17126. var start_menu = '';
  17127. 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">';
  17128. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_logic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_logic_expression') + '</div>';
  17129. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_arithmetic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_arithmetic_expression') + '</div>';
  17130. start_menu += '</div></div>';
  17131. start_menu = (0, _jquery2.default)(start_menu);
  17132. start_menu.dropdown({
  17133. onChange: function onChange(value, text, $selectedItem) {
  17134. switch ($selectedItem.data('exp')) {
  17135. case Models.EXPRESSION_TYPES.exp_logic:
  17136. expression.expression = new Models.LogicExpression(false, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17137. break;
  17138. case Models.EXPRESSION_TYPES.exp_arithmetic:
  17139. 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);
  17140. break;
  17141. }
  17142. initial_el_to_render.html('');
  17143. renderExpression(command, expression, function_obj, initial_el_to_render);
  17144. }
  17145. });
  17146. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17147. initial_el_to_render.append(start_menu);
  17148. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17149. }
  17150. /***/ }),
  17151. /***/ "./js/visualUI/commands/contextualized_menu.js":
  17152. /*!*****************************************************!*\
  17153. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  17154. \*****************************************************/
  17155. /*! no static exports found */
  17156. /***/ (function(module, exports, __webpack_require__) {
  17157. "use strict";
  17158. Object.defineProperty(exports, "__esModule", {
  17159. value: true
  17160. });
  17161. exports.renderMenu = renderMenu;
  17162. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17163. var _jquery2 = _interopRequireDefault(_jquery);
  17164. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17165. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17166. var Models = _interopRequireWildcard(_ivprog_elements);
  17167. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17168. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17169. var CommandsManagement = _interopRequireWildcard(_commands);
  17170. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17171. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  17172. var _switch = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  17173. var SwitchManagement = _interopRequireWildcard(_switch);
  17174. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17175. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17176. 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; } }
  17177. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17178. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  17179. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  17180. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17181. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17182. } else {
  17183. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17184. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.switchcase + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_case') + ' </a>';
  17185. }
  17186. menu_div += '</div></div>';
  17187. menu_div = (0, _jquery2.default)(menu_div);
  17188. dom_where_render.append(menu_div);
  17189. addHandlers(command, dom_where_render, function_obj, dom_command);
  17190. }
  17191. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  17192. dom_where_render.find('.menu_commands').dropdown({
  17193. on: 'hover'
  17194. });
  17195. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  17196. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17197. if (command.commands_block == null || command.commands_block.length == 0) {
  17198. command.commands_block = [];
  17199. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  17200. command.commands_block.push(new_cmd);
  17201. CommandsManagement.renderCommand(new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  17202. } else {
  17203. CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), (0, _jquery2.default)(this).data('command'), evt);
  17204. }
  17205. } else {
  17206. switch ((0, _jquery2.default)(this).data('command')) {
  17207. case Models.COMMAND_TYPES.break:
  17208. CommandsManagement.createFloatingCommand(function_obj, null, (0, _jquery2.default)(this).data('command'), evt);
  17209. break;
  17210. case Models.COMMAND_TYPES.switchcase:
  17211. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  17212. break;
  17213. }
  17214. }
  17215. });
  17216. }
  17217. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  17218. if (command.cases == null) {
  17219. command.cases = [];
  17220. }
  17221. var sc = new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17222. command.cases.push(sc);
  17223. SwitchManagement.renderCase(sc, command, function_obj, dom_command.find('.all_cases_div'));
  17224. }
  17225. /***/ }),
  17226. /***/ "./js/visualUI/commands/dowhiletrue.js":
  17227. /*!*********************************************!*\
  17228. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  17229. \*********************************************/
  17230. /*! no static exports found */
  17231. /***/ (function(module, exports, __webpack_require__) {
  17232. "use strict";
  17233. Object.defineProperty(exports, "__esModule", {
  17234. value: true
  17235. });
  17236. exports.createFloatingCommand = createFloatingCommand;
  17237. exports.renderCommand = renderCommand;
  17238. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17239. var _jquery2 = _interopRequireDefault(_jquery);
  17240. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17241. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17242. var Models = _interopRequireWildcard(_ivprog_elements);
  17243. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17244. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17245. var GlobalsManagement = _interopRequireWildcard(_globals);
  17246. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17247. var VariablesManagement = _interopRequireWildcard(_variables);
  17248. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17249. var CommandsManagement = _interopRequireWildcard(_commands);
  17250. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17251. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17252. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17253. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17254. 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; } }
  17255. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17256. function createFloatingCommand() {
  17257. 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>');
  17258. }
  17259. function renderCommand(command, function_obj) {
  17260. var ret = '';
  17261. 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>';
  17262. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  17263. ret += '</div>';
  17264. 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>';
  17265. ret += '</div>';
  17266. var el = (0, _jquery2.default)(ret);
  17267. el.data('command', command);
  17268. addHandlers(command, function_obj, el);
  17269. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17270. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17271. if (command.commands_block) {
  17272. for (var j = 0; j < command.commands_block.length; j++) {
  17273. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17274. }
  17275. }
  17276. return el;
  17277. }
  17278. function addHandlers(command, function_obj, dowhiletrue_dom) {
  17279. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  17280. if (CommandsManagement.removeCommand(command, function_obj, dowhiletrue_dom)) {
  17281. dowhiletrue_dom.fadeOut();
  17282. }
  17283. });
  17284. }
  17285. /***/ }),
  17286. /***/ "./js/visualUI/commands/functioncall.js":
  17287. /*!**********************************************!*\
  17288. !*** ./js/visualUI/commands/functioncall.js ***!
  17289. \**********************************************/
  17290. /*! no static exports found */
  17291. /***/ (function(module, exports, __webpack_require__) {
  17292. "use strict";
  17293. Object.defineProperty(exports, "__esModule", {
  17294. value: true
  17295. });
  17296. exports.createFloatingCommand = createFloatingCommand;
  17297. exports.renderCommand = renderCommand;
  17298. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17299. var _jquery2 = _interopRequireDefault(_jquery);
  17300. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17301. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17302. var Models = _interopRequireWildcard(_ivprog_elements);
  17303. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17304. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17305. var GlobalsManagement = _interopRequireWildcard(_globals);
  17306. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17307. var VariablesManagement = _interopRequireWildcard(_variables);
  17308. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17309. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17310. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17311. var CommandsManagement = _interopRequireWildcard(_commands);
  17312. 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; } }
  17313. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17314. function createFloatingCommand() {
  17315. return (0, _jquery2.default)('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  17316. }
  17317. function renderCommand(command, function_obj) {
  17318. 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>');
  17319. el.data('command', command);
  17320. VariableValueMenu.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  17321. addHandlers(command, function_obj, el);
  17322. return el;
  17323. }
  17324. function addHandlers(command, function_obj, functioncall_dom) {
  17325. functioncall_dom.find('.button_remove_command').on('click', function () {
  17326. if (CommandsManagement.removeCommand(command, function_obj, functioncall_dom)) {
  17327. functioncall_dom.fadeOut();
  17328. }
  17329. });
  17330. }
  17331. /***/ }),
  17332. /***/ "./js/visualUI/commands/iftrue.js":
  17333. /*!****************************************!*\
  17334. !*** ./js/visualUI/commands/iftrue.js ***!
  17335. \****************************************/
  17336. /*! no static exports found */
  17337. /***/ (function(module, exports, __webpack_require__) {
  17338. "use strict";
  17339. Object.defineProperty(exports, "__esModule", {
  17340. value: true
  17341. });
  17342. exports.createFloatingCommand = createFloatingCommand;
  17343. exports.renderCommand = renderCommand;
  17344. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17345. var _jquery2 = _interopRequireDefault(_jquery);
  17346. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17347. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17348. var Models = _interopRequireWildcard(_ivprog_elements);
  17349. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17350. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17351. var GlobalsManagement = _interopRequireWildcard(_globals);
  17352. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17353. var VariablesManagement = _interopRequireWildcard(_variables);
  17354. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17355. var CommandsManagement = _interopRequireWildcard(_commands);
  17356. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17357. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17358. 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; } }
  17359. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17360. function createFloatingCommand() {
  17361. return (0, _jquery2.default)('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  17362. }
  17363. function renderCommand(command, function_obj) {
  17364. var ret = '';
  17365. 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>';
  17366. ret += '<span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_if') + '</span>';
  17367. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  17368. ret += '<span> </span> ';
  17369. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  17370. ret += '</div></div>';
  17371. ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' </span>';
  17372. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  17373. ret += '</div>';
  17374. ret += '<span></span></div>';
  17375. ret += '</div>';
  17376. var el = (0, _jquery2.default)(ret);
  17377. el.data('command', command);
  17378. el.find('.block_commands').data('command', command);
  17379. el.find('.data_block_if').data('command', command);
  17380. el.find('.data_block_else').data('command', command);
  17381. addHandlers(command, function_obj, el);
  17382. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17383. if (command.commands_block) {
  17384. for (var j = 0; j < command.commands_block.length; j++) {
  17385. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.commands_if')[0]), 3, function_obj);
  17386. }
  17387. }
  17388. if (command.commands_else) {
  17389. for (var j = 0; j < command.commands_else.length; j++) {
  17390. CommandsManagement.renderCommand(command.commands_else[j], (0, _jquery2.default)(el.find('.commands_else')[0]), 3, function_obj);
  17391. }
  17392. }
  17393. return el;
  17394. }
  17395. function addHandlers(command, function_obj, iftrue_dom) {
  17396. iftrue_dom.find('.button_remove_command').on('click', function () {
  17397. if (CommandsManagement.removeCommand(command, function_obj, iftrue_dom)) {
  17398. iftrue_dom.fadeOut();
  17399. }
  17400. });
  17401. }
  17402. /***/ }),
  17403. /***/ "./js/visualUI/commands/reader.js":
  17404. /*!****************************************!*\
  17405. !*** ./js/visualUI/commands/reader.js ***!
  17406. \****************************************/
  17407. /*! no static exports found */
  17408. /***/ (function(module, exports, __webpack_require__) {
  17409. "use strict";
  17410. Object.defineProperty(exports, "__esModule", {
  17411. value: true
  17412. });
  17413. exports.createFloatingCommand = createFloatingCommand;
  17414. exports.renderCommand = renderCommand;
  17415. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17416. var _jquery2 = _interopRequireDefault(_jquery);
  17417. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17418. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17419. var Models = _interopRequireWildcard(_ivprog_elements);
  17420. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17421. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17422. var GlobalsManagement = _interopRequireWildcard(_globals);
  17423. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17424. var VariablesManagement = _interopRequireWildcard(_variables);
  17425. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17426. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17427. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17428. var CommandsManagement = _interopRequireWildcard(_commands);
  17429. 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; } }
  17430. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17431. function createFloatingCommand() {
  17432. 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>');
  17433. }
  17434. function renderCommand(command, function_obj) {
  17435. 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>';
  17436. el = (0, _jquery2.default)(el);
  17437. el.data('command', command);
  17438. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17439. addHandlers(command, function_obj, el);
  17440. return el;
  17441. }
  17442. function addHandlers(command, function_obj, reader_dom) {
  17443. reader_dom.find('.button_remove_command').on('click', function () {
  17444. if (CommandsManagement.removeCommand(command, function_obj, reader_dom)) {
  17445. reader_dom.fadeOut();
  17446. }
  17447. });
  17448. }
  17449. /***/ }),
  17450. /***/ "./js/visualUI/commands/repeatNtimes.js":
  17451. /*!**********************************************!*\
  17452. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  17453. \**********************************************/
  17454. /*! no static exports found */
  17455. /***/ (function(module, exports, __webpack_require__) {
  17456. "use strict";
  17457. Object.defineProperty(exports, "__esModule", {
  17458. value: true
  17459. });
  17460. exports.createFloatingCommand = createFloatingCommand;
  17461. exports.renderCommand = renderCommand;
  17462. exports.manageExpressionElements = manageExpressionElements;
  17463. exports.manageClearExpressionElements = manageClearExpressionElements;
  17464. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17465. var _jquery2 = _interopRequireDefault(_jquery);
  17466. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17467. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17468. var Models = _interopRequireWildcard(_ivprog_elements);
  17469. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17470. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17471. var GlobalsManagement = _interopRequireWildcard(_globals);
  17472. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17473. var VariablesManagement = _interopRequireWildcard(_variables);
  17474. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17475. var CommandsManagement = _interopRequireWildcard(_commands);
  17476. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17477. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17478. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17479. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17480. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17481. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17482. 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; } }
  17483. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17484. function createFloatingCommand() {
  17485. 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>');
  17486. }
  17487. function renderCommand(command, function_obj) {
  17488. 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>';
  17489. ret += '<div class="ui block_commands">';
  17490. ret += '</div>';
  17491. ret += '<span> </span>';
  17492. ret += '</div>';
  17493. var el = (0, _jquery2.default)(ret);
  17494. el.data('command', command);
  17495. addHandlers(command, function_obj, el);
  17496. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17497. VariableValueMenu.renderMenu(command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  17498. ConditionalExpressionManagement.renderExpression(command, command.expression2, function_obj, el.find('.conditional_expression'));
  17499. VariableValueMenu.renderMenu(command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  17500. if (command.expression1) {
  17501. el.find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17502. VariableValueMenu.renderMenu(command, command.expression1, el.find('.var_value_expression'), function_obj);
  17503. }
  17504. if (command.expression3) {
  17505. el.find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17506. VariableValueMenu.renderMenu(command, command.expression3.itens[0], el.find('.first_operand'), function_obj);
  17507. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  17508. VariableValueMenu.renderMenu(command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  17509. }
  17510. if (command.commands_block) {
  17511. for (var j = 0; j < command.commands_block.length; j++) {
  17512. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17513. }
  17514. }
  17515. return el;
  17516. }
  17517. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17518. if (dom_object.hasClass('variable_attribution')) {
  17519. if (!command.expression3) {
  17520. 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)]);
  17521. command.expression3 = exp;
  17522. command.var_incrementation = command.var_attribution;
  17523. 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);
  17524. command.expression2.expression = cond_exp;
  17525. }
  17526. dom_object.parent().find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17527. command.expression1 = new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "0", null, null, true);
  17528. dom_object.parent().find('.var_value_expression').empty();
  17529. VariableValueMenu.renderMenu(command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  17530. renderAlgorithm();
  17531. }
  17532. if (dom_object.hasClass('incrementation_variable')) {
  17533. dom_object.parent().find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17534. 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)]);
  17535. command.expression3 = exp;
  17536. VariableValueMenu.renderMenu(command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  17537. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  17538. VariableValueMenu.renderMenu(command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  17539. }
  17540. }
  17541. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17542. if (dom_object.hasClass('variable_attribution')) {
  17543. (0, _jquery2.default)(dom_object).parent().find('.text_receives').text('');
  17544. command.expression1 = null;
  17545. (0, _jquery2.default)(dom_object).parent().find('.var_value_expression').empty();
  17546. }
  17547. if (dom_object.hasClass('incrementation_variable')) {
  17548. (0, _jquery2.default)(dom_object).parent().find('.text_inc_receives').text('');
  17549. command.expression3 = null;
  17550. (0, _jquery2.default)(dom_object).parent().find('.first_operand').empty();
  17551. (0, _jquery2.default)(dom_object).parent().find('.operator').empty();
  17552. (0, _jquery2.default)(dom_object).parent().find('.second_operand').empty();
  17553. }
  17554. }
  17555. function addHandlers(command, function_obj, repeatNtimes_dom) {
  17556. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  17557. if (CommandsManagement.removeCommand(command, function_obj, repeatNtimes_dom)) {
  17558. repeatNtimes_dom.fadeOut();
  17559. }
  17560. });
  17561. }
  17562. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  17563. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div></div>');
  17564. menu_operator.dropdown({
  17565. values: [{
  17566. name: '+',
  17567. value: Models.ARITHMETIC_TYPES.plus,
  17568. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.plus
  17569. }, {
  17570. name: '-',
  17571. value: Models.ARITHMETIC_TYPES.minus,
  17572. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.minus
  17573. }, {
  17574. name: '*',
  17575. value: Models.ARITHMETIC_TYPES.multiplication,
  17576. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.multiplication
  17577. }, {
  17578. name: '/',
  17579. value: Models.ARITHMETIC_TYPES.division,
  17580. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.division
  17581. }, {
  17582. name: '%',
  17583. value: Models.ARITHMETIC_TYPES.module,
  17584. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.module
  17585. }],
  17586. onChange: function onChange(value, text, $selectedItem) {
  17587. expression_element.itens[index_op] = value;
  17588. }
  17589. });
  17590. temp_op.append(menu_operator);
  17591. }
  17592. /***/ }),
  17593. /***/ "./js/visualUI/commands/return.js":
  17594. /*!****************************************!*\
  17595. !*** ./js/visualUI/commands/return.js ***!
  17596. \****************************************/
  17597. /*! no static exports found */
  17598. /***/ (function(module, exports, __webpack_require__) {
  17599. "use strict";
  17600. Object.defineProperty(exports, "__esModule", {
  17601. value: true
  17602. });
  17603. exports.createFloatingCommand = createFloatingCommand;
  17604. exports.renderCommand = renderCommand;
  17605. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17606. var _jquery2 = _interopRequireDefault(_jquery);
  17607. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17608. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17609. var Models = _interopRequireWildcard(_ivprog_elements);
  17610. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17611. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17612. var GlobalsManagement = _interopRequireWildcard(_globals);
  17613. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17614. var VariablesManagement = _interopRequireWildcard(_variables);
  17615. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17616. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17617. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17618. var CommandsManagement = _interopRequireWildcard(_commands);
  17619. 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; } }
  17620. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17621. function createFloatingCommand() {
  17622. 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>');
  17623. }
  17624. function renderCommand(command, function_obj) {
  17625. 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>');
  17626. el.data('command', command);
  17627. addHandlers(command, function_obj, el);
  17628. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17629. return el;
  17630. }
  17631. function addHandlers(command, function_obj, return_dom) {
  17632. return_dom.find('.button_remove_command').on('click', function () {
  17633. if (CommandsManagement.removeCommand(command, function_obj, return_dom)) {
  17634. return_dom.fadeOut();
  17635. }
  17636. });
  17637. }
  17638. /***/ }),
  17639. /***/ "./js/visualUI/commands/switch.js":
  17640. /*!****************************************!*\
  17641. !*** ./js/visualUI/commands/switch.js ***!
  17642. \****************************************/
  17643. /*! no static exports found */
  17644. /***/ (function(module, exports, __webpack_require__) {
  17645. "use strict";
  17646. Object.defineProperty(exports, "__esModule", {
  17647. value: true
  17648. });
  17649. exports.createFloatingCommand = createFloatingCommand;
  17650. exports.renderCommand = renderCommand;
  17651. exports.renderCase = renderCase;
  17652. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17653. var _jquery2 = _interopRequireDefault(_jquery);
  17654. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17655. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17656. var Models = _interopRequireWildcard(_ivprog_elements);
  17657. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17658. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17659. var GlobalsManagement = _interopRequireWildcard(_globals);
  17660. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17661. var VariablesManagement = _interopRequireWildcard(_variables);
  17662. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17663. var CommandsManagement = _interopRequireWildcard(_commands);
  17664. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17665. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17666. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17667. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17668. 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; } }
  17669. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17670. function createFloatingCommand() {
  17671. 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>');
  17672. }
  17673. function renderCommand(command, function_obj) {
  17674. var ret = '';
  17675. 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>';
  17676. ret += '</div>';
  17677. var el = (0, _jquery2.default)(ret);
  17678. el.data('command', command);
  17679. addHandlers(command, function_obj, el);
  17680. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17681. VariableValueMenu.renderMenu(command, command.variable, el.find('.variable_to_switch'), function_obj);
  17682. if (command.cases) {
  17683. for (var i = 0; i < command.cases.length; i++) {
  17684. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  17685. }
  17686. }
  17687. return el;
  17688. }
  17689. function renderCase(switchcase, command, function_obj, el) {
  17690. 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>');
  17691. VariableValueMenu.renderMenu(command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  17692. casediv.data('switchcase', switchcase);
  17693. casediv.find('.case_commands_block').data('switchcase', switchcase);
  17694. el.append(casediv);
  17695. if (switchcase.commands_block) {
  17696. for (var j = 0; j < switchcase.commands_block.length; j++) {
  17697. CommandsManagement.renderCommand(switchcase.commands_block[j], (0, _jquery2.default)(casediv.find('.case_commands_block')[0]), 3, function_obj);
  17698. }
  17699. }
  17700. casediv.find('.button_remove_command').on('click', function () {
  17701. for (var i = 0; i < command.cases.length; i++) {
  17702. if (switchcase == command.cases[i]) {
  17703. delete command.cases[i];
  17704. command.cases.splice(i, 1);
  17705. casediv.remove();
  17706. break;
  17707. }
  17708. }
  17709. });
  17710. }
  17711. function addHandlers(command, function_obj, switch_dom) {
  17712. switch_dom.find('.button_remove_command').on('click', function () {
  17713. if (CommandsManagement.removeCommand(command, function_obj, switch_dom)) {
  17714. switch_dom.fadeOut();
  17715. }
  17716. });
  17717. }
  17718. /***/ }),
  17719. /***/ "./js/visualUI/commands/variable_value_menu.js":
  17720. /*!*****************************************************!*\
  17721. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  17722. \*****************************************************/
  17723. /*! no static exports found */
  17724. /***/ (function(module, exports, __webpack_require__) {
  17725. "use strict";
  17726. Object.defineProperty(exports, "__esModule", {
  17727. value: true
  17728. });
  17729. exports.VAR_OR_VALUE_TYPES = undefined;
  17730. exports.renderMenu = renderMenu;
  17731. exports.refreshMenu = refreshMenu;
  17732. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17733. var _jquery2 = _interopRequireDefault(_jquery);
  17734. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17735. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17736. var Models = _interopRequireWildcard(_ivprog_elements);
  17737. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17738. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17739. var GlobalsManagement = _interopRequireWildcard(_globals);
  17740. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17741. var VariablesManagement = _interopRequireWildcard(_variables);
  17742. var _attribution = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  17743. var AttribuitionsManagement = _interopRequireWildcard(_attribution);
  17744. var _writer = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  17745. var WritersManagement = _interopRequireWildcard(_writer);
  17746. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17747. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17748. 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; } }
  17749. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17750. 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,
  17751. value_and_function: 6, all: 7 });
  17752. function renderMenu(command, ref_object, dom_object, function_obj) {
  17753. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  17754. var expression_element = arguments[5];
  17755. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  17756. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  17757. if (ref_object.function_called) {
  17758. if (ref_object.function_called.parameters_list) {
  17759. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  17760. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  17761. ref_object.parameters_list.pop();
  17762. } else {
  17763. ref_object.parameters_list.push(new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17764. }
  17765. }
  17766. }
  17767. }
  17768. var menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-algo="12"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17769. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  17770. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_vars">';
  17771. menu_var_or_value += '</div>';
  17772. }
  17773. 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) {
  17774. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('variable');
  17775. menu_var_or_value += '<div class="menu menu_only_vars">';
  17776. menu_var_or_value += '</div></div>';
  17777. }
  17778. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  17779. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  17780. }
  17781. 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) {
  17782. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  17783. }
  17784. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  17785. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_functions">';
  17786. menu_var_or_value += '</div>';
  17787. }
  17788. 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) {
  17789. 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');
  17790. menu_var_or_value += '<div class="menu menu_only_functions">';
  17791. menu_var_or_value += '</div></div>';
  17792. if (command.type == Models.COMMAND_TYPES.attribution) {
  17793. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  17794. menu_var_or_value += '<div class="menu">';
  17795. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  17796. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  17797. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  17798. menu_var_or_value += '</div></div>';
  17799. }
  17800. }
  17801. menu_var_or_value += '</div></div>';
  17802. menu_var_or_value = (0, _jquery2.default)(menu_var_or_value);
  17803. dom_object.append(menu_var_or_value);
  17804. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  17805. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17806. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17807. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17808. if (ref_object.content || ref_object.function_called) {
  17809. if (ref_object.content) {
  17810. // Verificar se a variável ainda existe:
  17811. var variable_fun = isVarInProgram(ref_object.content, function_obj);
  17812. if (variable_fun) {
  17813. ref_object.content = variable_fun;
  17814. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17815. } else {
  17816. if (ref_object.content && ref_object.content.type) {
  17817. ref_object.content = null;
  17818. appendSelectText(ref_object, menu_var_or_value);
  17819. } else {
  17820. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17821. }
  17822. }
  17823. } else if (ref_object.function_called) {
  17824. // Verificar se a função ainda existe:
  17825. var ret_function = isFunctionInProgram(ref_object.function_called);
  17826. if (ret_function) {
  17827. ref_object.function_called = ret_function;
  17828. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17829. } else {
  17830. ref_object.content = null;
  17831. ref_object.row = null;
  17832. ref_object.column = null;
  17833. delete ref_object.function_called;
  17834. delete ref_object.parameters_list;
  17835. appendSelectText(ref_object, menu_var_or_value);
  17836. }
  17837. }
  17838. } else {
  17839. appendSelectText(ref_object, menu_var_or_value);
  17840. }
  17841. }
  17842. function appendSelectText(ref_object, menu_var_or_value) {
  17843. switch (ref_object.variable_and_value) {
  17844. case VAR_OR_VALUE_TYPES.only_variable:
  17845. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_var') + '</i>');
  17846. break;
  17847. case VAR_OR_VALUE_TYPES.all:
  17848. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  17849. break;
  17850. case VAR_OR_VALUE_TYPES.variable_and_function:
  17851. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  17852. break;
  17853. case VAR_OR_VALUE_TYPES.only_function:
  17854. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_function') + '</i>');
  17855. break;
  17856. }
  17857. }
  17858. function isFunctionInProgram(function_called_obj) {
  17859. if (function_called_obj.name) {
  17860. if (window.program_obj.functions) {
  17861. for (var i = 0; i < window.program_obj.functions.length; i++) {
  17862. if (window.program_obj.functions[i] == function_called_obj) {
  17863. return window.program_obj.functions[i];
  17864. }
  17865. }
  17866. for (var i = 0; i < window.program_obj.functions.length; i++) {
  17867. if (window.program_obj.functions[i].name == function_called_obj.name) {
  17868. return window.program_obj.functions[i];
  17869. }
  17870. }
  17871. }
  17872. } else if (function_called_obj.identifier) {
  17873. for (var i = 0; i < window.system_functions.length; i++) {
  17874. if (window.system_functions[i].identifier == function_called_obj.identifier) {
  17875. return window.system_functions[i];
  17876. }
  17877. }
  17878. }
  17879. return null;
  17880. }
  17881. function isVarInProgram(var_obj, function_obj) {
  17882. // Verify in locals:
  17883. if (function_obj.variables_list) {
  17884. for (var i = 0; i < function_obj.variables_list.length; i++) {
  17885. if (function_obj.variables_list[i] == var_obj) {
  17886. return function_obj.variables_list[i];
  17887. }
  17888. }
  17889. }
  17890. // Verify in parameters:
  17891. if (function_obj.parameters_list) {
  17892. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  17893. if (function_obj.parameters_list[i] == var_obj) {
  17894. return function_obj.parameters_list[i];
  17895. }
  17896. }
  17897. }
  17898. // Verify in globals:
  17899. if (window.program_obj.globals) {
  17900. for (var i = 0; i < window.program_obj.globals.length; i++) {
  17901. if (window.program_obj.globals[i] == var_obj) {
  17902. return window.program_obj.globals[i];
  17903. }
  17904. }
  17905. }
  17906. // If not found, verify if the reference was lost
  17907. if (var_obj) {
  17908. if (function_obj.variables_list) {
  17909. for (var i = 0; i < function_obj.variables_list.length; i++) {
  17910. if (function_obj.variables_list[i].name == var_obj.name) {
  17911. return function_obj.variables_list[i];
  17912. }
  17913. }
  17914. }
  17915. if (function_obj.parameters_list) {
  17916. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  17917. if (function_obj.parameters_list[i].name == var_obj.name) {
  17918. return function_obj.parameters_list[i];
  17919. }
  17920. }
  17921. }
  17922. if (window.program_obj.globals) {
  17923. for (var i = 0; i < window.program_obj.globals.length; i++) {
  17924. if (window.program_obj.globals[i].name == var_obj.name) {
  17925. return window.program_obj.globals[i];
  17926. }
  17927. }
  17928. }
  17929. }
  17930. return null;
  17931. }
  17932. function refreshMenu(menu_var_or_value_dom) {
  17933. console.log('\n\n');
  17934. console.log(menu_var_or_value_dom);
  17935. console.log("olá, fui chamado! note alguns DATAS recuperados: ");
  17936. console.log(menu_var_or_value_dom.data());
  17937. console.log('\n\n\n');
  17938. }
  17939. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  17940. if (ref_object.function_called) {
  17941. menu_var_or_value.remove();
  17942. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  17943. } else if (ref_object.content.type) {
  17944. menu_var_or_value.remove();
  17945. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  17946. } else {
  17947. menu_var_or_value.remove();
  17948. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  17949. }
  17950. }
  17951. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  17952. if (variable_obj.content || variable_obj.function_called) {
  17953. // Verificar se a variável ainda existe:
  17954. var var_fun = isVarInProgram(variable_obj.content, function_obj);
  17955. if (var_fun) {
  17956. variable_obj.content = var_fun;
  17957. } else {
  17958. if (variable_obj.content && variable_obj.content.type) {
  17959. variable_obj.content = null;
  17960. appendSelectText(variable_obj, menu_var_or_value);
  17961. }
  17962. }
  17963. } else {
  17964. appendSelectText(variable_obj, menu_var_or_value);
  17965. }
  17966. if (variable_obj.content == null && variable_obj.function_called == null) {
  17967. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  17968. return;
  17969. }
  17970. var ret = '';
  17971. if (variable_obj.function_called) {
  17972. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  17973. menu_var_or_value.find('.text').text(' ');
  17974. dom_object.find('.menu_var_or_value_dom').remove();
  17975. var parameters_menu;
  17976. if (variable_obj.function_called.name) {
  17977. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  17978. } else {
  17979. 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>';
  17980. }
  17981. parameters_menu += '<span> ) </span></div>';
  17982. parameters_menu = (0, _jquery2.default)(parameters_menu);
  17983. dom_object.append(parameters_menu);
  17984. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17985. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  17986. if (command.type == Models.COMMAND_TYPES.attribution) {
  17987. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  17988. context_menu += '<div class="menu">';
  17989. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  17990. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  17991. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  17992. context_menu += '</div></div>';
  17993. }
  17994. context_menu += '</div></div>';
  17995. context_menu = (0, _jquery2.default)(context_menu);
  17996. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  17997. context_menu.dropdown({
  17998. onChange: function onChange(value, text, $selectedItem) {
  17999. console.log('S1');
  18000. if ($selectedItem.data('clear')) {
  18001. console.log('PP1');
  18002. dom_object.text('');
  18003. variable_obj.content = null;
  18004. variable_obj.row = null;
  18005. variable_obj.column = null;
  18006. delete variable_obj.function_called;
  18007. delete variable_obj.parameters_list;
  18008. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18009. }
  18010. if ($selectedItem.data('exp')) {
  18011. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18012. }
  18013. }
  18014. });
  18015. } else {
  18016. menu_var_or_value.find('.text').text(' ');
  18017. dom_object.find('.menu_var_or_value_dom').remove();
  18018. var parameters_menu;
  18019. if (variable_obj.function_called.name) {
  18020. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  18021. } else {
  18022. 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>';
  18023. }
  18024. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  18025. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18026. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  18027. parameters_menu += ' , ';
  18028. }
  18029. }
  18030. parameters_menu += '<span> ) </span></div>';
  18031. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18032. dom_object.append(parameters_menu);
  18033. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  18034. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  18035. }
  18036. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18037. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18038. if (command.type == Models.COMMAND_TYPES.attribution) {
  18039. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18040. context_menu += '<div class="menu">';
  18041. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18042. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18043. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18044. context_menu += '</div></div>';
  18045. }
  18046. context_menu += '</div></div>';
  18047. context_menu = (0, _jquery2.default)(context_menu);
  18048. context_menu.insertAfter(parameters_menu);
  18049. context_menu.dropdown({
  18050. onChange: function onChange(value, text, $selectedItem) {
  18051. console.log('S2');
  18052. if ($selectedItem.data('clear')) {
  18053. console.log('PP2');
  18054. dom_object.text('');
  18055. variable_obj.content = null;
  18056. variable_obj.row = null;
  18057. variable_obj.column = null;
  18058. delete variable_obj.function_called;
  18059. delete variable_obj.parameters_list;
  18060. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18061. }
  18062. if ($selectedItem.data('exp')) {
  18063. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18064. }
  18065. }
  18066. });
  18067. }
  18068. } else if (variable_obj.content.type) {
  18069. var variable_render = "";
  18070. if (variable_obj.content.dimensions == 1) {
  18071. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18072. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18073. variable_render += '</div>';
  18074. variable_render = (0, _jquery2.default)(variable_render);
  18075. dom_object.append(variable_render);
  18076. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18077. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18078. if (command.type == Models.COMMAND_TYPES.attribution) {
  18079. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18080. context_menu += '<div class="menu">';
  18081. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18082. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18083. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18084. context_menu += '</div></div>';
  18085. }
  18086. context_menu += '</div></div>';
  18087. context_menu = (0, _jquery2.default)(context_menu);
  18088. variable_render.append(context_menu);
  18089. context_menu.dropdown({
  18090. onChange: function onChange(value, text, $selectedItem) {
  18091. console.log('S3');
  18092. if ($selectedItem.data('clear')) {
  18093. console.log('PP3');
  18094. dom_object.text('');
  18095. variable_obj.content = null;
  18096. variable_obj.row = null;
  18097. variable_obj.column = null;
  18098. delete variable_obj.function_called;
  18099. delete variable_obj.parameters_list;
  18100. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18101. }
  18102. if ($selectedItem.data('exp')) {
  18103. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18104. }
  18105. }
  18106. });
  18107. if (!variable_obj.column) {
  18108. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18109. }
  18110. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18111. } else if (variable_obj.content.dimensions == 2) {
  18112. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18113. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  18114. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  18115. variable_render += '</div>';
  18116. variable_render = (0, _jquery2.default)(variable_render);
  18117. dom_object.append(variable_render);
  18118. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18119. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18120. if (command.type == Models.COMMAND_TYPES.attribution) {
  18121. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18122. context_menu += '<div class="menu">';
  18123. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18124. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18125. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18126. context_menu += '</div></div>';
  18127. }
  18128. context_menu += '</div></div>';
  18129. context_menu = (0, _jquery2.default)(context_menu);
  18130. variable_render.append(context_menu);
  18131. context_menu.dropdown({
  18132. onChange: function onChange(value, text, $selectedItem) {
  18133. console.log('S4');
  18134. if ($selectedItem.data('clear')) {
  18135. console.log('PP4');
  18136. dom_object.text('');
  18137. variable_obj.content = null;
  18138. variable_obj.row = null;
  18139. variable_obj.column = null;
  18140. delete variable_obj.function_called;
  18141. delete variable_obj.parameters_list;
  18142. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18143. }
  18144. if ($selectedItem.data('exp')) {
  18145. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18146. }
  18147. }
  18148. });
  18149. if (!variable_obj.column) {
  18150. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18151. }
  18152. if (!variable_obj.row) {
  18153. variable_obj.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18154. }
  18155. variableValueMenuCode(command, variable_obj.row, (0, _jquery2.default)(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  18156. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18157. } else {
  18158. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18159. variable_render += '</div>';
  18160. variable_render = (0, _jquery2.default)(variable_render);
  18161. dom_object.append(variable_render);
  18162. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18163. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18164. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18165. console.log('dom_object6');
  18166. console.log(dom_object);
  18167. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18168. context_menu += '<div class="menu">';
  18169. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18170. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18171. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18172. context_menu += '</div></div>';
  18173. }
  18174. context_menu += '</div></div>';
  18175. context_menu = (0, _jquery2.default)(context_menu);
  18176. variable_render.append(context_menu);
  18177. context_menu.dropdown({
  18178. onChange: function onChange(value, text, $selectedItem) {
  18179. console.log('S5');
  18180. if ($selectedItem.data('clear')) {
  18181. console.log('PP5');
  18182. dom_object.text('');
  18183. variable_obj.content = null;
  18184. variable_obj.row = null;
  18185. variable_obj.column = null;
  18186. delete variable_obj.function_called;
  18187. delete variable_obj.parameters_list;
  18188. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18189. }
  18190. if ($selectedItem.data('exp')) {
  18191. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18192. }
  18193. }
  18194. });
  18195. }
  18196. } else {
  18197. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  18198. variable_render += '</div>';
  18199. variable_render = (0, _jquery2.default)(variable_render);
  18200. dom_object.append(variable_render);
  18201. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18202. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18203. if (command.type == Models.COMMAND_TYPES.attribution) {
  18204. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18205. context_menu += '<div class="menu">';
  18206. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18207. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18208. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18209. context_menu += '</div></div>';
  18210. }
  18211. context_menu += '</div></div>';
  18212. context_menu = (0, _jquery2.default)(context_menu);
  18213. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18214. context_menu.insertAfter(variable_render);
  18215. }
  18216. context_menu.dropdown({
  18217. onChange: function onChange(value, text, $selectedItem) {
  18218. console.log('S6');
  18219. if ($selectedItem.data('clear')) {
  18220. console.log('PP6');
  18221. dom_object.text('');
  18222. variable_obj.content = null;
  18223. variable_obj.row = null;
  18224. variable_obj.column = null;
  18225. delete variable_obj.function_called;
  18226. delete variable_obj.parameters_list;
  18227. dom_object.find('.value_rendered').remove();
  18228. dom_object.find('.context_menu_clear').remove();
  18229. dom_object.find('.width-dynamic-minus').remove();
  18230. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18231. }
  18232. if ($selectedItem.data('exp')) {
  18233. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18234. }
  18235. }
  18236. });
  18237. variable_render.on('click', function (e) {
  18238. variable_render.remove();
  18239. variable_render.empty();
  18240. variable_render.remove();
  18241. dom_object.empty();
  18242. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18243. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  18244. });
  18245. }
  18246. }
  18247. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18248. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18249. sub_menu.append('<div class="divider"></div><div class="header">' + _localizedStringsService.LocalizedStrings.getUI('text_header_ivprog_functions') + '</div>');
  18250. 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>');
  18251. 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>');
  18252. 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>');
  18253. 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>');
  18254. // Insert Math functions:
  18255. for (var i = 0; i < window.system_functions.length; i++) {
  18256. var t = (0, _jquery2.default)('<div class="item"></div>');
  18257. t.data('function_reference', window.system_functions[i]);
  18258. t.data('option', VAR_OR_VALUE_TYPES.only_function);
  18259. t.text(_localizedStringsService.LocalizedStrings.getUI(window.system_functions[i].identifier));
  18260. switch (window.system_functions[i].category) {
  18261. case Models.SYSTEM_FUNCTIONS_CATEGORIES.math:
  18262. sub_menu.find('.menu_math_functions').append(t);
  18263. break;
  18264. case Models.SYSTEM_FUNCTIONS_CATEGORIES.text:
  18265. sub_menu.find('.menu_text_functions').append(t);
  18266. break;
  18267. case Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement:
  18268. sub_menu.find('.menu_arrangement_functions').append(t);
  18269. break;
  18270. case Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion:
  18271. sub_menu.find('.menu_conversion_functions').append(t);
  18272. break;
  18273. }
  18274. }
  18275. }
  18276. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18277. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18278. sub_menu.text('');
  18279. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18280. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + ' </div>');
  18281. temp.data('function_reference', window.program_obj.functions[i]);
  18282. sub_menu.append(temp);
  18283. }
  18284. }
  18285. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18286. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  18287. sub_menu.text('');
  18288. var is_there = false;
  18289. if (window.program_obj.globals) {
  18290. if (ref_object.include_constant) {
  18291. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18292. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18293. temp.data('variable_reference', window.program_obj.globals[i]);
  18294. sub_menu.append(temp);
  18295. is_there = true;
  18296. }
  18297. } else {
  18298. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18299. if (!window.program_obj.globals[i].is_constant) {
  18300. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18301. temp.data('variable_reference', window.program_obj.globals[i]);
  18302. sub_menu.append(temp);
  18303. is_there = true;
  18304. }
  18305. }
  18306. }
  18307. }
  18308. if (function_obj.parameters_list) {
  18309. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18310. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + ' </div>');
  18311. temp.data('variable_reference', function_obj.parameters_list[i]);
  18312. sub_menu.append(temp);
  18313. is_there = true;
  18314. }
  18315. }
  18316. if (function_obj.variables_list) {
  18317. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18318. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + ' </div>');
  18319. temp.data('variable_reference', function_obj.variables_list[i]);
  18320. sub_menu.append(temp);
  18321. is_there = true;
  18322. }
  18323. }
  18324. if (!is_there) {
  18325. sub_menu.append((0, _jquery2.default)('<div class="header">' + _localizedStringsService.LocalizedStrings.getUI('text_none_variable') + '</div>'));
  18326. sub_menu.append((0, _jquery2.default)('<div class="item disabled">' + _localizedStringsService.LocalizedStrings.getUI('text_none_variable_instruction') + '</div>'));
  18327. }
  18328. }
  18329. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18330. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18331. menu_var_or_value.dropdown({
  18332. onChange: function onChange(value, text, $selectedItem) {
  18333. console.log('S7');
  18334. dom_object.find('.var_name').remove();
  18335. switch ($selectedItem.data('option')) {
  18336. case VAR_OR_VALUE_TYPES.only_function:
  18337. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('function_reference'), expression_element);
  18338. break;
  18339. case VAR_OR_VALUE_TYPES.only_value:
  18340. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18341. break;
  18342. case VAR_OR_VALUE_TYPES.only_variable:
  18343. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('variable_reference'), expression_element);
  18344. break;
  18345. }
  18346. if ($selectedItem.data('exp')) {
  18347. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18348. }
  18349. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18350. RepeatNTimesManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18351. }
  18352. }
  18353. });
  18354. }
  18355. dom_object.find('.width-dynamic').on('input', function () {
  18356. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  18357. (0, _jquery2.default)(this).focus();
  18358. var tmpStr = (0, _jquery2.default)(this).val();
  18359. (0, _jquery2.default)(this).val('');
  18360. (0, _jquery2.default)(this).val(tmpStr);
  18361. (0, _jquery2.default)(this).css({
  18362. width: inputWidth
  18363. });
  18364. }).trigger('input');
  18365. if (command.type == Models.COMMAND_TYPES.comment) {
  18366. dom_object.parent().on('click', function (e) {
  18367. dom_object.find('.value_rendered').remove();
  18368. dom_object.find('.value_rendered').empty();
  18369. dom_object.find('.value_rendered').remove();
  18370. dom_object.empty();
  18371. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18372. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18373. });
  18374. }
  18375. }
  18376. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  18377. ref_object.function_called = function_selected;
  18378. ref_object.parameters_list = [];
  18379. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  18380. menu_var_or_value.find('.text').text(' ');
  18381. dom_object.find('.menu_var_or_value_dom').remove();
  18382. var parameters_menu;
  18383. if (function_selected.name) {
  18384. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18385. } else {
  18386. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18387. }
  18388. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18389. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18390. if (j + 1 != function_selected.parameters_list.length) {
  18391. parameters_menu += ' , ';
  18392. }
  18393. }
  18394. parameters_menu += '<span> ) </span></div>';
  18395. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18396. dom_object.append(parameters_menu);
  18397. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18398. var temp = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18399. ref_object.parameters_list.push(temp);
  18400. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  18401. }
  18402. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18403. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18404. if (command.type == Models.COMMAND_TYPES.attribution) {
  18405. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18406. context_menu += '<div class="menu">';
  18407. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18408. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18409. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18410. context_menu += '</div></div>';
  18411. }
  18412. context_menu += '</div></div>';
  18413. context_menu = (0, _jquery2.default)(context_menu);
  18414. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18415. context_menu.dropdown({
  18416. onChange: function onChange(value, text, $selectedItem) {
  18417. console.log('S8');
  18418. if ($selectedItem.data('clear')) {
  18419. console.log('PP7');
  18420. dom_object.text('');
  18421. ref_object.content = null;
  18422. ref_object.row = null;
  18423. ref_object.column = null;
  18424. delete ref_object.function_called;
  18425. delete ref_object.parameters_list;
  18426. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18427. }
  18428. if ($selectedItem.data('exp')) {
  18429. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18430. }
  18431. }
  18432. });
  18433. } else {
  18434. menu_var_or_value.find('.text').text(' ');
  18435. dom_object.find('.menu_var_or_value_dom').remove();
  18436. var parameters_menu;
  18437. if (function_selected.name) {
  18438. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18439. } else {
  18440. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18441. }
  18442. parameters_menu += '<span> ) </span></div>';
  18443. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18444. dom_object.append(parameters_menu);
  18445. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18446. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18447. if (command.type == Models.COMMAND_TYPES.attribution) {
  18448. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18449. context_menu += '<div class="menu">';
  18450. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18451. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18452. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18453. context_menu += '</div></div>';
  18454. }
  18455. context_menu += '</div></div>';
  18456. context_menu = (0, _jquery2.default)(context_menu);
  18457. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18458. context_menu.dropdown({
  18459. onChange: function onChange(value, text, $selectedItem) {
  18460. console.log('S9');
  18461. if ($selectedItem.data('clear')) {
  18462. console.log('PP8');
  18463. dom_object.text('');
  18464. ref_object.content = null;
  18465. ref_object.row = null;
  18466. ref_object.column = null;
  18467. delete ref_object.function_called;
  18468. delete ref_object.parameters_list;
  18469. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18470. }
  18471. if ($selectedItem.data('exp')) {
  18472. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18473. }
  18474. }
  18475. });
  18476. }
  18477. if (command.type == Models.COMMAND_TYPES.attribution) {
  18478. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18479. }
  18480. }
  18481. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  18482. ref_object.content = variable_selected;
  18483. menu_var_or_value.find('.text').text(' ');
  18484. dom_object.find('.menu_var_or_value_dom').remove();
  18485. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  18486. if (variable_selected.dimensions == 1) {
  18487. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18488. }
  18489. if (variable_selected.dimensions == 2) {
  18490. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  18491. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18492. }
  18493. variable_render += '</div>';
  18494. variable_render = (0, _jquery2.default)(variable_render);
  18495. dom_object.append(variable_render);
  18496. if (variable_selected.dimensions == 1) {
  18497. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18498. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18499. }
  18500. if (variable_selected.dimensions == 2) {
  18501. ref_object.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18502. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  18503. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18504. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18505. }
  18506. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18507. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18508. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18509. console.log("dom_object 10: ");
  18510. console.log(dom_object);
  18511. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18512. context_menu += '<div class="menu">';
  18513. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18514. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18515. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18516. context_menu += '</div></div>';
  18517. }
  18518. context_menu += '</div></div>';
  18519. context_menu = (0, _jquery2.default)(context_menu);
  18520. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  18521. context_menu.dropdown({
  18522. onChange: function onChange(value, text, $selectedItem) {
  18523. console.log('S10');
  18524. if ($selectedItem.data('clear')) {
  18525. console.log('PP9');
  18526. dom_object.text('');
  18527. ref_object.content = null;
  18528. ref_object.row = null;
  18529. ref_object.column = null;
  18530. delete ref_object.function_called;
  18531. delete ref_object.parameters_list;
  18532. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18533. }
  18534. if ($selectedItem.data('exp')) {
  18535. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18536. }
  18537. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18538. RepeatNTimesManagement.manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18539. }
  18540. }
  18541. });
  18542. if (command.type == Models.COMMAND_TYPES.attribution) {
  18543. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  18544. }
  18545. }
  18546. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18547. if (ref_object.content == null) {
  18548. ref_object.content = "";
  18549. }
  18550. menu_var_or_value.find('.text').text(' ');
  18551. var field = (0, _jquery2.default)('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  18552. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  18553. var rendered = (0, _jquery2.default)('<div class="value_rendered"></div>');
  18554. rendered.insertBefore(field);
  18555. field.focus();
  18556. field.val(ref_object.content);
  18557. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18558. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18559. if (command.type == Models.COMMAND_TYPES.attribution) {
  18560. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18561. context_menu += '<div class="menu">';
  18562. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18563. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18564. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18565. context_menu += '</div></div>';
  18566. }
  18567. context_menu += '</div></div>';
  18568. context_menu = (0, _jquery2.default)(context_menu);
  18569. dom_object.find('.menu_var_or_value_dom').remove();
  18570. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18571. context_menu.insertAfter(field);
  18572. }
  18573. context_menu.dropdown({
  18574. onChange: function onChange(value, text, $selectedItem) {
  18575. console.log('S11');
  18576. if ($selectedItem.data('clear')) {
  18577. console.log('PP10');
  18578. dom_object.text('');
  18579. dom_object.find('.value_rendered').remove();
  18580. dom_object.find('.context_menu_clear').remove();
  18581. dom_object.find('.width-dynamic-minus').remove();
  18582. ref_object.content = null;
  18583. ref_object.row = null;
  18584. ref_object.column = null;
  18585. delete ref_object.function_called;
  18586. delete ref_object.parameters_list;
  18587. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18588. }
  18589. if ($selectedItem.data('exp')) {
  18590. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18591. }
  18592. }
  18593. });
  18594. dom_object.find('.width-dynamic-minus').focusout(function () {
  18595. if ((0, _jquery2.default)(this).val().trim()) {
  18596. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18597. }
  18598. rendered.text(ref_object.content);
  18599. (0, _jquery2.default)(this).remove();
  18600. });
  18601. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  18602. var code = e.keyCode || e.which;
  18603. if (code == 13) {
  18604. if ((0, _jquery2.default)(this).val().trim()) {
  18605. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18606. }
  18607. rendered.text(ref_object.content);
  18608. (0, _jquery2.default)(this).remove();
  18609. }
  18610. if (code == 27) {
  18611. rendered.text(ref_object.content);
  18612. (0, _jquery2.default)(this).remove();
  18613. }
  18614. });
  18615. if (command.type == Models.COMMAND_TYPES.comment) {
  18616. rendered.parent().on('click', function (e) {
  18617. console.log("TTT14");
  18618. rendered.remove();
  18619. rendered.empty();
  18620. rendered.remove();
  18621. dom_object.empty();
  18622. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18623. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18624. });
  18625. }
  18626. rendered.on('click', function (e) {
  18627. console.log("TTT2");
  18628. rendered.remove();
  18629. rendered.empty();
  18630. rendered.remove();
  18631. dom_object.empty();
  18632. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18633. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18634. });
  18635. if (command.type == Models.COMMAND_TYPES.attribution) {
  18636. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18637. }
  18638. }
  18639. _jquery2.default.fn.textWidth = function (text, font) {
  18640. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  18641. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  18642. return _jquery2.default.fn.textWidth.fakeEl.width();
  18643. };
  18644. /***/ }),
  18645. /***/ "./js/visualUI/commands/whiletrue.js":
  18646. /*!*******************************************!*\
  18647. !*** ./js/visualUI/commands/whiletrue.js ***!
  18648. \*******************************************/
  18649. /*! no static exports found */
  18650. /***/ (function(module, exports, __webpack_require__) {
  18651. "use strict";
  18652. Object.defineProperty(exports, "__esModule", {
  18653. value: true
  18654. });
  18655. exports.createFloatingCommand = createFloatingCommand;
  18656. exports.renderCommand = renderCommand;
  18657. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18658. var _jquery2 = _interopRequireDefault(_jquery);
  18659. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18660. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18661. var Models = _interopRequireWildcard(_ivprog_elements);
  18662. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18663. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18664. var GlobalsManagement = _interopRequireWildcard(_globals);
  18665. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18666. var VariablesManagement = _interopRequireWildcard(_variables);
  18667. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18668. var CommandsManagement = _interopRequireWildcard(_commands);
  18669. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  18670. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  18671. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  18672. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  18673. 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; } }
  18674. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18675. function createFloatingCommand() {
  18676. 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>');
  18677. }
  18678. function renderCommand(command, function_obj) {
  18679. var ret = '';
  18680. 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>';
  18681. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  18682. ret += ' </span>';
  18683. ret += '<div class="ui block_commands">';
  18684. ret += '</div>';
  18685. ret += '<span> </span>';
  18686. ret += '</div>';
  18687. var el = (0, _jquery2.default)(ret);
  18688. el.data('command', command);
  18689. addHandlers(command, function_obj, el);
  18690. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  18691. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  18692. if (command.commands_block) {
  18693. for (var j = 0; j < command.commands_block.length; j++) {
  18694. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  18695. }
  18696. }
  18697. return el;
  18698. }
  18699. function addHandlers(command, function_obj, whiletrue_dom) {
  18700. whiletrue_dom.find('.button_remove_command').on('click', function () {
  18701. if (CommandsManagement.removeCommand(command, function_obj, whiletrue_dom)) {
  18702. whiletrue_dom.fadeOut();
  18703. }
  18704. });
  18705. }
  18706. /***/ }),
  18707. /***/ "./js/visualUI/commands/writer.js":
  18708. /*!****************************************!*\
  18709. !*** ./js/visualUI/commands/writer.js ***!
  18710. \****************************************/
  18711. /*! no static exports found */
  18712. /***/ (function(module, exports, __webpack_require__) {
  18713. "use strict";
  18714. Object.defineProperty(exports, "__esModule", {
  18715. value: true
  18716. });
  18717. exports.createFloatingCommand = createFloatingCommand;
  18718. exports.renderCommand = renderCommand;
  18719. exports.addContent = addContent;
  18720. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18721. var _jquery2 = _interopRequireDefault(_jquery);
  18722. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18723. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18724. var Models = _interopRequireWildcard(_ivprog_elements);
  18725. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18726. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18727. var GlobalsManagement = _interopRequireWildcard(_globals);
  18728. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18729. var VariablesManagement = _interopRequireWildcard(_variables);
  18730. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  18731. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  18732. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  18733. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18734. var CommandsManagement = _interopRequireWildcard(_commands);
  18735. 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; } }
  18736. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18737. function createFloatingCommand() {
  18738. 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>');
  18739. }
  18740. function renderCommand(command, function_obj) {
  18741. var ret = '';
  18742. 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>';
  18743. var el = (0, _jquery2.default)(ret);
  18744. el.data('command', command);
  18745. for (var i = 0; i < command.content.length; i++) {
  18746. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  18747. el.find('.all_elements_write').append(new_div_item);
  18748. VariableValueMenu.renderMenu(command, command.content[i], new_div_item, function_obj);
  18749. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  18750. }
  18751. addHandlers(command, function_obj, el);
  18752. return el;
  18753. }
  18754. function addHandlers(command, function_obj, writer_dom) {
  18755. writer_dom.find('.button_remove_command').on('click', function () {
  18756. if (CommandsManagement.removeCommand(command, function_obj, writer_dom)) {
  18757. writer_dom.fadeOut();
  18758. }
  18759. });
  18760. }
  18761. function addHandlerIconAdd(dom_object, command, function_obj) {
  18762. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  18763. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  18764. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  18765. if (!insert_after) {
  18766. dom_object.append(icon_add_item);
  18767. } else {
  18768. icon_add_item.insertAfter(after_which);
  18769. }
  18770. icon_add_item.on('click', function (e) {
  18771. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div" style="display:none;"></div>');
  18772. new_div_item.insertAfter(icon_add_item);
  18773. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18774. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  18775. addHandlerIconAdd(dom_object, command, function_obj, true, new_div_item);
  18776. var pos = 1;
  18777. dom_object.find('.icon_add_item_to_writer').each(function () {
  18778. if ((0, _jquery2.default)(this).get(0) === icon_add_item.get(0)) {
  18779. command.content.splice(pos, 0, new_related_menu);
  18780. } else {
  18781. pos++;
  18782. }
  18783. });
  18784. new_div_item.fadeIn();
  18785. });
  18786. }
  18787. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  18788. if (dom_object.hasClass('var_value_menu_div')) {
  18789. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  18790. icon_add_item.insertAfter(dom_object);
  18791. icon_add_item.on('click', function (e) {
  18792. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  18793. new_div_item.insertAfter(icon_add_item);
  18794. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18795. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  18796. command.content.push(new_related_menu);
  18797. });
  18798. }
  18799. }
  18800. /***/ }),
  18801. /***/ "./js/visualUI/functions.js":
  18802. /*!**********************************!*\
  18803. !*** ./js/visualUI/functions.js ***!
  18804. \**********************************/
  18805. /*! no static exports found */
  18806. /***/ (function(module, exports, __webpack_require__) {
  18807. "use strict";
  18808. Object.defineProperty(exports, "__esModule", {
  18809. value: true
  18810. });
  18811. exports.renderFunction = renderFunction;
  18812. exports.initVisualUI = initVisualUI;
  18813. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18814. var _jquery2 = _interopRequireDefault(_jquery);
  18815. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  18816. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18817. var Models = _interopRequireWildcard(_ivprog_elements);
  18818. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18819. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  18820. var GlobalsManagement = _interopRequireWildcard(_globals);
  18821. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  18822. var VariablesManagement = _interopRequireWildcard(_variables);
  18823. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  18824. var CommandsManagement = _interopRequireWildcard(_commands);
  18825. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  18826. var CodeManagement = _interopRequireWildcard(_code_generator);
  18827. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  18828. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  18829. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  18830. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  18831. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  18832. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  18833. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  18834. var _semanticAnalyser = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  18835. var _ivprogAssessment = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  18836. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  18837. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  18838. __webpack_require__(/*! ../Sortable.js */ "./js/Sortable.js");
  18839. 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; } }
  18840. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18841. var counter_new_functions = 0;
  18842. var counter_new_parameters = 0;
  18843. var studentTemp = null;
  18844. var domConsole = null;
  18845. window.studentGrade = null;
  18846. window.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  18847. var program = new Models.Program();
  18848. window.system_functions = [];
  18849. // Adding math functions:
  18850. 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));
  18851. 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));
  18852. 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));
  18853. 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));
  18854. 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));
  18855. 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));
  18856. 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));
  18857. 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));
  18858. 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));
  18859. 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));
  18860. 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));
  18861. // Adding text functions:
  18862. 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));
  18863. 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));
  18864. 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));
  18865. 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));
  18866. 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));
  18867. // Adding arrangement functions:
  18868. window.system_functions.push(new Models.SystemFunction('$numElements', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  18869. window.system_functions.push(new Models.SystemFunction('$matrixLines', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  18870. window.system_functions.push(new Models.SystemFunction('$matrixColumns', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  18871. // Adding conversion functions:
  18872. 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));
  18873. 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));
  18874. 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));
  18875. 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));
  18876. 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));
  18877. 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));
  18878. 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));
  18879. /*const variable1 = new Models.Variable(Types.INTEGER, "a", 1);
  18880. const parameter1 = new Models.Variable(Types.INTEGER, "par_1", 1);
  18881. const command1 = new Models.Comment(new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.only_value, "Testing rendering commands"));
  18882. const sumFunction = new Models.Function("soma", Types.INTEGER, 0, [parameter1], false, false, [], null, [command1]);
  18883. program.addFunction(sumFunction);
  18884. */
  18885. console.log(' ___ ___ ________ \n / / / / / ____/ \n / / / / / / \n / / / / ______ ___ / /__ \n / / / / / \\ / / / ___/ \n / /______ / / / /\\ \\/ / / / \n / / / / / / \\ / / /____ \n/__________/ /___/ /___/ \\___/ /________/ ');
  18886. var mainFunction = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("start"), _types.Types.VOID, 0, [], true, false);
  18887. mainFunction.function_comment = new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_main'));
  18888. program.addFunction(mainFunction);
  18889. window.program_obj = program;
  18890. window.generator = CodeManagement.generate;
  18891. window.runCodeAssessment = runCodeAssessment;
  18892. window.renderAlgorithm = AlgorithmManagement.renderAlgorithm;
  18893. window.insertContext = false;
  18894. window.watchW = _melankeWatchjs2.default;
  18895. _melankeWatchjs2.default.watch(window.program_obj.globals, function () {
  18896. if (window.insertContext) {
  18897. setTimeout(function () {
  18898. AlgorithmManagement.renderAlgorithm();
  18899. }, 300);
  18900. window.insertContext = false;
  18901. } else {
  18902. AlgorithmManagement.renderAlgorithm();
  18903. }
  18904. }, 1);
  18905. _melankeWatchjs2.default.watch(window.program_obj.functions, function () {
  18906. if (window.insertContext) {
  18907. setTimeout(function () {
  18908. AlgorithmManagement.renderAlgorithm();
  18909. }, 300);
  18910. window.insertContext = false;
  18911. } else {
  18912. AlgorithmManagement.renderAlgorithm();
  18913. }
  18914. }, 1);
  18915. function addFunctionHandler() {
  18916. 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')));
  18917. program.addFunction(new_function);
  18918. counter_new_functions++;
  18919. window.insertContext = true;
  18920. var newe = renderFunction(new_function);
  18921. newe.css('display', 'none');
  18922. newe.fadeIn();
  18923. }
  18924. function addParameter(function_obj, function_container) {
  18925. var is_from_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  18926. if (function_obj.parameters_list == null) {
  18927. function_obj.parameters_list = [];
  18928. }
  18929. var new_parameter = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI("new_parameter") + "_" + counter_new_parameters);
  18930. function_obj.parameters_list.push(new_parameter);
  18931. counter_new_parameters++;
  18932. var newe = renderParameter(function_obj, new_parameter, function_container);
  18933. if (is_from_click) {
  18934. newe.css('display', 'none');
  18935. newe.fadeIn();
  18936. }
  18937. }
  18938. function updateReturnType(function_obj, new_type) {
  18939. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  18940. function_obj.return_type = new_type;
  18941. function_obj.return_dimensions = new_dimensions;
  18942. }
  18943. function removeFunction(function_obj) {
  18944. var index = program.functions.indexOf(function_obj);
  18945. if (index > -1) {
  18946. program.functions.splice(index, 1);
  18947. }
  18948. }
  18949. function minimizeFunction(function_obj) {
  18950. function_obj.is_hidden = !function_obj.is_hidden;
  18951. }
  18952. function addHandlers(function_obj, function_container) {
  18953. function_container.find('.ui.dropdown.function_return').dropdown({
  18954. onChange: function onChange(value, text, $selectedItem) {
  18955. if ($selectedItem.data('dimensions')) {
  18956. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  18957. } else {
  18958. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')]);
  18959. }
  18960. }
  18961. });
  18962. function_container.find(".name_function_updated").on('click', function (e) {
  18963. enableNameFunctionUpdate(function_obj, function_container);
  18964. });
  18965. function_container.find(".add_parameter_button").on('click', function (e) {
  18966. window.insertContext = true;
  18967. addParameter(function_obj, function_container, true);
  18968. });
  18969. function_container.find('.menu_commands').dropdown({
  18970. on: 'hover'
  18971. });
  18972. function_container.find('.menu_commands a').on('click', function (evt) {
  18973. if (function_obj.commands == null || function_obj.commands.length == 0) {
  18974. function_obj.commands = [];
  18975. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  18976. function_obj.commands.push(new_cmd);
  18977. CommandsManagement.renderCommand(new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  18978. } else {
  18979. CommandsManagement.createFloatingCommand(function_obj, function_container, (0, _jquery2.default)(this).data('command'), evt);
  18980. }
  18981. });
  18982. function_container.find('.add_var_button_function').on('click', function (e) {
  18983. window.insertContext = true;
  18984. VariablesManagement.addVariable(function_obj, function_container, true);
  18985. });
  18986. function_container.find('.remove_function_button').on('click', function (e) {
  18987. removeFunction(function_obj);
  18988. function_container.fadeOut();
  18989. });
  18990. function_container.find('.minimize_function_button').on('click', function (e) {
  18991. minimizeFunction(function_obj);
  18992. if (function_obj.is_hidden) {
  18993. function_container.find(".add_var_button_function").toggle();
  18994. function_container.find(".inline_add_command").toggle();
  18995. function_container.find(".function_area").slideToggle();
  18996. } else {
  18997. function_container.find(".function_area").slideToggle(function () {
  18998. function_container.find(".add_var_button_function").toggle();
  18999. function_container.find(".inline_add_command").toggle();
  19000. });
  19001. }
  19002. });
  19003. }
  19004. // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  19005. function renderFunctionReturn(function_obj, function_element) {
  19006. var ret = '<div class="ui dropdown function_return">';
  19007. if (function_obj.return_dimensions > 0) {
  19008. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI("vector") + ':' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type);
  19009. if (function_obj.return_dimensions == 1) {
  19010. ret += ' [ ] ';
  19011. } else {
  19012. ret += ' [ ] [ ] ';
  19013. }
  19014. ret += '</div>';
  19015. } else {
  19016. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type) + '</div>';
  19017. }
  19018. ret += '<div class="menu">';
  19019. for (var tm in _types.Types) {
  19020. 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>';
  19021. }
  19022. for (var tm in _types.Types) {
  19023. if (tm == _types.Types.VOID.toUpperCase()) {
  19024. continue;
  19025. }
  19026. 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>';
  19027. }
  19028. ret += '</div></div>';
  19029. ret = (0, _jquery2.default)(ret);
  19030. function_element.find('.function_return').append(ret);
  19031. }
  19032. function renderFunction(function_obj) {
  19033. var appender = '<div class="ui secondary segment function_div list-group-item">';
  19034. if (function_obj.function_comment) {
  19035. //appender += renderComment(function_obj.function_comment, sequence, true, -1);
  19036. }
  19037. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  19038. 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>';
  19039. appender += '<div class="function_signature_div">' + _localizedStringsService.LocalizedStrings.getUI("function") + ' ';
  19040. if (function_obj.is_main) {
  19041. 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">';
  19042. } else {
  19043. appender += '<div class="ui function_return"></div>';
  19044. 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">';
  19045. }
  19046. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  19047. 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>';
  19048. appender += '<div class="ui top attached segment variables_list_div"></div>';
  19049. appender += '<div class="ui inline_add_command"><i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button dropdown menu_commands orange" style="float: left;" ><i class="icon code"></i> <div class="menu"> ';
  19050. appender += '<a class="item" data-command="' + Models.COMMAND_TYPES.reader + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_read_var') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.writer + '"><i class="upload icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_write_var') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.comment + '"><i class="quote left icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_comment') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.attribution + '"><i class="arrow left icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_attribution') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.functioncall + '"><i class="hand point right icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_functioncall') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.iftrue + '" ><i class="random icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_iftrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.repeatNtimes + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_repeatNtimes') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.whiletrue + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_whiletrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.dowhiletrue + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_dowhiletrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.switch + '"><i class="list icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_switch') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.return + '"><i class="reply icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_btn_return') + '</a>' + '</div></div></div>';
  19051. appender += '<div class="ui bottom attached segment commands_list_div"></div>';
  19052. appender += '</div></div>';
  19053. appender = (0, _jquery2.default)(appender);
  19054. (0, _jquery2.default)('.all_functions').append(appender);
  19055. appender.data('fun', function_obj);
  19056. appender.find('.commands_list_div').data('fun', function_obj);
  19057. renderFunctionReturn(function_obj, appender);
  19058. addHandlers(function_obj, appender);
  19059. // Rendering parameters:
  19060. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  19061. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  19062. }
  19063. // Rendering variables:
  19064. for (var j = 0; j < function_obj.variables_list.length; j++) {
  19065. VariablesManagement.renderVariable(appender, function_obj.variables_list[j], function_obj);
  19066. }
  19067. // Rendering commands:
  19068. for (var j = 0; j < function_obj.commands.length; j++) {
  19069. CommandsManagement.renderCommand(function_obj.commands[j], (0, _jquery2.default)(appender.find('.commands_list_div')[0]), 3, function_obj);
  19070. }
  19071. (0, _jquery2.default)('.minimize_function_button').popup({
  19072. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_minimize"),
  19073. delay: {
  19074. show: 750,
  19075. hide: 0
  19076. }
  19077. });
  19078. Sortable.create(appender.find(".variables_list_div")[0], {
  19079. handle: '.ellipsis',
  19080. animation: 100,
  19081. ghostClass: 'ghost',
  19082. group: 'local_vars_drag_' + program.functions.indexOf(function_obj),
  19083. onEnd: function onEnd(evt) {
  19084. updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  19085. }
  19086. });
  19087. Sortable.create(appender.find(".commands_list_div")[0], {
  19088. handle: '.command_drag',
  19089. animation: 100,
  19090. ghostClass: 'ghost',
  19091. group: 'commands_drag_' + program.functions.indexOf(function_obj),
  19092. onEnd: function onEnd(evt) {
  19093. //updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  19094. }
  19095. });
  19096. if (!function_obj.is_main) {
  19097. Sortable.create(appender.find(".container_parameters_list")[0], {
  19098. handle: '.ellipsis',
  19099. animation: 100,
  19100. ghostClass: 'ghost',
  19101. group: 'parameters_drag_' + program.functions.indexOf(function_obj),
  19102. onEnd: function onEnd(evt) {
  19103. updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
  19104. }
  19105. });
  19106. }
  19107. return appender;
  19108. }
  19109. function initVisualUI() {
  19110. // MUST USE CONST, LET, OR VAR !!!!!!
  19111. var mainDiv = (0, _jquery2.default)('#visual-main-div');
  19112. // fill mainDiv with functions and globals...
  19113. // renderAlgorithm()...
  19114. (0, _jquery2.default)('.add_function_button').on('click', function () {
  19115. addFunctionHandler();
  19116. });
  19117. (0, _jquery2.default)('.add_global_button').on('click', function () {
  19118. window.insertContext = true;
  19119. GlobalsManagement.addGlobal(program, true);
  19120. });
  19121. (0, _jquery2.default)('.run_button').on('click', function () {
  19122. runCode();
  19123. });
  19124. (0, _jquery2.default)('.visual_coding_button').on('click', function () {
  19125. toggleVisualCoding();
  19126. });
  19127. (0, _jquery2.default)('.textual_coding_button').on('click', function () {
  19128. toggleTextualCoding();
  19129. });
  19130. (0, _jquery2.default)('.assessment').on('click', function () {
  19131. runCodeAssessment();
  19132. is_iassign = true;
  19133. });
  19134. (0, _jquery2.default)('.div_toggle_console').on('click', function () {
  19135. toggleConsole();
  19136. });
  19137. (0, _jquery2.default)('.expand_button').on('click', function () {
  19138. full_screen();
  19139. });
  19140. (0, _jquery2.default)('.main_title h2').prop('title', _localizedStringsService.LocalizedStrings.getUI('text_ivprog_description'));
  19141. }
  19142. var is_iassign = false;
  19143. (0, _jquery2.default)(document).ready(function () {
  19144. for (var i = 0; i < program.functions.length; i++) {
  19145. renderFunction(program.functions[i]);
  19146. }
  19147. var time_show = 750;
  19148. (0, _jquery2.default)('.visual_coding_button').popup({
  19149. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_visual"),
  19150. delay: {
  19151. show: time_show,
  19152. hide: 0
  19153. }
  19154. });
  19155. (0, _jquery2.default)('.textual_coding_button').popup({
  19156. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_textual"),
  19157. delay: {
  19158. show: time_show,
  19159. hide: 0
  19160. }
  19161. });
  19162. (0, _jquery2.default)('.upload_file_button').popup({
  19163. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_upload"),
  19164. delay: {
  19165. show: time_show,
  19166. hide: 0
  19167. }
  19168. });
  19169. (0, _jquery2.default)('.download_file_button').popup({
  19170. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_download"),
  19171. delay: {
  19172. show: time_show,
  19173. hide: 0
  19174. }
  19175. });
  19176. (0, _jquery2.default)('.undo_button').popup({
  19177. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_undo"),
  19178. delay: {
  19179. show: time_show,
  19180. hide: 0
  19181. }
  19182. });
  19183. (0, _jquery2.default)('.redo_button').popup({
  19184. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_redo"),
  19185. delay: {
  19186. show: time_show,
  19187. hide: 0
  19188. }
  19189. });
  19190. (0, _jquery2.default)('.run_button').popup({
  19191. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_run"),
  19192. delay: {
  19193. show: time_show,
  19194. hide: 0
  19195. }
  19196. });
  19197. (0, _jquery2.default)('.assessment_button').popup({
  19198. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_evaluate"),
  19199. delay: {
  19200. show: time_show,
  19201. hide: 0
  19202. }
  19203. });
  19204. (0, _jquery2.default)('.help_button').popup({
  19205. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_help") + ' - ' + _localizedStringsService.LocalizedStrings.getUI("text_ivprog_version"),
  19206. delay: {
  19207. show: time_show,
  19208. hide: 0
  19209. }
  19210. });
  19211. (0, _jquery2.default)('.add_global_button').popup({
  19212. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_add_global"),
  19213. delay: {
  19214. show: time_show,
  19215. hide: 0
  19216. }
  19217. });
  19218. (0, _jquery2.default)('.div_toggle_console').popup({
  19219. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_console"),
  19220. delay: {
  19221. show: time_show,
  19222. hide: 0
  19223. }
  19224. });
  19225. Sortable.create(listWithHandle, {
  19226. handle: '.glyphicon-move',
  19227. animation: 100,
  19228. ghostClass: 'ghost',
  19229. group: 'functions_divs_drag',
  19230. onEnd: function onEnd(evt) {
  19231. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  19232. }
  19233. });
  19234. var listGlobalsHandle = document.getElementById("listGlobalsHandle");
  19235. Sortable.create(listGlobalsHandle, {
  19236. handle: '.ellipsis',
  19237. animation: 100,
  19238. ghostClass: 'ghost',
  19239. group: 'globals_divs_drag',
  19240. onEnd: function onEnd(evt) {
  19241. updateSequenceGlobals(evt.oldIndex, evt.newIndex);
  19242. }
  19243. });
  19244. });
  19245. function updateSequenceParameters(oldIndex, newIndex, function_obj) {
  19246. function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
  19247. }
  19248. function updateSequenceLocals(oldIndex, newIndex, function_obj) {
  19249. function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
  19250. }
  19251. function updateSequenceGlobals(oldIndex, newIndex) {
  19252. program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
  19253. }
  19254. function updateSequenceFunction(oldIndex, newIndex) {
  19255. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  19256. }
  19257. function runCodeAssessment() {
  19258. toggleConsole(true);
  19259. window.studentGrade = null;
  19260. studentTemp = null;
  19261. var strCode = CodeManagement.generate();
  19262. if (strCode == null) {
  19263. return;
  19264. }
  19265. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19266. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19267. var runner = new _ivprogAssessment.IVProgAssessment(strCode, testCases, domConsole);
  19268. runner.runTest().then(function (grade) {
  19269. if (!is_iassign) {
  19270. parent.getEvaluationCallback(grade);
  19271. } else {
  19272. is_iassign = false;
  19273. }
  19274. }).catch(function (err) {
  19275. return domConsole.err(err.message);
  19276. });
  19277. }
  19278. function runCode() {
  19279. toggleConsole(true);
  19280. var strCode = CodeManagement.generate();
  19281. if (strCode == null) {
  19282. return;
  19283. }
  19284. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19285. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19286. try {
  19287. var parser = _ivprogParser.IVProgParser.createParser(strCode);
  19288. var analyser = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  19289. var data = analyser.analyseTree();
  19290. var proc = new _ivprogProcessor.IVProgProcessor(data);
  19291. proc.registerInput(domConsole);
  19292. proc.registerOutput(domConsole);
  19293. (0, _jquery2.default)("#ivprog-term").addClass('ivprog-term-active');
  19294. proc.interpretAST().then(function (_) {
  19295. domConsole.info("Programa executado com sucesso!");
  19296. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19297. }).catch(function (err) {
  19298. domConsole.err(err.message);
  19299. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19300. });
  19301. } catch (error) {
  19302. domConsole.err(error.message);
  19303. console.log(error);
  19304. }
  19305. }
  19306. function toggleConsole(is_running) {
  19307. if (is_running) {
  19308. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19309. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19310. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19311. return;
  19312. }
  19313. if ((0, _jquery2.default)('#ivprog-term').css('min-height') == '160px') {
  19314. // esconder
  19315. (0, _jquery2.default)('.ivprog-term-div').css('display', 'none');
  19316. (0, _jquery2.default)('#ivprog-term').css('min-height', '0');
  19317. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-30px');
  19318. (0, _jquery2.default)('#ivprog-term').css('padding', '5px');
  19319. } else {
  19320. // mostrar
  19321. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19322. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19323. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19324. }
  19325. }
  19326. function waitToCloseConsole() {
  19327. domConsole.info("Aperte qualquer tecla para fechar...");
  19328. var p = new Promise(function (resolve, _) {
  19329. domConsole.requestInput(resolve, true);
  19330. });
  19331. p.then(function (_) {
  19332. domConsole.dispose();
  19333. domConsole = null;
  19334. (0, _jquery2.default)("#ivprog-term").hide();
  19335. });
  19336. }
  19337. function toggleTextualCoding() {
  19338. var code = CodeManagement.generate();
  19339. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'none');
  19340. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'block');
  19341. (0, _jquery2.default)('.ivprog_textual_panel').removeClass('loading');
  19342. (0, _jquery2.default)('.ivprog_textual_code').text(code);
  19343. (0, _jquery2.default)('.visual_coding_button').removeClass('active');
  19344. (0, _jquery2.default)('.textual_coding_button').addClass('active');
  19345. }
  19346. function toggleVisualCoding() {
  19347. (0, _jquery2.default)('.ivprog_textual_panel').addClass('loading');
  19348. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'none');
  19349. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'block');
  19350. (0, _jquery2.default)('.textual_coding_button').removeClass('active');
  19351. (0, _jquery2.default)('.visual_coding_button').addClass('active');
  19352. }
  19353. function removeParameter(function_obj, parameter_obj, parameter_container) {
  19354. var index = function_obj.parameters_list.indexOf(parameter_obj);
  19355. if (index > -1) {
  19356. window.insertContext = true;
  19357. function_obj.parameters_list.splice(index, 1);
  19358. }
  19359. (0, _jquery2.default)(parameter_container).fadeOut();
  19360. }
  19361. function updateParameterType(parameter_obj, new_type) {
  19362. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19363. parameter_obj.type = new_type;
  19364. parameter_obj.dimensions = new_dimensions;
  19365. if (new_dimensions > 0) {
  19366. parameter_obj.rows = new_dimensions;
  19367. parameter_obj.columns = 2;
  19368. }
  19369. }
  19370. function renderParameter(function_obj, parameter_obj, function_container) {
  19371. var ret = "";
  19372. ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
  19373. ret += '<div class="ui dropdown parameter_type">';
  19374. if (parameter_obj.dimensions > 0) {
  19375. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type);
  19376. if (parameter_obj.dimensions == 1) {
  19377. ret += ' [ ] ';
  19378. } else {
  19379. ret += ' [ ] [ ] ';
  19380. }
  19381. ret += '</div>';
  19382. } else {
  19383. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type) + '</div>';
  19384. }
  19385. ret += '<div class="menu">';
  19386. for (var tm in _types.Types) {
  19387. if (tm == _types.Types.VOID.toUpperCase()) {
  19388. continue;
  19389. }
  19390. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  19391. }
  19392. for (var tm in _types.Types) {
  19393. if (tm == _types.Types.VOID.toUpperCase()) {
  19394. continue;
  19395. }
  19396. 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>';
  19397. }
  19398. ret += '</div></div>';
  19399. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  19400. ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
  19401. ret = (0, _jquery2.default)(ret);
  19402. function_container.find('.container_parameters_list').append(ret);
  19403. ret.find('.remove_parameter').on('click', function (e) {
  19404. removeParameter(function_obj, parameter_obj, ret);
  19405. });
  19406. ret.find('.ui.dropdown.parameter_type').dropdown({
  19407. onChange: function onChange(value, text, $selectedItem) {
  19408. if ($selectedItem.data('dimensions')) {
  19409. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19410. } else {
  19411. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')]);
  19412. }
  19413. }
  19414. });
  19415. ret.find('.label_enable_name_parameter').on('click', function (e) {
  19416. enableNameParameterUpdate(parameter_obj, ret);
  19417. });
  19418. return ret;
  19419. }
  19420. var opened_name_parameter = false;
  19421. var opened_input_parameter = null;
  19422. function enableNameParameterUpdate(parameter_obj, parent_node) {
  19423. if (opened_name_parameter) {
  19424. opened_input_parameter.focus();
  19425. return;
  19426. }
  19427. opened_name_parameter = true;
  19428. parent_node = (0, _jquery2.default)(parent_node);
  19429. var input_field;
  19430. parent_node.find('.span_name_parameter').text('');
  19431. 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 + "' />");
  19432. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  19433. input_field.on('input', function () {
  19434. var inputWidth = input_field.textWidth() + 10;
  19435. opened_input_parameter = input_field;
  19436. input_field.focus();
  19437. var tmpStr = input_field.val();
  19438. input_field.val('');
  19439. input_field.val(tmpStr);
  19440. input_field.css({
  19441. width: inputWidth
  19442. });
  19443. }).trigger('input');
  19444. input_field.focusout(function () {
  19445. /// update array:
  19446. if (input_field.val().trim()) {
  19447. parameter_obj.name = input_field.val().trim();
  19448. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19449. }
  19450. input_field.off();
  19451. input_field.remove();
  19452. /// update elements:
  19453. opened_name_parameter = false;
  19454. opened_input_parameter = false;
  19455. });
  19456. input_field.on('keydown', function (e) {
  19457. var code = e.keyCode || e.which;
  19458. if (code == 13) {
  19459. if (input_field.val().trim()) {
  19460. parameter_obj.name = input_field.val().trim();
  19461. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19462. }
  19463. input_field.off();
  19464. input_field.remove();
  19465. /// update elements:
  19466. opened_name_parameter = false;
  19467. opened_input_parameter = false;
  19468. }
  19469. if (code == 27) {
  19470. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19471. input_field.off();
  19472. input_field.remove();
  19473. /// update elements:
  19474. opened_name_parameter = false;
  19475. opened_input_parameter = false;
  19476. }
  19477. });
  19478. input_field.select();
  19479. }
  19480. var opened_name_function = false;
  19481. var opened_input = null;
  19482. var previousPadding = null;
  19483. function enableNameFunctionUpdate(function_obj, parent_node) {
  19484. if (opened_name_function) {
  19485. opened_input.focus();
  19486. return;
  19487. }
  19488. parent_node = (0, _jquery2.default)(parent_node);
  19489. parent_node.find('.span_name_function').text('');
  19490. var input_field;
  19491. if (!previousPadding) {
  19492. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  19493. }
  19494. parent_node.find('.span_name_function').css('padding-left', '0');
  19495. parent_node.find('.span_name_function').css('padding-right', '0');
  19496. 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 + "' />");
  19497. input_field.insertBefore(parent_node.find('.span_name_function'));
  19498. input_field.on('input', function () {
  19499. var inputWidth = input_field.textWidth() + 10;
  19500. opened_input = input_field;
  19501. input_field.focus();
  19502. var tmpStr = input_field.val();
  19503. input_field.val('');
  19504. input_field.val(tmpStr);
  19505. input_field.css({
  19506. width: inputWidth
  19507. });
  19508. }).trigger('input');
  19509. input_field.focusout(function () {
  19510. /// update array:
  19511. if (input_field.val().trim()) {
  19512. function_obj.name = input_field.val().trim();
  19513. }
  19514. input_field.off();
  19515. input_field.remove();
  19516. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19517. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19518. parent_node.find('.span_name_function').text(function_obj.name);
  19519. /// update elements:
  19520. opened_name_function = false;
  19521. opened_input = false;
  19522. });
  19523. input_field.on('keydown', function (e) {
  19524. var code = e.keyCode || e.which;
  19525. if (code == 13) {
  19526. if (input_field.val().trim()) {
  19527. function_obj.name = input_field.val().trim();
  19528. }
  19529. input_field.off();
  19530. input_field.remove();
  19531. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19532. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19533. parent_node.find('.span_name_function').text(function_obj.name);
  19534. /// update elements:
  19535. opened_name_function = false;
  19536. opened_input = false;
  19537. }
  19538. if (code == 27) {
  19539. input_field.off();
  19540. input_field.remove();
  19541. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19542. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19543. parent_node.find('.span_name_function').text(function_obj.name);
  19544. /// update elements:
  19545. opened_name_function = false;
  19546. opened_input = false;
  19547. }
  19548. });
  19549. input_field.select();
  19550. }
  19551. /***/ }),
  19552. /***/ "./js/visualUI/globals.js":
  19553. /*!********************************!*\
  19554. !*** ./js/visualUI/globals.js ***!
  19555. \********************************/
  19556. /*! no static exports found */
  19557. /***/ (function(module, exports, __webpack_require__) {
  19558. "use strict";
  19559. Object.defineProperty(exports, "__esModule", {
  19560. value: true
  19561. });
  19562. exports.addGlobal = addGlobal;
  19563. exports.renderGlobal = renderGlobal;
  19564. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19565. var _jquery2 = _interopRequireDefault(_jquery);
  19566. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19567. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19568. var Models = _interopRequireWildcard(_ivprog_elements);
  19569. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19570. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  19571. 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; } }
  19572. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19573. window.jQuery = _jquery2.default;
  19574. var counter_new_globals = 0;
  19575. function addGlobal(program) {
  19576. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  19577. var new_global = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals, 1);
  19578. counter_new_globals++;
  19579. program.addGlobal(new_global);
  19580. var newe = renderGlobal(new_global);
  19581. if (is_from_click) {
  19582. newe.css('display', 'none');
  19583. newe.fadeIn();
  19584. }
  19585. }
  19586. function toggleConstant(global_var) {
  19587. global_var.is_constant = !global_var.is_constant;
  19588. }
  19589. function updateName(global_var, new_name) {
  19590. global_var.name = new_name;
  19591. }
  19592. function updateType(global_var, new_type) {
  19593. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19594. global_var.type = new_type;
  19595. global_var.dimensions = new_dimensions;
  19596. if (new_dimensions > 0) {
  19597. global_var.rows = new_dimensions;
  19598. global_var.columns = 2;
  19599. }
  19600. updateInitialValues(global_var);
  19601. }
  19602. function removeGlobal(global_var, global_container) {
  19603. var index = window.program_obj.globals.indexOf(global_var);
  19604. if (index > -1) {
  19605. window.insertContext = true;
  19606. window.program_obj.globals.splice(index, 1);
  19607. }
  19608. global_container.children().off();
  19609. global_container.off();
  19610. global_container.fadeOut();
  19611. }
  19612. function updateInitialValues(global_var) {
  19613. if (global_var.type == _types.Types.INTEGER) {
  19614. if (global_var.dimensions == 0) {
  19615. global_var.value = 1;
  19616. }
  19617. if (global_var.dimensions == 1) {
  19618. global_var.value = [1, 1];
  19619. }
  19620. if (global_var.dimensions == 2) {
  19621. global_var.value = [[1, 1], [1, 1]];
  19622. }
  19623. }
  19624. if (global_var.type == _types.Types.REAL) {
  19625. if (global_var.dimensions == 0) {
  19626. global_var.value = 1.0;
  19627. }
  19628. if (global_var.dimensions == 1) {
  19629. global_var.value = [1.0, 1.0];
  19630. }
  19631. if (global_var.dimensions == 2) {
  19632. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  19633. }
  19634. }
  19635. if (global_var.type == _types.Types.TEXT) {
  19636. if (global_var.dimensions == 0) {
  19637. global_var.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  19638. }
  19639. if (global_var.dimensions == 1) {
  19640. global_var.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  19641. }
  19642. if (global_var.dimensions == 2) {
  19643. global_var.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  19644. }
  19645. }
  19646. if (global_var.type == _types.Types.BOOLEAN) {
  19647. if (global_var.dimensions == 0) {
  19648. global_var.value = true;
  19649. }
  19650. if (global_var.dimensions == 1) {
  19651. global_var.value = [true, true];
  19652. }
  19653. if (global_var.dimensions == 2) {
  19654. global_var.value = [[true, true], [true, true]];
  19655. }
  19656. }
  19657. }
  19658. function alternateBooleanGlobalValue(global_var, value_container) {
  19659. global_var.value = !global_var.value;
  19660. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value));
  19661. }
  19662. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  19663. global_var.value[index] = !global_var.value[index];
  19664. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[index]));
  19665. }
  19666. function removeGlobalColumnVector(global_var) {
  19667. if (global_var.columns == 0) {
  19668. return;
  19669. }
  19670. global_var.columns--;
  19671. global_var.value.splice(global_var.value.length - 1, 1);
  19672. }
  19673. function addGlobalColumnVector(global_var) {
  19674. global_var.columns++;
  19675. if (global_var.type == _types.Types.INTEGER) {
  19676. global_var.value.push(1);
  19677. }
  19678. if (global_var.type == _types.Types.REAL) {
  19679. global_var.value.push(1.0);
  19680. }
  19681. if (global_var.type == _types.Types.TEXT) {
  19682. global_var.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  19683. }
  19684. if (global_var.type == _types.Types.BOOLEAN) {
  19685. global_var.value.push(true);
  19686. }
  19687. }
  19688. function removeColumnGlobalMatrix(global_var) {
  19689. if (global_var.columns == 0) {
  19690. return;
  19691. }
  19692. global_var.columns--;
  19693. for (var i = 0; i < global_var.rows; i++) {
  19694. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  19695. }
  19696. }
  19697. function addColumnGlobalMatrix(global_var) {
  19698. global_var.columns++;
  19699. if (global_var.type == _types.Types.INTEGER) {
  19700. for (var i = 0; i < global_var.rows; i++) {
  19701. global_var.value[i].push(1);
  19702. }
  19703. }
  19704. if (global_var.type == _types.Types.REAL) {
  19705. for (var i = 0; i < global_var.rows; i++) {
  19706. global_var.value[i].push(1.0);
  19707. }
  19708. }
  19709. if (global_var.type == _types.Types.TEXT) {
  19710. for (var i = 0; i < global_var.rows; i++) {
  19711. global_var.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  19712. }
  19713. }
  19714. if (global_var.type == _types.Types.BOOLEAN) {
  19715. for (var i = 0; i < global_var.rows; i++) {
  19716. global_var.value[i].push(true);
  19717. }
  19718. }
  19719. }
  19720. function removeLineGlobalMatrix(global_var) {
  19721. if (global_var.rows == 0) {
  19722. return;
  19723. }
  19724. global_var.rows--;
  19725. global_var.value.splice(global_var.value.length - 1, 1);
  19726. }
  19727. function addLineGlobalMatrix(global_var) {
  19728. global_var.rows++;
  19729. if (global_var.type == _types.Types.INTEGER) {
  19730. var n_l = [];
  19731. for (var i = 0; i < global_var.columns; i++) {
  19732. n_l.push(1);
  19733. }
  19734. global_var.value.push(n_l);
  19735. }
  19736. if (global_var.type == _types.Types.REAL) {
  19737. var n_l = [];
  19738. for (i = 0; i < global_var.columns; i++) {
  19739. n_l.push(1.0);
  19740. }
  19741. global_var.value.push(n_l);
  19742. }
  19743. if (global_var.type == _types.Types.TEXT) {
  19744. var n_l = [];
  19745. for (i = 0; i < global_var.columns; i++) {
  19746. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  19747. }
  19748. global_var.value.push(n_l);
  19749. }
  19750. if (global_var.type == _types.Types.BOOLEAN) {
  19751. var n_l = [];
  19752. for (i = 0; i < global_var.columns; i++) {
  19753. n_l.push(true);
  19754. }
  19755. global_var.value.push(n_l);
  19756. }
  19757. }
  19758. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  19759. global_var.value[row][index] = !global_var.value[row][index];
  19760. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[row][index]));
  19761. }
  19762. function renderValues(global_var, global_container) {
  19763. var ret = "";
  19764. var j = 0;
  19765. if (global_var.dimensions == 0) {
  19766. if (global_var.type == _types.Types.REAL) {
  19767. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  19768. } else {
  19769. if (global_var.type == _types.Types.BOOLEAN) {
  19770. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value) + '</span> </div> ';
  19771. } else {
  19772. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  19773. }
  19774. }
  19775. } else {
  19776. ret += '<table class="tabela_var">';
  19777. if (global_var.dimensions == 1) {
  19778. ret += '<tr>';
  19779. if (global_var.type == _types.Types.REAL) {
  19780. for (var k = 0; k < global_var.columns; k++) {
  19781. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  19782. }
  19783. } else {
  19784. for (var k = 0; k < global_var.columns; k++) {
  19785. if (global_var.type == _types.Types.BOOLEAN) {
  19786. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[k]) + '</span></td>';
  19787. } else {
  19788. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  19789. }
  19790. }
  19791. }
  19792. ret += '</tr>';
  19793. ret += '</table>';
  19794. 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>';
  19795. }
  19796. if (global_var.dimensions == 2) {
  19797. if (global_var.type == _types.Types.REAL) {
  19798. for (var l = 0; l < global_var.rows; l++) {
  19799. ret += '<tr>';
  19800. for (var k = 0; k < global_var.columns; k++) {
  19801. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  19802. }
  19803. ret += '</tr>';
  19804. }
  19805. } else {
  19806. for (var l = 0; l < global_var.rows; l++) {
  19807. ret += '<tr>';
  19808. for (var k = 0; k < global_var.columns; k++) {
  19809. if (global_var.type == _types.Types.BOOLEAN) {
  19810. 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>';
  19811. } else {
  19812. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  19813. }
  19814. }
  19815. ret += '</tr>';
  19816. }
  19817. }
  19818. if (global_var.rows == 0) {
  19819. ret += '<tr><td></td></tr>';
  19820. }
  19821. 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>';
  19822. ret += '</table>';
  19823. 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>';
  19824. }
  19825. }
  19826. global_container.find(".div_valor_var").html('');
  19827. ret = (0, _jquery2.default)(ret);
  19828. ret.find('.span_value_variable').data('associatedOject', global_var);
  19829. ret.find(".boolean_simple_type").on('click', function (e) {
  19830. alternateBooleanGlobalValue(global_var, this.parentNode);
  19831. });
  19832. ret.find(".simple_var").on('click', function (e) {
  19833. enableGlobalValueUpdate(global_var, this.parentNode);
  19834. });
  19835. ret.find(".boolean_vector_var").on('click', function (e) {
  19836. alternateBooleanGlobalVectorValue(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  19837. });
  19838. ret.find(".vector_var").on('click', function (e) {
  19839. enableGlobalVectorValueUpdate(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  19840. });
  19841. ret.find(".remove_global_vector_column").on('click', function (e) {
  19842. removeGlobalColumnVector(global_var);
  19843. global_container.find(".div_valor_var").html('');
  19844. renderValues(global_var, global_container);
  19845. });
  19846. ret.find(".add_global_vector_column").on('click', function (e) {
  19847. addGlobalColumnVector(global_var);
  19848. global_container.find(".div_valor_var").html('');
  19849. renderValues(global_var, global_container);
  19850. });
  19851. ret.find(".remove_global_matrix_column").on('click', function (e) {
  19852. removeColumnGlobalMatrix(global_var);
  19853. global_container.find(".div_valor_var").html('');
  19854. renderValues(global_var, global_container);
  19855. });
  19856. ret.find(".add_global_matrix_column").on('click', function (e) {
  19857. addColumnGlobalMatrix(global_var);
  19858. global_container.find(".div_valor_var").html('');
  19859. renderValues(global_var, global_container);
  19860. });
  19861. ret.find(".remove_global_matrix_line").on('click', function (e) {
  19862. removeLineGlobalMatrix(global_var);
  19863. global_container.find(".div_valor_var").html('');
  19864. renderValues(global_var, global_container);
  19865. });
  19866. ret.find(".add_global_matrix_line").on('click', function (e) {
  19867. addLineGlobalMatrix(global_var);
  19868. global_container.find(".div_valor_var").html('');
  19869. renderValues(global_var, global_container);
  19870. });
  19871. ret.find(".boolean_matrix_var").on('click', function (e) {
  19872. alternateBooleanGlobalMatrixValue(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  19873. });
  19874. ret.find(".matrix_var").on('click', function (e) {
  19875. enableGlobalMatrixValueUpdate(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  19876. });
  19877. global_container.find(".div_valor_var").append(ret);
  19878. updateColumnsAndRowsText(global_container, global_var);
  19879. }
  19880. function addHandlers(global_container) {
  19881. var global_var = global_container.data('associatedOject');
  19882. // Manage constant option:
  19883. global_container.find(".alternate_constant").on('click', function (e) {
  19884. toggleConstant(global_var);
  19885. (0, _jquery2.default)(this).removeClass("on off");
  19886. if (global_var.is_constant) {
  19887. (0, _jquery2.default)(this).addClass("on");
  19888. } else {
  19889. (0, _jquery2.default)(this).addClass("off");
  19890. }
  19891. });
  19892. // Manage global name:
  19893. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  19894. enableNameUpdate(global_container);
  19895. });
  19896. // Menu to change type:
  19897. global_container.find('.ui.dropdown.global_type').dropdown({
  19898. onChange: function onChange(value, text, $selectedItem) {
  19899. if ($selectedItem.data('dimensions')) {
  19900. updateType(global_var, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19901. } else {
  19902. updateType(global_var, _types.Types[$selectedItem.data('type')]);
  19903. }
  19904. renderValues(global_var, global_container);
  19905. }
  19906. });
  19907. // Remove global:
  19908. global_container.find(".remove_global").on('click', function (e) {
  19909. removeGlobal(global_var, global_container);
  19910. });
  19911. }
  19912. function updateColumnsAndRowsText(global_container, global_var) {
  19913. var prev = global_container.find('.text').text().split('[');
  19914. if (prev.length == 2) {
  19915. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  19916. global_container.find('.text').empty();
  19917. global_container.find('.text').text(ff);
  19918. }
  19919. if (prev.length == 3) {
  19920. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  19921. global_container.find('.text').empty();
  19922. global_container.find('.text').text(ff);
  19923. }
  19924. }
  19925. function renderGlobal(global_var) {
  19926. var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  19927. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  19928. element += '<div class="ui dropdown global_type">';
  19929. if (global_var.dimensions > 0) {
  19930. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(global_var.type);
  19931. for (var i = 0; i < global_var.dimensions; i++) {
  19932. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  19933. }
  19934. element += '</div>';
  19935. } else {
  19936. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(global_var.type.toLowerCase()) + '</div>';
  19937. }
  19938. element += '<div class="menu">';
  19939. for (var tm in _types.Types) {
  19940. if (tm == _types.Types.VOID.toUpperCase()) {
  19941. continue;
  19942. }
  19943. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  19944. }
  19945. for (var tm in _types.Types) {
  19946. if (tm == _types.Types.VOID.toUpperCase()) {
  19947. continue;
  19948. }
  19949. 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>';
  19950. }
  19951. 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> ';
  19952. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  19953. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  19954. var complete_element = (0, _jquery2.default)(element);
  19955. complete_element.data('associatedOject', global_var);
  19956. (0, _jquery2.default)('.list_globals').append(complete_element);
  19957. addHandlers(complete_element);
  19958. renderValues(global_var, complete_element);
  19959. if (global_var.dimensions == 1) {
  19960. complete_element.find('.dimensions_0').text(global_var.columns);
  19961. }
  19962. if (global_var.dimensions == 2) {
  19963. complete_element.find('.dimensions_0').text(global_var.columns);
  19964. complete_element.find('.dimensions_1').text(global_var.rows);
  19965. }
  19966. return complete_element;
  19967. }
  19968. var opened_name_value_matrix_global_v = false;
  19969. var opened_input_value_matrix_global_v = null;
  19970. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  19971. if (opened_name_value_matrix_global_v) {
  19972. opened_input_value_matrix_global_v.focus();
  19973. return;
  19974. }
  19975. parent_node = (0, _jquery2.default)(parent_node);
  19976. opened_name_value_matrix_global_v = true;
  19977. parent_node.find('.span_value_variable').text('');
  19978. var input_field;
  19979. if (global_var.type == _types.Types.REAL) {
  19980. 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) + "' />");
  19981. input_field.insertBefore(parent_node.find('.span_value_variable'));
  19982. } else {
  19983. 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] + "' />");
  19984. input_field.insertBefore(parent_node.find('.span_value_variable'));
  19985. }
  19986. input_field.on('input', function () {
  19987. var inputWidth = input_field.textWidth() + 10;
  19988. opened_input_value_matrix_global_v = input_field;
  19989. input_field.focus();
  19990. var tmpStr = input_field.val();
  19991. input_field.val('');
  19992. input_field.val(tmpStr);
  19993. input_field.css({
  19994. width: inputWidth
  19995. });
  19996. }).trigger('input');
  19997. input_field.focusout(function () {
  19998. /// update array:
  19999. if (input_field.val().trim()) {
  20000. if (global_var.type == _types.Types.REAL) {
  20001. global_var.value[row][index] = parseFloat(input_field.val().trim());
  20002. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20003. } else {
  20004. if (global_var.type == _types.Types.INTEGER) {
  20005. global_var.value[row][index] = parseInt(input_field.val().trim());
  20006. } else {
  20007. global_var.value[row][index] = input_field.val().trim();
  20008. }
  20009. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20010. }
  20011. } else {
  20012. if (global_var.type == _types.Types.REAL) {
  20013. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20014. } else {
  20015. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20016. }
  20017. }
  20018. if (global_var.type == _types.Types.TEXT) {
  20019. global_var.value[row][index] = input_field.val();
  20020. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20021. }
  20022. input_field.off();
  20023. input_field.remove();
  20024. /// update elements:
  20025. opened_name_value_matrix_global_v = false;
  20026. opened_input_value_matrix_global_v = false;
  20027. });
  20028. input_field.on('keydown', function (e) {
  20029. var code = e.keyCode || e.which;
  20030. if (code == 13) {
  20031. if (input_field.val().trim()) {
  20032. if (global_var.type == _types.Types.REAL) {
  20033. global_var.value[row][index] = parseFloat(input_field.val().trim());
  20034. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20035. } else {
  20036. if (global_var.type == _types.Types.INTEGER) {
  20037. global_var.value[row][index] = parseInt(input_field.val().trim());
  20038. } else {
  20039. global_var.value[row][index] = input_field.val().trim();
  20040. }
  20041. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20042. }
  20043. } else {
  20044. if (global_var.type == _types.Types.REAL) {
  20045. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20046. } else {
  20047. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20048. }
  20049. }
  20050. if (global_var.type == _types.Types.TEXT) {
  20051. global_var.value[row][index] = input_field.val();
  20052. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20053. }
  20054. input_field.off();
  20055. input_field.remove();
  20056. /// update elements:
  20057. opened_name_value_matrix_global_v = false;
  20058. opened_input_value_matrix_global_v = false;
  20059. }
  20060. if (code == 27) {
  20061. if (global_var.type == _types.Types.REAL) {
  20062. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20063. } else {
  20064. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20065. }
  20066. input_field.off();
  20067. input_field.remove();
  20068. /// update elements:
  20069. opened_name_value_matrix_global_v = false;
  20070. opened_input_value_matrix_global_v = false;
  20071. }
  20072. });
  20073. input_field.select();
  20074. }
  20075. var opened_name_value_global_var = false;
  20076. var opened_input_value_global_ar = null;
  20077. function enableGlobalValueUpdate(global_var, parent_node) {
  20078. if (opened_name_value_global_var) {
  20079. opened_input_value_global_ar.focus();
  20080. return;
  20081. }
  20082. parent_node = (0, _jquery2.default)(parent_node);
  20083. opened_name_value_global_var = true;
  20084. parent_node.find('.span_value_variable').text('');
  20085. var input_field;
  20086. if (global_var.type == _types.Types.REAL) {
  20087. 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) + "' />");
  20088. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20089. } else {
  20090. 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 + "' />");
  20091. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20092. }
  20093. input_field.on('input', function () {
  20094. var inputWidth = input_field.textWidth() + 10;
  20095. opened_input_value_global_ar = input_field;
  20096. input_field.focus();
  20097. var tmpStr = input_field.val();
  20098. input_field.val('');
  20099. input_field.val(tmpStr);
  20100. input_field.css({
  20101. width: inputWidth
  20102. });
  20103. }).trigger('input');
  20104. input_field.focusout(function () {
  20105. /// update array:
  20106. if (input_field.val().trim()) {
  20107. if (global_var.type == _types.Types.REAL) {
  20108. global_var.value = parseFloat(input_field.val().trim());
  20109. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20110. } else {
  20111. if (global_var.type == _types.Types.INTEGER) {
  20112. global_var.value = parseInt(input_field.val().trim());
  20113. } else {
  20114. global_var.value = input_field.val().trim();
  20115. }
  20116. parent_node.find('.span_value_variable').text(global_var.value);
  20117. }
  20118. } else {
  20119. if (global_var.type == _types.Types.REAL) {
  20120. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20121. } else {
  20122. parent_node.find('.span_value_variable').text(global_var.value);
  20123. }
  20124. }
  20125. if (global_var.type == _types.Types.TEXT) {
  20126. global_var.value = input_field.val();
  20127. parent_node.find('.span_value_variable').text(global_var.value);
  20128. }
  20129. input_field.off();
  20130. input_field.remove();
  20131. /// update elements:
  20132. opened_name_value_global_var = false;
  20133. opened_input_value_global_ar = false;
  20134. });
  20135. input_field.on('keydown', function (e) {
  20136. var code = e.keyCode || e.which;
  20137. if (code == 13) {
  20138. if (input_field.val().trim()) {
  20139. if (global_var.type == _types.Types.REAL) {
  20140. global_var.value = parseFloat(input_field.val().trim());
  20141. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20142. } else {
  20143. if (global_var.type == _types.Types.INTEGER) {
  20144. global_var.value = parseInt(input_field.val().trim());
  20145. } else {
  20146. global_var.value = input_field.val().trim();
  20147. }
  20148. parent_node.find('.span_value_variable').text(global_var.value);
  20149. }
  20150. } else {
  20151. if (global_var.type == _types.Types.REAL) {
  20152. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20153. } else {
  20154. parent_node.find('.span_value_variable').text(global_var.value);
  20155. }
  20156. }
  20157. if (global_var.type == _types.Types.TEXT) {
  20158. global_var.value = input_field.val();
  20159. parent_node.find('.span_value_variable').text(global_var.value);
  20160. }
  20161. input_field.off();
  20162. input_field.remove();
  20163. /// update elements:
  20164. opened_name_value_global_var = false;
  20165. opened_input_value_global_ar = false;
  20166. }
  20167. if (code == 27) {
  20168. if (global_var.type == _types.Types.REAL) {
  20169. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20170. } else {
  20171. parent_node.find('.span_value_variable').text(global_var.value);
  20172. }
  20173. input_field.off();
  20174. input_field.remove();
  20175. /// update elements:
  20176. opened_name_value_global_var = false;
  20177. opened_input_value_global_ar = false;
  20178. }
  20179. });
  20180. input_field.select();
  20181. }
  20182. var opened_name_global = false;
  20183. var opened_input_global = null;
  20184. function enableNameUpdate(global_container) {
  20185. var global_var = global_container.data('associatedOject');
  20186. if (opened_name_global) {
  20187. opened_input_global.focus();
  20188. return;
  20189. }
  20190. opened_name_global = true;
  20191. global_container.find('.span_name_variable').text('');
  20192. 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 + "' />");
  20193. input_name.insertBefore(global_container.find('.span_name_variable'));
  20194. input_name.on('input', function () {
  20195. var inputWidth = input_name.textWidth() + 10;
  20196. opened_input_global = input_name;
  20197. opened_input_global.focus();
  20198. opened_input_global.css({
  20199. width: inputWidth
  20200. });
  20201. }).trigger('input');
  20202. input_name.focusout(function () {
  20203. /// update array:
  20204. if (input_name.val().trim().length > 0) {
  20205. updateName(global_var, input_name.val().trim());
  20206. global_container.find('.span_name_variable').text(global_var.name);
  20207. } else {
  20208. global_container.find('.span_name_variable').text(global_var.name);
  20209. }
  20210. input_name.off();
  20211. input_name.remove();
  20212. /// update elements:
  20213. opened_name_global = false;
  20214. opened_input_global = false;
  20215. });
  20216. input_name.on('keydown', function (e) {
  20217. var code = e.keyCode || e.which;
  20218. if (code == 13) {
  20219. if (input_name.val().trim()) {
  20220. updateName(global_var, input_name.val().trim());
  20221. global_container.find('.span_name_variable').text(global_var.name);
  20222. } else {
  20223. global_container.find('.span_name_variable').text(global_var.name);
  20224. }
  20225. input_name.off();
  20226. input_name.remove();
  20227. /// update elements:
  20228. opened_name_global = false;
  20229. opened_input_global = false;
  20230. }
  20231. if (code == 27) {
  20232. global_container.find('.span_name_variable').text(global_var.name);
  20233. input_name.off();
  20234. input_name.remove();
  20235. /// update elements:
  20236. opened_name_global = false;
  20237. opened_input_global = false;
  20238. }
  20239. });
  20240. input_name.select();
  20241. }
  20242. var opened_name_value_vector_global_ = false;
  20243. var opened_input_value_vector_global_ = null;
  20244. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  20245. if (opened_name_value_vector_global_) {
  20246. opened_input_value_vector_global_.focus();
  20247. return;
  20248. }
  20249. parent_node = (0, _jquery2.default)(parent_node);
  20250. opened_name_value_vector_global_ = true;
  20251. parent_node.find('.span_value_variable').text('');
  20252. var input_field;
  20253. if (global_var.type == _types.Types.REAL) {
  20254. 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) + "' />");
  20255. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20256. } else {
  20257. 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] + "' />");
  20258. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20259. }
  20260. input_field.on('input', function () {
  20261. var inputWidth = input_field.textWidth() + 10;
  20262. opened_input_value_vector_global_ = input_field;
  20263. input_field.focus();
  20264. var tmpStr = input_field.val();
  20265. input_field.val('');
  20266. input_field.val(tmpStr);
  20267. input_field.css({
  20268. width: inputWidth
  20269. });
  20270. }).trigger('input');
  20271. input_field.focusout(function () {
  20272. /// update array:
  20273. if (input_field.val().trim()) {
  20274. if (global_var.type == _types.Types.REAL) {
  20275. global_var.value[index] = parseFloat(input_field.val().trim());
  20276. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20277. } else {
  20278. if (global_var.type == _types.Types.INTEGER) {
  20279. global_var.value[index] = parseInt(input_field.val().trim());
  20280. } else {
  20281. global_var.value[index] = input_field.val().trim();
  20282. }
  20283. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20284. }
  20285. } else {
  20286. if (global_var.type == _types.Types.REAL) {
  20287. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20288. } else {
  20289. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20290. }
  20291. }
  20292. if (global_var.type == _types.Types.TEXT) {
  20293. global_var.value[index] = input_field.val();
  20294. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20295. }
  20296. input_field.off();
  20297. input_field.remove();
  20298. /// update elements:
  20299. opened_name_value_vector_global_ = false;
  20300. opened_input_value_vector_global_ = false;
  20301. });
  20302. input_field.on('keydown', function (e) {
  20303. var code = e.keyCode || e.which;
  20304. if (code == 13) {
  20305. if (input_field.val().trim()) {
  20306. if (global_var.type == _types.Types.REAL) {
  20307. global_var.value[index] = parseFloat(input_field.val().trim());
  20308. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20309. } else {
  20310. if (global_var.type == _types.Types.INTEGER) {
  20311. global_var.value[index] = parseInt(input_field.val().trim());
  20312. } else {
  20313. global_var.value[index] = input_field.val().trim();
  20314. }
  20315. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20316. }
  20317. } else {
  20318. if (global_var.type == _types.Types.REAL) {
  20319. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20320. } else {
  20321. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20322. }
  20323. }
  20324. if (global_var.type == _types.Types.TEXT) {
  20325. global_var.value[index] = input_field.val();
  20326. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20327. }
  20328. input_field.off();
  20329. input_field.remove();
  20330. /// update elements:
  20331. opened_name_value_vector_global_ = false;
  20332. opened_input_value_vector_global_ = false;
  20333. }
  20334. if (code == 27) {
  20335. if (global_var.type == _types.Types.REAL) {
  20336. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20337. } else {
  20338. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20339. }
  20340. input_field.off();
  20341. input_field.remove();
  20342. /// update elements:
  20343. opened_name_value_vector_global_ = false;
  20344. opened_input_value_vector_global_ = false;
  20345. }
  20346. });
  20347. input_field.select();
  20348. }
  20349. _jquery2.default.fn.textWidth = function (text, font) {
  20350. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  20351. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  20352. return _jquery2.default.fn.textWidth.fakeEl.width();
  20353. };
  20354. /***/ }),
  20355. /***/ "./js/visualUI/ivprog_elements.js":
  20356. /*!****************************************!*\
  20357. !*** ./js/visualUI/ivprog_elements.js ***!
  20358. \****************************************/
  20359. /*! no static exports found */
  20360. /***/ (function(module, exports, __webpack_require__) {
  20361. "use strict";
  20362. Object.defineProperty(exports, "__esModule", {
  20363. value: true
  20364. });
  20365. 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;
  20366. 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; }; }();
  20367. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  20368. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  20369. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20370. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  20371. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  20372. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  20373. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  20374. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20375. 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; } }
  20376. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20377. var COMMAND_TYPES = exports.COMMAND_TYPES = Object.freeze({ function: "function", comment: "comment", reader: "reader", writer: "writer", attribution: "attribution", iftrue: "iftrue",
  20378. repeatNtimes: "repeatNtimes", whiletrue: "whiletrue", dowhiletrue: "dowhiletrue", switch: "switch", switchcase: "switchcase", functioncall: "functioncall", break: "break",
  20379. return: "return" });
  20380. var ARITHMETIC_TYPES = exports.ARITHMETIC_TYPES = Object.freeze({ plus: "plus", minus: "minus", multiplication: "multiplication", division: "division", module: "module", none: "none" });
  20381. 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" });
  20382. var EXPRESSION_TYPES = exports.EXPRESSION_TYPES = Object.freeze({ exp_conditional: "exp_conditional", exp_logic: "exp_logic", exp_arithmetic: "exp_arithmetic" });
  20383. 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" });
  20384. var LOGIC_COMPARISON = exports.LOGIC_COMPARISON = Object.freeze({ equals_to: "equals_to", not_equals_to: "not_equals_to", and: "and", or: "or" });
  20385. var SYSTEM_FUNCTIONS_CATEGORIES = exports.SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({ math: "math", text: "text_t", arrangement: "arrangement", conversion: "conversion" });
  20386. var Variable = exports.Variable = function Variable(type, name, value) {
  20387. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  20388. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  20389. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  20390. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  20391. _classCallCheck(this, Variable);
  20392. this.type = type;
  20393. this.name = name;
  20394. this.value = value;
  20395. this.dimensions = dimensions;
  20396. this.is_constant = is_constant;
  20397. this.rows = rows;
  20398. this.columns = columns;
  20399. };
  20400. var Function = exports.Function = function Function(name) {
  20401. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types.Types.VOID;
  20402. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20403. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  20404. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  20405. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  20406. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  20407. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  20408. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  20409. _classCallCheck(this, Function);
  20410. this.type = COMMAND_TYPES.function;
  20411. this.name = name;
  20412. this.return_type = return_type;
  20413. this.return_dimensions = return_dimensions;
  20414. this.parameters_list = parameters_list;
  20415. this.is_main = is_main;
  20416. this.is_hidden = is_hidden;
  20417. this.variables_list = variables_list;
  20418. this.function_comment = function_comment;
  20419. this.commands = commands;
  20420. };
  20421. var SystemFunction = exports.SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  20422. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  20423. var category = arguments[5];
  20424. _classCallCheck(this, SystemFunction);
  20425. this.type = COMMAND_TYPES.function;
  20426. this.identifier = identifier;
  20427. this.return_type = return_type;
  20428. this.return_dimensions = return_dimensions;
  20429. this.parameters_list = parameters_list;
  20430. this.function_comment = function_comment;
  20431. this.category = category;
  20432. };
  20433. var Comment = exports.Comment = function Comment(comment_text) {
  20434. _classCallCheck(this, Comment);
  20435. this.type = COMMAND_TYPES.comment;
  20436. this.comment_text = comment_text;
  20437. };
  20438. var Break = exports.Break = function Break() {
  20439. _classCallCheck(this, Break);
  20440. this.type = COMMAND_TYPES.break;
  20441. };
  20442. var Reader = exports.Reader = function Reader() {
  20443. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  20444. _classCallCheck(this, Reader);
  20445. this.type = COMMAND_TYPES.reader;
  20446. this.variable_value_menu = variable_value_menu;
  20447. };
  20448. var Writer = exports.Writer = function Writer(content) {
  20449. _classCallCheck(this, Writer);
  20450. this.type = COMMAND_TYPES.writer;
  20451. this.content = content;
  20452. };
  20453. var Attribution = exports.Attribution = function Attribution(variable) {
  20454. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20455. _classCallCheck(this, Attribution);
  20456. this.type = COMMAND_TYPES.attribution;
  20457. this.variable = variable;
  20458. this.expression = expression;
  20459. };
  20460. var ExpressionElement = exports.ExpressionElement = function ExpressionElement(type_exp) {
  20461. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20462. _classCallCheck(this, ExpressionElement);
  20463. this.type_exp = type_exp;
  20464. this.itens = itens;
  20465. };
  20466. var ConditionalExpression = exports.ConditionalExpression = function ConditionalExpression(expression) {
  20467. _classCallCheck(this, ConditionalExpression);
  20468. this.type = EXPRESSION_TYPES.exp_conditional;
  20469. this.expression = expression;
  20470. };
  20471. var LogicExpression = exports.LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  20472. _classCallCheck(this, LogicExpression);
  20473. this.type = EXPRESSION_TYPES.exp_logic;
  20474. this.has_neg = has_neg;
  20475. this.first_operand = first_operand;
  20476. this.second_operand = second_operand;
  20477. this.operator = operator;
  20478. };
  20479. var ArithmeticExpression = exports.ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  20480. _classCallCheck(this, ArithmeticExpression);
  20481. this.type = EXPRESSION_TYPES.exp_arithmetic;
  20482. this.first_operand = first_operand;
  20483. this.second_operand = second_operand;
  20484. this.operator = operator;
  20485. };
  20486. var IfTrue = exports.IfTrue = function IfTrue(expression, commands_block, commands_else) {
  20487. _classCallCheck(this, IfTrue);
  20488. this.type = COMMAND_TYPES.iftrue;
  20489. this.expression = expression;
  20490. this.commands_block = commands_block;
  20491. this.commands_else = commands_else;
  20492. };
  20493. var RepeatNTimes = exports.RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  20494. _classCallCheck(this, RepeatNTimes);
  20495. this.type = COMMAND_TYPES.repeatNtimes;
  20496. this.var_attribution = var_attribution;
  20497. this.var_incrementation = var_incrementation;
  20498. this.expression1 = expression1;
  20499. this.expression2 = expression2;
  20500. this.expression3 = expression3;
  20501. this.commands_block = commands_block;
  20502. };
  20503. var WhileTrue = exports.WhileTrue = function WhileTrue(expression, commands_block) {
  20504. _classCallCheck(this, WhileTrue);
  20505. this.type = COMMAND_TYPES.whiletrue;
  20506. this.expression = expression;
  20507. this.commands_block = commands_block;
  20508. };
  20509. var DoWhileTrue = exports.DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  20510. _classCallCheck(this, DoWhileTrue);
  20511. this.type = COMMAND_TYPES.dowhiletrue;
  20512. this.expression = expression;
  20513. this.commands_block = commands_block;
  20514. };
  20515. var Switch = exports.Switch = function Switch(variable) {
  20516. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20517. _classCallCheck(this, Switch);
  20518. this.type = COMMAND_TYPES.switch;
  20519. this.variable = variable;
  20520. this.cases = cases;
  20521. };
  20522. var Return = exports.Return = function Return(variable_value_menu) {
  20523. _classCallCheck(this, Return);
  20524. this.type = COMMAND_TYPES.return;
  20525. this.variable_value_menu = variable_value_menu;
  20526. };
  20527. var SwitchCase = exports.SwitchCase = function SwitchCase(variable_value_menu) {
  20528. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20529. _classCallCheck(this, SwitchCase);
  20530. this.type = COMMAND_TYPES.switchcase;
  20531. this.variable_value_menu = variable_value_menu;
  20532. this.commands_block = commands_block;
  20533. };
  20534. var FunctionCall = exports.FunctionCall = function FunctionCall(function_called, parameters_list) {
  20535. _classCallCheck(this, FunctionCall);
  20536. this.type = COMMAND_TYPES.functioncall;
  20537. this.function_called = function_called;
  20538. this.parameters_list = parameters_list;
  20539. };
  20540. var VariableValueMenu = exports.VariableValueMenu = function VariableValueMenu() {
  20541. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  20542. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  20543. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  20544. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  20545. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  20546. _classCallCheck(this, VariableValueMenu);
  20547. this.type = "var_value";
  20548. this.variable_and_value = variable_and_value;
  20549. this.content = content;
  20550. this.row = row;
  20551. this.column = column;
  20552. this.include_constant = include_constant;
  20553. };
  20554. var FunctionCallMenu = exports.FunctionCallMenu = function FunctionCallMenu() {
  20555. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  20556. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20557. _classCallCheck(this, FunctionCallMenu);
  20558. this.type = "function_call";
  20559. this.function_called = function_called;
  20560. this.parameters_list = parameters_list;
  20561. };
  20562. var Program = exports.Program = function () {
  20563. function Program() {
  20564. _classCallCheck(this, Program);
  20565. this.functions = [];
  20566. this.globals = [];
  20567. }
  20568. _createClass(Program, [{
  20569. key: 'addFunction',
  20570. value: function addFunction(function_to_add) {
  20571. _melankeWatchjs2.default.watch(function_to_add.parameters_list, function () {
  20572. if (window.insertContext) {
  20573. setTimeout(function () {
  20574. AlgorithmManagement.renderAlgorithm();
  20575. }, 300);
  20576. window.insertContext = false;
  20577. } else {
  20578. AlgorithmManagement.renderAlgorithm();
  20579. }
  20580. }, 1);
  20581. _melankeWatchjs2.default.watch(function_to_add.variables_list, function () {
  20582. if (window.insertContext) {
  20583. setTimeout(function () {
  20584. AlgorithmManagement.renderAlgorithm();
  20585. }, 300);
  20586. window.insertContext = false;
  20587. } else {
  20588. AlgorithmManagement.renderAlgorithm();
  20589. }
  20590. }, 1);
  20591. this.functions.push(function_to_add);
  20592. }
  20593. }, {
  20594. key: 'addVariable',
  20595. value: function addVariable(function_to_receive, variable) {
  20596. if (this.functions[function_to_receive].variable === null) {
  20597. this.functions[function_to_receive].variables_list = [];
  20598. }
  20599. this.functions[function_to_receive].variables_list.push(variable);
  20600. }
  20601. }, {
  20602. key: 'addGlobal',
  20603. value: function addGlobal(variable) {
  20604. this.globals.push(variable);
  20605. }
  20606. }]);
  20607. return Program;
  20608. }();
  20609. /***/ }),
  20610. /***/ "./js/visualUI/types.js":
  20611. /*!******************************!*\
  20612. !*** ./js/visualUI/types.js ***!
  20613. \******************************/
  20614. /*! no static exports found */
  20615. /***/ (function(module, exports, __webpack_require__) {
  20616. "use strict";
  20617. Object.defineProperty(exports, "__esModule", {
  20618. value: true
  20619. });
  20620. var Types = exports.Types = Object.freeze({
  20621. INTEGER: "integer",
  20622. REAL: "real",
  20623. TEXT: "text",
  20624. BOOLEAN: "boolean",
  20625. VOID: "void"
  20626. });
  20627. /***/ }),
  20628. /***/ "./js/visualUI/variables.js":
  20629. /*!**********************************!*\
  20630. !*** ./js/visualUI/variables.js ***!
  20631. \**********************************/
  20632. /*! no static exports found */
  20633. /***/ (function(module, exports, __webpack_require__) {
  20634. "use strict";
  20635. Object.defineProperty(exports, "__esModule", {
  20636. value: true
  20637. });
  20638. exports.addVariable = addVariable;
  20639. exports.renderVariable = renderVariable;
  20640. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  20641. var _jquery2 = _interopRequireDefault(_jquery);
  20642. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20643. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  20644. var Models = _interopRequireWildcard(_ivprog_elements);
  20645. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  20646. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  20647. 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; } }
  20648. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20649. window.jQuery = _jquery2.default;
  20650. var counter_new_variables = 0;
  20651. function addVariable(function_obj, function_container) {
  20652. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  20653. var new_var = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_variable') + '_' + counter_new_variables, 1);
  20654. if (function_obj.variables_list == null) {
  20655. function_obj.variables_list = [];
  20656. }
  20657. function_obj.variables_list.push(new_var);
  20658. counter_new_variables++;
  20659. var newe = renderVariable(function_container, new_var, function_obj);
  20660. if (is_in_click) {
  20661. newe.css('display', 'none');
  20662. newe.fadeIn();
  20663. }
  20664. }
  20665. function updateName(variable_obj, new_name) {
  20666. variable_obj.name = new_name;
  20667. }
  20668. function removeVariable(variable_obj, variable_container) {
  20669. var function_associated = variable_container.data('associatedFunction');
  20670. var index = function_associated.variables_list.indexOf(variable_obj);
  20671. if (index > -1) {
  20672. window.insertContext = true;
  20673. delete function_associated.variables_list[index];
  20674. function_associated.variables_list.splice(index, 1);
  20675. }
  20676. variable_container.children().off();
  20677. variable_container.off();
  20678. variable_container.fadeOut();
  20679. }
  20680. function updateType(variable_obj, new_type) {
  20681. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20682. variable_obj.type = new_type;
  20683. variable_obj.dimensions = new_dimensions;
  20684. if (new_dimensions > 0) {
  20685. variable_obj.rows = new_dimensions;
  20686. variable_obj.columns = 2;
  20687. }
  20688. updateInitialValues(variable_obj);
  20689. }
  20690. function addHandlers(variable_obj, variable_container) {
  20691. // Manage variable name:
  20692. variable_container.find(".enable_edit_name_variable").on('click', function (e) {
  20693. enableNameUpdate(variable_obj, variable_container);
  20694. });
  20695. // Menu to change type:
  20696. variable_container.find('.ui.dropdown.variable_type').dropdown({
  20697. onChange: function onChange(value, text, $selectedItem) {
  20698. if ($selectedItem.data('dimensions')) {
  20699. updateType(variable_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  20700. } else {
  20701. updateType(variable_obj, _types.Types[$selectedItem.data('type')]);
  20702. }
  20703. renderValues(variable_obj, variable_container);
  20704. }
  20705. });
  20706. // Remove variable:
  20707. variable_container.find(".remove_variable").on('click', function (e) {
  20708. removeVariable(variable_obj, variable_container);
  20709. });
  20710. }
  20711. function renderVariable(function_container, new_var, function_obj) {
  20712. var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
  20713. element += '<div class="ui dropdown variable_type">';
  20714. if (new_var.dimensions > 0) {
  20715. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase());
  20716. for (var i = 0; i < new_var.dimensions; i++) {
  20717. element += ' [ ] ';
  20718. }
  20719. element += '</div>';
  20720. } else {
  20721. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase()) + '</div>';
  20722. }
  20723. element += '<div class="menu">';
  20724. for (var tm in _types.Types) {
  20725. if (tm == _types.Types.VOID.toUpperCase()) {
  20726. continue;
  20727. }
  20728. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  20729. }
  20730. for (var tm in _types.Types) {
  20731. if (tm == _types.Types.VOID.toUpperCase()) {
  20732. continue;
  20733. }
  20734. 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>';
  20735. }
  20736. element += '</div></div> ';
  20737. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  20738. element += ' <span class="character_equals"> = </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  20739. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  20740. element = (0, _jquery2.default)(element);
  20741. element.data('associatedFunction', function_obj);
  20742. function_container.find('.variables_list_div').append(element);
  20743. addHandlers(new_var, element);
  20744. renderValues(new_var, element);
  20745. return element;
  20746. }
  20747. function updateColumnsAndRowsText(variable_container, variable_var) {
  20748. var prev = variable_container.find('.text').text().split('[');
  20749. if (prev.length == 2) {
  20750. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  20751. variable_container.find('.text').empty();
  20752. variable_container.find('.text').text(ff);
  20753. }
  20754. if (prev.length == 3) {
  20755. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  20756. variable_container.find('.text').empty();
  20757. variable_container.find('.text').text(ff);
  20758. }
  20759. }
  20760. function renderValues(new_var, variable_container) {
  20761. var ret = "";
  20762. var j = 0;
  20763. if (new_var.dimensions == 0) {
  20764. if (new_var.type == _types.Types.REAL) {
  20765. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  20766. } else {
  20767. if (new_var.type == _types.Types.BOOLEAN) {
  20768. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value) + '</span> </div> ';
  20769. } else {
  20770. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  20771. }
  20772. }
  20773. } else {
  20774. ret += '<table class="tabela_var">';
  20775. if (new_var.dimensions == 1) {
  20776. ret += '<tr>';
  20777. if (new_var.type == _types.Types.REAL) {
  20778. for (var k = 0; k < new_var.columns; k++) {
  20779. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  20780. }
  20781. } else {
  20782. for (var k = 0; k < new_var.columns; k++) {
  20783. if (new_var.type == _types.Types.BOOLEAN) {
  20784. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value[k]) + '</span></td>';
  20785. } else {
  20786. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  20787. }
  20788. }
  20789. }
  20790. ret += '</tr>';
  20791. ret += '</table>';
  20792. 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>';
  20793. }
  20794. if (new_var.dimensions == 2) {
  20795. if (new_var.type == _types.Types.REAL) {
  20796. for (var l = 0; l < new_var.rows; l++) {
  20797. ret += '<tr>';
  20798. for (var k = 0; k < new_var.columns; k++) {
  20799. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  20800. }
  20801. ret += '</tr>';
  20802. }
  20803. } else {
  20804. for (var l = 0; l < new_var.rows; l++) {
  20805. ret += '<tr>';
  20806. for (var k = 0; k < new_var.columns; k++) {
  20807. if (new_var.type == _types.Types.BOOLEAN) {
  20808. 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>';
  20809. } else {
  20810. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  20811. }
  20812. }
  20813. ret += '</tr>';
  20814. }
  20815. }
  20816. if (new_var.rows == 0) {
  20817. ret += '<tr><td></td></tr>';
  20818. }
  20819. 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>';
  20820. ret += '</table>';
  20821. 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>';
  20822. }
  20823. }
  20824. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20825. ret = (0, _jquery2.default)(ret);
  20826. (0, _jquery2.default)(ret).find('.span_value_variable').data('associatedOject', new_var);
  20827. (0, _jquery2.default)(ret).find(".boolean_simple_type").on('click', function (e) {
  20828. alternateBooleanValue(new_var, this.parentNode);
  20829. });
  20830. (0, _jquery2.default)(ret).find(".simple_var").on('click', function (e) {
  20831. enableValueUpdate(new_var, this.parentNode);
  20832. });
  20833. (0, _jquery2.default)(ret).find(".boolean_vector_var").on('click', function (e) {
  20834. alternateBooleanVectorValue(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20835. });
  20836. (0, _jquery2.default)(ret).find(".vector_var").on('click', function (e) {
  20837. enableVectorValueUpdate(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20838. });
  20839. (0, _jquery2.default)(ret).find(".remove_global_vector_column").on('click', function (e) {
  20840. removeColumnVector(new_var);
  20841. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20842. renderValues(new_var, variable_container);
  20843. });
  20844. (0, _jquery2.default)(ret).find(".add_global_vector_column").on('click', function (e) {
  20845. addColumnVector(new_var);
  20846. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20847. renderValues(new_var, variable_container);
  20848. });
  20849. (0, _jquery2.default)(ret).find(".remove_global_matrix_column").on('click', function (e) {
  20850. removeColumnMatrix(new_var);
  20851. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20852. renderValues(new_var, variable_container);
  20853. });
  20854. (0, _jquery2.default)(ret).find(".add_global_matrix_column").on('click', function (e) {
  20855. addColumnMatrix(new_var);
  20856. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20857. renderValues(new_var, variable_container);
  20858. });
  20859. (0, _jquery2.default)(ret).find(".remove_global_matrix_line").on('click', function (e) {
  20860. removeLineMatrix(new_var);
  20861. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20862. renderValues(new_var, variable_container);
  20863. });
  20864. (0, _jquery2.default)(ret).find(".add_global_matrix_line").on('click', function (e) {
  20865. addLineMatrix(new_var);
  20866. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20867. renderValues(new_var, variable_container);
  20868. });
  20869. (0, _jquery2.default)(ret).find(".boolean_matrix_var").on('click', function (e) {
  20870. alternateBooleanMatrixValue(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20871. });
  20872. (0, _jquery2.default)(ret).find(".matrix_var").on('click', function (e) {
  20873. enableMatrixValueUpdate(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20874. });
  20875. (0, _jquery2.default)(variable_container).find(".div_valor_var").append(ret);
  20876. updateColumnsAndRowsText(variable_container, new_var);
  20877. }
  20878. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  20879. var_obj.value[row][index] = !var_obj.value[row][index];
  20880. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[row][index]));
  20881. }
  20882. function addLineMatrix(var_obj) {
  20883. var_obj.rows++;
  20884. if (var_obj.type == _types.Types.INTEGER) {
  20885. var n_l = [];
  20886. for (var i = 0; i < var_obj.columns; i++) {
  20887. n_l.push(1);
  20888. }
  20889. var_obj.value.push(n_l);
  20890. }
  20891. if (var_obj.type == _types.Types.REAL) {
  20892. var n_l = [];
  20893. for (i = 0; i < var_obj.columns; i++) {
  20894. n_l.push(1.0);
  20895. }
  20896. var_obj.value.push(n_l);
  20897. }
  20898. if (var_obj.type == _types.Types.TEXT) {
  20899. var n_l = [];
  20900. for (i = 0; i < var_obj.columns; i++) {
  20901. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20902. }
  20903. var_obj.value.push(n_l);
  20904. }
  20905. if (var_obj.type == _types.Types.BOOLEAN) {
  20906. var n_l = [];
  20907. for (i = 0; i < var_obj.columns; i++) {
  20908. n_l.push(true);
  20909. }
  20910. var_obj.value.push(n_l);
  20911. }
  20912. }
  20913. function removeLineMatrix(var_obj) {
  20914. if (var_obj.rows == 0) {
  20915. return;
  20916. }
  20917. var_obj.rows--;
  20918. var_obj.value.splice(var_obj.value.length - 1, 1);
  20919. }
  20920. function addColumnMatrix(var_obj) {
  20921. var_obj.columns++;
  20922. if (var_obj.type == _types.Types.INTEGER) {
  20923. for (var i = 0; i < var_obj.rows; i++) {
  20924. var_obj.value[i].push(1);
  20925. }
  20926. }
  20927. if (var_obj.type == _types.Types.REAL) {
  20928. for (var i = 0; i < var_obj.rows; i++) {
  20929. var_obj.value[i].push(1.0);
  20930. }
  20931. }
  20932. if (var_obj.type == _types.Types.TEXT) {
  20933. for (var i = 0; i < var_obj.rows; i++) {
  20934. var_obj.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20935. }
  20936. }
  20937. if (var_obj.type == _types.Types.BOOLEAN) {
  20938. for (var i = 0; i < var_obj.rows; i++) {
  20939. var_obj.value[i].push(true);
  20940. }
  20941. }
  20942. }
  20943. function removeColumnMatrix(var_obj) {
  20944. if (var_obj.columns == 0) {
  20945. return;
  20946. }
  20947. var_obj.columns--;
  20948. for (var i = 0; i < var_obj.rows; i++) {
  20949. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  20950. }
  20951. }
  20952. function addColumnVector(var_obj) {
  20953. var_obj.columns++;
  20954. if (var_obj.type == _types.Types.INTEGER) {
  20955. var_obj.value.push(1);
  20956. }
  20957. if (var_obj.type == _types.Types.REAL) {
  20958. var_obj.value.push(1.0);
  20959. }
  20960. if (var_obj.type == _types.Types.TEXT) {
  20961. var_obj.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20962. }
  20963. if (var_obj.type == _types.Types.BOOLEAN) {
  20964. var_obj.value.push(true);
  20965. }
  20966. }
  20967. function removeColumnVector(var_obj) {
  20968. if (var_obj.columns == 0) {
  20969. return;
  20970. }
  20971. var_obj.columns--;
  20972. var_obj.value.splice(var_obj.value.length - 1, 1);
  20973. }
  20974. function alternateBooleanValue(var_obj, value_container) {
  20975. var_obj.value = !var_obj.value;
  20976. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value));
  20977. }
  20978. function alternateBooleanVectorValue(var_obj, index, value_container) {
  20979. var_obj.value[index] = !var_obj.value[index];
  20980. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[index]));
  20981. }
  20982. function updateInitialValues(variable_obj) {
  20983. if (variable_obj.type == _types.Types.INTEGER) {
  20984. if (variable_obj.dimensions == 0) {
  20985. variable_obj.value = 1;
  20986. }
  20987. if (variable_obj.dimensions == 1) {
  20988. variable_obj.value = [1, 1];
  20989. }
  20990. if (variable_obj.dimensions == 2) {
  20991. variable_obj.value = [[1, 1], [1, 1]];
  20992. }
  20993. }
  20994. if (variable_obj.type == _types.Types.REAL) {
  20995. if (variable_obj.dimensions == 0) {
  20996. variable_obj.value = 1.0;
  20997. }
  20998. if (variable_obj.dimensions == 1) {
  20999. variable_obj.value = [1.0, 1.0];
  21000. }
  21001. if (variable_obj.dimensions == 2) {
  21002. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  21003. }
  21004. }
  21005. if (variable_obj.type == _types.Types.TEXT) {
  21006. if (variable_obj.dimensions == 0) {
  21007. variable_obj.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  21008. }
  21009. if (variable_obj.dimensions == 1) {
  21010. variable_obj.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  21011. }
  21012. if (variable_obj.dimensions == 2) {
  21013. variable_obj.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  21014. }
  21015. }
  21016. if (variable_obj.type == _types.Types.BOOLEAN) {
  21017. if (variable_obj.dimensions == 0) {
  21018. variable_obj.value = true;
  21019. }
  21020. if (variable_obj.dimensions == 1) {
  21021. variable_obj.value = [true, true];
  21022. }
  21023. if (variable_obj.dimensions == 2) {
  21024. variable_obj.value = [[true, true], [true, true]];
  21025. }
  21026. }
  21027. }
  21028. var opened_name_value_vector_global_ = false;
  21029. var opened_input_value_vector_global_ = null;
  21030. function enableVectorValueUpdate(var_obj, index, parent_node) {
  21031. if (opened_name_value_vector_global_) {
  21032. opened_input_value_vector_global_.focus();
  21033. return;
  21034. }
  21035. parent_node = (0, _jquery2.default)(parent_node);
  21036. opened_name_value_vector_global_ = true;
  21037. parent_node.find('.span_value_variable').text('');
  21038. var input_field;
  21039. if (var_obj.type == _types.Types.REAL) {
  21040. 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) + "' />");
  21041. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21042. } else {
  21043. 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] + "' />");
  21044. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21045. }
  21046. input_field.on('input', function () {
  21047. var inputWidth = input_field.textWidth() + 10;
  21048. opened_input_value_vector_global_ = input_field;
  21049. input_field.focus();
  21050. var tmpStr = input_field.val();
  21051. input_field.val('');
  21052. input_field.val(tmpStr);
  21053. input_field.css({
  21054. width: inputWidth
  21055. });
  21056. }).trigger('input');
  21057. input_field.focusout(function () {
  21058. /// update array:
  21059. if (input_field.val().trim()) {
  21060. if (var_obj.type == _types.Types.REAL) {
  21061. var_obj.value[index] = parseFloat(input_field.val().trim());
  21062. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21063. } else {
  21064. if (var_obj.type == _types.Types.INTEGER) {
  21065. var_obj.value[index] = parseInt(input_field.val().trim());
  21066. } else {
  21067. var_obj.value[index] = input_field.val().trim();
  21068. }
  21069. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21070. }
  21071. } else {
  21072. if (var_obj.type == _types.Types.REAL) {
  21073. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21074. } else {
  21075. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21076. }
  21077. }
  21078. if (var_obj.type == _types.Types.TEXT) {
  21079. var_obj.value[index] = input_field.val();
  21080. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21081. }
  21082. input_field.off();
  21083. input_field.remove();
  21084. /// update elements:
  21085. opened_name_value_vector_global_ = false;
  21086. opened_input_value_vector_global_ = false;
  21087. });
  21088. input_field.on('keydown', function (e) {
  21089. var code = e.keyCode || e.which;
  21090. if (code == 13) {
  21091. if (input_field.val().trim()) {
  21092. if (var_obj.type == _types.Types.REAL) {
  21093. var_obj.value[index] = parseFloat(input_field.val().trim());
  21094. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21095. } else {
  21096. if (var_obj.type == _types.Types.INTEGER) {
  21097. var_obj.value[index] = parseInt(input_field.val().trim());
  21098. } else {
  21099. var_obj.value[index] = input_field.val().trim();
  21100. }
  21101. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21102. }
  21103. } else {
  21104. if (var_obj.type == _types.Types.REAL) {
  21105. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21106. } else {
  21107. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21108. }
  21109. }
  21110. if (var_obj.type == _types.Types.TEXT) {
  21111. var_obj.value[index] = input_field.val();
  21112. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21113. }
  21114. input_field.off();
  21115. input_field.remove();
  21116. /// update elements:
  21117. opened_name_value_vector_global_ = false;
  21118. opened_input_value_vector_global_ = false;
  21119. }
  21120. if (code == 27) {
  21121. if (var_obj.type == _types.Types.REAL) {
  21122. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21123. } else {
  21124. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21125. }
  21126. input_field.off();
  21127. input_field.remove();
  21128. /// update elements:
  21129. opened_name_value_vector_global_ = false;
  21130. opened_input_value_vector_global_ = false;
  21131. }
  21132. });
  21133. input_field.select();
  21134. }
  21135. var opened_name_value_global_var = false;
  21136. var opened_input_value_global_ar = null;
  21137. function enableValueUpdate(var_obj, parent_node) {
  21138. if (opened_name_value_global_var) {
  21139. opened_input_value_global_ar.focus();
  21140. return;
  21141. }
  21142. parent_node = (0, _jquery2.default)(parent_node);
  21143. opened_name_value_global_var = true;
  21144. var input_field;
  21145. parent_node.find('.span_value_variable').text('');
  21146. if (var_obj.type == _types.Types.REAL) {
  21147. 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) + "' />");
  21148. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21149. } else {
  21150. 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 + "' />");
  21151. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21152. }
  21153. input_field.on('input', function () {
  21154. var inputWidth = input_field.textWidth() + 10;
  21155. opened_input_value_global_ar = input_field;
  21156. input_field.focus();
  21157. var tmpStr = input_field.val();
  21158. input_field.val('');
  21159. input_field.val(tmpStr);
  21160. input_field.css({
  21161. width: inputWidth
  21162. });
  21163. }).trigger('input');
  21164. input_field.focusout(function () {
  21165. /// update array:
  21166. if (input_field.val().trim()) {
  21167. if (var_obj.type == _types.Types.REAL) {
  21168. var_obj.value = parseFloat(input_field.val().trim());
  21169. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21170. } else {
  21171. if (var_obj.type == _types.Types.INTEGER) {
  21172. var_obj.value = parseInt(input_field.val().trim());
  21173. } else {
  21174. var_obj.value = input_field.val().trim();
  21175. }
  21176. parent_node.find('.span_value_variable').text(var_obj.value);
  21177. }
  21178. } else {
  21179. if (var_obj.type == _types.Types.REAL) {
  21180. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21181. } else {
  21182. parent_node.find('.span_value_variable').text(var_obj.value);
  21183. }
  21184. }
  21185. if (var_obj.type == _types.Types.TEXT) {
  21186. var_obj.value = input_field.val();
  21187. parent_node.find('.span_value_variable').text(var_obj.value);
  21188. }
  21189. input_field.off();
  21190. input_field.remove();
  21191. /// update elements:
  21192. opened_name_value_global_var = false;
  21193. opened_input_value_global_ar = false;
  21194. });
  21195. input_field.on('keydown', function (e) {
  21196. var code = e.keyCode || e.which;
  21197. if (code == 13) {
  21198. if (input_field.val().trim()) {
  21199. if (var_obj.type == _types.Types.REAL) {
  21200. var_obj.value = parseFloat(input_field.val().trim());
  21201. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21202. } else {
  21203. if (var_obj.type == _types.Types.INTEGER) {
  21204. var_obj.value = parseInt(input_field.val().trim());
  21205. } else {
  21206. var_obj.value = input_field.val().trim();
  21207. }
  21208. parent_node.find('.span_value_variable').text(var_obj.value);
  21209. }
  21210. } else {
  21211. if (var_obj.type == _types.Types.REAL) {
  21212. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21213. } else {
  21214. parent_node.find('.span_value_variable').text(var_obj.value);
  21215. }
  21216. }
  21217. if (var_obj.type == _types.Types.TEXT) {
  21218. var_obj.value = input_field.val();
  21219. parent_node.find('.span_value_variable').text(var_obj.value);
  21220. }
  21221. input_field.off();
  21222. input_field.remove();
  21223. /// update elements:
  21224. opened_name_value_global_var = false;
  21225. opened_input_value_global_ar = false;
  21226. }
  21227. if (code == 27) {
  21228. if (var_obj.type == _types.Types.REAL) {
  21229. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21230. } else {
  21231. parent_node.find('.span_value_variable').text(var_obj.value);
  21232. }
  21233. input_field.off();
  21234. input_field.remove();
  21235. /// update elements:
  21236. opened_name_value_global_var = false;
  21237. opened_input_value_global_ar = false;
  21238. }
  21239. });
  21240. input_field.select();
  21241. }
  21242. var opened_name_global = false;
  21243. var opened_input_global = null;
  21244. function enableNameUpdate(variable_obj, variable_container) {
  21245. if (opened_name_global) {
  21246. opened_input_global.focus();
  21247. return;
  21248. }
  21249. opened_name_global = true;
  21250. variable_container.find('.span_name_variable').text('');
  21251. var input_name;
  21252. 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 + "' />");
  21253. input_name.insertBefore(variable_container.find('.span_name_variable'));
  21254. input_name.on('input', function () {
  21255. var inputWidth = input_name.textWidth() + 10;
  21256. opened_input_global = input_name;
  21257. input_name.focus();
  21258. var tmpStr = input_name.val();
  21259. input_name.val('');
  21260. input_name.val(tmpStr);
  21261. input_name.css({
  21262. width: inputWidth
  21263. });
  21264. }).trigger('input');
  21265. input_name.focusout(function () {
  21266. /// update array:
  21267. if (input_name.val().trim().length > 0) {
  21268. updateName(variable_obj, input_name.val().trim());
  21269. variable_container.find('.span_name_variable').text(variable_obj.name);
  21270. } else {
  21271. variable_container.find('.span_name_variable').text(variable_obj.name);
  21272. }
  21273. input_name.off();
  21274. input_name.remove();
  21275. /// update elements:
  21276. opened_name_global = false;
  21277. opened_input_global = false;
  21278. });
  21279. input_name.on('keydown', function (e) {
  21280. var code = e.keyCode || e.which;
  21281. if (code == 13) {
  21282. if (input_name.val().trim().length > 0) {
  21283. updateName(variable_obj, input_name.val().trim());
  21284. variable_container.find('.span_name_variable').text(variable_obj.name);
  21285. } else {
  21286. variable_container.find('.span_name_variable').text(variable_obj.name);
  21287. }
  21288. input_name.off();
  21289. input_name.remove();
  21290. /// update elements:
  21291. opened_name_global = false;
  21292. opened_input_global = false;
  21293. }
  21294. if (code == 27) {
  21295. variable_container.find('.span_name_variable').text(variable_obj.name);
  21296. input_name.off();
  21297. input_name.remove();
  21298. /// update elements:
  21299. opened_name_global = false;
  21300. opened_input_global = false;
  21301. }
  21302. });
  21303. input_name.select();
  21304. }
  21305. var opened_name_value_matrix_global_v = false;
  21306. var opened_input_value_matrix_global_v = null;
  21307. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  21308. if (opened_name_value_matrix_global_v) {
  21309. opened_input_value_matrix_global_v.focus();
  21310. return;
  21311. }
  21312. parent_node = (0, _jquery2.default)(parent_node);
  21313. opened_name_value_matrix_global_v = true;
  21314. parent_node.find('.span_value_variable').text('');
  21315. var input_field;
  21316. if (var_obj.type == _types.Types.REAL) {
  21317. 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) + "' />");
  21318. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21319. } else {
  21320. 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] + "' />");
  21321. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21322. }
  21323. input_field.on('input', function () {
  21324. var inputWidth = input_field.textWidth() + 10;
  21325. opened_input_value_matrix_global_v = input_field;
  21326. input_field.focus();
  21327. var tmpStr = input_field.val();
  21328. input_field.val('');
  21329. input_field.val(tmpStr);
  21330. input_field.css({
  21331. width: inputWidth
  21332. });
  21333. }).trigger('input');
  21334. input_field.focusout(function () {
  21335. /// update array:
  21336. if (input_field.val().trim()) {
  21337. if (var_obj.type == _types.Types.REAL) {
  21338. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  21339. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21340. } else {
  21341. if (var_obj.type == _types.Types.INTEGER) {
  21342. var_obj.value[row][index] = parseInt(input_field.val().trim());
  21343. } else {
  21344. var_obj.value[row][index] = input_field.val().trim();
  21345. }
  21346. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21347. }
  21348. } else {
  21349. if (var_obj.type == _types.Types.REAL) {
  21350. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21351. } else {
  21352. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21353. }
  21354. }
  21355. if (var_obj.type == _types.Types.TEXT) {
  21356. var_obj.value[row][index] = input_field.val();
  21357. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21358. }
  21359. input_field.off();
  21360. input_field.remove();
  21361. /// update elements:
  21362. opened_name_value_matrix_global_v = false;
  21363. opened_input_value_matrix_global_v = false;
  21364. });
  21365. input_field.on('keydown', function (e) {
  21366. var code = e.keyCode || e.which;
  21367. if (code == 13) {
  21368. if (input_field.val().trim()) {
  21369. if (var_obj.type == _types.Types.REAL) {
  21370. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  21371. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21372. } else {
  21373. if (var_obj.type == _types.Types.INTEGER) {
  21374. var_obj.value[row][index] = parseInt(input_field.val().trim());
  21375. } else {
  21376. var_obj.value[row][index] = input_field.val().trim();
  21377. }
  21378. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21379. }
  21380. } else {
  21381. if (var_obj.type == _types.Types.REAL) {
  21382. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21383. } else {
  21384. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21385. }
  21386. }
  21387. if (var_obj.type == _types.Types.TEXT) {
  21388. var_obj.value[row][index] = input_field.val();
  21389. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21390. }
  21391. input_field.off();
  21392. input_field.remove();
  21393. /// update elements:
  21394. opened_name_value_matrix_global_v = false;
  21395. opened_input_value_matrix_global_v = false;
  21396. }
  21397. if (code == 27) {
  21398. if (var_obj.type == _types.Types.REAL) {
  21399. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21400. } else {
  21401. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21402. }
  21403. input_field.off();
  21404. input_field.remove();
  21405. /// update elements:
  21406. opened_name_value_matrix_global_v = false;
  21407. opened_input_value_matrix_global_v = false;
  21408. }
  21409. });
  21410. input_field.select();
  21411. }
  21412. /***/ }),
  21413. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  21414. /*!****************************************************!*\
  21415. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  21416. \****************************************************/
  21417. /*! no static exports found */
  21418. /***/ (function(module, exports, __webpack_require__) {
  21419. "use strict";
  21420. //
  21421. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21422. * Use of this file is governed by the BSD 3-clause license that
  21423. * can be found in the LICENSE.txt file in the project root.
  21424. */
  21425. // This implementation of {@link TokenStream} loads tokens from a
  21426. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  21427. // access to any previous token by index.
  21428. //
  21429. // <p>
  21430. // This token stream ignores the value of {@link Token//getChannel}. If your
  21431. // parser requires the token stream filter tokens to only those on a particular
  21432. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  21433. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  21434. // {@link CommonTokenStream}.</p>
  21435. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  21436. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  21437. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  21438. // this is just to keep meaningful parameter types to Parser
  21439. function TokenStream() {
  21440. return this;
  21441. }
  21442. function BufferedTokenStream(tokenSource) {
  21443. TokenStream.call(this);
  21444. // The {@link TokenSource} from which tokens for this stream are fetched.
  21445. this.tokenSource = tokenSource;
  21446. // A collection of all tokens fetched from the token source. The list is
  21447. // considered a complete view of the input once {@link //fetchedEOF} is set
  21448. // to {@code true}.
  21449. this.tokens = [];
  21450. // The index into {@link //tokens} of the current token (next token to
  21451. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  21452. // be
  21453. // {@link //LT LT(1)}.
  21454. //
  21455. // <p>This field is set to -1 when the stream is first constructed or when
  21456. // {@link //setTokenSource} is called, indicating that the first token has
  21457. // not yet been fetched from the token source. For additional information,
  21458. // see the documentation of {@link IntStream} for a description of
  21459. // Initializing Methods.</p>
  21460. this.index = -1;
  21461. // Indicates whether the {@link Token//EOF} token has been fetched from
  21462. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  21463. // performance for the following cases:
  21464. //
  21465. // <ul>
  21466. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  21467. // prevent
  21468. // consuming the EOF symbol is optimized by checking the values of
  21469. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  21470. // //LA}.</li>
  21471. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  21472. // into
  21473. // {@link //tokens} is trivial with this field.</li>
  21474. // <ul>
  21475. this.fetchedEOF = false;
  21476. return this;
  21477. }
  21478. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  21479. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  21480. BufferedTokenStream.prototype.mark = function () {
  21481. return 0;
  21482. };
  21483. BufferedTokenStream.prototype.release = function (marker) {
  21484. // no resources to release
  21485. };
  21486. BufferedTokenStream.prototype.reset = function () {
  21487. this.seek(0);
  21488. };
  21489. BufferedTokenStream.prototype.seek = function (index) {
  21490. this.lazyInit();
  21491. this.index = this.adjustSeekIndex(index);
  21492. };
  21493. BufferedTokenStream.prototype.get = function (index) {
  21494. this.lazyInit();
  21495. return this.tokens[index];
  21496. };
  21497. BufferedTokenStream.prototype.consume = function () {
  21498. var skipEofCheck = false;
  21499. if (this.index >= 0) {
  21500. if (this.fetchedEOF) {
  21501. // the last token in tokens is EOF. skip check if p indexes any
  21502. // fetched token except the last.
  21503. skipEofCheck = this.index < this.tokens.length - 1;
  21504. } else {
  21505. // no EOF token in tokens. skip check if p indexes a fetched token.
  21506. skipEofCheck = this.index < this.tokens.length;
  21507. }
  21508. } else {
  21509. // not yet initialized
  21510. skipEofCheck = false;
  21511. }
  21512. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  21513. throw "cannot consume EOF";
  21514. }
  21515. if (this.sync(this.index + 1)) {
  21516. this.index = this.adjustSeekIndex(this.index + 1);
  21517. }
  21518. };
  21519. // Make sure index {@code i} in tokens has a token.
  21520. //
  21521. // @return {@code true} if a token is located at index {@code i}, otherwise
  21522. // {@code false}.
  21523. // @see //get(int i)
  21524. // /
  21525. BufferedTokenStream.prototype.sync = function (i) {
  21526. var n = i - this.tokens.length + 1; // how many more elements we need?
  21527. if (n > 0) {
  21528. var fetched = this.fetch(n);
  21529. return fetched >= n;
  21530. }
  21531. return true;
  21532. };
  21533. // Add {@code n} elements to buffer.
  21534. //
  21535. // @return The actual number of elements added to the buffer.
  21536. // /
  21537. BufferedTokenStream.prototype.fetch = function (n) {
  21538. if (this.fetchedEOF) {
  21539. return 0;
  21540. }
  21541. for (var i = 0; i < n; i++) {
  21542. var t = this.tokenSource.nextToken();
  21543. t.tokenIndex = this.tokens.length;
  21544. this.tokens.push(t);
  21545. if (t.type === Token.EOF) {
  21546. this.fetchedEOF = true;
  21547. return i + 1;
  21548. }
  21549. }
  21550. return n;
  21551. };
  21552. // Get all tokens from start..stop inclusively///
  21553. BufferedTokenStream.prototype.getTokens = function (start, stop, types) {
  21554. if (types === undefined) {
  21555. types = null;
  21556. }
  21557. if (start < 0 || stop < 0) {
  21558. return null;
  21559. }
  21560. this.lazyInit();
  21561. var subset = [];
  21562. if (stop >= this.tokens.length) {
  21563. stop = this.tokens.length - 1;
  21564. }
  21565. for (var i = start; i < stop; i++) {
  21566. var t = this.tokens[i];
  21567. if (t.type === Token.EOF) {
  21568. break;
  21569. }
  21570. if (types === null || types.contains(t.type)) {
  21571. subset.push(t);
  21572. }
  21573. }
  21574. return subset;
  21575. };
  21576. BufferedTokenStream.prototype.LA = function (i) {
  21577. return this.LT(i).type;
  21578. };
  21579. BufferedTokenStream.prototype.LB = function (k) {
  21580. if (this.index - k < 0) {
  21581. return null;
  21582. }
  21583. return this.tokens[this.index - k];
  21584. };
  21585. BufferedTokenStream.prototype.LT = function (k) {
  21586. this.lazyInit();
  21587. if (k === 0) {
  21588. return null;
  21589. }
  21590. if (k < 0) {
  21591. return this.LB(-k);
  21592. }
  21593. var i = this.index + k - 1;
  21594. this.sync(i);
  21595. if (i >= this.tokens.length) {
  21596. // return EOF token
  21597. // EOF must be last token
  21598. return this.tokens[this.tokens.length - 1];
  21599. }
  21600. return this.tokens[i];
  21601. };
  21602. // Allowed derived classes to modify the behavior of operations which change
  21603. // the current stream position by adjusting the target token index of a seek
  21604. // operation. The default implementation simply returns {@code i}. If an
  21605. // exception is thrown in this method, the current stream index should not be
  21606. // changed.
  21607. //
  21608. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  21609. // that
  21610. // the seek target is always an on-channel token.</p>
  21611. //
  21612. // @param i The target token index.
  21613. // @return The adjusted target token index.
  21614. BufferedTokenStream.prototype.adjustSeekIndex = function (i) {
  21615. return i;
  21616. };
  21617. BufferedTokenStream.prototype.lazyInit = function () {
  21618. if (this.index === -1) {
  21619. this.setup();
  21620. }
  21621. };
  21622. BufferedTokenStream.prototype.setup = function () {
  21623. this.sync(0);
  21624. this.index = this.adjustSeekIndex(0);
  21625. };
  21626. // Reset this token stream by setting its token source.///
  21627. BufferedTokenStream.prototype.setTokenSource = function (tokenSource) {
  21628. this.tokenSource = tokenSource;
  21629. this.tokens = [];
  21630. this.index = -1;
  21631. this.fetchedEOF = false;
  21632. };
  21633. // Given a starting index, return the index of the next token on channel.
  21634. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  21635. // on channel between i and EOF.
  21636. // /
  21637. BufferedTokenStream.prototype.nextTokenOnChannel = function (i, channel) {
  21638. this.sync(i);
  21639. if (i >= this.tokens.length) {
  21640. return -1;
  21641. }
  21642. var token = this.tokens[i];
  21643. while (token.channel !== this.channel) {
  21644. if (token.type === Token.EOF) {
  21645. return -1;
  21646. }
  21647. i += 1;
  21648. this.sync(i);
  21649. token = this.tokens[i];
  21650. }
  21651. return i;
  21652. };
  21653. // Given a starting index, return the index of the previous token on channel.
  21654. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  21655. // on channel between i and 0.
  21656. BufferedTokenStream.prototype.previousTokenOnChannel = function (i, channel) {
  21657. while (i >= 0 && this.tokens[i].channel !== channel) {
  21658. i -= 1;
  21659. }
  21660. return i;
  21661. };
  21662. // Collect all tokens on specified channel to the right of
  21663. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  21664. // EOF. If channel is -1, find any non default channel token.
  21665. BufferedTokenStream.prototype.getHiddenTokensToRight = function (tokenIndex, channel) {
  21666. if (channel === undefined) {
  21667. channel = -1;
  21668. }
  21669. this.lazyInit();
  21670. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  21671. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  21672. }
  21673. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  21674. var from_ = tokenIndex + 1;
  21675. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  21676. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  21677. return this.filterForChannel(from_, to, channel);
  21678. };
  21679. // Collect all tokens on specified channel to the left of
  21680. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  21681. // If channel is -1, find any non default channel token.
  21682. BufferedTokenStream.prototype.getHiddenTokensToLeft = function (tokenIndex, channel) {
  21683. if (channel === undefined) {
  21684. channel = -1;
  21685. }
  21686. this.lazyInit();
  21687. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  21688. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  21689. }
  21690. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  21691. if (prevOnChannel === tokenIndex - 1) {
  21692. return null;
  21693. }
  21694. // if none on channel to left, prevOnChannel=-1 then from=0
  21695. var from_ = prevOnChannel + 1;
  21696. var to = tokenIndex - 1;
  21697. return this.filterForChannel(from_, to, channel);
  21698. };
  21699. BufferedTokenStream.prototype.filterForChannel = function (left, right, channel) {
  21700. var hidden = [];
  21701. for (var i = left; i < right + 1; i++) {
  21702. var t = this.tokens[i];
  21703. if (channel === -1) {
  21704. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  21705. hidden.push(t);
  21706. }
  21707. } else if (t.channel === channel) {
  21708. hidden.push(t);
  21709. }
  21710. }
  21711. if (hidden.length === 0) {
  21712. return null;
  21713. }
  21714. return hidden;
  21715. };
  21716. BufferedTokenStream.prototype.getSourceName = function () {
  21717. return this.tokenSource.getSourceName();
  21718. };
  21719. // Get the text of all tokens in this buffer.///
  21720. BufferedTokenStream.prototype.getText = function (interval) {
  21721. this.lazyInit();
  21722. this.fill();
  21723. if (interval === undefined || interval === null) {
  21724. interval = new Interval(0, this.tokens.length - 1);
  21725. }
  21726. var start = interval.start;
  21727. if (start instanceof Token) {
  21728. start = start.tokenIndex;
  21729. }
  21730. var stop = interval.stop;
  21731. if (stop instanceof Token) {
  21732. stop = stop.tokenIndex;
  21733. }
  21734. if (start === null || stop === null || start < 0 || stop < 0) {
  21735. return "";
  21736. }
  21737. if (stop >= this.tokens.length) {
  21738. stop = this.tokens.length - 1;
  21739. }
  21740. var s = "";
  21741. for (var i = start; i < stop + 1; i++) {
  21742. var t = this.tokens[i];
  21743. if (t.type === Token.EOF) {
  21744. break;
  21745. }
  21746. s = s + t.text;
  21747. }
  21748. return s;
  21749. };
  21750. // Get all tokens from lexer until EOF///
  21751. BufferedTokenStream.prototype.fill = function () {
  21752. this.lazyInit();
  21753. while (this.fetch(1000) === 1000) {
  21754. continue;
  21755. }
  21756. };
  21757. exports.BufferedTokenStream = BufferedTokenStream;
  21758. /***/ }),
  21759. /***/ "./node_modules/antlr4/CharStreams.js":
  21760. /*!********************************************!*\
  21761. !*** ./node_modules/antlr4/CharStreams.js ***!
  21762. \********************************************/
  21763. /*! no static exports found */
  21764. /***/ (function(module, exports, __webpack_require__) {
  21765. "use strict";
  21766. //
  21767. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21768. * Use of this file is governed by the BSD 3-clause license that
  21769. * can be found in the LICENSE.txt file in the project root.
  21770. */
  21771. //
  21772. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  21773. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  21774. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  21775. // Utility functions to create InputStreams from various sources.
  21776. //
  21777. // All returned InputStreams support the full range of Unicode
  21778. // up to U+10FFFF (the default behavior of InputStream only supports
  21779. // code points up to U+FFFF).
  21780. var CharStreams = {
  21781. // Creates an InputStream from a string.
  21782. fromString: function fromString(str) {
  21783. return new InputStream(str, true);
  21784. },
  21785. // Asynchronously creates an InputStream from a blob given the
  21786. // encoding of the bytes in that blob (defaults to 'utf8' if
  21787. // encoding is null).
  21788. //
  21789. // Invokes onLoad(result) on success, onError(error) on
  21790. // failure.
  21791. fromBlob: function fromBlob(blob, encoding, onLoad, onError) {
  21792. var reader = FileReader();
  21793. reader.onload = function (e) {
  21794. var is = new InputStream(e.target.result, true);
  21795. onLoad(is);
  21796. };
  21797. reader.onerror = onError;
  21798. reader.readAsText(blob, encoding);
  21799. },
  21800. // Creates an InputStream from a Buffer given the
  21801. // encoding of the bytes in that buffer (defaults to 'utf8' if
  21802. // encoding is null).
  21803. fromBuffer: function fromBuffer(buffer, encoding) {
  21804. return new InputStream(buffer.toString(encoding), true);
  21805. },
  21806. // Asynchronously creates an InputStream from a file on disk given
  21807. // the encoding of the bytes in that file (defaults to 'utf8' if
  21808. // encoding is null).
  21809. //
  21810. // Invokes callback(error, result) on completion.
  21811. fromPath: function fromPath(path, encoding, callback) {
  21812. fs.readFile(path, encoding, function (err, data) {
  21813. var is = null;
  21814. if (data !== null) {
  21815. is = new InputStream(data, true);
  21816. }
  21817. callback(err, is);
  21818. });
  21819. },
  21820. // Synchronously creates an InputStream given a path to a file
  21821. // on disk and the encoding of the bytes in that file (defaults to
  21822. // 'utf8' if encoding is null).
  21823. fromPathSync: function fromPathSync(path, encoding) {
  21824. var data = fs.readFileSync(path, encoding);
  21825. return new InputStream(data, true);
  21826. }
  21827. };
  21828. exports.CharStreams = CharStreams;
  21829. /***/ }),
  21830. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  21831. /*!***************************************************!*\
  21832. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  21833. \***************************************************/
  21834. /*! no static exports found */
  21835. /***/ (function(module, exports, __webpack_require__) {
  21836. "use strict";
  21837. //
  21838. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21839. * Use of this file is governed by the BSD 3-clause license that
  21840. * can be found in the LICENSE.txt file in the project root.
  21841. */
  21842. //
  21843. //
  21844. // This default implementation of {@link TokenFactory} creates
  21845. // {@link CommonToken} objects.
  21846. //
  21847. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  21848. function TokenFactory() {
  21849. return this;
  21850. }
  21851. function CommonTokenFactory(copyText) {
  21852. TokenFactory.call(this);
  21853. // Indicates whether {@link CommonToken//setText} should be called after
  21854. // constructing tokens to explicitly set the text. This is useful for cases
  21855. // where the input stream might not be able to provide arbitrary substrings
  21856. // of text from the input after the lexer creates a token (e.g. the
  21857. // implementation of {@link CharStream//getText} in
  21858. // {@link UnbufferedCharStream} throws an
  21859. // {@link UnsupportedOperationException}). Explicitly setting the token text
  21860. // allows {@link Token//getText} to be called at any time regardless of the
  21861. // input stream implementation.
  21862. //
  21863. // <p>
  21864. // The default value is {@code false} to avoid the performance and memory
  21865. // overhead of copying text for every token unless explicitly requested.</p>
  21866. //
  21867. this.copyText = copyText === undefined ? false : copyText;
  21868. return this;
  21869. }
  21870. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  21871. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  21872. //
  21873. // The default {@link CommonTokenFactory} instance.
  21874. //
  21875. // <p>
  21876. // This token factory does not explicitly copy token text when constructing
  21877. // tokens.</p>
  21878. //
  21879. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  21880. CommonTokenFactory.prototype.create = function (source, type, text, channel, start, stop, line, column) {
  21881. var t = new CommonToken(source, type, channel, start, stop);
  21882. t.line = line;
  21883. t.column = column;
  21884. if (text !== null) {
  21885. t.text = text;
  21886. } else if (this.copyText && source[1] !== null) {
  21887. t.text = source[1].getText(start, stop);
  21888. }
  21889. return t;
  21890. };
  21891. CommonTokenFactory.prototype.createThin = function (type, text) {
  21892. var t = new CommonToken(null, type);
  21893. t.text = text;
  21894. return t;
  21895. };
  21896. exports.CommonTokenFactory = CommonTokenFactory;
  21897. /***/ }),
  21898. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  21899. /*!**************************************************!*\
  21900. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  21901. \**************************************************/
  21902. /*! no static exports found */
  21903. /***/ (function(module, exports, __webpack_require__) {
  21904. "use strict";
  21905. //
  21906. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21907. * Use of this file is governed by the BSD 3-clause license that
  21908. * can be found in the LICENSE.txt file in the project root.
  21909. */
  21910. ///
  21911. //
  21912. // This class extends {@link BufferedTokenStream} with functionality to filter
  21913. // token streams to tokens on a particular channel (tokens where
  21914. // {@link Token//getChannel} returns a particular value).
  21915. //
  21916. // <p>
  21917. // This token stream provides access to all tokens by index or when calling
  21918. // methods like {@link //getText}. The channel filtering is only used for code
  21919. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  21920. // {@link //LB}.</p>
  21921. //
  21922. // <p>
  21923. // By default, tokens are placed on the default channel
  21924. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  21925. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  21926. // call {@link Lexer//setChannel}.
  21927. // </p>
  21928. //
  21929. // <p>
  21930. // Note: lexer rules which use the {@code ->skip} lexer command or call
  21931. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  21932. // such a rule will not be available as part of the token stream, regardless of
  21933. // channel.</p>
  21934. ///
  21935. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  21936. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  21937. function CommonTokenStream(lexer, channel) {
  21938. BufferedTokenStream.call(this, lexer);
  21939. this.channel = channel === undefined ? Token.DEFAULT_CHANNEL : channel;
  21940. return this;
  21941. }
  21942. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  21943. CommonTokenStream.prototype.constructor = CommonTokenStream;
  21944. CommonTokenStream.prototype.adjustSeekIndex = function (i) {
  21945. return this.nextTokenOnChannel(i, this.channel);
  21946. };
  21947. CommonTokenStream.prototype.LB = function (k) {
  21948. if (k === 0 || this.index - k < 0) {
  21949. return null;
  21950. }
  21951. var i = this.index;
  21952. var n = 1;
  21953. // find k good tokens looking backwards
  21954. while (n <= k) {
  21955. // skip off-channel tokens
  21956. i = this.previousTokenOnChannel(i - 1, this.channel);
  21957. n += 1;
  21958. }
  21959. if (i < 0) {
  21960. return null;
  21961. }
  21962. return this.tokens[i];
  21963. };
  21964. CommonTokenStream.prototype.LT = function (k) {
  21965. this.lazyInit();
  21966. if (k === 0) {
  21967. return null;
  21968. }
  21969. if (k < 0) {
  21970. return this.LB(-k);
  21971. }
  21972. var i = this.index;
  21973. var n = 1; // we know tokens[pos] is a good one
  21974. // find k good tokens
  21975. while (n < k) {
  21976. // skip off-channel tokens, but make sure to not look past EOF
  21977. if (this.sync(i + 1)) {
  21978. i = this.nextTokenOnChannel(i + 1, this.channel);
  21979. }
  21980. n += 1;
  21981. }
  21982. return this.tokens[i];
  21983. };
  21984. // Count EOF just once.///
  21985. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function () {
  21986. var n = 0;
  21987. this.fill();
  21988. for (var i = 0; i < this.tokens.length; i++) {
  21989. var t = this.tokens[i];
  21990. if (t.channel === this.channel) {
  21991. n += 1;
  21992. }
  21993. if (t.type === Token.EOF) {
  21994. break;
  21995. }
  21996. }
  21997. return n;
  21998. };
  21999. exports.CommonTokenStream = CommonTokenStream;
  22000. /***/ }),
  22001. /***/ "./node_modules/antlr4/FileStream.js":
  22002. /*!*******************************************!*\
  22003. !*** ./node_modules/antlr4/FileStream.js ***!
  22004. \*******************************************/
  22005. /*! no static exports found */
  22006. /***/ (function(module, exports, __webpack_require__) {
  22007. "use strict";
  22008. //
  22009. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22010. * Use of this file is governed by the BSD 3-clause license that
  22011. * can be found in the LICENSE.txt file in the project root.
  22012. */
  22013. //
  22014. //
  22015. // This is an InputStream that is loaded from a file all at once
  22016. // when you construct the object.
  22017. //
  22018. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  22019. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  22020. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  22021. function FileStream(fileName, decodeToUnicodeCodePoints) {
  22022. var data = fs.readFileSync(fileName, "utf8");
  22023. InputStream.call(this, data, decodeToUnicodeCodePoints);
  22024. this.fileName = fileName;
  22025. return this;
  22026. }
  22027. FileStream.prototype = Object.create(InputStream.prototype);
  22028. FileStream.prototype.constructor = FileStream;
  22029. exports.FileStream = FileStream;
  22030. /***/ }),
  22031. /***/ "./node_modules/antlr4/InputStream.js":
  22032. /*!********************************************!*\
  22033. !*** ./node_modules/antlr4/InputStream.js ***!
  22034. \********************************************/
  22035. /*! no static exports found */
  22036. /***/ (function(module, exports, __webpack_require__) {
  22037. "use strict";
  22038. //
  22039. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22040. * Use of this file is governed by the BSD 3-clause license that
  22041. * can be found in the LICENSE.txt file in the project root.
  22042. */
  22043. //
  22044. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22045. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  22046. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  22047. // Vacuum all input from a string and then treat it like a buffer.
  22048. function _loadString(stream, decodeToUnicodeCodePoints) {
  22049. stream._index = 0;
  22050. stream.data = [];
  22051. if (stream.decodeToUnicodeCodePoints) {
  22052. for (var i = 0; i < stream.strdata.length;) {
  22053. var codePoint = stream.strdata.codePointAt(i);
  22054. stream.data.push(codePoint);
  22055. i += codePoint <= 0xFFFF ? 1 : 2;
  22056. }
  22057. } else {
  22058. for (var i = 0; i < stream.strdata.length; i++) {
  22059. var codeUnit = stream.strdata.charCodeAt(i);
  22060. stream.data.push(codeUnit);
  22061. }
  22062. }
  22063. stream._size = stream.data.length;
  22064. }
  22065. // If decodeToUnicodeCodePoints is true, the input is treated
  22066. // as a series of Unicode code points.
  22067. //
  22068. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  22069. // units.
  22070. function InputStream(data, decodeToUnicodeCodePoints) {
  22071. this.name = "<empty>";
  22072. this.strdata = data;
  22073. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  22074. _loadString(this);
  22075. return this;
  22076. }
  22077. Object.defineProperty(InputStream.prototype, "index", {
  22078. get: function get() {
  22079. return this._index;
  22080. }
  22081. });
  22082. Object.defineProperty(InputStream.prototype, "size", {
  22083. get: function get() {
  22084. return this._size;
  22085. }
  22086. });
  22087. // Reset the stream so that it's in the same state it was
  22088. // when the object was created *except* the data array is not
  22089. // touched.
  22090. //
  22091. InputStream.prototype.reset = function () {
  22092. this._index = 0;
  22093. };
  22094. InputStream.prototype.consume = function () {
  22095. if (this._index >= this._size) {
  22096. // assert this.LA(1) == Token.EOF
  22097. throw "cannot consume EOF";
  22098. }
  22099. this._index += 1;
  22100. };
  22101. InputStream.prototype.LA = function (offset) {
  22102. if (offset === 0) {
  22103. return 0; // undefined
  22104. }
  22105. if (offset < 0) {
  22106. offset += 1; // e.g., translate LA(-1) to use offset=0
  22107. }
  22108. var pos = this._index + offset - 1;
  22109. if (pos < 0 || pos >= this._size) {
  22110. // invalid
  22111. return Token.EOF;
  22112. }
  22113. return this.data[pos];
  22114. };
  22115. InputStream.prototype.LT = function (offset) {
  22116. return this.LA(offset);
  22117. };
  22118. // mark/release do nothing; we have entire buffer
  22119. InputStream.prototype.mark = function () {
  22120. return -1;
  22121. };
  22122. InputStream.prototype.release = function (marker) {};
  22123. // consume() ahead until p==_index; can't just set p=_index as we must
  22124. // update line and column. If we seek backwards, just set p
  22125. //
  22126. InputStream.prototype.seek = function (_index) {
  22127. if (_index <= this._index) {
  22128. this._index = _index; // just jump; don't update stream state (line,
  22129. // ...)
  22130. return;
  22131. }
  22132. // seek forward
  22133. this._index = Math.min(_index, this._size);
  22134. };
  22135. InputStream.prototype.getText = function (start, stop) {
  22136. if (stop >= this._size) {
  22137. stop = this._size - 1;
  22138. }
  22139. if (start >= this._size) {
  22140. return "";
  22141. } else {
  22142. if (this.decodeToUnicodeCodePoints) {
  22143. var result = "";
  22144. for (var i = start; i <= stop; i++) {
  22145. result += String.fromCodePoint(this.data[i]);
  22146. }
  22147. return result;
  22148. } else {
  22149. return this.strdata.slice(start, stop + 1);
  22150. }
  22151. }
  22152. };
  22153. InputStream.prototype.toString = function () {
  22154. return this.strdata;
  22155. };
  22156. exports.InputStream = InputStream;
  22157. /***/ }),
  22158. /***/ "./node_modules/antlr4/IntervalSet.js":
  22159. /*!********************************************!*\
  22160. !*** ./node_modules/antlr4/IntervalSet.js ***!
  22161. \********************************************/
  22162. /*! no static exports found */
  22163. /***/ (function(module, exports, __webpack_require__) {
  22164. "use strict";
  22165. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22166. * Use of this file is governed by the BSD 3-clause license that
  22167. * can be found in the LICENSE.txt file in the project root.
  22168. */
  22169. /*jslint smarttabs:true */
  22170. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22171. /* stop is not included! */
  22172. function Interval(start, stop) {
  22173. this.start = start;
  22174. this.stop = stop;
  22175. return this;
  22176. }
  22177. Interval.prototype.contains = function (item) {
  22178. return item >= this.start && item < this.stop;
  22179. };
  22180. Interval.prototype.toString = function () {
  22181. if (this.start === this.stop - 1) {
  22182. return this.start.toString();
  22183. } else {
  22184. return this.start.toString() + ".." + (this.stop - 1).toString();
  22185. }
  22186. };
  22187. Object.defineProperty(Interval.prototype, "length", {
  22188. get: function get() {
  22189. return this.stop - this.start;
  22190. }
  22191. });
  22192. function IntervalSet() {
  22193. this.intervals = null;
  22194. this.readOnly = false;
  22195. }
  22196. IntervalSet.prototype.first = function (v) {
  22197. if (this.intervals === null || this.intervals.length === 0) {
  22198. return Token.INVALID_TYPE;
  22199. } else {
  22200. return this.intervals[0].start;
  22201. }
  22202. };
  22203. IntervalSet.prototype.addOne = function (v) {
  22204. this.addInterval(new Interval(v, v + 1));
  22205. };
  22206. IntervalSet.prototype.addRange = function (l, h) {
  22207. this.addInterval(new Interval(l, h + 1));
  22208. };
  22209. IntervalSet.prototype.addInterval = function (v) {
  22210. if (this.intervals === null) {
  22211. this.intervals = [];
  22212. this.intervals.push(v);
  22213. } else {
  22214. // find insert pos
  22215. for (var k = 0; k < this.intervals.length; k++) {
  22216. var i = this.intervals[k];
  22217. // distinct range -> insert
  22218. if (v.stop < i.start) {
  22219. this.intervals.splice(k, 0, v);
  22220. return;
  22221. }
  22222. // contiguous range -> adjust
  22223. else if (v.stop === i.start) {
  22224. this.intervals[k].start = v.start;
  22225. return;
  22226. }
  22227. // overlapping range -> adjust and reduce
  22228. else if (v.start <= i.stop) {
  22229. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  22230. this.reduce(k);
  22231. return;
  22232. }
  22233. }
  22234. // greater than any existing
  22235. this.intervals.push(v);
  22236. }
  22237. };
  22238. IntervalSet.prototype.addSet = function (other) {
  22239. if (other.intervals !== null) {
  22240. for (var k = 0; k < other.intervals.length; k++) {
  22241. var i = other.intervals[k];
  22242. this.addInterval(new Interval(i.start, i.stop));
  22243. }
  22244. }
  22245. return this;
  22246. };
  22247. IntervalSet.prototype.reduce = function (k) {
  22248. // only need to reduce if k is not the last
  22249. if (k < this.intervalslength - 1) {
  22250. var l = this.intervals[k];
  22251. var r = this.intervals[k + 1];
  22252. // if r contained in l
  22253. if (l.stop >= r.stop) {
  22254. this.intervals.pop(k + 1);
  22255. this.reduce(k);
  22256. } else if (l.stop >= r.start) {
  22257. this.intervals[k] = new Interval(l.start, r.stop);
  22258. this.intervals.pop(k + 1);
  22259. }
  22260. }
  22261. };
  22262. IntervalSet.prototype.complement = function (start, stop) {
  22263. var result = new IntervalSet();
  22264. result.addInterval(new Interval(start, stop + 1));
  22265. for (var i = 0; i < this.intervals.length; i++) {
  22266. result.removeRange(this.intervals[i]);
  22267. }
  22268. return result;
  22269. };
  22270. IntervalSet.prototype.contains = function (item) {
  22271. if (this.intervals === null) {
  22272. return false;
  22273. } else {
  22274. for (var k = 0; k < this.intervals.length; k++) {
  22275. if (this.intervals[k].contains(item)) {
  22276. return true;
  22277. }
  22278. }
  22279. return false;
  22280. }
  22281. };
  22282. Object.defineProperty(IntervalSet.prototype, "length", {
  22283. get: function get() {
  22284. var len = 0;
  22285. this.intervals.map(function (i) {
  22286. len += i.length;
  22287. });
  22288. return len;
  22289. }
  22290. });
  22291. IntervalSet.prototype.removeRange = function (v) {
  22292. if (v.start === v.stop - 1) {
  22293. this.removeOne(v.start);
  22294. } else if (this.intervals !== null) {
  22295. var k = 0;
  22296. for (var n = 0; n < this.intervals.length; n++) {
  22297. var i = this.intervals[k];
  22298. // intervals are ordered
  22299. if (v.stop <= i.start) {
  22300. return;
  22301. }
  22302. // check for including range, split it
  22303. else if (v.start > i.start && v.stop < i.stop) {
  22304. this.intervals[k] = new Interval(i.start, v.start);
  22305. var x = new Interval(v.stop, i.stop);
  22306. this.intervals.splice(k, 0, x);
  22307. return;
  22308. }
  22309. // check for included range, remove it
  22310. else if (v.start <= i.start && v.stop >= i.stop) {
  22311. this.intervals.splice(k, 1);
  22312. k = k - 1; // need another pass
  22313. }
  22314. // check for lower boundary
  22315. else if (v.start < i.stop) {
  22316. this.intervals[k] = new Interval(i.start, v.start);
  22317. }
  22318. // check for upper boundary
  22319. else if (v.stop < i.stop) {
  22320. this.intervals[k] = new Interval(v.stop, i.stop);
  22321. }
  22322. k += 1;
  22323. }
  22324. }
  22325. };
  22326. IntervalSet.prototype.removeOne = function (v) {
  22327. if (this.intervals !== null) {
  22328. for (var k = 0; k < this.intervals.length; k++) {
  22329. var i = this.intervals[k];
  22330. // intervals is ordered
  22331. if (v < i.start) {
  22332. return;
  22333. }
  22334. // check for single value range
  22335. else if (v === i.start && v === i.stop - 1) {
  22336. this.intervals.splice(k, 1);
  22337. return;
  22338. }
  22339. // check for lower boundary
  22340. else if (v === i.start) {
  22341. this.intervals[k] = new Interval(i.start + 1, i.stop);
  22342. return;
  22343. }
  22344. // check for upper boundary
  22345. else if (v === i.stop - 1) {
  22346. this.intervals[k] = new Interval(i.start, i.stop - 1);
  22347. return;
  22348. }
  22349. // split existing range
  22350. else if (v < i.stop - 1) {
  22351. var x = new Interval(i.start, v);
  22352. i.start = v + 1;
  22353. this.intervals.splice(k, 0, x);
  22354. return;
  22355. }
  22356. }
  22357. }
  22358. };
  22359. IntervalSet.prototype.toString = function (literalNames, symbolicNames, elemsAreChar) {
  22360. literalNames = literalNames || null;
  22361. symbolicNames = symbolicNames || null;
  22362. elemsAreChar = elemsAreChar || false;
  22363. if (this.intervals === null) {
  22364. return "{}";
  22365. } else if (literalNames !== null || symbolicNames !== null) {
  22366. return this.toTokenString(literalNames, symbolicNames);
  22367. } else if (elemsAreChar) {
  22368. return this.toCharString();
  22369. } else {
  22370. return this.toIndexString();
  22371. }
  22372. };
  22373. IntervalSet.prototype.toCharString = function () {
  22374. var names = [];
  22375. for (var i = 0; i < this.intervals.length; i++) {
  22376. var v = this.intervals[i];
  22377. if (v.stop === v.start + 1) {
  22378. if (v.start === Token.EOF) {
  22379. names.push("<EOF>");
  22380. } else {
  22381. names.push("'" + String.fromCharCode(v.start) + "'");
  22382. }
  22383. } else {
  22384. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop - 1) + "'");
  22385. }
  22386. }
  22387. if (names.length > 1) {
  22388. return "{" + names.join(", ") + "}";
  22389. } else {
  22390. return names[0];
  22391. }
  22392. };
  22393. IntervalSet.prototype.toIndexString = function () {
  22394. var names = [];
  22395. for (var i = 0; i < this.intervals.length; i++) {
  22396. var v = this.intervals[i];
  22397. if (v.stop === v.start + 1) {
  22398. if (v.start === Token.EOF) {
  22399. names.push("<EOF>");
  22400. } else {
  22401. names.push(v.start.toString());
  22402. }
  22403. } else {
  22404. names.push(v.start.toString() + ".." + (v.stop - 1).toString());
  22405. }
  22406. }
  22407. if (names.length > 1) {
  22408. return "{" + names.join(", ") + "}";
  22409. } else {
  22410. return names[0];
  22411. }
  22412. };
  22413. IntervalSet.prototype.toTokenString = function (literalNames, symbolicNames) {
  22414. var names = [];
  22415. for (var i = 0; i < this.intervals.length; i++) {
  22416. var v = this.intervals[i];
  22417. for (var j = v.start; j < v.stop; j++) {
  22418. names.push(this.elementName(literalNames, symbolicNames, j));
  22419. }
  22420. }
  22421. if (names.length > 1) {
  22422. return "{" + names.join(", ") + "}";
  22423. } else {
  22424. return names[0];
  22425. }
  22426. };
  22427. IntervalSet.prototype.elementName = function (literalNames, symbolicNames, a) {
  22428. if (a === Token.EOF) {
  22429. return "<EOF>";
  22430. } else if (a === Token.EPSILON) {
  22431. return "<EPSILON>";
  22432. } else {
  22433. return literalNames[a] || symbolicNames[a];
  22434. }
  22435. };
  22436. exports.Interval = Interval;
  22437. exports.IntervalSet = IntervalSet;
  22438. /***/ }),
  22439. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  22440. /*!********************************************!*\
  22441. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  22442. \********************************************/
  22443. /*! no static exports found */
  22444. /***/ (function(module, exports, __webpack_require__) {
  22445. "use strict";
  22446. //
  22447. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22448. * Use of this file is governed by the BSD 3-clause license that
  22449. * can be found in the LICENSE.txt file in the project root.
  22450. */
  22451. ///
  22452. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  22453. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  22454. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22455. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  22456. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  22457. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  22458. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  22459. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  22460. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  22461. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  22462. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  22463. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  22464. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  22465. var PredictionContext = pc.PredictionContext;
  22466. var SingletonPredictionContext = pc.SingletonPredictionContext;
  22467. function LL1Analyzer(atn) {
  22468. this.atn = atn;
  22469. }
  22470. //* Special value added to the lookahead sets to indicate that we hit
  22471. // a predicate during analysis if {@code seeThruPreds==false}.
  22472. ///
  22473. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  22474. //*
  22475. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  22476. // of an {@link ATNState}. The returned array has one element for each
  22477. // outgoing transition in {@code s}. If the closure from transition
  22478. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  22479. // element at index <em>i</em> of the result will be {@code null}.
  22480. //
  22481. // @param s the ATN state
  22482. // @return the expected symbols for each outgoing transition of {@code s}.
  22483. ///
  22484. LL1Analyzer.prototype.getDecisionLookahead = function (s) {
  22485. if (s === null) {
  22486. return null;
  22487. }
  22488. var count = s.transitions.length;
  22489. var look = [];
  22490. for (var alt = 0; alt < count; alt++) {
  22491. look[alt] = new IntervalSet();
  22492. var lookBusy = new Set();
  22493. var seeThruPreds = false; // fail to get lookahead upon pred
  22494. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY, look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  22495. // Wipe out lookahead for this alternative if we found nothing
  22496. // or we had a predicate when we !seeThruPreds
  22497. if (look[alt].length === 0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  22498. look[alt] = null;
  22499. }
  22500. }
  22501. return look;
  22502. };
  22503. //*
  22504. // Compute set of tokens that can follow {@code s} in the ATN in the
  22505. // specified {@code ctx}.
  22506. //
  22507. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  22508. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  22509. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  22510. // reached, {@link Token//EOF} is added to the result set.</p>
  22511. //
  22512. // @param s the ATN state
  22513. // @param stopState the ATN state to stop at. This can be a
  22514. // {@link BlockEndState} to detect epsilon paths through a closure.
  22515. // @param ctx the complete parser context, or {@code null} if the context
  22516. // should be ignored
  22517. //
  22518. // @return The set of tokens that can follow {@code s} in the ATN in the
  22519. // specified {@code ctx}.
  22520. ///
  22521. LL1Analyzer.prototype.LOOK = function (s, stopState, ctx) {
  22522. var r = new IntervalSet();
  22523. var seeThruPreds = true; // ignore preds; get all lookahead
  22524. ctx = ctx || null;
  22525. var lookContext = ctx !== null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  22526. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  22527. return r;
  22528. };
  22529. //*
  22530. // Compute set of tokens that can follow {@code s} in the ATN in the
  22531. // specified {@code ctx}.
  22532. //
  22533. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  22534. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  22535. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  22536. // {@code true} and {@code stopState} or the end of the outermost rule is
  22537. // reached, {@link Token//EOF} is added to the result set.</p>
  22538. //
  22539. // @param s the ATN state.
  22540. // @param stopState the ATN state to stop at. This can be a
  22541. // {@link BlockEndState} to detect epsilon paths through a closure.
  22542. // @param ctx The outer context, or {@code null} if the outer context should
  22543. // not be used.
  22544. // @param look The result lookahead set.
  22545. // @param lookBusy A set used for preventing epsilon closures in the ATN
  22546. // from causing a stack overflow. Outside code should pass
  22547. // {@code new Set<ATNConfig>} for this argument.
  22548. // @param calledRuleStack A set used for preventing left recursion in the
  22549. // ATN from causing a stack overflow. Outside code should pass
  22550. // {@code new BitSet()} for this argument.
  22551. // @param seeThruPreds {@code true} to true semantic predicates as
  22552. // implicitly {@code true} and "see through them", otherwise {@code false}
  22553. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  22554. // result if one is encountered.
  22555. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  22556. // outermost context is reached. This parameter has no effect if {@code ctx}
  22557. // is {@code null}.
  22558. ///
  22559. LL1Analyzer.prototype._LOOK = function (s, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  22560. var c = new ATNConfig({ state: s, alt: 0, context: ctx }, null);
  22561. if (lookBusy.contains(c)) {
  22562. return;
  22563. }
  22564. lookBusy.add(c);
  22565. if (s === stopState) {
  22566. if (ctx === null) {
  22567. look.addOne(Token.EPSILON);
  22568. return;
  22569. } else if (ctx.isEmpty() && addEOF) {
  22570. look.addOne(Token.EOF);
  22571. return;
  22572. }
  22573. }
  22574. if (s instanceof RuleStopState) {
  22575. if (ctx === null) {
  22576. look.addOne(Token.EPSILON);
  22577. return;
  22578. } else if (ctx.isEmpty() && addEOF) {
  22579. look.addOne(Token.EOF);
  22580. return;
  22581. }
  22582. if (ctx !== PredictionContext.EMPTY) {
  22583. // run thru all possible stack tops in ctx
  22584. for (var i = 0; i < ctx.length; i++) {
  22585. var returnState = this.atn.states[ctx.getReturnState(i)];
  22586. var removed = calledRuleStack.contains(returnState.ruleIndex);
  22587. try {
  22588. calledRuleStack.remove(returnState.ruleIndex);
  22589. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22590. } finally {
  22591. if (removed) {
  22592. calledRuleStack.add(returnState.ruleIndex);
  22593. }
  22594. }
  22595. }
  22596. return;
  22597. }
  22598. }
  22599. for (var j = 0; j < s.transitions.length; j++) {
  22600. var t = s.transitions[j];
  22601. if (t.constructor === RuleTransition) {
  22602. if (calledRuleStack.contains(t.target.ruleIndex)) {
  22603. continue;
  22604. }
  22605. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  22606. try {
  22607. calledRuleStack.add(t.target.ruleIndex);
  22608. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22609. } finally {
  22610. calledRuleStack.remove(t.target.ruleIndex);
  22611. }
  22612. } else if (t instanceof AbstractPredicateTransition) {
  22613. if (seeThruPreds) {
  22614. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22615. } else {
  22616. look.addOne(LL1Analyzer.HIT_PRED);
  22617. }
  22618. } else if (t.isEpsilon) {
  22619. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22620. } else if (t.constructor === WildcardTransition) {
  22621. look.addRange(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  22622. } else {
  22623. var set = t.label;
  22624. if (set !== null) {
  22625. if (t instanceof NotSetTransition) {
  22626. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  22627. }
  22628. look.addSet(set);
  22629. }
  22630. }
  22631. }
  22632. };
  22633. exports.LL1Analyzer = LL1Analyzer;
  22634. /***/ }),
  22635. /***/ "./node_modules/antlr4/Lexer.js":
  22636. /*!**************************************!*\
  22637. !*** ./node_modules/antlr4/Lexer.js ***!
  22638. \**************************************/
  22639. /*! no static exports found */
  22640. /***/ (function(module, exports, __webpack_require__) {
  22641. "use strict";
  22642. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22643. * Use of this file is governed by the BSD 3-clause license that
  22644. * can be found in the LICENSE.txt file in the project root.
  22645. */
  22646. ///
  22647. // A lexer is recognizer that draws input symbols from a character stream.
  22648. // lexer grammars result in a subclass of this object. A Lexer object
  22649. // uses simplified match() and error recovery mechanisms in the interest of speed.
  22650. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22651. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  22652. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  22653. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  22654. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  22655. function TokenSource() {
  22656. return this;
  22657. }
  22658. function Lexer(input) {
  22659. Recognizer.call(this);
  22660. this._input = input;
  22661. this._factory = CommonTokenFactory.DEFAULT;
  22662. this._tokenFactorySourcePair = [this, input];
  22663. this._interp = null; // child classes must populate this
  22664. // The goal of all lexer rules/methods is to create a token object.
  22665. // this is an instance variable as multiple rules may collaborate to
  22666. // create a single token. nextToken will return this object after
  22667. // matching lexer rule(s). If you subclass to allow multiple token
  22668. // emissions, then set this to the last token to be matched or
  22669. // something nonnull so that the auto token emit mechanism will not
  22670. // emit another token.
  22671. this._token = null;
  22672. // What character index in the stream did the current token start at?
  22673. // Needed, for example, to get the text for current token. Set at
  22674. // the start of nextToken.
  22675. this._tokenStartCharIndex = -1;
  22676. // The line on which the first character of the token resides///
  22677. this._tokenStartLine = -1;
  22678. // The character position of first character within the line///
  22679. this._tokenStartColumn = -1;
  22680. // Once we see EOF on char stream, next token will be EOF.
  22681. // If you have DONE : EOF ; then you see DONE EOF.
  22682. this._hitEOF = false;
  22683. // The channel number for the current token///
  22684. this._channel = Token.DEFAULT_CHANNEL;
  22685. // The token type for the current token///
  22686. this._type = Token.INVALID_TYPE;
  22687. this._modeStack = [];
  22688. this._mode = Lexer.DEFAULT_MODE;
  22689. // You can set the text for the current token to override what is in
  22690. // the input char buffer. Use setText() or can set this instance var.
  22691. // /
  22692. this._text = null;
  22693. return this;
  22694. }
  22695. Lexer.prototype = Object.create(Recognizer.prototype);
  22696. Lexer.prototype.constructor = Lexer;
  22697. Lexer.DEFAULT_MODE = 0;
  22698. Lexer.MORE = -2;
  22699. Lexer.SKIP = -3;
  22700. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  22701. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  22702. Lexer.MIN_CHAR_VALUE = 0x0000;
  22703. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  22704. Lexer.prototype.reset = function () {
  22705. // wack Lexer state variables
  22706. if (this._input !== null) {
  22707. this._input.seek(0); // rewind the input
  22708. }
  22709. this._token = null;
  22710. this._type = Token.INVALID_TYPE;
  22711. this._channel = Token.DEFAULT_CHANNEL;
  22712. this._tokenStartCharIndex = -1;
  22713. this._tokenStartColumn = -1;
  22714. this._tokenStartLine = -1;
  22715. this._text = null;
  22716. this._hitEOF = false;
  22717. this._mode = Lexer.DEFAULT_MODE;
  22718. this._modeStack = [];
  22719. this._interp.reset();
  22720. };
  22721. // Return a token from this source; i.e., match a token on the char stream.
  22722. Lexer.prototype.nextToken = function () {
  22723. if (this._input === null) {
  22724. throw "nextToken requires a non-null input stream.";
  22725. }
  22726. // Mark start location in char stream so unbuffered streams are
  22727. // guaranteed at least have text of current token
  22728. var tokenStartMarker = this._input.mark();
  22729. try {
  22730. while (true) {
  22731. if (this._hitEOF) {
  22732. this.emitEOF();
  22733. return this._token;
  22734. }
  22735. this._token = null;
  22736. this._channel = Token.DEFAULT_CHANNEL;
  22737. this._tokenStartCharIndex = this._input.index;
  22738. this._tokenStartColumn = this._interp.column;
  22739. this._tokenStartLine = this._interp.line;
  22740. this._text = null;
  22741. var continueOuter = false;
  22742. while (true) {
  22743. this._type = Token.INVALID_TYPE;
  22744. var ttype = Lexer.SKIP;
  22745. try {
  22746. ttype = this._interp.match(this._input, this._mode);
  22747. } catch (e) {
  22748. if (e instanceof RecognitionException) {
  22749. this.notifyListeners(e); // report error
  22750. this.recover(e);
  22751. } else {
  22752. console.log(e.stack);
  22753. throw e;
  22754. }
  22755. }
  22756. if (this._input.LA(1) === Token.EOF) {
  22757. this._hitEOF = true;
  22758. }
  22759. if (this._type === Token.INVALID_TYPE) {
  22760. this._type = ttype;
  22761. }
  22762. if (this._type === Lexer.SKIP) {
  22763. continueOuter = true;
  22764. break;
  22765. }
  22766. if (this._type !== Lexer.MORE) {
  22767. break;
  22768. }
  22769. }
  22770. if (continueOuter) {
  22771. continue;
  22772. }
  22773. if (this._token === null) {
  22774. this.emit();
  22775. }
  22776. return this._token;
  22777. }
  22778. } finally {
  22779. // make sure we release marker after match or
  22780. // unbuffered char stream will keep buffering
  22781. this._input.release(tokenStartMarker);
  22782. }
  22783. };
  22784. // Instruct the lexer to skip creating a token for current lexer rule
  22785. // and look for another token. nextToken() knows to keep looking when
  22786. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  22787. // if token==null at end of any token rule, it creates one for you
  22788. // and emits it.
  22789. // /
  22790. Lexer.prototype.skip = function () {
  22791. this._type = Lexer.SKIP;
  22792. };
  22793. Lexer.prototype.more = function () {
  22794. this._type = Lexer.MORE;
  22795. };
  22796. Lexer.prototype.mode = function (m) {
  22797. this._mode = m;
  22798. };
  22799. Lexer.prototype.pushMode = function (m) {
  22800. if (this._interp.debug) {
  22801. console.log("pushMode " + m);
  22802. }
  22803. this._modeStack.push(this._mode);
  22804. this.mode(m);
  22805. };
  22806. Lexer.prototype.popMode = function () {
  22807. if (this._modeStack.length === 0) {
  22808. throw "Empty Stack";
  22809. }
  22810. if (this._interp.debug) {
  22811. console.log("popMode back to " + this._modeStack.slice(0, -1));
  22812. }
  22813. this.mode(this._modeStack.pop());
  22814. return this._mode;
  22815. };
  22816. // Set the char stream and reset the lexer
  22817. Object.defineProperty(Lexer.prototype, "inputStream", {
  22818. get: function get() {
  22819. return this._input;
  22820. },
  22821. set: function set(input) {
  22822. this._input = null;
  22823. this._tokenFactorySourcePair = [this, this._input];
  22824. this.reset();
  22825. this._input = input;
  22826. this._tokenFactorySourcePair = [this, this._input];
  22827. }
  22828. });
  22829. Object.defineProperty(Lexer.prototype, "sourceName", {
  22830. get: function sourceName() {
  22831. return this._input.sourceName;
  22832. }
  22833. });
  22834. // By default does not support multiple emits per nextToken invocation
  22835. // for efficiency reasons. Subclass and override this method, nextToken,
  22836. // and getToken (to push tokens into a list and pull from that list
  22837. // rather than a single variable as this implementation does).
  22838. // /
  22839. Lexer.prototype.emitToken = function (token) {
  22840. this._token = token;
  22841. };
  22842. // The standard method called to automatically emit a token at the
  22843. // outermost lexical rule. The token object should point into the
  22844. // char buffer start..stop. If there is a text override in 'text',
  22845. // use that to set the token's text. Override this method to emit
  22846. // custom Token objects or provide a new factory.
  22847. // /
  22848. Lexer.prototype.emit = function () {
  22849. var t = this._factory.create(this._tokenFactorySourcePair, this._type, this._text, this._channel, this._tokenStartCharIndex, this.getCharIndex() - 1, this._tokenStartLine, this._tokenStartColumn);
  22850. this.emitToken(t);
  22851. return t;
  22852. };
  22853. Lexer.prototype.emitEOF = function () {
  22854. var cpos = this.column;
  22855. var lpos = this.line;
  22856. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, this._input.index, this._input.index - 1, lpos, cpos);
  22857. this.emitToken(eof);
  22858. return eof;
  22859. };
  22860. Object.defineProperty(Lexer.prototype, "type", {
  22861. get: function get() {
  22862. return this.type;
  22863. },
  22864. set: function set(type) {
  22865. this._type = type;
  22866. }
  22867. });
  22868. Object.defineProperty(Lexer.prototype, "line", {
  22869. get: function get() {
  22870. return this._interp.line;
  22871. },
  22872. set: function set(line) {
  22873. this._interp.line = line;
  22874. }
  22875. });
  22876. Object.defineProperty(Lexer.prototype, "column", {
  22877. get: function get() {
  22878. return this._interp.column;
  22879. },
  22880. set: function set(column) {
  22881. this._interp.column = column;
  22882. }
  22883. });
  22884. // What is the index of the current character of lookahead?///
  22885. Lexer.prototype.getCharIndex = function () {
  22886. return this._input.index;
  22887. };
  22888. // Return the text matched so far for the current token or any text override.
  22889. //Set the complete text of this token; it wipes any previous changes to the text.
  22890. Object.defineProperty(Lexer.prototype, "text", {
  22891. get: function get() {
  22892. if (this._text !== null) {
  22893. return this._text;
  22894. } else {
  22895. return this._interp.getText(this._input);
  22896. }
  22897. },
  22898. set: function set(text) {
  22899. this._text = text;
  22900. }
  22901. });
  22902. // Return a list of all Token objects in input char stream.
  22903. // Forces load of all tokens. Does not include EOF token.
  22904. // /
  22905. Lexer.prototype.getAllTokens = function () {
  22906. var tokens = [];
  22907. var t = this.nextToken();
  22908. while (t.type !== Token.EOF) {
  22909. tokens.push(t);
  22910. t = this.nextToken();
  22911. }
  22912. return tokens;
  22913. };
  22914. Lexer.prototype.notifyListeners = function (e) {
  22915. var start = this._tokenStartCharIndex;
  22916. var stop = this._input.index;
  22917. var text = this._input.getText(start, stop);
  22918. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  22919. var listener = this.getErrorListenerDispatch();
  22920. listener.syntaxError(this, null, this._tokenStartLine, this._tokenStartColumn, msg, e);
  22921. };
  22922. Lexer.prototype.getErrorDisplay = function (s) {
  22923. var d = [];
  22924. for (var i = 0; i < s.length; i++) {
  22925. d.push(s[i]);
  22926. }
  22927. return d.join('');
  22928. };
  22929. Lexer.prototype.getErrorDisplayForChar = function (c) {
  22930. if (c.charCodeAt(0) === Token.EOF) {
  22931. return "<EOF>";
  22932. } else if (c === '\n') {
  22933. return "\\n";
  22934. } else if (c === '\t') {
  22935. return "\\t";
  22936. } else if (c === '\r') {
  22937. return "\\r";
  22938. } else {
  22939. return c;
  22940. }
  22941. };
  22942. Lexer.prototype.getCharErrorDisplay = function (c) {
  22943. return "'" + this.getErrorDisplayForChar(c) + "'";
  22944. };
  22945. // Lexers can normally match any char in it's vocabulary after matching
  22946. // a token, so do the easy thing and just kill a character and hope
  22947. // it all works out. You can instead use the rule invocation stack
  22948. // to do sophisticated error recovery if you are in a fragment rule.
  22949. // /
  22950. Lexer.prototype.recover = function (re) {
  22951. if (this._input.LA(1) !== Token.EOF) {
  22952. if (re instanceof LexerNoViableAltException) {
  22953. // skip a char and try again
  22954. this._interp.consume(this._input);
  22955. } else {
  22956. // TODO: Do we lose character or line position information?
  22957. this._input.consume();
  22958. }
  22959. }
  22960. };
  22961. exports.Lexer = Lexer;
  22962. /***/ }),
  22963. /***/ "./node_modules/antlr4/Parser.js":
  22964. /*!***************************************!*\
  22965. !*** ./node_modules/antlr4/Parser.js ***!
  22966. \***************************************/
  22967. /*! no static exports found */
  22968. /***/ (function(module, exports, __webpack_require__) {
  22969. "use strict";
  22970. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22971. * Use of this file is governed by the BSD 3-clause license that
  22972. * can be found in the LICENSE.txt file in the project root.
  22973. */
  22974. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22975. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  22976. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  22977. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  22978. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  22979. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  22980. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  22981. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  22982. function TraceListener(parser) {
  22983. ParseTreeListener.call(this);
  22984. this.parser = parser;
  22985. return this;
  22986. }
  22987. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  22988. TraceListener.prototype.constructor = TraceListener;
  22989. TraceListener.prototype.enterEveryRule = function (ctx) {
  22990. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  22991. };
  22992. TraceListener.prototype.visitTerminal = function (node) {
  22993. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  22994. };
  22995. TraceListener.prototype.exitEveryRule = function (ctx) {
  22996. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  22997. };
  22998. // this is all the parsing support code essentially; most of it is error
  22999. // recovery stuff.//
  23000. function Parser(input) {
  23001. Recognizer.call(this);
  23002. // The input stream.
  23003. this._input = null;
  23004. // The error handling strategy for the parser. The default value is a new
  23005. // instance of {@link DefaultErrorStrategy}.
  23006. this._errHandler = new DefaultErrorStrategy();
  23007. this._precedenceStack = [];
  23008. this._precedenceStack.push(0);
  23009. // The {@link ParserRuleContext} object for the currently executing rule.
  23010. // this is always non-null during the parsing process.
  23011. this._ctx = null;
  23012. // Specifies whether or not the parser should construct a parse tree during
  23013. // the parsing process. The default value is {@code true}.
  23014. this.buildParseTrees = true;
  23015. // When {@link //setTrace}{@code (true)} is called, a reference to the
  23016. // {@link TraceListener} is stored here so it can be easily removed in a
  23017. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  23018. // implemented as a parser listener so this field is not directly used by
  23019. // other parser methods.
  23020. this._tracer = null;
  23021. // The list of {@link ParseTreeListener} listeners registered to receive
  23022. // events during the parse.
  23023. this._parseListeners = null;
  23024. // The number of syntax errors reported during parsing. this value is
  23025. // incremented each time {@link //notifyErrorListeners} is called.
  23026. this._syntaxErrors = 0;
  23027. this.setInputStream(input);
  23028. return this;
  23029. }
  23030. Parser.prototype = Object.create(Recognizer.prototype);
  23031. Parser.prototype.contructor = Parser;
  23032. // this field maps from the serialized ATN string to the deserialized {@link
  23033. // ATN} with
  23034. // bypass alternatives.
  23035. //
  23036. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  23037. //
  23038. Parser.bypassAltsAtnCache = {};
  23039. // reset the parser's state//
  23040. Parser.prototype.reset = function () {
  23041. if (this._input !== null) {
  23042. this._input.seek(0);
  23043. }
  23044. this._errHandler.reset(this);
  23045. this._ctx = null;
  23046. this._syntaxErrors = 0;
  23047. this.setTrace(false);
  23048. this._precedenceStack = [];
  23049. this._precedenceStack.push(0);
  23050. if (this._interp !== null) {
  23051. this._interp.reset();
  23052. }
  23053. };
  23054. // Match current input symbol against {@code ttype}. If the symbol type
  23055. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  23056. // called to complete the match process.
  23057. //
  23058. // <p>If the symbol type does not match,
  23059. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  23060. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  23061. // {@code true} and the token index of the symbol returned by
  23062. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  23063. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  23064. //
  23065. // @param ttype the token type to match
  23066. // @return the matched symbol
  23067. // @throws RecognitionException if the current input symbol did not match
  23068. // {@code ttype} and the error strategy could not recover from the
  23069. // mismatched symbol
  23070. Parser.prototype.match = function (ttype) {
  23071. var t = this.getCurrentToken();
  23072. if (t.type === ttype) {
  23073. this._errHandler.reportMatch(this);
  23074. this.consume();
  23075. } else {
  23076. t = this._errHandler.recoverInline(this);
  23077. if (this.buildParseTrees && t.tokenIndex === -1) {
  23078. // we must have conjured up a new token during single token
  23079. // insertion
  23080. // if it's not the current symbol
  23081. this._ctx.addErrorNode(t);
  23082. }
  23083. }
  23084. return t;
  23085. };
  23086. // Match current input symbol as a wildcard. If the symbol type matches
  23087. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  23088. // and {@link //consume} are called to complete the match process.
  23089. //
  23090. // <p>If the symbol type does not match,
  23091. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  23092. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  23093. // {@code true} and the token index of the symbol returned by
  23094. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  23095. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  23096. //
  23097. // @return the matched symbol
  23098. // @throws RecognitionException if the current input symbol did not match
  23099. // a wildcard and the error strategy could not recover from the mismatched
  23100. // symbol
  23101. Parser.prototype.matchWildcard = function () {
  23102. var t = this.getCurrentToken();
  23103. if (t.type > 0) {
  23104. this._errHandler.reportMatch(this);
  23105. this.consume();
  23106. } else {
  23107. t = this._errHandler.recoverInline(this);
  23108. if (this._buildParseTrees && t.tokenIndex === -1) {
  23109. // we must have conjured up a new token during single token
  23110. // insertion
  23111. // if it's not the current symbol
  23112. this._ctx.addErrorNode(t);
  23113. }
  23114. }
  23115. return t;
  23116. };
  23117. Parser.prototype.getParseListeners = function () {
  23118. return this._parseListeners || [];
  23119. };
  23120. // Registers {@code listener} to receive events during the parsing process.
  23121. //
  23122. // <p>To support output-preserving grammar transformations (including but not
  23123. // limited to left-recursion removal, automated left-factoring, and
  23124. // optimized code generation), calls to listener methods during the parse
  23125. // may differ substantially from calls made by
  23126. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  23127. // particular, rule entry and exit events may occur in a different order
  23128. // during the parse than after the parser. In addition, calls to certain
  23129. // rule entry methods may be omitted.</p>
  23130. //
  23131. // <p>With the following specific exceptions, calls to listener events are
  23132. // <em>deterministic</em>, i.e. for identical input the calls to listener
  23133. // methods will be the same.</p>
  23134. //
  23135. // <ul>
  23136. // <li>Alterations to the grammar used to generate code may change the
  23137. // behavior of the listener calls.</li>
  23138. // <li>Alterations to the command line options passed to ANTLR 4 when
  23139. // generating the parser may change the behavior of the listener calls.</li>
  23140. // <li>Changing the version of the ANTLR Tool used to generate the parser
  23141. // may change the behavior of the listener calls.</li>
  23142. // </ul>
  23143. //
  23144. // @param listener the listener to add
  23145. //
  23146. // @throws NullPointerException if {@code} listener is {@code null}
  23147. //
  23148. Parser.prototype.addParseListener = function (listener) {
  23149. if (listener === null) {
  23150. throw "listener";
  23151. }
  23152. if (this._parseListeners === null) {
  23153. this._parseListeners = [];
  23154. }
  23155. this._parseListeners.push(listener);
  23156. };
  23157. //
  23158. // Remove {@code listener} from the list of parse listeners.
  23159. //
  23160. // <p>If {@code listener} is {@code null} or has not been added as a parse
  23161. // listener, this method does nothing.</p>
  23162. // @param listener the listener to remove
  23163. //
  23164. Parser.prototype.removeParseListener = function (listener) {
  23165. if (this._parseListeners !== null) {
  23166. var idx = this._parseListeners.indexOf(listener);
  23167. if (idx >= 0) {
  23168. this._parseListeners.splice(idx, 1);
  23169. }
  23170. if (this._parseListeners.length === 0) {
  23171. this._parseListeners = null;
  23172. }
  23173. }
  23174. };
  23175. // Remove all parse listeners.
  23176. Parser.prototype.removeParseListeners = function () {
  23177. this._parseListeners = null;
  23178. };
  23179. // Notify any parse listeners of an enter rule event.
  23180. Parser.prototype.triggerEnterRuleEvent = function () {
  23181. if (this._parseListeners !== null) {
  23182. var ctx = this._ctx;
  23183. this._parseListeners.map(function (listener) {
  23184. listener.enterEveryRule(ctx);
  23185. ctx.enterRule(listener);
  23186. });
  23187. }
  23188. };
  23189. //
  23190. // Notify any parse listeners of an exit rule event.
  23191. //
  23192. // @see //addParseListener
  23193. //
  23194. Parser.prototype.triggerExitRuleEvent = function () {
  23195. if (this._parseListeners !== null) {
  23196. // reverse order walk of listeners
  23197. var ctx = this._ctx;
  23198. this._parseListeners.slice(0).reverse().map(function (listener) {
  23199. ctx.exitRule(listener);
  23200. listener.exitEveryRule(ctx);
  23201. });
  23202. }
  23203. };
  23204. Parser.prototype.getTokenFactory = function () {
  23205. return this._input.tokenSource._factory;
  23206. };
  23207. // Tell our token source and error strategy about a new way to create tokens.//
  23208. Parser.prototype.setTokenFactory = function (factory) {
  23209. this._input.tokenSource._factory = factory;
  23210. };
  23211. // The ATN with bypass alternatives is expensive to create so we create it
  23212. // lazily.
  23213. //
  23214. // @throws UnsupportedOperationException if the current parser does not
  23215. // implement the {@link //getSerializedATN()} method.
  23216. //
  23217. Parser.prototype.getATNWithBypassAlts = function () {
  23218. var serializedAtn = this.getSerializedATN();
  23219. if (serializedAtn === null) {
  23220. throw "The current parser does not support an ATN with bypass alternatives.";
  23221. }
  23222. var result = this.bypassAltsAtnCache[serializedAtn];
  23223. if (result === null) {
  23224. var deserializationOptions = new ATNDeserializationOptions();
  23225. deserializationOptions.generateRuleBypassTransitions = true;
  23226. result = new ATNDeserializer(deserializationOptions).deserialize(serializedAtn);
  23227. this.bypassAltsAtnCache[serializedAtn] = result;
  23228. }
  23229. return result;
  23230. };
  23231. // The preferred method of getting a tree pattern. For example, here's a
  23232. // sample use:
  23233. //
  23234. // <pre>
  23235. // ParseTree t = parser.expr();
  23236. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  23237. // MyParser.RULE_expr);
  23238. // ParseTreeMatch m = p.match(t);
  23239. // String id = m.get("ID");
  23240. // </pre>
  23241. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  23242. Parser.prototype.compileParseTreePattern = function (pattern, patternRuleIndex, lexer) {
  23243. lexer = lexer || null;
  23244. if (lexer === null) {
  23245. if (this.getTokenStream() !== null) {
  23246. var tokenSource = this.getTokenStream().tokenSource;
  23247. if (tokenSource instanceof Lexer) {
  23248. lexer = tokenSource;
  23249. }
  23250. }
  23251. }
  23252. if (lexer === null) {
  23253. throw "Parser can't discover a lexer to use";
  23254. }
  23255. var m = new ParseTreePatternMatcher(lexer, this);
  23256. return m.compile(pattern, patternRuleIndex);
  23257. };
  23258. Parser.prototype.getInputStream = function () {
  23259. return this.getTokenStream();
  23260. };
  23261. Parser.prototype.setInputStream = function (input) {
  23262. this.setTokenStream(input);
  23263. };
  23264. Parser.prototype.getTokenStream = function () {
  23265. return this._input;
  23266. };
  23267. // Set the token stream and reset the parser.//
  23268. Parser.prototype.setTokenStream = function (input) {
  23269. this._input = null;
  23270. this.reset();
  23271. this._input = input;
  23272. };
  23273. // Match needs to return the current input symbol, which gets put
  23274. // into the label for the associated token ref; e.g., x=ID.
  23275. //
  23276. Parser.prototype.getCurrentToken = function () {
  23277. return this._input.LT(1);
  23278. };
  23279. Parser.prototype.notifyErrorListeners = function (msg, offendingToken, err) {
  23280. offendingToken = offendingToken || null;
  23281. err = err || null;
  23282. if (offendingToken === null) {
  23283. offendingToken = this.getCurrentToken();
  23284. }
  23285. this._syntaxErrors += 1;
  23286. var line = offendingToken.line;
  23287. var column = offendingToken.column;
  23288. var listener = this.getErrorListenerDispatch();
  23289. listener.syntaxError(this, offendingToken, line, column, msg, err);
  23290. };
  23291. //
  23292. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  23293. //
  23294. // <p>E.g., given the following input with {@code A} being the current
  23295. // lookahead symbol, this function moves the cursor to {@code B} and returns
  23296. // {@code A}.</p>
  23297. //
  23298. // <pre>
  23299. // A B
  23300. // ^
  23301. // </pre>
  23302. //
  23303. // If the parser is not in error recovery mode, the consumed symbol is added
  23304. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  23305. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  23306. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  23307. // added to the parse tree using
  23308. // {@link ParserRuleContext//addErrorNode(Token)}, and
  23309. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  23310. // listeners.
  23311. //
  23312. Parser.prototype.consume = function () {
  23313. var o = this.getCurrentToken();
  23314. if (o.type !== Token.EOF) {
  23315. this.getInputStream().consume();
  23316. }
  23317. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  23318. if (this.buildParseTrees || hasListener) {
  23319. var node;
  23320. if (this._errHandler.inErrorRecoveryMode(this)) {
  23321. node = this._ctx.addErrorNode(o);
  23322. } else {
  23323. node = this._ctx.addTokenNode(o);
  23324. }
  23325. node.invokingState = this.state;
  23326. if (hasListener) {
  23327. this._parseListeners.map(function (listener) {
  23328. if (node instanceof ErrorNode || node.isErrorNode !== undefined && node.isErrorNode()) {
  23329. listener.visitErrorNode(node);
  23330. } else if (node instanceof TerminalNode) {
  23331. listener.visitTerminal(node);
  23332. }
  23333. });
  23334. }
  23335. }
  23336. return o;
  23337. };
  23338. Parser.prototype.addContextToParseTree = function () {
  23339. // add current context to parent if we have a parent
  23340. if (this._ctx.parentCtx !== null) {
  23341. this._ctx.parentCtx.addChild(this._ctx);
  23342. }
  23343. };
  23344. // Always called by generated parsers upon entry to a rule. Access field
  23345. // {@link //_ctx} get the current context.
  23346. Parser.prototype.enterRule = function (localctx, state, ruleIndex) {
  23347. this.state = state;
  23348. this._ctx = localctx;
  23349. this._ctx.start = this._input.LT(1);
  23350. if (this.buildParseTrees) {
  23351. this.addContextToParseTree();
  23352. }
  23353. if (this._parseListeners !== null) {
  23354. this.triggerEnterRuleEvent();
  23355. }
  23356. };
  23357. Parser.prototype.exitRule = function () {
  23358. this._ctx.stop = this._input.LT(-1);
  23359. // trigger event on _ctx, before it reverts to parent
  23360. if (this._parseListeners !== null) {
  23361. this.triggerExitRuleEvent();
  23362. }
  23363. this.state = this._ctx.invokingState;
  23364. this._ctx = this._ctx.parentCtx;
  23365. };
  23366. Parser.prototype.enterOuterAlt = function (localctx, altNum) {
  23367. localctx.setAltNumber(altNum);
  23368. // if we have new localctx, make sure we replace existing ctx
  23369. // that is previous child of parse tree
  23370. if (this.buildParseTrees && this._ctx !== localctx) {
  23371. if (this._ctx.parentCtx !== null) {
  23372. this._ctx.parentCtx.removeLastChild();
  23373. this._ctx.parentCtx.addChild(localctx);
  23374. }
  23375. }
  23376. this._ctx = localctx;
  23377. };
  23378. // Get the precedence level for the top-most precedence rule.
  23379. //
  23380. // @return The precedence level for the top-most precedence rule, or -1 if
  23381. // the parser context is not nested within a precedence rule.
  23382. Parser.prototype.getPrecedence = function () {
  23383. if (this._precedenceStack.length === 0) {
  23384. return -1;
  23385. } else {
  23386. return this._precedenceStack[this._precedenceStack.length - 1];
  23387. }
  23388. };
  23389. Parser.prototype.enterRecursionRule = function (localctx, state, ruleIndex, precedence) {
  23390. this.state = state;
  23391. this._precedenceStack.push(precedence);
  23392. this._ctx = localctx;
  23393. this._ctx.start = this._input.LT(1);
  23394. if (this._parseListeners !== null) {
  23395. this.triggerEnterRuleEvent(); // simulates rule entry for
  23396. // left-recursive rules
  23397. }
  23398. };
  23399. //
  23400. // Like {@link //enterRule} but for recursive rules.
  23401. Parser.prototype.pushNewRecursionContext = function (localctx, state, ruleIndex) {
  23402. var previous = this._ctx;
  23403. previous.parentCtx = localctx;
  23404. previous.invokingState = state;
  23405. previous.stop = this._input.LT(-1);
  23406. this._ctx = localctx;
  23407. this._ctx.start = previous.start;
  23408. if (this.buildParseTrees) {
  23409. this._ctx.addChild(previous);
  23410. }
  23411. if (this._parseListeners !== null) {
  23412. this.triggerEnterRuleEvent(); // simulates rule entry for
  23413. // left-recursive rules
  23414. }
  23415. };
  23416. Parser.prototype.unrollRecursionContexts = function (parentCtx) {
  23417. this._precedenceStack.pop();
  23418. this._ctx.stop = this._input.LT(-1);
  23419. var retCtx = this._ctx; // save current ctx (return value)
  23420. // unroll so _ctx is as it was before call to recursive method
  23421. if (this._parseListeners !== null) {
  23422. while (this._ctx !== parentCtx) {
  23423. this.triggerExitRuleEvent();
  23424. this._ctx = this._ctx.parentCtx;
  23425. }
  23426. } else {
  23427. this._ctx = parentCtx;
  23428. }
  23429. // hook into tree
  23430. retCtx.parentCtx = parentCtx;
  23431. if (this.buildParseTrees && parentCtx !== null) {
  23432. // add return ctx into invoking rule's tree
  23433. parentCtx.addChild(retCtx);
  23434. }
  23435. };
  23436. Parser.prototype.getInvokingContext = function (ruleIndex) {
  23437. var ctx = this._ctx;
  23438. while (ctx !== null) {
  23439. if (ctx.ruleIndex === ruleIndex) {
  23440. return ctx;
  23441. }
  23442. ctx = ctx.parentCtx;
  23443. }
  23444. return null;
  23445. };
  23446. Parser.prototype.precpred = function (localctx, precedence) {
  23447. return precedence >= this._precedenceStack[this._precedenceStack.length - 1];
  23448. };
  23449. Parser.prototype.inContext = function (context) {
  23450. // TODO: useful in parser?
  23451. return false;
  23452. };
  23453. //
  23454. // Checks whether or not {@code symbol} can follow the current state in the
  23455. // ATN. The behavior of this method is equivalent to the following, but is
  23456. // implemented such that the complete context-sensitive follow set does not
  23457. // need to be explicitly constructed.
  23458. //
  23459. // <pre>
  23460. // return getExpectedTokens().contains(symbol);
  23461. // </pre>
  23462. //
  23463. // @param symbol the symbol type to check
  23464. // @return {@code true} if {@code symbol} can follow the current state in
  23465. // the ATN, otherwise {@code false}.
  23466. Parser.prototype.isExpectedToken = function (symbol) {
  23467. var atn = this._interp.atn;
  23468. var ctx = this._ctx;
  23469. var s = atn.states[this.state];
  23470. var following = atn.nextTokens(s);
  23471. if (following.contains(symbol)) {
  23472. return true;
  23473. }
  23474. if (!following.contains(Token.EPSILON)) {
  23475. return false;
  23476. }
  23477. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  23478. var invokingState = atn.states[ctx.invokingState];
  23479. var rt = invokingState.transitions[0];
  23480. following = atn.nextTokens(rt.followState);
  23481. if (following.contains(symbol)) {
  23482. return true;
  23483. }
  23484. ctx = ctx.parentCtx;
  23485. }
  23486. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  23487. return true;
  23488. } else {
  23489. return false;
  23490. }
  23491. };
  23492. // Computes the set of input symbols which could follow the current parser
  23493. // state and context, as given by {@link //getState} and {@link //getContext},
  23494. // respectively.
  23495. //
  23496. // @see ATN//getExpectedTokens(int, RuleContext)
  23497. //
  23498. Parser.prototype.getExpectedTokens = function () {
  23499. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  23500. };
  23501. Parser.prototype.getExpectedTokensWithinCurrentRule = function () {
  23502. var atn = this._interp.atn;
  23503. var s = atn.states[this.state];
  23504. return atn.nextTokens(s);
  23505. };
  23506. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  23507. Parser.prototype.getRuleIndex = function (ruleName) {
  23508. var ruleIndex = this.getRuleIndexMap()[ruleName];
  23509. if (ruleIndex !== null) {
  23510. return ruleIndex;
  23511. } else {
  23512. return -1;
  23513. }
  23514. };
  23515. // Return List&lt;String&gt; of the rule names in your parser instance
  23516. // leading up to a call to the current rule. You could override if
  23517. // you want more details such as the file/line info of where
  23518. // in the ATN a rule is invoked.
  23519. //
  23520. // this is very useful for error messages.
  23521. //
  23522. Parser.prototype.getRuleInvocationStack = function (p) {
  23523. p = p || null;
  23524. if (p === null) {
  23525. p = this._ctx;
  23526. }
  23527. var stack = [];
  23528. while (p !== null) {
  23529. // compute what follows who invoked us
  23530. var ruleIndex = p.ruleIndex;
  23531. if (ruleIndex < 0) {
  23532. stack.push("n/a");
  23533. } else {
  23534. stack.push(this.ruleNames[ruleIndex]);
  23535. }
  23536. p = p.parentCtx;
  23537. }
  23538. return stack;
  23539. };
  23540. // For debugging and other purposes.//
  23541. Parser.prototype.getDFAStrings = function () {
  23542. return this._interp.decisionToDFA.toString();
  23543. };
  23544. // For debugging and other purposes.//
  23545. Parser.prototype.dumpDFA = function () {
  23546. var seenOne = false;
  23547. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  23548. var dfa = this._interp.decisionToDFA[i];
  23549. if (dfa.states.length > 0) {
  23550. if (seenOne) {
  23551. console.log();
  23552. }
  23553. this.printer.println("Decision " + dfa.decision + ":");
  23554. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  23555. seenOne = true;
  23556. }
  23557. }
  23558. };
  23559. /*
  23560. " printer = function() {\r\n" +
  23561. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  23562. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  23563. " };\r\n" +
  23564. */
  23565. Parser.prototype.getSourceName = function () {
  23566. return this._input.sourceName;
  23567. };
  23568. // During a parse is sometimes useful to listen in on the rule entry and exit
  23569. // events as well as token matches. this is for quick and dirty debugging.
  23570. //
  23571. Parser.prototype.setTrace = function (trace) {
  23572. if (!trace) {
  23573. this.removeParseListener(this._tracer);
  23574. this._tracer = null;
  23575. } else {
  23576. if (this._tracer !== null) {
  23577. this.removeParseListener(this._tracer);
  23578. }
  23579. this._tracer = new TraceListener(this);
  23580. this.addParseListener(this._tracer);
  23581. }
  23582. };
  23583. exports.Parser = Parser;
  23584. /***/ }),
  23585. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  23586. /*!**************************************************!*\
  23587. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  23588. \**************************************************/
  23589. /*! no static exports found */
  23590. /***/ (function(module, exports, __webpack_require__) {
  23591. "use strict";
  23592. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23593. * Use of this file is governed by the BSD 3-clause license that
  23594. * can be found in the LICENSE.txt file in the project root.
  23595. */
  23596. //* A rule invocation record for parsing.
  23597. //
  23598. // Contains all of the information about the current rule not stored in the
  23599. // RuleContext. It handles parse tree children list, Any ATN state
  23600. // tracing, and the default values available for rule indications:
  23601. // start, stop, rule index, current alt number, current
  23602. // ATN state.
  23603. //
  23604. // Subclasses made for each rule and grammar track the parameters,
  23605. // return values, locals, and labels specific to that rule. These
  23606. // are the objects that are returned from rules.
  23607. //
  23608. // Note text is not an actual field of a rule return value; it is computed
  23609. // from start and stop using the input stream's toString() method. I
  23610. // could add a ctor to this so that we can pass in and store the input
  23611. // stream, but I'm not sure we want to do that. It would seem to be undefined
  23612. // to get the .text property anyway if the rule matches tokens from multiple
  23613. // input streams.
  23614. //
  23615. // I do not use getters for fields of objects that are used simply to
  23616. // group values such as this aggregate. The getters/setters are there to
  23617. // satisfy the superclass interface.
  23618. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  23619. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  23620. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  23621. var TerminalNode = Tree.TerminalNode;
  23622. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  23623. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  23624. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  23625. function ParserRuleContext(parent, invokingStateNumber) {
  23626. parent = parent || null;
  23627. invokingStateNumber = invokingStateNumber || null;
  23628. RuleContext.call(this, parent, invokingStateNumber);
  23629. this.ruleIndex = -1;
  23630. // * If we are debugging or building a parse tree for a visitor,
  23631. // we need to track all of the tokens and rule invocations associated
  23632. // with this rule's context. This is empty for parsing w/o tree constr.
  23633. // operation because we don't the need to track the details about
  23634. // how we parse this rule.
  23635. // /
  23636. this.children = null;
  23637. this.start = null;
  23638. this.stop = null;
  23639. // The exception that forced this rule to return. If the rule successfully
  23640. // completed, this is {@code null}.
  23641. this.exception = null;
  23642. }
  23643. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  23644. ParserRuleContext.prototype.constructor = ParserRuleContext;
  23645. // * COPY a ctx (I'm deliberately not using copy constructor)///
  23646. ParserRuleContext.prototype.copyFrom = function (ctx) {
  23647. // from RuleContext
  23648. this.parentCtx = ctx.parentCtx;
  23649. this.invokingState = ctx.invokingState;
  23650. this.children = null;
  23651. this.start = ctx.start;
  23652. this.stop = ctx.stop;
  23653. // copy any error nodes to alt label node
  23654. if (ctx.children) {
  23655. this.children = [];
  23656. // reset parent pointer for any error nodes
  23657. ctx.children.map(function (child) {
  23658. if (child instanceof ErrorNodeImpl) {
  23659. this.children.push(child);
  23660. child.parentCtx = this;
  23661. }
  23662. }, this);
  23663. }
  23664. };
  23665. // Double dispatch methods for listeners
  23666. ParserRuleContext.prototype.enterRule = function (listener) {};
  23667. ParserRuleContext.prototype.exitRule = function (listener) {};
  23668. // * Does not set parent link; other add methods do that///
  23669. ParserRuleContext.prototype.addChild = function (child) {
  23670. if (this.children === null) {
  23671. this.children = [];
  23672. }
  23673. this.children.push(child);
  23674. return child;
  23675. };
  23676. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  23677. // we entered a rule. If we have // label, we will need to remove
  23678. // generic ruleContext object.
  23679. // /
  23680. ParserRuleContext.prototype.removeLastChild = function () {
  23681. if (this.children !== null) {
  23682. this.children.pop();
  23683. }
  23684. };
  23685. ParserRuleContext.prototype.addTokenNode = function (token) {
  23686. var node = new TerminalNodeImpl(token);
  23687. this.addChild(node);
  23688. node.parentCtx = this;
  23689. return node;
  23690. };
  23691. ParserRuleContext.prototype.addErrorNode = function (badToken) {
  23692. var node = new ErrorNodeImpl(badToken);
  23693. this.addChild(node);
  23694. node.parentCtx = this;
  23695. return node;
  23696. };
  23697. ParserRuleContext.prototype.getChild = function (i, type) {
  23698. type = type || null;
  23699. if (this.children === null || i < 0 || i >= this.children.length) {
  23700. return null;
  23701. }
  23702. if (type === null) {
  23703. return this.children[i];
  23704. } else {
  23705. for (var j = 0; j < this.children.length; j++) {
  23706. var child = this.children[j];
  23707. if (child instanceof type) {
  23708. if (i === 0) {
  23709. return child;
  23710. } else {
  23711. i -= 1;
  23712. }
  23713. }
  23714. }
  23715. return null;
  23716. }
  23717. };
  23718. ParserRuleContext.prototype.getToken = function (ttype, i) {
  23719. if (this.children === null || i < 0 || i >= this.children.length) {
  23720. return null;
  23721. }
  23722. for (var j = 0; j < this.children.length; j++) {
  23723. var child = this.children[j];
  23724. if (child instanceof TerminalNode) {
  23725. if (child.symbol.type === ttype) {
  23726. if (i === 0) {
  23727. return child;
  23728. } else {
  23729. i -= 1;
  23730. }
  23731. }
  23732. }
  23733. }
  23734. return null;
  23735. };
  23736. ParserRuleContext.prototype.getTokens = function (ttype) {
  23737. if (this.children === null) {
  23738. return [];
  23739. } else {
  23740. var tokens = [];
  23741. for (var j = 0; j < this.children.length; j++) {
  23742. var child = this.children[j];
  23743. if (child instanceof TerminalNode) {
  23744. if (child.symbol.type === ttype) {
  23745. tokens.push(child);
  23746. }
  23747. }
  23748. }
  23749. return tokens;
  23750. }
  23751. };
  23752. ParserRuleContext.prototype.getTypedRuleContext = function (ctxType, i) {
  23753. return this.getChild(i, ctxType);
  23754. };
  23755. ParserRuleContext.prototype.getTypedRuleContexts = function (ctxType) {
  23756. if (this.children === null) {
  23757. return [];
  23758. } else {
  23759. var contexts = [];
  23760. for (var j = 0; j < this.children.length; j++) {
  23761. var child = this.children[j];
  23762. if (child instanceof ctxType) {
  23763. contexts.push(child);
  23764. }
  23765. }
  23766. return contexts;
  23767. }
  23768. };
  23769. ParserRuleContext.prototype.getChildCount = function () {
  23770. if (this.children === null) {
  23771. return 0;
  23772. } else {
  23773. return this.children.length;
  23774. }
  23775. };
  23776. ParserRuleContext.prototype.getSourceInterval = function () {
  23777. if (this.start === null || this.stop === null) {
  23778. return INVALID_INTERVAL;
  23779. } else {
  23780. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  23781. }
  23782. };
  23783. RuleContext.EMPTY = new ParserRuleContext();
  23784. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  23785. ParserRuleContext.call(parent, invokingStateNumber);
  23786. this.ruleIndex = ruleIndex;
  23787. return this;
  23788. }
  23789. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  23790. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  23791. exports.ParserRuleContext = ParserRuleContext;
  23792. /***/ }),
  23793. /***/ "./node_modules/antlr4/PredictionContext.js":
  23794. /*!**************************************************!*\
  23795. !*** ./node_modules/antlr4/PredictionContext.js ***!
  23796. \**************************************************/
  23797. /*! no static exports found */
  23798. /***/ (function(module, exports, __webpack_require__) {
  23799. "use strict";
  23800. //
  23801. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23802. * Use of this file is governed by the BSD 3-clause license that
  23803. * can be found in the LICENSE.txt file in the project root.
  23804. */
  23805. ///
  23806. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  23807. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  23808. function PredictionContext(cachedHashCode) {
  23809. this.cachedHashCode = cachedHashCode;
  23810. }
  23811. // Represents {@code $} in local context prediction, which means wildcard.
  23812. // {@code//+x =//}.
  23813. // /
  23814. PredictionContext.EMPTY = null;
  23815. // Represents {@code $} in an array in full context mode, when {@code $}
  23816. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  23817. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  23818. // /
  23819. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  23820. PredictionContext.globalNodeCount = 1;
  23821. PredictionContext.id = PredictionContext.globalNodeCount;
  23822. // Stores the computed hash code of this {@link PredictionContext}. The hash
  23823. // code is computed in parts to match the following reference algorithm.
  23824. //
  23825. // <pre>
  23826. // private int referenceHashCode() {
  23827. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  23828. // //INITIAL_HASH});
  23829. //
  23830. // for (int i = 0; i &lt; {@link //size()}; i++) {
  23831. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  23832. // getParent}(i));
  23833. // }
  23834. //
  23835. // for (int i = 0; i &lt; {@link //size()}; i++) {
  23836. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  23837. // //getReturnState getReturnState}(i));
  23838. // }
  23839. //
  23840. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  23841. // //size()});
  23842. // return hash;
  23843. // }
  23844. // </pre>
  23845. // /
  23846. // This means only the {@link //EMPTY} context is in set.
  23847. PredictionContext.prototype.isEmpty = function () {
  23848. return this === PredictionContext.EMPTY;
  23849. };
  23850. PredictionContext.prototype.hasEmptyPath = function () {
  23851. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  23852. };
  23853. PredictionContext.prototype.hashCode = function () {
  23854. return this.cachedHashCode;
  23855. };
  23856. PredictionContext.prototype.updateHashCode = function (hash) {
  23857. hash.update(this.cachedHashCode);
  23858. };
  23859. /*
  23860. function calculateHashString(parent, returnState) {
  23861. return "" + parent + returnState;
  23862. }
  23863. */
  23864. // Used to cache {@link PredictionContext} objects. Its used for the shared
  23865. // context cash associated with contexts in DFA states. This cache
  23866. // can be used for both lexers and parsers.
  23867. function PredictionContextCache() {
  23868. this.cache = {};
  23869. return this;
  23870. }
  23871. // Add a context to the cache and return it. If the context already exists,
  23872. // return that one instead and do not add a new context to the cache.
  23873. // Protect shared cache from unsafe thread access.
  23874. //
  23875. PredictionContextCache.prototype.add = function (ctx) {
  23876. if (ctx === PredictionContext.EMPTY) {
  23877. return PredictionContext.EMPTY;
  23878. }
  23879. var existing = this.cache[ctx] || null;
  23880. if (existing !== null) {
  23881. return existing;
  23882. }
  23883. this.cache[ctx] = ctx;
  23884. return ctx;
  23885. };
  23886. PredictionContextCache.prototype.get = function (ctx) {
  23887. return this.cache[ctx] || null;
  23888. };
  23889. Object.defineProperty(PredictionContextCache.prototype, "length", {
  23890. get: function get() {
  23891. return this.cache.length;
  23892. }
  23893. });
  23894. function SingletonPredictionContext(parent, returnState) {
  23895. var hashCode = 0;
  23896. if (parent !== null) {
  23897. var hash = new Hash();
  23898. hash.update(parent, returnState);
  23899. hashCode = hash.finish();
  23900. }
  23901. PredictionContext.call(this, hashCode);
  23902. this.parentCtx = parent;
  23903. this.returnState = returnState;
  23904. }
  23905. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  23906. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  23907. SingletonPredictionContext.create = function (parent, returnState) {
  23908. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  23909. // someone can pass in the bits of an array ctx that mean $
  23910. return PredictionContext.EMPTY;
  23911. } else {
  23912. return new SingletonPredictionContext(parent, returnState);
  23913. }
  23914. };
  23915. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  23916. get: function get() {
  23917. return 1;
  23918. }
  23919. });
  23920. SingletonPredictionContext.prototype.getParent = function (index) {
  23921. return this.parentCtx;
  23922. };
  23923. SingletonPredictionContext.prototype.getReturnState = function (index) {
  23924. return this.returnState;
  23925. };
  23926. SingletonPredictionContext.prototype.equals = function (other) {
  23927. if (this === other) {
  23928. return true;
  23929. } else if (!(other instanceof SingletonPredictionContext)) {
  23930. return false;
  23931. } else if (this.hashCode() !== other.hashCode()) {
  23932. return false; // can't be same if hash is different
  23933. } else {
  23934. if (this.returnState !== other.returnState) return false;else if (this.parentCtx == null) return other.parentCtx == null;else return this.parentCtx.equals(other.parentCtx);
  23935. }
  23936. };
  23937. SingletonPredictionContext.prototype.toString = function () {
  23938. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  23939. if (up.length === 0) {
  23940. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  23941. return "$";
  23942. } else {
  23943. return "" + this.returnState;
  23944. }
  23945. } else {
  23946. return "" + this.returnState + " " + up;
  23947. }
  23948. };
  23949. function EmptyPredictionContext() {
  23950. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  23951. return this;
  23952. }
  23953. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  23954. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  23955. EmptyPredictionContext.prototype.isEmpty = function () {
  23956. return true;
  23957. };
  23958. EmptyPredictionContext.prototype.getParent = function (index) {
  23959. return null;
  23960. };
  23961. EmptyPredictionContext.prototype.getReturnState = function (index) {
  23962. return this.returnState;
  23963. };
  23964. EmptyPredictionContext.prototype.equals = function (other) {
  23965. return this === other;
  23966. };
  23967. EmptyPredictionContext.prototype.toString = function () {
  23968. return "$";
  23969. };
  23970. PredictionContext.EMPTY = new EmptyPredictionContext();
  23971. function ArrayPredictionContext(parents, returnStates) {
  23972. // Parent can be null only if full ctx mode and we make an array
  23973. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  23974. // null parent and
  23975. // returnState == {@link //EMPTY_RETURN_STATE}.
  23976. var h = new Hash();
  23977. h.update(parents, returnStates);
  23978. var hashCode = h.finish();
  23979. PredictionContext.call(this, hashCode);
  23980. this.parents = parents;
  23981. this.returnStates = returnStates;
  23982. return this;
  23983. }
  23984. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  23985. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  23986. ArrayPredictionContext.prototype.isEmpty = function () {
  23987. // since EMPTY_RETURN_STATE can only appear in the last position, we
  23988. // don't need to verify that size==1
  23989. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  23990. };
  23991. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  23992. get: function get() {
  23993. return this.returnStates.length;
  23994. }
  23995. });
  23996. ArrayPredictionContext.prototype.getParent = function (index) {
  23997. return this.parents[index];
  23998. };
  23999. ArrayPredictionContext.prototype.getReturnState = function (index) {
  24000. return this.returnStates[index];
  24001. };
  24002. ArrayPredictionContext.prototype.equals = function (other) {
  24003. if (this === other) {
  24004. return true;
  24005. } else if (!(other instanceof ArrayPredictionContext)) {
  24006. return false;
  24007. } else if (this.hashCode() !== other.hashCode()) {
  24008. return false; // can't be same if hash is different
  24009. } else {
  24010. return this.returnStates === other.returnStates && this.parents === other.parents;
  24011. }
  24012. };
  24013. ArrayPredictionContext.prototype.toString = function () {
  24014. if (this.isEmpty()) {
  24015. return "[]";
  24016. } else {
  24017. var s = "[";
  24018. for (var i = 0; i < this.returnStates.length; i++) {
  24019. if (i > 0) {
  24020. s = s + ", ";
  24021. }
  24022. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  24023. s = s + "$";
  24024. continue;
  24025. }
  24026. s = s + this.returnStates[i];
  24027. if (this.parents[i] !== null) {
  24028. s = s + " " + this.parents[i];
  24029. } else {
  24030. s = s + "null";
  24031. }
  24032. }
  24033. return s + "]";
  24034. }
  24035. };
  24036. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  24037. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  24038. // /
  24039. function predictionContextFromRuleContext(atn, outerContext) {
  24040. if (outerContext === undefined || outerContext === null) {
  24041. outerContext = RuleContext.EMPTY;
  24042. }
  24043. // if we are in RuleContext of start rule, s, then PredictionContext
  24044. // is EMPTY. Nobody called us. (if we are empty, return empty)
  24045. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  24046. return PredictionContext.EMPTY;
  24047. }
  24048. // If we have a parent, convert it to a PredictionContext graph
  24049. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  24050. var state = atn.states[outerContext.invokingState];
  24051. var transition = state.transitions[0];
  24052. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  24053. }
  24054. /*
  24055. function calculateListsHashString(parents, returnStates) {
  24056. var s = "";
  24057. parents.map(function(p) {
  24058. s = s + p;
  24059. });
  24060. returnStates.map(function(r) {
  24061. s = s + r;
  24062. });
  24063. return s;
  24064. }
  24065. */
  24066. function merge(a, b, rootIsWildcard, mergeCache) {
  24067. // share same graph if both same
  24068. if (a === b) {
  24069. return a;
  24070. }
  24071. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  24072. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  24073. }
  24074. // At least one of a or b is array
  24075. // If one is $ and rootIsWildcard, return $ as// wildcard
  24076. if (rootIsWildcard) {
  24077. if (a instanceof EmptyPredictionContext) {
  24078. return a;
  24079. }
  24080. if (b instanceof EmptyPredictionContext) {
  24081. return b;
  24082. }
  24083. }
  24084. // convert singleton so both are arrays to normalize
  24085. if (a instanceof SingletonPredictionContext) {
  24086. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  24087. }
  24088. if (b instanceof SingletonPredictionContext) {
  24089. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  24090. }
  24091. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  24092. }
  24093. //
  24094. // Merge two {@link SingletonPredictionContext} instances.
  24095. //
  24096. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  24097. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  24098. // type="image/svg+xml"/></p>
  24099. //
  24100. // <p>Same stack top, parents differ; merge parents giving array node, then
  24101. // remainders of those graphs. A new root node is created to point to the
  24102. // merged parents.<br>
  24103. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  24104. // type="image/svg+xml"/></p>
  24105. //
  24106. // <p>Different stack tops pointing to same parent. Make array node for the
  24107. // root where both element in the root point to the same (original)
  24108. // parent.<br>
  24109. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  24110. // type="image/svg+xml"/></p>
  24111. //
  24112. // <p>Different stack tops pointing to different parents. Make array node for
  24113. // the root where each element points to the corresponding original
  24114. // parent.<br>
  24115. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  24116. // type="image/svg+xml"/></p>
  24117. //
  24118. // @param a the first {@link SingletonPredictionContext}
  24119. // @param b the second {@link SingletonPredictionContext}
  24120. // @param rootIsWildcard {@code true} if this is a local-context merge,
  24121. // otherwise false to indicate a full-context merge
  24122. // @param mergeCache
  24123. // /
  24124. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  24125. if (mergeCache !== null) {
  24126. var previous = mergeCache.get(a, b);
  24127. if (previous !== null) {
  24128. return previous;
  24129. }
  24130. previous = mergeCache.get(b, a);
  24131. if (previous !== null) {
  24132. return previous;
  24133. }
  24134. }
  24135. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  24136. if (rootMerge !== null) {
  24137. if (mergeCache !== null) {
  24138. mergeCache.set(a, b, rootMerge);
  24139. }
  24140. return rootMerge;
  24141. }
  24142. if (a.returnState === b.returnState) {
  24143. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  24144. // if parent is same as existing a or b parent or reduced to a parent,
  24145. // return it
  24146. if (parent === a.parentCtx) {
  24147. return a; // ax + bx = ax, if a=b
  24148. }
  24149. if (parent === b.parentCtx) {
  24150. return b; // ax + bx = bx, if a=b
  24151. }
  24152. // else: ax + ay = a'[x,y]
  24153. // merge parents x and y, giving array node with x,y then remainders
  24154. // of those graphs. dup a, a' points at merged array
  24155. // new joined parent so create new singleton pointing to it, a'
  24156. var spc = SingletonPredictionContext.create(parent, a.returnState);
  24157. if (mergeCache !== null) {
  24158. mergeCache.set(a, b, spc);
  24159. }
  24160. return spc;
  24161. } else {
  24162. // a != b payloads differ
  24163. // see if we can collapse parents due to $+x parents if local ctx
  24164. var singleParent = null;
  24165. if (a === b || a.parentCtx !== null && a.parentCtx === b.parentCtx) {
  24166. // ax +
  24167. // bx =
  24168. // [a,b]x
  24169. singleParent = a.parentCtx;
  24170. }
  24171. if (singleParent !== null) {
  24172. // parents are same
  24173. // sort payloads and use same parent
  24174. var payloads = [a.returnState, b.returnState];
  24175. if (a.returnState > b.returnState) {
  24176. payloads[0] = b.returnState;
  24177. payloads[1] = a.returnState;
  24178. }
  24179. var parents = [singleParent, singleParent];
  24180. var apc = new ArrayPredictionContext(parents, payloads);
  24181. if (mergeCache !== null) {
  24182. mergeCache.set(a, b, apc);
  24183. }
  24184. return apc;
  24185. }
  24186. // parents differ and can't merge them. Just pack together
  24187. // into array; can't merge.
  24188. // ax + by = [ax,by]
  24189. var payloads = [a.returnState, b.returnState];
  24190. var parents = [a.parentCtx, b.parentCtx];
  24191. if (a.returnState > b.returnState) {
  24192. // sort by payload
  24193. payloads[0] = b.returnState;
  24194. payloads[1] = a.returnState;
  24195. parents = [b.parentCtx, a.parentCtx];
  24196. }
  24197. var a_ = new ArrayPredictionContext(parents, payloads);
  24198. if (mergeCache !== null) {
  24199. mergeCache.set(a, b, a_);
  24200. }
  24201. return a_;
  24202. }
  24203. }
  24204. //
  24205. // Handle case where at least one of {@code a} or {@code b} is
  24206. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  24207. // to represent {@link //EMPTY}.
  24208. //
  24209. // <h2>Local-Context Merges</h2>
  24210. //
  24211. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  24212. // is true.</p>
  24213. //
  24214. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  24215. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24216. //
  24217. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  24218. // {@code //EMPTY}; return left graph.<br>
  24219. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  24220. //
  24221. // <p>Special case of last merge if local context.<br>
  24222. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  24223. //
  24224. // <h2>Full-Context Merges</h2>
  24225. //
  24226. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  24227. // is false.</p>
  24228. //
  24229. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  24230. //
  24231. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  24232. // null parent).<br>
  24233. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24234. //
  24235. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  24236. //
  24237. // @param a the first {@link SingletonPredictionContext}
  24238. // @param b the second {@link SingletonPredictionContext}
  24239. // @param rootIsWildcard {@code true} if this is a local-context merge,
  24240. // otherwise false to indicate a full-context merge
  24241. // /
  24242. function mergeRoot(a, b, rootIsWildcard) {
  24243. if (rootIsWildcard) {
  24244. if (a === PredictionContext.EMPTY) {
  24245. return PredictionContext.EMPTY; // // + b =//
  24246. }
  24247. if (b === PredictionContext.EMPTY) {
  24248. return PredictionContext.EMPTY; // a +// =//
  24249. }
  24250. } else {
  24251. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  24252. return PredictionContext.EMPTY; // $ + $ = $
  24253. } else if (a === PredictionContext.EMPTY) {
  24254. // $ + x = [$,x]
  24255. var payloads = [b.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24256. var parents = [b.parentCtx, null];
  24257. return new ArrayPredictionContext(parents, payloads);
  24258. } else if (b === PredictionContext.EMPTY) {
  24259. // x + $ = [$,x] ($ is always first if present)
  24260. var payloads = [a.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24261. var parents = [a.parentCtx, null];
  24262. return new ArrayPredictionContext(parents, payloads);
  24263. }
  24264. }
  24265. return null;
  24266. }
  24267. //
  24268. // Merge two {@link ArrayPredictionContext} instances.
  24269. //
  24270. // <p>Different tops, different parents.<br>
  24271. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  24272. //
  24273. // <p>Shared top, same parents.<br>
  24274. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  24275. //
  24276. // <p>Shared top, different parents.<br>
  24277. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  24278. //
  24279. // <p>Shared top, all shared parents.<br>
  24280. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  24281. // type="image/svg+xml"/></p>
  24282. //
  24283. // <p>Equal tops, merge parents and reduce top to
  24284. // {@link SingletonPredictionContext}.<br>
  24285. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  24286. // /
  24287. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  24288. if (mergeCache !== null) {
  24289. var previous = mergeCache.get(a, b);
  24290. if (previous !== null) {
  24291. return previous;
  24292. }
  24293. previous = mergeCache.get(b, a);
  24294. if (previous !== null) {
  24295. return previous;
  24296. }
  24297. }
  24298. // merge sorted payloads a + b => M
  24299. var i = 0; // walks a
  24300. var j = 0; // walks b
  24301. var k = 0; // walks target M array
  24302. var mergedReturnStates = [];
  24303. var mergedParents = [];
  24304. // walk and merge to yield mergedParents, mergedReturnStates
  24305. while (i < a.returnStates.length && j < b.returnStates.length) {
  24306. var a_parent = a.parents[i];
  24307. var b_parent = b.parents[j];
  24308. if (a.returnStates[i] === b.returnStates[j]) {
  24309. // same payload (stack tops are equal), must yield merged singleton
  24310. var payload = a.returnStates[i];
  24311. // $+$ = $
  24312. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE && a_parent === null && b_parent === null;
  24313. var ax_ax = a_parent !== null && b_parent !== null && a_parent === b_parent; // ax+ax
  24314. // ->
  24315. // ax
  24316. if (bothDollars || ax_ax) {
  24317. mergedParents[k] = a_parent; // choose left
  24318. mergedReturnStates[k] = payload;
  24319. } else {
  24320. // ax+ay -> a'[x,y]
  24321. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  24322. mergedParents[k] = mergedParent;
  24323. mergedReturnStates[k] = payload;
  24324. }
  24325. i += 1; // hop over left one as usual
  24326. j += 1; // but also skip one in right side since we merge
  24327. } else if (a.returnStates[i] < b.returnStates[j]) {
  24328. // copy a[i] to M
  24329. mergedParents[k] = a_parent;
  24330. mergedReturnStates[k] = a.returnStates[i];
  24331. i += 1;
  24332. } else {
  24333. // b > a, copy b[j] to M
  24334. mergedParents[k] = b_parent;
  24335. mergedReturnStates[k] = b.returnStates[j];
  24336. j += 1;
  24337. }
  24338. k += 1;
  24339. }
  24340. // copy over any payloads remaining in either array
  24341. if (i < a.returnStates.length) {
  24342. for (var p = i; p < a.returnStates.length; p++) {
  24343. mergedParents[k] = a.parents[p];
  24344. mergedReturnStates[k] = a.returnStates[p];
  24345. k += 1;
  24346. }
  24347. } else {
  24348. for (var p = j; p < b.returnStates.length; p++) {
  24349. mergedParents[k] = b.parents[p];
  24350. mergedReturnStates[k] = b.returnStates[p];
  24351. k += 1;
  24352. }
  24353. }
  24354. // trim merged if we combined a few that had same stack tops
  24355. if (k < mergedParents.length) {
  24356. // write index < last position; trim
  24357. if (k === 1) {
  24358. // for just one merged element, return singleton top
  24359. var a_ = SingletonPredictionContext.create(mergedParents[0], mergedReturnStates[0]);
  24360. if (mergeCache !== null) {
  24361. mergeCache.set(a, b, a_);
  24362. }
  24363. return a_;
  24364. }
  24365. mergedParents = mergedParents.slice(0, k);
  24366. mergedReturnStates = mergedReturnStates.slice(0, k);
  24367. }
  24368. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  24369. // if we created same array as a or b, return that instead
  24370. // TODO: track whether this is possible above during merge sort for speed
  24371. if (M === a) {
  24372. if (mergeCache !== null) {
  24373. mergeCache.set(a, b, a);
  24374. }
  24375. return a;
  24376. }
  24377. if (M === b) {
  24378. if (mergeCache !== null) {
  24379. mergeCache.set(a, b, b);
  24380. }
  24381. return b;
  24382. }
  24383. combineCommonParents(mergedParents);
  24384. if (mergeCache !== null) {
  24385. mergeCache.set(a, b, M);
  24386. }
  24387. return M;
  24388. }
  24389. //
  24390. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  24391. // ones.
  24392. // /
  24393. function combineCommonParents(parents) {
  24394. var uniqueParents = {};
  24395. for (var p = 0; p < parents.length; p++) {
  24396. var parent = parents[p];
  24397. if (!(parent in uniqueParents)) {
  24398. uniqueParents[parent] = parent;
  24399. }
  24400. }
  24401. for (var q = 0; q < parents.length; q++) {
  24402. parents[q] = uniqueParents[parents[q]];
  24403. }
  24404. }
  24405. function getCachedPredictionContext(context, contextCache, visited) {
  24406. if (context.isEmpty()) {
  24407. return context;
  24408. }
  24409. var existing = visited[context] || null;
  24410. if (existing !== null) {
  24411. return existing;
  24412. }
  24413. existing = contextCache.get(context);
  24414. if (existing !== null) {
  24415. visited[context] = existing;
  24416. return existing;
  24417. }
  24418. var changed = false;
  24419. var parents = [];
  24420. for (var i = 0; i < parents.length; i++) {
  24421. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  24422. if (changed || parent !== context.getParent(i)) {
  24423. if (!changed) {
  24424. parents = [];
  24425. for (var j = 0; j < context.length; j++) {
  24426. parents[j] = context.getParent(j);
  24427. }
  24428. changed = true;
  24429. }
  24430. parents[i] = parent;
  24431. }
  24432. }
  24433. if (!changed) {
  24434. contextCache.add(context);
  24435. visited[context] = context;
  24436. return context;
  24437. }
  24438. var updated = null;
  24439. if (parents.length === 0) {
  24440. updated = PredictionContext.EMPTY;
  24441. } else if (parents.length === 1) {
  24442. updated = SingletonPredictionContext.create(parents[0], context.getReturnState(0));
  24443. } else {
  24444. updated = new ArrayPredictionContext(parents, context.returnStates);
  24445. }
  24446. contextCache.add(updated);
  24447. visited[updated] = updated;
  24448. visited[context] = updated;
  24449. return updated;
  24450. }
  24451. // ter's recursive version of Sam's getAllNodes()
  24452. function getAllContextNodes(context, nodes, visited) {
  24453. if (nodes === null) {
  24454. nodes = [];
  24455. return getAllContextNodes(context, nodes, visited);
  24456. } else if (visited === null) {
  24457. visited = {};
  24458. return getAllContextNodes(context, nodes, visited);
  24459. } else {
  24460. if (context === null || visited[context] !== null) {
  24461. return nodes;
  24462. }
  24463. visited[context] = context;
  24464. nodes.push(context);
  24465. for (var i = 0; i < context.length; i++) {
  24466. getAllContextNodes(context.getParent(i), nodes, visited);
  24467. }
  24468. return nodes;
  24469. }
  24470. }
  24471. exports.merge = merge;
  24472. exports.PredictionContext = PredictionContext;
  24473. exports.PredictionContextCache = PredictionContextCache;
  24474. exports.SingletonPredictionContext = SingletonPredictionContext;
  24475. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  24476. exports.getCachedPredictionContext = getCachedPredictionContext;
  24477. /***/ }),
  24478. /***/ "./node_modules/antlr4/Recognizer.js":
  24479. /*!*******************************************!*\
  24480. !*** ./node_modules/antlr4/Recognizer.js ***!
  24481. \*******************************************/
  24482. /*! no static exports found */
  24483. /***/ (function(module, exports, __webpack_require__) {
  24484. "use strict";
  24485. //
  24486. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24487. * Use of this file is governed by the BSD 3-clause license that
  24488. * can be found in the LICENSE.txt file in the project root.
  24489. */
  24490. //
  24491. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  24492. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  24493. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  24494. function Recognizer() {
  24495. this._listeners = [ConsoleErrorListener.INSTANCE];
  24496. this._interp = null;
  24497. this._stateNumber = -1;
  24498. return this;
  24499. }
  24500. Recognizer.tokenTypeMapCache = {};
  24501. Recognizer.ruleIndexMapCache = {};
  24502. Recognizer.prototype.checkVersion = function (toolVersion) {
  24503. var runtimeVersion = "4.7.1";
  24504. if (runtimeVersion !== toolVersion) {
  24505. console.log("ANTLR runtime and generated code versions disagree: " + runtimeVersion + "!=" + toolVersion);
  24506. }
  24507. };
  24508. Recognizer.prototype.addErrorListener = function (listener) {
  24509. this._listeners.push(listener);
  24510. };
  24511. Recognizer.prototype.removeErrorListeners = function () {
  24512. this._listeners = [];
  24513. };
  24514. Recognizer.prototype.getTokenTypeMap = function () {
  24515. var tokenNames = this.getTokenNames();
  24516. if (tokenNames === null) {
  24517. throw "The current recognizer does not provide a list of token names.";
  24518. }
  24519. var result = this.tokenTypeMapCache[tokenNames];
  24520. if (result === undefined) {
  24521. result = tokenNames.reduce(function (o, k, i) {
  24522. o[k] = i;
  24523. });
  24524. result.EOF = Token.EOF;
  24525. this.tokenTypeMapCache[tokenNames] = result;
  24526. }
  24527. return result;
  24528. };
  24529. // Get a map from rule names to rule indexes.
  24530. //
  24531. // <p>Used for XPath and tree pattern compilation.</p>
  24532. //
  24533. Recognizer.prototype.getRuleIndexMap = function () {
  24534. var ruleNames = this.ruleNames;
  24535. if (ruleNames === null) {
  24536. throw "The current recognizer does not provide a list of rule names.";
  24537. }
  24538. var result = this.ruleIndexMapCache[ruleNames];
  24539. if (result === undefined) {
  24540. result = ruleNames.reduce(function (o, k, i) {
  24541. o[k] = i;
  24542. });
  24543. this.ruleIndexMapCache[ruleNames] = result;
  24544. }
  24545. return result;
  24546. };
  24547. Recognizer.prototype.getTokenType = function (tokenName) {
  24548. var ttype = this.getTokenTypeMap()[tokenName];
  24549. if (ttype !== undefined) {
  24550. return ttype;
  24551. } else {
  24552. return Token.INVALID_TYPE;
  24553. }
  24554. };
  24555. // What is the error header, normally line/character position information?//
  24556. Recognizer.prototype.getErrorHeader = function (e) {
  24557. var line = e.getOffendingToken().line;
  24558. var column = e.getOffendingToken().column;
  24559. return "line " + line + ":" + column;
  24560. };
  24561. // How should a token be displayed in an error message? The default
  24562. // is to display just the text, but during development you might
  24563. // want to have a lot of information spit out. Override in that case
  24564. // to use t.toString() (which, for CommonToken, dumps everything about
  24565. // the token). This is better than forcing you to override a method in
  24566. // your token objects because you don't have to go modify your lexer
  24567. // so that it creates a new Java type.
  24568. //
  24569. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  24570. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  24571. // feature when necessary. For example, see
  24572. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  24573. //
  24574. Recognizer.prototype.getTokenErrorDisplay = function (t) {
  24575. if (t === null) {
  24576. return "<no token>";
  24577. }
  24578. var s = t.text;
  24579. if (s === null) {
  24580. if (t.type === Token.EOF) {
  24581. s = "<EOF>";
  24582. } else {
  24583. s = "<" + t.type + ">";
  24584. }
  24585. }
  24586. s = s.replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t");
  24587. return "'" + s + "'";
  24588. };
  24589. Recognizer.prototype.getErrorListenerDispatch = function () {
  24590. return new ProxyErrorListener(this._listeners);
  24591. };
  24592. // subclass needs to override these if there are sempreds or actions
  24593. // that the ATN interp needs to execute
  24594. Recognizer.prototype.sempred = function (localctx, ruleIndex, actionIndex) {
  24595. return true;
  24596. };
  24597. Recognizer.prototype.precpred = function (localctx, precedence) {
  24598. return true;
  24599. };
  24600. //Indicate that the recognizer has changed internal state that is
  24601. //consistent with the ATN state passed in. This way we always know
  24602. //where we are in the ATN as the parser goes along. The rule
  24603. //context objects form a stack that lets us see the stack of
  24604. //invoking rules. Combine this and we have complete ATN
  24605. //configuration information.
  24606. Object.defineProperty(Recognizer.prototype, "state", {
  24607. get: function get() {
  24608. return this._stateNumber;
  24609. },
  24610. set: function set(state) {
  24611. this._stateNumber = state;
  24612. }
  24613. });
  24614. exports.Recognizer = Recognizer;
  24615. /***/ }),
  24616. /***/ "./node_modules/antlr4/RuleContext.js":
  24617. /*!********************************************!*\
  24618. !*** ./node_modules/antlr4/RuleContext.js ***!
  24619. \********************************************/
  24620. /*! no static exports found */
  24621. /***/ (function(module, exports, __webpack_require__) {
  24622. "use strict";
  24623. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24624. * Use of this file is governed by the BSD 3-clause license that
  24625. * can be found in the LICENSE.txt file in the project root.
  24626. */
  24627. ///
  24628. // A rule context is a record of a single rule invocation. It knows
  24629. // which context invoked it, if any. If there is no parent context, then
  24630. // naturally the invoking state is not valid. The parent link
  24631. // provides a chain upwards from the current rule invocation to the root
  24632. // of the invocation tree, forming a stack. We actually carry no
  24633. // information about the rule associated with this context (except
  24634. // when parsing). We keep only the state number of the invoking state from
  24635. // the ATN submachine that invoked this. Contrast this with the s
  24636. // pointer inside ParserRuleContext that tracks the current state
  24637. // being "executed" for the current rule.
  24638. //
  24639. // The parent contexts are useful for computing lookahead sets and
  24640. // getting error information.
  24641. //
  24642. // These objects are used during parsing and prediction.
  24643. // For the special case of parsers, we use the subclass
  24644. // ParserRuleContext.
  24645. //
  24646. // @see ParserRuleContext
  24647. ///
  24648. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  24649. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  24650. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  24651. function RuleContext(parent, invokingState) {
  24652. RuleNode.call(this);
  24653. // What context invoked this rule?
  24654. this.parentCtx = parent || null;
  24655. // What state invoked the rule associated with this context?
  24656. // The "return address" is the followState of invokingState
  24657. // If parent is null, this should be -1.
  24658. this.invokingState = invokingState || -1;
  24659. return this;
  24660. }
  24661. RuleContext.prototype = Object.create(RuleNode.prototype);
  24662. RuleContext.prototype.constructor = RuleContext;
  24663. RuleContext.prototype.depth = function () {
  24664. var n = 0;
  24665. var p = this;
  24666. while (p !== null) {
  24667. p = p.parentCtx;
  24668. n += 1;
  24669. }
  24670. return n;
  24671. };
  24672. // A context is empty if there is no invoking state; meaning nobody call
  24673. // current context.
  24674. RuleContext.prototype.isEmpty = function () {
  24675. return this.invokingState === -1;
  24676. };
  24677. // satisfy the ParseTree / SyntaxTree interface
  24678. RuleContext.prototype.getSourceInterval = function () {
  24679. return INVALID_INTERVAL;
  24680. };
  24681. RuleContext.prototype.getRuleContext = function () {
  24682. return this;
  24683. };
  24684. RuleContext.prototype.getPayload = function () {
  24685. return this;
  24686. };
  24687. // Return the combined text of all child nodes. This method only considers
  24688. // tokens which have been added to the parse tree.
  24689. // <p>
  24690. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  24691. // added to the parse trees, they will not appear in the output of this
  24692. // method.
  24693. // /
  24694. RuleContext.prototype.getText = function () {
  24695. if (this.getChildCount() === 0) {
  24696. return "";
  24697. } else {
  24698. return this.children.map(function (child) {
  24699. return child.getText();
  24700. }).join("");
  24701. }
  24702. };
  24703. // For rule associated with this parse tree internal node, return
  24704. // the outer alternative number used to match the input. Default
  24705. // implementation does not compute nor store this alt num. Create
  24706. // a subclass of ParserRuleContext with backing field and set
  24707. // option contextSuperClass.
  24708. // to set it.
  24709. RuleContext.prototype.getAltNumber = function () {
  24710. return INVALID_ALT_NUMBER;
  24711. };
  24712. // Set the outer alternative number for this context node. Default
  24713. // implementation does nothing to avoid backing field overhead for
  24714. // trees that don't need it. Create
  24715. // a subclass of ParserRuleContext with backing field and set
  24716. // option contextSuperClass.
  24717. RuleContext.prototype.setAltNumber = function (altNumber) {};
  24718. RuleContext.prototype.getChild = function (i) {
  24719. return null;
  24720. };
  24721. RuleContext.prototype.getChildCount = function () {
  24722. return 0;
  24723. };
  24724. RuleContext.prototype.accept = function (visitor) {
  24725. return visitor.visitChildren(this);
  24726. };
  24727. //need to manage circular dependencies, so export now
  24728. exports.RuleContext = RuleContext;
  24729. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  24730. // Print out a whole tree, not just a node, in LISP format
  24731. // (root child1 .. childN). Print just a node if this is a leaf.
  24732. //
  24733. RuleContext.prototype.toStringTree = function (ruleNames, recog) {
  24734. return Trees.toStringTree(this, ruleNames, recog);
  24735. };
  24736. RuleContext.prototype.toString = function (ruleNames, stop) {
  24737. ruleNames = ruleNames || null;
  24738. stop = stop || null;
  24739. var p = this;
  24740. var s = "[";
  24741. while (p !== null && p !== stop) {
  24742. if (ruleNames === null) {
  24743. if (!p.isEmpty()) {
  24744. s += p.invokingState;
  24745. }
  24746. } else {
  24747. var ri = p.ruleIndex;
  24748. var ruleName = ri >= 0 && ri < ruleNames.length ? ruleNames[ri] : "" + ri;
  24749. s += ruleName;
  24750. }
  24751. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  24752. s += " ";
  24753. }
  24754. p = p.parentCtx;
  24755. }
  24756. s += "]";
  24757. return s;
  24758. };
  24759. /***/ }),
  24760. /***/ "./node_modules/antlr4/Token.js":
  24761. /*!**************************************!*\
  24762. !*** ./node_modules/antlr4/Token.js ***!
  24763. \**************************************/
  24764. /*! no static exports found */
  24765. /***/ (function(module, exports, __webpack_require__) {
  24766. "use strict";
  24767. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24768. * Use of this file is governed by the BSD 3-clause license that
  24769. * can be found in the LICENSE.txt file in the project root.
  24770. */
  24771. //
  24772. // A token has properties: text, type, line, character position in the line
  24773. // (so we can ignore tabs), token channel, index, and source from which
  24774. // we obtained this token.
  24775. function Token() {
  24776. this.source = null;
  24777. this.type = null; // token type of the token
  24778. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  24779. this.start = null; // optional; return -1 if not implemented.
  24780. this.stop = null; // optional; return -1 if not implemented.
  24781. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  24782. this.line = null; // line=1..n of the 1st character
  24783. this.column = null; // beginning of the line at which it occurs, 0..n-1
  24784. this._text = null; // text of the token.
  24785. return this;
  24786. }
  24787. Token.INVALID_TYPE = 0;
  24788. // During lookahead operations, this "token" signifies we hit rule end ATN state
  24789. // and did not follow it despite needing to.
  24790. Token.EPSILON = -2;
  24791. Token.MIN_USER_TOKEN_TYPE = 1;
  24792. Token.EOF = -1;
  24793. // All tokens go to the parser (unless skip() is called in that rule)
  24794. // on a particular "channel". The parser tunes to a particular channel
  24795. // so that whitespace etc... can go to the parser on a "hidden" channel.
  24796. Token.DEFAULT_CHANNEL = 0;
  24797. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  24798. // by parser.
  24799. Token.HIDDEN_CHANNEL = 1;
  24800. // Explicitly set the text for this token. If {code text} is not
  24801. // {@code null}, then {@link //getText} will return this value rather than
  24802. // extracting the text from the input.
  24803. //
  24804. // @param text The explicit text of the token, or {@code null} if the text
  24805. // should be obtained from the input along with the start and stop indexes
  24806. // of the token.
  24807. Object.defineProperty(Token.prototype, "text", {
  24808. get: function get() {
  24809. return this._text;
  24810. },
  24811. set: function set(text) {
  24812. this._text = text;
  24813. }
  24814. });
  24815. Token.prototype.getTokenSource = function () {
  24816. return this.source[0];
  24817. };
  24818. Token.prototype.getInputStream = function () {
  24819. return this.source[1];
  24820. };
  24821. function CommonToken(source, type, channel, start, stop) {
  24822. Token.call(this);
  24823. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  24824. this.type = type !== undefined ? type : null;
  24825. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  24826. this.start = start !== undefined ? start : -1;
  24827. this.stop = stop !== undefined ? stop : -1;
  24828. this.tokenIndex = -1;
  24829. if (this.source[0] !== null) {
  24830. this.line = source[0].line;
  24831. this.column = source[0].column;
  24832. } else {
  24833. this.column = -1;
  24834. }
  24835. return this;
  24836. }
  24837. CommonToken.prototype = Object.create(Token.prototype);
  24838. CommonToken.prototype.constructor = CommonToken;
  24839. // An empty {@link Pair} which is used as the default value of
  24840. // {@link //source} for tokens that do not have a source.
  24841. CommonToken.EMPTY_SOURCE = [null, null];
  24842. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  24843. //
  24844. // <p>
  24845. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  24846. // constructed token will share a reference to the {@link //text} field and
  24847. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  24848. // be assigned the result of calling {@link //getText}, and {@link //source}
  24849. // will be constructed from the result of {@link Token//getTokenSource} and
  24850. // {@link Token//getInputStream}.</p>
  24851. //
  24852. // @param oldToken The token to copy.
  24853. //
  24854. CommonToken.prototype.clone = function () {
  24855. var t = new CommonToken(this.source, this.type, this.channel, this.start, this.stop);
  24856. t.tokenIndex = this.tokenIndex;
  24857. t.line = this.line;
  24858. t.column = this.column;
  24859. t.text = this.text;
  24860. return t;
  24861. };
  24862. Object.defineProperty(CommonToken.prototype, "text", {
  24863. get: function get() {
  24864. if (this._text !== null) {
  24865. return this._text;
  24866. }
  24867. var input = this.getInputStream();
  24868. if (input === null) {
  24869. return null;
  24870. }
  24871. var n = input.size;
  24872. if (this.start < n && this.stop < n) {
  24873. return input.getText(this.start, this.stop);
  24874. } else {
  24875. return "<EOF>";
  24876. }
  24877. },
  24878. set: function set(text) {
  24879. this._text = text;
  24880. }
  24881. });
  24882. CommonToken.prototype.toString = function () {
  24883. var txt = this.text;
  24884. if (txt !== null) {
  24885. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  24886. } else {
  24887. txt = "<no text>";
  24888. }
  24889. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" + txt + "',<" + this.type + ">" + (this.channel > 0 ? ",channel=" + this.channel : "") + "," + this.line + ":" + this.column + "]";
  24890. };
  24891. exports.Token = Token;
  24892. exports.CommonToken = CommonToken;
  24893. /***/ }),
  24894. /***/ "./node_modules/antlr4/Utils.js":
  24895. /*!**************************************!*\
  24896. !*** ./node_modules/antlr4/Utils.js ***!
  24897. \**************************************/
  24898. /*! no static exports found */
  24899. /***/ (function(module, exports, __webpack_require__) {
  24900. "use strict";
  24901. 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; };
  24902. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24903. * Use of this file is governed by the BSD 3-clause license that
  24904. * can be found in the LICENSE.txt file in the project root.
  24905. */
  24906. function arrayToString(a) {
  24907. return "[" + a.join(", ") + "]";
  24908. }
  24909. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  24910. String.prototype.hashCode = function () {
  24911. var remainder,
  24912. bytes,
  24913. h1,
  24914. h1b,
  24915. c1,
  24916. c1b,
  24917. c2,
  24918. c2b,
  24919. k1,
  24920. i,
  24921. key = this.toString();
  24922. remainder = key.length & 3; // key.length % 4
  24923. bytes = key.length - remainder;
  24924. h1 = String.prototype.seed;
  24925. c1 = 0xcc9e2d51;
  24926. c2 = 0x1b873593;
  24927. i = 0;
  24928. while (i < bytes) {
  24929. k1 = key.charCodeAt(i) & 0xff | (key.charCodeAt(++i) & 0xff) << 8 | (key.charCodeAt(++i) & 0xff) << 16 | (key.charCodeAt(++i) & 0xff) << 24;
  24930. ++i;
  24931. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  24932. k1 = k1 << 15 | k1 >>> 17;
  24933. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  24934. h1 ^= k1;
  24935. h1 = h1 << 13 | h1 >>> 19;
  24936. h1b = (h1 & 0xffff) * 5 + (((h1 >>> 16) * 5 & 0xffff) << 16) & 0xffffffff;
  24937. h1 = (h1b & 0xffff) + 0x6b64 + (((h1b >>> 16) + 0xe654 & 0xffff) << 16);
  24938. }
  24939. k1 = 0;
  24940. switch (remainder) {
  24941. case 3:
  24942. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  24943. case 2:
  24944. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  24945. case 1:
  24946. k1 ^= key.charCodeAt(i) & 0xff;
  24947. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  24948. k1 = k1 << 15 | k1 >>> 17;
  24949. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  24950. h1 ^= k1;
  24951. }
  24952. h1 ^= key.length;
  24953. h1 ^= h1 >>> 16;
  24954. h1 = (h1 & 0xffff) * 0x85ebca6b + (((h1 >>> 16) * 0x85ebca6b & 0xffff) << 16) & 0xffffffff;
  24955. h1 ^= h1 >>> 13;
  24956. h1 = (h1 & 0xffff) * 0xc2b2ae35 + (((h1 >>> 16) * 0xc2b2ae35 & 0xffff) << 16) & 0xffffffff;
  24957. h1 ^= h1 >>> 16;
  24958. return h1 >>> 0;
  24959. };
  24960. function standardEqualsFunction(a, b) {
  24961. return a.equals(b);
  24962. }
  24963. function standardHashCodeFunction(a) {
  24964. return a.hashCode();
  24965. }
  24966. function Set(hashFunction, equalsFunction) {
  24967. this.data = {};
  24968. this.hashFunction = hashFunction || standardHashCodeFunction;
  24969. this.equalsFunction = equalsFunction || standardEqualsFunction;
  24970. return this;
  24971. }
  24972. Object.defineProperty(Set.prototype, "length", {
  24973. get: function get() {
  24974. var l = 0;
  24975. for (var key in this.data) {
  24976. if (key.indexOf("hash_") === 0) {
  24977. l = l + this.data[key].length;
  24978. }
  24979. }
  24980. return l;
  24981. }
  24982. });
  24983. Set.prototype.add = function (value) {
  24984. var hash = this.hashFunction(value);
  24985. var key = "hash_" + hash;
  24986. if (key in this.data) {
  24987. var values = this.data[key];
  24988. for (var i = 0; i < values.length; i++) {
  24989. if (this.equalsFunction(value, values[i])) {
  24990. return values[i];
  24991. }
  24992. }
  24993. values.push(value);
  24994. return value;
  24995. } else {
  24996. this.data[key] = [value];
  24997. return value;
  24998. }
  24999. };
  25000. Set.prototype.contains = function (value) {
  25001. return this.get(value) != null;
  25002. };
  25003. Set.prototype.get = function (value) {
  25004. var hash = this.hashFunction(value);
  25005. var key = "hash_" + hash;
  25006. if (key in this.data) {
  25007. var values = this.data[key];
  25008. for (var i = 0; i < values.length; i++) {
  25009. if (this.equalsFunction(value, values[i])) {
  25010. return values[i];
  25011. }
  25012. }
  25013. }
  25014. return null;
  25015. };
  25016. Set.prototype.values = function () {
  25017. var l = [];
  25018. for (var key in this.data) {
  25019. if (key.indexOf("hash_") === 0) {
  25020. l = l.concat(this.data[key]);
  25021. }
  25022. }
  25023. return l;
  25024. };
  25025. Set.prototype.toString = function () {
  25026. return arrayToString(this.values());
  25027. };
  25028. function BitSet() {
  25029. this.data = [];
  25030. return this;
  25031. }
  25032. BitSet.prototype.add = function (value) {
  25033. this.data[value] = true;
  25034. };
  25035. BitSet.prototype.or = function (set) {
  25036. var bits = this;
  25037. Object.keys(set.data).map(function (alt) {
  25038. bits.add(alt);
  25039. });
  25040. };
  25041. BitSet.prototype.remove = function (value) {
  25042. delete this.data[value];
  25043. };
  25044. BitSet.prototype.contains = function (value) {
  25045. return this.data[value] === true;
  25046. };
  25047. BitSet.prototype.values = function () {
  25048. return Object.keys(this.data);
  25049. };
  25050. BitSet.prototype.minValue = function () {
  25051. return Math.min.apply(null, this.values());
  25052. };
  25053. BitSet.prototype.hashCode = function () {
  25054. var hash = new Hash();
  25055. hash.update(this.values());
  25056. return hash.finish();
  25057. };
  25058. BitSet.prototype.equals = function (other) {
  25059. if (!(other instanceof BitSet)) {
  25060. return false;
  25061. }
  25062. return this.hashCode() === other.hashCode();
  25063. };
  25064. Object.defineProperty(BitSet.prototype, "length", {
  25065. get: function get() {
  25066. return this.values().length;
  25067. }
  25068. });
  25069. BitSet.prototype.toString = function () {
  25070. return "{" + this.values().join(", ") + "}";
  25071. };
  25072. function Map(hashFunction, equalsFunction) {
  25073. this.data = {};
  25074. this.hashFunction = hashFunction || standardHashCodeFunction;
  25075. this.equalsFunction = equalsFunction || standardEqualsFunction;
  25076. return this;
  25077. }
  25078. Object.defineProperty(Map.prototype, "length", {
  25079. get: function get() {
  25080. var l = 0;
  25081. for (var hashKey in this.data) {
  25082. if (hashKey.indexOf("hash_") === 0) {
  25083. l = l + this.data[hashKey].length;
  25084. }
  25085. }
  25086. return l;
  25087. }
  25088. });
  25089. Map.prototype.put = function (key, value) {
  25090. var hashKey = "hash_" + this.hashFunction(key);
  25091. if (hashKey in this.data) {
  25092. var entries = this.data[hashKey];
  25093. for (var i = 0; i < entries.length; i++) {
  25094. var entry = entries[i];
  25095. if (this.equalsFunction(key, entry.key)) {
  25096. var oldValue = entry.value;
  25097. entry.value = value;
  25098. return oldValue;
  25099. }
  25100. }
  25101. entries.push({ key: key, value: value });
  25102. return value;
  25103. } else {
  25104. this.data[hashKey] = [{ key: key, value: value }];
  25105. return value;
  25106. }
  25107. };
  25108. Map.prototype.containsKey = function (key) {
  25109. var hashKey = "hash_" + this.hashFunction(key);
  25110. if (hashKey in this.data) {
  25111. var entries = this.data[hashKey];
  25112. for (var i = 0; i < entries.length; i++) {
  25113. var entry = entries[i];
  25114. if (this.equalsFunction(key, entry.key)) return true;
  25115. }
  25116. }
  25117. return false;
  25118. };
  25119. Map.prototype.get = function (key) {
  25120. var hashKey = "hash_" + this.hashFunction(key);
  25121. if (hashKey in this.data) {
  25122. var entries = this.data[hashKey];
  25123. for (var i = 0; i < entries.length; i++) {
  25124. var entry = entries[i];
  25125. if (this.equalsFunction(key, entry.key)) return entry.value;
  25126. }
  25127. }
  25128. return null;
  25129. };
  25130. Map.prototype.entries = function () {
  25131. var l = [];
  25132. for (var key in this.data) {
  25133. if (key.indexOf("hash_") === 0) {
  25134. l = l.concat(this.data[key]);
  25135. }
  25136. }
  25137. return l;
  25138. };
  25139. Map.prototype.getKeys = function () {
  25140. return this.entries().map(function (e) {
  25141. return e.key;
  25142. });
  25143. };
  25144. Map.prototype.getValues = function () {
  25145. return this.entries().map(function (e) {
  25146. return e.value;
  25147. });
  25148. };
  25149. Map.prototype.toString = function () {
  25150. var ss = this.entries().map(function (entry) {
  25151. return '{' + entry.key + ':' + entry.value + '}';
  25152. });
  25153. return '[' + ss.join(", ") + ']';
  25154. };
  25155. function AltDict() {
  25156. this.data = {};
  25157. return this;
  25158. }
  25159. AltDict.prototype.get = function (key) {
  25160. key = "k-" + key;
  25161. if (key in this.data) {
  25162. return this.data[key];
  25163. } else {
  25164. return null;
  25165. }
  25166. };
  25167. AltDict.prototype.put = function (key, value) {
  25168. key = "k-" + key;
  25169. this.data[key] = value;
  25170. };
  25171. AltDict.prototype.values = function () {
  25172. var data = this.data;
  25173. var keys = Object.keys(this.data);
  25174. return keys.map(function (key) {
  25175. return data[key];
  25176. });
  25177. };
  25178. function DoubleDict() {
  25179. return this;
  25180. }
  25181. function Hash() {
  25182. this.count = 0;
  25183. this.hash = 0;
  25184. return this;
  25185. }
  25186. Hash.prototype.update = function () {
  25187. for (var i = 0; i < arguments.length; i++) {
  25188. var value = arguments[i];
  25189. if (value == null) continue;
  25190. if (Array.isArray(value)) this.update.apply(value);else {
  25191. var k = 0;
  25192. switch (typeof value === "undefined" ? "undefined" : _typeof(value)) {
  25193. case 'undefined':
  25194. case 'function':
  25195. continue;
  25196. case 'number':
  25197. case 'boolean':
  25198. k = value;
  25199. break;
  25200. case 'string':
  25201. k = value.hashCode();
  25202. break;
  25203. default:
  25204. value.updateHashCode(this);
  25205. continue;
  25206. }
  25207. k = k * 0xCC9E2D51;
  25208. k = k << 15 | k >>> 32 - 15;
  25209. k = k * 0x1B873593;
  25210. this.count = this.count + 1;
  25211. var hash = this.hash ^ k;
  25212. hash = hash << 13 | hash >>> 32 - 13;
  25213. hash = hash * 5 + 0xE6546B64;
  25214. this.hash = hash;
  25215. }
  25216. }
  25217. };
  25218. Hash.prototype.finish = function () {
  25219. var hash = this.hash ^ this.count * 4;
  25220. hash = hash ^ hash >>> 16;
  25221. hash = hash * 0x85EBCA6B;
  25222. hash = hash ^ hash >>> 13;
  25223. hash = hash * 0xC2B2AE35;
  25224. hash = hash ^ hash >>> 16;
  25225. return hash;
  25226. };
  25227. function hashStuff() {
  25228. var hash = new Hash();
  25229. hash.update.apply(arguments);
  25230. return hash.finish();
  25231. }
  25232. DoubleDict.prototype.get = function (a, b) {
  25233. var d = this[a] || null;
  25234. return d === null ? null : d[b] || null;
  25235. };
  25236. DoubleDict.prototype.set = function (a, b, o) {
  25237. var d = this[a] || null;
  25238. if (d === null) {
  25239. d = {};
  25240. this[a] = d;
  25241. }
  25242. d[b] = o;
  25243. };
  25244. function escapeWhitespace(s, escapeSpaces) {
  25245. s = s.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
  25246. if (escapeSpaces) {
  25247. s = s.replace(/ /g, "\xB7");
  25248. }
  25249. return s;
  25250. }
  25251. function titleCase(str) {
  25252. return str.replace(/\w\S*/g, function (txt) {
  25253. return txt.charAt(0).toUpperCase() + txt.substr(1);
  25254. });
  25255. };
  25256. function equalArrays(a, b) {
  25257. if (!Array.isArray(a) || !Array.isArray(b)) return false;
  25258. if (a == b) return true;
  25259. if (a.length != b.length) return false;
  25260. for (var i = 0; i < a.length; i++) {
  25261. if (a[i] == b[i]) continue;
  25262. if (!a[i].equals(b[i])) return false;
  25263. }
  25264. return true;
  25265. };
  25266. exports.Hash = Hash;
  25267. exports.Set = Set;
  25268. exports.Map = Map;
  25269. exports.BitSet = BitSet;
  25270. exports.AltDict = AltDict;
  25271. exports.DoubleDict = DoubleDict;
  25272. exports.hashStuff = hashStuff;
  25273. exports.escapeWhitespace = escapeWhitespace;
  25274. exports.arrayToString = arrayToString;
  25275. exports.titleCase = titleCase;
  25276. exports.equalArrays = equalArrays;
  25277. /***/ }),
  25278. /***/ "./node_modules/antlr4/atn/ATN.js":
  25279. /*!****************************************!*\
  25280. !*** ./node_modules/antlr4/atn/ATN.js ***!
  25281. \****************************************/
  25282. /*! no static exports found */
  25283. /***/ (function(module, exports, __webpack_require__) {
  25284. "use strict";
  25285. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25286. * Use of this file is governed by the BSD 3-clause license that
  25287. * can be found in the LICENSE.txt file in the project root.
  25288. */
  25289. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  25290. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  25291. function ATN(grammarType, maxTokenType) {
  25292. // Used for runtime deserialization of ATNs from strings///
  25293. // The type of the ATN.
  25294. this.grammarType = grammarType;
  25295. // The maximum value for any symbol recognized by a transition in the ATN.
  25296. this.maxTokenType = maxTokenType;
  25297. this.states = [];
  25298. // Each subrule/rule is a decision point and we must track them so we
  25299. // can go back later and build DFA predictors for them. This includes
  25300. // all the rules, subrules, optional blocks, ()+, ()* etc...
  25301. this.decisionToState = [];
  25302. // Maps from rule index to starting state number.
  25303. this.ruleToStartState = [];
  25304. // Maps from rule index to stop state number.
  25305. this.ruleToStopState = null;
  25306. this.modeNameToStartState = {};
  25307. // For lexer ATNs, this maps the rule index to the resulting token type.
  25308. // For parser ATNs, this maps the rule index to the generated bypass token
  25309. // type if the
  25310. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  25311. // deserialization option was specified; otherwise, this is {@code null}.
  25312. this.ruleToTokenType = null;
  25313. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  25314. // be referenced by action transitions in the ATN.
  25315. this.lexerActions = null;
  25316. this.modeToStartState = [];
  25317. return this;
  25318. }
  25319. // Compute the set of valid tokens that can occur starting in state {@code s}.
  25320. // If {@code ctx} is null, the set of tokens will not include what can follow
  25321. // the rule surrounding {@code s}. In other words, the set will be
  25322. // restricted to tokens reachable staying within {@code s}'s rule.
  25323. ATN.prototype.nextTokensInContext = function (s, ctx) {
  25324. var anal = new LL1Analyzer(this);
  25325. return anal.LOOK(s, null, ctx);
  25326. };
  25327. // Compute the set of valid tokens that can occur starting in {@code s} and
  25328. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  25329. // rule.
  25330. ATN.prototype.nextTokensNoContext = function (s) {
  25331. if (s.nextTokenWithinRule !== null) {
  25332. return s.nextTokenWithinRule;
  25333. }
  25334. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  25335. s.nextTokenWithinRule.readOnly = true;
  25336. return s.nextTokenWithinRule;
  25337. };
  25338. ATN.prototype.nextTokens = function (s, ctx) {
  25339. if (ctx === undefined) {
  25340. return this.nextTokensNoContext(s);
  25341. } else {
  25342. return this.nextTokensInContext(s, ctx);
  25343. }
  25344. };
  25345. ATN.prototype.addState = function (state) {
  25346. if (state !== null) {
  25347. state.atn = this;
  25348. state.stateNumber = this.states.length;
  25349. }
  25350. this.states.push(state);
  25351. };
  25352. ATN.prototype.removeState = function (state) {
  25353. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  25354. };
  25355. ATN.prototype.defineDecisionState = function (s) {
  25356. this.decisionToState.push(s);
  25357. s.decision = this.decisionToState.length - 1;
  25358. return s.decision;
  25359. };
  25360. ATN.prototype.getDecisionState = function (decision) {
  25361. if (this.decisionToState.length === 0) {
  25362. return null;
  25363. } else {
  25364. return this.decisionToState[decision];
  25365. }
  25366. };
  25367. // Computes the set of input symbols which could follow ATN state number
  25368. // {@code stateNumber} in the specified full {@code context}. This method
  25369. // considers the complete parser context, but does not evaluate semantic
  25370. // predicates (i.e. all predicates encountered during the calculation are
  25371. // assumed true). If a path in the ATN exists from the starting state to the
  25372. // {@link RuleStopState} of the outermost context without matching any
  25373. // symbols, {@link Token//EOF} is added to the returned set.
  25374. //
  25375. // <p>If {@code context} is {@code null}, it is treated as
  25376. // {@link ParserRuleContext//EMPTY}.</p>
  25377. //
  25378. // @param stateNumber the ATN state number
  25379. // @param context the full parse context
  25380. // @return The set of potentially valid input symbols which could follow the
  25381. // specified state in the specified context.
  25382. // @throws IllegalArgumentException if the ATN does not contain a state with
  25383. // number {@code stateNumber}
  25384. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  25385. ATN.prototype.getExpectedTokens = function (stateNumber, ctx) {
  25386. if (stateNumber < 0 || stateNumber >= this.states.length) {
  25387. throw "Invalid state number.";
  25388. }
  25389. var s = this.states[stateNumber];
  25390. var following = this.nextTokens(s);
  25391. if (!following.contains(Token.EPSILON)) {
  25392. return following;
  25393. }
  25394. var expected = new IntervalSet();
  25395. expected.addSet(following);
  25396. expected.removeOne(Token.EPSILON);
  25397. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  25398. var invokingState = this.states[ctx.invokingState];
  25399. var rt = invokingState.transitions[0];
  25400. following = this.nextTokens(rt.followState);
  25401. expected.addSet(following);
  25402. expected.removeOne(Token.EPSILON);
  25403. ctx = ctx.parentCtx;
  25404. }
  25405. if (following.contains(Token.EPSILON)) {
  25406. expected.addOne(Token.EOF);
  25407. }
  25408. return expected;
  25409. };
  25410. ATN.INVALID_ALT_NUMBER = 0;
  25411. exports.ATN = ATN;
  25412. /***/ }),
  25413. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  25414. /*!**********************************************!*\
  25415. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  25416. \**********************************************/
  25417. /*! no static exports found */
  25418. /***/ (function(module, exports, __webpack_require__) {
  25419. "use strict";
  25420. //
  25421. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25422. * Use of this file is governed by the BSD 3-clause license that
  25423. * can be found in the LICENSE.txt file in the project root.
  25424. */
  25425. ///
  25426. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  25427. // The syntactic context is a graph-structured stack node whose
  25428. // path(s) to the root is the rule invocation(s)
  25429. // chain used to arrive at the state. The semantic context is
  25430. // the tree of semantic predicates encountered before reaching
  25431. // an ATN state.
  25432. ///
  25433. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  25434. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  25435. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  25436. function checkParams(params, isCfg) {
  25437. if (params === null) {
  25438. var result = { state: null, alt: null, context: null, semanticContext: null };
  25439. if (isCfg) {
  25440. result.reachesIntoOuterContext = 0;
  25441. }
  25442. return result;
  25443. } else {
  25444. var props = {};
  25445. props.state = params.state || null;
  25446. props.alt = params.alt === undefined ? null : params.alt;
  25447. props.context = params.context || null;
  25448. props.semanticContext = params.semanticContext || null;
  25449. if (isCfg) {
  25450. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  25451. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  25452. }
  25453. return props;
  25454. }
  25455. }
  25456. function ATNConfig(params, config) {
  25457. this.checkContext(params, config);
  25458. params = checkParams(params);
  25459. config = checkParams(config, true);
  25460. // The ATN state associated with this configuration///
  25461. this.state = params.state !== null ? params.state : config.state;
  25462. // What alt (or lexer rule) is predicted by this configuration///
  25463. this.alt = params.alt !== null ? params.alt : config.alt;
  25464. // The stack of invoking states leading to the rule/states associated
  25465. // with this config. We track only those contexts pushed during
  25466. // execution of the ATN simulator.
  25467. this.context = params.context !== null ? params.context : config.context;
  25468. this.semanticContext = params.semanticContext !== null ? params.semanticContext : config.semanticContext !== null ? config.semanticContext : SemanticContext.NONE;
  25469. // We cannot execute predicates dependent upon local context unless
  25470. // we know for sure we are in the correct context. Because there is
  25471. // no way to do this efficiently, we simply cannot evaluate
  25472. // dependent predicates unless we are in the rule that initially
  25473. // invokes the ATN simulator.
  25474. //
  25475. // closure() tracks the depth of how far we dip into the
  25476. // outer context: depth &gt; 0. Note that it may not be totally
  25477. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  25478. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  25479. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  25480. return this;
  25481. }
  25482. ATNConfig.prototype.checkContext = function (params, config) {
  25483. if ((params.context === null || params.context === undefined) && (config === null || config.context === null || config.context === undefined)) {
  25484. this.context = null;
  25485. }
  25486. };
  25487. ATNConfig.prototype.hashCode = function () {
  25488. var hash = new Hash();
  25489. this.updateHashCode(hash);
  25490. return hash.finish();
  25491. };
  25492. ATNConfig.prototype.updateHashCode = function (hash) {
  25493. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  25494. };
  25495. // An ATN configuration is equal to another if both have
  25496. // the same state, they predict the same alternative, and
  25497. // syntactic/semantic contexts are the same.
  25498. ATNConfig.prototype.equals = function (other) {
  25499. if (this === other) {
  25500. return true;
  25501. } else if (!(other instanceof ATNConfig)) {
  25502. return false;
  25503. } else {
  25504. 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;
  25505. }
  25506. };
  25507. ATNConfig.prototype.hashCodeForConfigSet = function () {
  25508. var hash = new Hash();
  25509. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  25510. return hash.finish();
  25511. };
  25512. ATNConfig.prototype.equalsForConfigSet = function (other) {
  25513. if (this === other) {
  25514. return true;
  25515. } else if (!(other instanceof ATNConfig)) {
  25516. return false;
  25517. } else {
  25518. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && this.semanticContext.equals(other.semanticContext);
  25519. }
  25520. };
  25521. ATNConfig.prototype.toString = function () {
  25522. return "(" + this.state + "," + this.alt + (this.context !== null ? ",[" + this.context.toString() + "]" : "") + (this.semanticContext !== SemanticContext.NONE ? "," + this.semanticContext.toString() : "") + (this.reachesIntoOuterContext > 0 ? ",up=" + this.reachesIntoOuterContext : "") + ")";
  25523. };
  25524. function LexerATNConfig(params, config) {
  25525. ATNConfig.call(this, params, config);
  25526. // This is the backing field for {@link //getLexerActionExecutor}.
  25527. var lexerActionExecutor = params.lexerActionExecutor || null;
  25528. this.lexerActionExecutor = lexerActionExecutor || (config !== null ? config.lexerActionExecutor : null);
  25529. this.passedThroughNonGreedyDecision = config !== null ? this.checkNonGreedyDecision(config, this.state) : false;
  25530. return this;
  25531. }
  25532. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  25533. LexerATNConfig.prototype.constructor = LexerATNConfig;
  25534. LexerATNConfig.prototype.updateHashCode = function (hash) {
  25535. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  25536. };
  25537. LexerATNConfig.prototype.equals = function (other) {
  25538. 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);
  25539. };
  25540. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  25541. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  25542. LexerATNConfig.prototype.checkNonGreedyDecision = function (source, target) {
  25543. return source.passedThroughNonGreedyDecision || target instanceof DecisionState && target.nonGreedy;
  25544. };
  25545. exports.ATNConfig = ATNConfig;
  25546. exports.LexerATNConfig = LexerATNConfig;
  25547. /***/ }),
  25548. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  25549. /*!*************************************************!*\
  25550. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  25551. \*************************************************/
  25552. /*! no static exports found */
  25553. /***/ (function(module, exports, __webpack_require__) {
  25554. "use strict";
  25555. //
  25556. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25557. * Use of this file is governed by the BSD 3-clause license that
  25558. * can be found in the LICENSE.txt file in the project root.
  25559. */
  25560. //
  25561. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  25562. // info about the set, with support for combining similar configurations using a
  25563. // graph-structured stack.
  25564. ///
  25565. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  25566. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  25567. var Hash = Utils.Hash;
  25568. var Set = Utils.Set;
  25569. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  25570. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  25571. function hashATNConfig(c) {
  25572. return c.hashCodeForConfigSet();
  25573. }
  25574. function equalATNConfigs(a, b) {
  25575. if (a === b) {
  25576. return true;
  25577. } else if (a === null || b === null) {
  25578. return false;
  25579. } else return a.equalsForConfigSet(b);
  25580. }
  25581. function ATNConfigSet(fullCtx) {
  25582. //
  25583. // The reason that we need this is because we don't want the hash map to use
  25584. // the standard hash code and equals. We need all configurations with the
  25585. // same
  25586. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  25587. // doubles
  25588. // the number of objects associated with ATNConfigs. The other solution is
  25589. // to
  25590. // use a hash table that lets us specify the equals/hashcode operation.
  25591. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  25592. // when we go readonly as this set becomes a DFA state.
  25593. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  25594. // Indicates that this configuration set is part of a full context
  25595. // LL prediction. It will be used to determine how to merge $. With SLL
  25596. // it's a wildcard whereas it is not for LL context merge.
  25597. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  25598. // Indicates that the set of configurations is read-only. Do not
  25599. // allow any code to manipulate the set; DFA states will point at
  25600. // the sets and they must not change. This does not protect the other
  25601. // fields; in particular, conflictingAlts is set after
  25602. // we've made this readonly.
  25603. this.readOnly = false;
  25604. // Track the elements as they are added to the set; supports get(i)///
  25605. this.configs = [];
  25606. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  25607. // together, saves recomputation
  25608. // TODO: can we track conflicts as they are added to save scanning configs
  25609. // later?
  25610. this.uniqueAlt = 0;
  25611. this.conflictingAlts = null;
  25612. // Used in parser and lexer. In lexer, it indicates we hit a pred
  25613. // while computing a closure operation. Don't make a DFA state from this.
  25614. this.hasSemanticContext = false;
  25615. this.dipsIntoOuterContext = false;
  25616. this.cachedHashCode = -1;
  25617. return this;
  25618. }
  25619. // Adding a new config means merging contexts with existing configs for
  25620. // {@code (s, i, pi, _)}, where {@code s} is the
  25621. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  25622. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  25623. // {@code (s,i,pi)} as key.
  25624. //
  25625. // <p>This method updates {@link //dipsIntoOuterContext} and
  25626. // {@link //hasSemanticContext} when necessary.</p>
  25627. // /
  25628. ATNConfigSet.prototype.add = function (config, mergeCache) {
  25629. if (mergeCache === undefined) {
  25630. mergeCache = null;
  25631. }
  25632. if (this.readOnly) {
  25633. throw "This set is readonly";
  25634. }
  25635. if (config.semanticContext !== SemanticContext.NONE) {
  25636. this.hasSemanticContext = true;
  25637. }
  25638. if (config.reachesIntoOuterContext > 0) {
  25639. this.dipsIntoOuterContext = true;
  25640. }
  25641. var existing = this.configLookup.add(config);
  25642. if (existing === config) {
  25643. this.cachedHashCode = -1;
  25644. this.configs.push(config); // track order here
  25645. return true;
  25646. }
  25647. // a previous (s,i,pi,_), merge with it and save result
  25648. var rootIsWildcard = !this.fullCtx;
  25649. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  25650. // no need to check for existing.context, config.context in cache
  25651. // since only way to create new graphs is "call rule" and here. We
  25652. // cache at both places.
  25653. existing.reachesIntoOuterContext = Math.max(existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  25654. // make sure to preserve the precedence filter suppression during the merge
  25655. if (config.precedenceFilterSuppressed) {
  25656. existing.precedenceFilterSuppressed = true;
  25657. }
  25658. existing.context = merged; // replace context; no need to alt mapping
  25659. return true;
  25660. };
  25661. ATNConfigSet.prototype.getStates = function () {
  25662. var states = new Set();
  25663. for (var i = 0; i < this.configs.length; i++) {
  25664. states.add(this.configs[i].state);
  25665. }
  25666. return states;
  25667. };
  25668. ATNConfigSet.prototype.getPredicates = function () {
  25669. var preds = [];
  25670. for (var i = 0; i < this.configs.length; i++) {
  25671. var c = this.configs[i].semanticContext;
  25672. if (c !== SemanticContext.NONE) {
  25673. preds.push(c.semanticContext);
  25674. }
  25675. }
  25676. return preds;
  25677. };
  25678. Object.defineProperty(ATNConfigSet.prototype, "items", {
  25679. get: function get() {
  25680. return this.configs;
  25681. }
  25682. });
  25683. ATNConfigSet.prototype.optimizeConfigs = function (interpreter) {
  25684. if (this.readOnly) {
  25685. throw "This set is readonly";
  25686. }
  25687. if (this.configLookup.length === 0) {
  25688. return;
  25689. }
  25690. for (var i = 0; i < this.configs.length; i++) {
  25691. var config = this.configs[i];
  25692. config.context = interpreter.getCachedContext(config.context);
  25693. }
  25694. };
  25695. ATNConfigSet.prototype.addAll = function (coll) {
  25696. for (var i = 0; i < coll.length; i++) {
  25697. this.add(coll[i]);
  25698. }
  25699. return false;
  25700. };
  25701. ATNConfigSet.prototype.equals = function (other) {
  25702. 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;
  25703. };
  25704. ATNConfigSet.prototype.hashCode = function () {
  25705. var hash = new Hash();
  25706. this.updateHashCode(hash);
  25707. return hash.finish();
  25708. };
  25709. ATNConfigSet.prototype.updateHashCode = function (hash) {
  25710. if (this.readOnly) {
  25711. if (this.cachedHashCode === -1) {
  25712. var hash = new Hash();
  25713. hash.update(this.configs);
  25714. this.cachedHashCode = hash.finish();
  25715. }
  25716. hash.update(this.cachedHashCode);
  25717. } else {
  25718. hash.update(this.configs);
  25719. }
  25720. };
  25721. Object.defineProperty(ATNConfigSet.prototype, "length", {
  25722. get: function get() {
  25723. return this.configs.length;
  25724. }
  25725. });
  25726. ATNConfigSet.prototype.isEmpty = function () {
  25727. return this.configs.length === 0;
  25728. };
  25729. ATNConfigSet.prototype.contains = function (item) {
  25730. if (this.configLookup === null) {
  25731. throw "This method is not implemented for readonly sets.";
  25732. }
  25733. return this.configLookup.contains(item);
  25734. };
  25735. ATNConfigSet.prototype.containsFast = function (item) {
  25736. if (this.configLookup === null) {
  25737. throw "This method is not implemented for readonly sets.";
  25738. }
  25739. return this.configLookup.containsFast(item);
  25740. };
  25741. ATNConfigSet.prototype.clear = function () {
  25742. if (this.readOnly) {
  25743. throw "This set is readonly";
  25744. }
  25745. this.configs = [];
  25746. this.cachedHashCode = -1;
  25747. this.configLookup = new Set();
  25748. };
  25749. ATNConfigSet.prototype.setReadonly = function (readOnly) {
  25750. this.readOnly = readOnly;
  25751. if (readOnly) {
  25752. this.configLookup = null; // can't mod, no need for lookup cache
  25753. }
  25754. };
  25755. ATNConfigSet.prototype.toString = function () {
  25756. 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" : "");
  25757. };
  25758. function OrderedATNConfigSet() {
  25759. ATNConfigSet.call(this);
  25760. this.configLookup = new Set();
  25761. return this;
  25762. }
  25763. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  25764. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  25765. exports.ATNConfigSet = ATNConfigSet;
  25766. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  25767. /***/ }),
  25768. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  25769. /*!**************************************************************!*\
  25770. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  25771. \**************************************************************/
  25772. /*! no static exports found */
  25773. /***/ (function(module, exports, __webpack_require__) {
  25774. "use strict";
  25775. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25776. * Use of this file is governed by the BSD 3-clause license that
  25777. * can be found in the LICENSE.txt file in the project root.
  25778. */
  25779. function ATNDeserializationOptions(copyFrom) {
  25780. if (copyFrom === undefined) {
  25781. copyFrom = null;
  25782. }
  25783. this.readOnly = false;
  25784. this.verifyATN = copyFrom === null ? true : copyFrom.verifyATN;
  25785. this.generateRuleBypassTransitions = copyFrom === null ? false : copyFrom.generateRuleBypassTransitions;
  25786. return this;
  25787. }
  25788. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  25789. ATNDeserializationOptions.defaultOptions.readOnly = true;
  25790. // def __setattr__(self, key, value):
  25791. // if key!="readOnly" and self.readOnly:
  25792. // raise Exception("The object is read only.")
  25793. // super(type(self), self).__setattr__(key,value)
  25794. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  25795. /***/ }),
  25796. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  25797. /*!****************************************************!*\
  25798. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  25799. \****************************************************/
  25800. /*! no static exports found */
  25801. /***/ (function(module, exports, __webpack_require__) {
  25802. "use strict";
  25803. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25804. * Use of this file is governed by the BSD 3-clause license that
  25805. * can be found in the LICENSE.txt file in the project root.
  25806. */
  25807. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  25808. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  25809. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  25810. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  25811. var ATNState = ATNStates.ATNState;
  25812. var BasicState = ATNStates.BasicState;
  25813. var DecisionState = ATNStates.DecisionState;
  25814. var BlockStartState = ATNStates.BlockStartState;
  25815. var BlockEndState = ATNStates.BlockEndState;
  25816. var LoopEndState = ATNStates.LoopEndState;
  25817. var RuleStartState = ATNStates.RuleStartState;
  25818. var RuleStopState = ATNStates.RuleStopState;
  25819. var TokensStartState = ATNStates.TokensStartState;
  25820. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  25821. var StarLoopbackState = ATNStates.StarLoopbackState;
  25822. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  25823. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  25824. var StarBlockStartState = ATNStates.StarBlockStartState;
  25825. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  25826. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  25827. var Transition = Transitions.Transition;
  25828. var AtomTransition = Transitions.AtomTransition;
  25829. var SetTransition = Transitions.SetTransition;
  25830. var NotSetTransition = Transitions.NotSetTransition;
  25831. var RuleTransition = Transitions.RuleTransition;
  25832. var RangeTransition = Transitions.RangeTransition;
  25833. var ActionTransition = Transitions.ActionTransition;
  25834. var EpsilonTransition = Transitions.EpsilonTransition;
  25835. var WildcardTransition = Transitions.WildcardTransition;
  25836. var PredicateTransition = Transitions.PredicateTransition;
  25837. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  25838. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  25839. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  25840. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  25841. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  25842. var LexerActionType = LexerActions.LexerActionType;
  25843. var LexerSkipAction = LexerActions.LexerSkipAction;
  25844. var LexerChannelAction = LexerActions.LexerChannelAction;
  25845. var LexerCustomAction = LexerActions.LexerCustomAction;
  25846. var LexerMoreAction = LexerActions.LexerMoreAction;
  25847. var LexerTypeAction = LexerActions.LexerTypeAction;
  25848. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  25849. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  25850. var LexerModeAction = LexerActions.LexerModeAction;
  25851. // This is the earliest supported serialized UUID.
  25852. // stick to serialized version for now, we don't need a UUID instance
  25853. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  25854. //
  25855. // This UUID indicates the serialized ATN contains two sets of
  25856. // IntervalSets, where the second set's values are encoded as
  25857. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  25858. //
  25859. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  25860. // This list contains all of the currently supported UUIDs, ordered by when
  25861. // the feature first appeared in this branch.
  25862. var SUPPORTED_UUIDS = [BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP];
  25863. var SERIALIZED_VERSION = 3;
  25864. // This is the current serialized UUID.
  25865. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  25866. function initArray(length, value) {
  25867. var tmp = [];
  25868. tmp[length - 1] = value;
  25869. return tmp.map(function (i) {
  25870. return value;
  25871. });
  25872. }
  25873. function ATNDeserializer(options) {
  25874. if (options === undefined || options === null) {
  25875. options = ATNDeserializationOptions.defaultOptions;
  25876. }
  25877. this.deserializationOptions = options;
  25878. this.stateFactories = null;
  25879. this.actionFactories = null;
  25880. return this;
  25881. }
  25882. // Determines if a particular serialized representation of an ATN supports
  25883. // a particular feature, identified by the {@link UUID} used for serializing
  25884. // the ATN at the time the feature was first introduced.
  25885. //
  25886. // @param feature The {@link UUID} marking the first time the feature was
  25887. // supported in the serialized ATN.
  25888. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  25889. // currently being deserialized.
  25890. // @return {@code true} if the {@code actualUuid} value represents a
  25891. // serialized ATN at or after the feature identified by {@code feature} was
  25892. // introduced; otherwise, {@code false}.
  25893. ATNDeserializer.prototype.isFeatureSupported = function (feature, actualUuid) {
  25894. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  25895. if (idx1 < 0) {
  25896. return false;
  25897. }
  25898. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  25899. return idx2 >= idx1;
  25900. };
  25901. ATNDeserializer.prototype.deserialize = function (data) {
  25902. this.reset(data);
  25903. this.checkVersion();
  25904. this.checkUUID();
  25905. var atn = this.readATN();
  25906. this.readStates(atn);
  25907. this.readRules(atn);
  25908. this.readModes(atn);
  25909. var sets = [];
  25910. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  25911. this.readSets(atn, sets, this.readInt.bind(this));
  25912. // Next, if the ATN was serialized with the Unicode SMP feature,
  25913. // deserialize sets with 32-bit arguments <= U+10FFFF.
  25914. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  25915. this.readSets(atn, sets, this.readInt32.bind(this));
  25916. }
  25917. this.readEdges(atn, sets);
  25918. this.readDecisions(atn);
  25919. this.readLexerActions(atn);
  25920. this.markPrecedenceDecisions(atn);
  25921. this.verifyATN(atn);
  25922. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER) {
  25923. this.generateRuleBypassTransitions(atn);
  25924. // re-verify after modification
  25925. this.verifyATN(atn);
  25926. }
  25927. return atn;
  25928. };
  25929. ATNDeserializer.prototype.reset = function (data) {
  25930. var adjust = function adjust(c) {
  25931. var v = c.charCodeAt(0);
  25932. return v > 1 ? v - 2 : v + 65533;
  25933. };
  25934. var temp = data.split("").map(adjust);
  25935. // don't adjust the first value since that's the version number
  25936. temp[0] = data.charCodeAt(0);
  25937. this.data = temp;
  25938. this.pos = 0;
  25939. };
  25940. ATNDeserializer.prototype.checkVersion = function () {
  25941. var version = this.readInt();
  25942. if (version !== SERIALIZED_VERSION) {
  25943. throw "Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").";
  25944. }
  25945. };
  25946. ATNDeserializer.prototype.checkUUID = function () {
  25947. var uuid = this.readUUID();
  25948. if (SUPPORTED_UUIDS.indexOf(uuid) < 0) {
  25949. throw "Could not deserialize ATN with UUID: " + uuid + " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID;
  25950. }
  25951. this.uuid = uuid;
  25952. };
  25953. ATNDeserializer.prototype.readATN = function () {
  25954. var grammarType = this.readInt();
  25955. var maxTokenType = this.readInt();
  25956. return new ATN(grammarType, maxTokenType);
  25957. };
  25958. ATNDeserializer.prototype.readStates = function (atn) {
  25959. var j, pair, stateNumber;
  25960. var loopBackStateNumbers = [];
  25961. var endStateNumbers = [];
  25962. var nstates = this.readInt();
  25963. for (var i = 0; i < nstates; i++) {
  25964. var stype = this.readInt();
  25965. // ignore bad type of states
  25966. if (stype === ATNState.INVALID_TYPE) {
  25967. atn.addState(null);
  25968. continue;
  25969. }
  25970. var ruleIndex = this.readInt();
  25971. if (ruleIndex === 0xFFFF) {
  25972. ruleIndex = -1;
  25973. }
  25974. var s = this.stateFactory(stype, ruleIndex);
  25975. if (stype === ATNState.LOOP_END) {
  25976. // special case
  25977. var loopBackStateNumber = this.readInt();
  25978. loopBackStateNumbers.push([s, loopBackStateNumber]);
  25979. } else if (s instanceof BlockStartState) {
  25980. var endStateNumber = this.readInt();
  25981. endStateNumbers.push([s, endStateNumber]);
  25982. }
  25983. atn.addState(s);
  25984. }
  25985. // delay the assignment of loop back and end states until we know all the
  25986. // state instances have been initialized
  25987. for (j = 0; j < loopBackStateNumbers.length; j++) {
  25988. pair = loopBackStateNumbers[j];
  25989. pair[0].loopBackState = atn.states[pair[1]];
  25990. }
  25991. for (j = 0; j < endStateNumbers.length; j++) {
  25992. pair = endStateNumbers[j];
  25993. pair[0].endState = atn.states[pair[1]];
  25994. }
  25995. var numNonGreedyStates = this.readInt();
  25996. for (j = 0; j < numNonGreedyStates; j++) {
  25997. stateNumber = this.readInt();
  25998. atn.states[stateNumber].nonGreedy = true;
  25999. }
  26000. var numPrecedenceStates = this.readInt();
  26001. for (j = 0; j < numPrecedenceStates; j++) {
  26002. stateNumber = this.readInt();
  26003. atn.states[stateNumber].isPrecedenceRule = true;
  26004. }
  26005. };
  26006. ATNDeserializer.prototype.readRules = function (atn) {
  26007. var i;
  26008. var nrules = this.readInt();
  26009. if (atn.grammarType === ATNType.LEXER) {
  26010. atn.ruleToTokenType = initArray(nrules, 0);
  26011. }
  26012. atn.ruleToStartState = initArray(nrules, 0);
  26013. for (i = 0; i < nrules; i++) {
  26014. var s = this.readInt();
  26015. var startState = atn.states[s];
  26016. atn.ruleToStartState[i] = startState;
  26017. if (atn.grammarType === ATNType.LEXER) {
  26018. var tokenType = this.readInt();
  26019. if (tokenType === 0xFFFF) {
  26020. tokenType = Token.EOF;
  26021. }
  26022. atn.ruleToTokenType[i] = tokenType;
  26023. }
  26024. }
  26025. atn.ruleToStopState = initArray(nrules, 0);
  26026. for (i = 0; i < atn.states.length; i++) {
  26027. var state = atn.states[i];
  26028. if (!(state instanceof RuleStopState)) {
  26029. continue;
  26030. }
  26031. atn.ruleToStopState[state.ruleIndex] = state;
  26032. atn.ruleToStartState[state.ruleIndex].stopState = state;
  26033. }
  26034. };
  26035. ATNDeserializer.prototype.readModes = function (atn) {
  26036. var nmodes = this.readInt();
  26037. for (var i = 0; i < nmodes; i++) {
  26038. var s = this.readInt();
  26039. atn.modeToStartState.push(atn.states[s]);
  26040. }
  26041. };
  26042. ATNDeserializer.prototype.readSets = function (atn, sets, readUnicode) {
  26043. var m = this.readInt();
  26044. for (var i = 0; i < m; i++) {
  26045. var iset = new IntervalSet();
  26046. sets.push(iset);
  26047. var n = this.readInt();
  26048. var containsEof = this.readInt();
  26049. if (containsEof !== 0) {
  26050. iset.addOne(-1);
  26051. }
  26052. for (var j = 0; j < n; j++) {
  26053. var i1 = readUnicode();
  26054. var i2 = readUnicode();
  26055. iset.addRange(i1, i2);
  26056. }
  26057. }
  26058. };
  26059. ATNDeserializer.prototype.readEdges = function (atn, sets) {
  26060. var i, j, state, trans, target;
  26061. var nedges = this.readInt();
  26062. for (i = 0; i < nedges; i++) {
  26063. var src = this.readInt();
  26064. var trg = this.readInt();
  26065. var ttype = this.readInt();
  26066. var arg1 = this.readInt();
  26067. var arg2 = this.readInt();
  26068. var arg3 = this.readInt();
  26069. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  26070. var srcState = atn.states[src];
  26071. srcState.addTransition(trans);
  26072. }
  26073. // edges for rule stop states can be derived, so they aren't serialized
  26074. for (i = 0; i < atn.states.length; i++) {
  26075. state = atn.states[i];
  26076. for (j = 0; j < state.transitions.length; j++) {
  26077. var t = state.transitions[j];
  26078. if (!(t instanceof RuleTransition)) {
  26079. continue;
  26080. }
  26081. var outermostPrecedenceReturn = -1;
  26082. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  26083. if (t.precedence === 0) {
  26084. outermostPrecedenceReturn = t.target.ruleIndex;
  26085. }
  26086. }
  26087. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  26088. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  26089. }
  26090. }
  26091. for (i = 0; i < atn.states.length; i++) {
  26092. state = atn.states[i];
  26093. if (state instanceof BlockStartState) {
  26094. // we need to know the end state to set its start state
  26095. if (state.endState === null) {
  26096. throw "IllegalState";
  26097. }
  26098. // block end states can only be associated to a single block start
  26099. // state
  26100. if (state.endState.startState !== null) {
  26101. throw "IllegalState";
  26102. }
  26103. state.endState.startState = state;
  26104. }
  26105. if (state instanceof PlusLoopbackState) {
  26106. for (j = 0; j < state.transitions.length; j++) {
  26107. target = state.transitions[j].target;
  26108. if (target instanceof PlusBlockStartState) {
  26109. target.loopBackState = state;
  26110. }
  26111. }
  26112. } else if (state instanceof StarLoopbackState) {
  26113. for (j = 0; j < state.transitions.length; j++) {
  26114. target = state.transitions[j].target;
  26115. if (target instanceof StarLoopEntryState) {
  26116. target.loopBackState = state;
  26117. }
  26118. }
  26119. }
  26120. }
  26121. };
  26122. ATNDeserializer.prototype.readDecisions = function (atn) {
  26123. var ndecisions = this.readInt();
  26124. for (var i = 0; i < ndecisions; i++) {
  26125. var s = this.readInt();
  26126. var decState = atn.states[s];
  26127. atn.decisionToState.push(decState);
  26128. decState.decision = i;
  26129. }
  26130. };
  26131. ATNDeserializer.prototype.readLexerActions = function (atn) {
  26132. if (atn.grammarType === ATNType.LEXER) {
  26133. var count = this.readInt();
  26134. atn.lexerActions = initArray(count, null);
  26135. for (var i = 0; i < count; i++) {
  26136. var actionType = this.readInt();
  26137. var data1 = this.readInt();
  26138. if (data1 === 0xFFFF) {
  26139. data1 = -1;
  26140. }
  26141. var data2 = this.readInt();
  26142. if (data2 === 0xFFFF) {
  26143. data2 = -1;
  26144. }
  26145. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  26146. atn.lexerActions[i] = lexerAction;
  26147. }
  26148. }
  26149. };
  26150. ATNDeserializer.prototype.generateRuleBypassTransitions = function (atn) {
  26151. var i;
  26152. var count = atn.ruleToStartState.length;
  26153. for (i = 0; i < count; i++) {
  26154. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  26155. }
  26156. for (i = 0; i < count; i++) {
  26157. this.generateRuleBypassTransition(atn, i);
  26158. }
  26159. };
  26160. ATNDeserializer.prototype.generateRuleBypassTransition = function (atn, idx) {
  26161. var i, state;
  26162. var bypassStart = new BasicBlockStartState();
  26163. bypassStart.ruleIndex = idx;
  26164. atn.addState(bypassStart);
  26165. var bypassStop = new BlockEndState();
  26166. bypassStop.ruleIndex = idx;
  26167. atn.addState(bypassStop);
  26168. bypassStart.endState = bypassStop;
  26169. atn.defineDecisionState(bypassStart);
  26170. bypassStop.startState = bypassStart;
  26171. var excludeTransition = null;
  26172. var endState = null;
  26173. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  26174. // wrap from the beginning of the rule to the StarLoopEntryState
  26175. endState = null;
  26176. for (i = 0; i < atn.states.length; i++) {
  26177. state = atn.states[i];
  26178. if (this.stateIsEndStateFor(state, idx)) {
  26179. endState = state;
  26180. excludeTransition = state.loopBackState.transitions[0];
  26181. break;
  26182. }
  26183. }
  26184. if (excludeTransition === null) {
  26185. throw "Couldn't identify final state of the precedence rule prefix section.";
  26186. }
  26187. } else {
  26188. endState = atn.ruleToStopState[idx];
  26189. }
  26190. // all non-excluded transitions that currently target end state need to
  26191. // target blockEnd instead
  26192. for (i = 0; i < atn.states.length; i++) {
  26193. state = atn.states[i];
  26194. for (var j = 0; j < state.transitions.length; j++) {
  26195. var transition = state.transitions[j];
  26196. if (transition === excludeTransition) {
  26197. continue;
  26198. }
  26199. if (transition.target === endState) {
  26200. transition.target = bypassStop;
  26201. }
  26202. }
  26203. }
  26204. // all transitions leaving the rule start state need to leave blockStart
  26205. // instead
  26206. var ruleToStartState = atn.ruleToStartState[idx];
  26207. var count = ruleToStartState.transitions.length;
  26208. while (count > 0) {
  26209. bypassStart.addTransition(ruleToStartState.transitions[count - 1]);
  26210. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  26211. }
  26212. // link the new states
  26213. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  26214. bypassStop.addTransition(new EpsilonTransition(endState));
  26215. var matchState = new BasicState();
  26216. atn.addState(matchState);
  26217. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  26218. bypassStart.addTransition(new EpsilonTransition(matchState));
  26219. };
  26220. ATNDeserializer.prototype.stateIsEndStateFor = function (state, idx) {
  26221. if (state.ruleIndex !== idx) {
  26222. return null;
  26223. }
  26224. if (!(state instanceof StarLoopEntryState)) {
  26225. return null;
  26226. }
  26227. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26228. if (!(maybeLoopEndState instanceof LoopEndState)) {
  26229. return null;
  26230. }
  26231. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26232. return state;
  26233. } else {
  26234. return null;
  26235. }
  26236. };
  26237. //
  26238. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  26239. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  26240. // correct value.
  26241. //
  26242. // @param atn The ATN.
  26243. //
  26244. ATNDeserializer.prototype.markPrecedenceDecisions = function (atn) {
  26245. for (var i = 0; i < atn.states.length; i++) {
  26246. var state = atn.states[i];
  26247. if (!(state instanceof StarLoopEntryState)) {
  26248. continue;
  26249. }
  26250. // We analyze the ATN to determine if this ATN decision state is the
  26251. // decision for the closure block that determines whether a
  26252. // precedence rule should continue or complete.
  26253. //
  26254. if (atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  26255. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26256. if (maybeLoopEndState instanceof LoopEndState) {
  26257. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26258. state.isPrecedenceDecision = true;
  26259. }
  26260. }
  26261. }
  26262. }
  26263. };
  26264. ATNDeserializer.prototype.verifyATN = function (atn) {
  26265. if (!this.deserializationOptions.verifyATN) {
  26266. return;
  26267. }
  26268. // verify assumptions
  26269. for (var i = 0; i < atn.states.length; i++) {
  26270. var state = atn.states[i];
  26271. if (state === null) {
  26272. continue;
  26273. }
  26274. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  26275. if (state instanceof PlusBlockStartState) {
  26276. this.checkCondition(state.loopBackState !== null);
  26277. } else if (state instanceof StarLoopEntryState) {
  26278. this.checkCondition(state.loopBackState !== null);
  26279. this.checkCondition(state.transitions.length === 2);
  26280. if (state.transitions[0].target instanceof StarBlockStartState) {
  26281. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  26282. this.checkCondition(!state.nonGreedy);
  26283. } else if (state.transitions[0].target instanceof LoopEndState) {
  26284. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  26285. this.checkCondition(state.nonGreedy);
  26286. } else {
  26287. throw "IllegalState";
  26288. }
  26289. } else if (state instanceof StarLoopbackState) {
  26290. this.checkCondition(state.transitions.length === 1);
  26291. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  26292. } else if (state instanceof LoopEndState) {
  26293. this.checkCondition(state.loopBackState !== null);
  26294. } else if (state instanceof RuleStartState) {
  26295. this.checkCondition(state.stopState !== null);
  26296. } else if (state instanceof BlockStartState) {
  26297. this.checkCondition(state.endState !== null);
  26298. } else if (state instanceof BlockEndState) {
  26299. this.checkCondition(state.startState !== null);
  26300. } else if (state instanceof DecisionState) {
  26301. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  26302. } else {
  26303. this.checkCondition(state.transitions.length <= 1 || state instanceof RuleStopState);
  26304. }
  26305. }
  26306. };
  26307. ATNDeserializer.prototype.checkCondition = function (condition, message) {
  26308. if (!condition) {
  26309. if (message === undefined || message === null) {
  26310. message = "IllegalState";
  26311. }
  26312. throw message;
  26313. }
  26314. };
  26315. ATNDeserializer.prototype.readInt = function () {
  26316. return this.data[this.pos++];
  26317. };
  26318. ATNDeserializer.prototype.readInt32 = function () {
  26319. var low = this.readInt();
  26320. var high = this.readInt();
  26321. return low | high << 16;
  26322. };
  26323. ATNDeserializer.prototype.readLong = function () {
  26324. var low = this.readInt32();
  26325. var high = this.readInt32();
  26326. return low & 0x00000000FFFFFFFF | high << 32;
  26327. };
  26328. function createByteToHex() {
  26329. var bth = [];
  26330. for (var i = 0; i < 256; i++) {
  26331. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  26332. }
  26333. return bth;
  26334. }
  26335. var byteToHex = createByteToHex();
  26336. ATNDeserializer.prototype.readUUID = function () {
  26337. var bb = [];
  26338. for (var i = 7; i >= 0; i--) {
  26339. var int = this.readInt();
  26340. /* jshint bitwise: false */
  26341. bb[2 * i + 1] = int & 0xFF;
  26342. bb[2 * i] = int >> 8 & 0xFF;
  26343. }
  26344. 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]];
  26345. };
  26346. ATNDeserializer.prototype.edgeFactory = function (atn, type, src, trg, arg1, arg2, arg3, sets) {
  26347. var target = atn.states[trg];
  26348. switch (type) {
  26349. case Transition.EPSILON:
  26350. return new EpsilonTransition(target);
  26351. case Transition.RANGE:
  26352. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  26353. case Transition.RULE:
  26354. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  26355. case Transition.PREDICATE:
  26356. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  26357. case Transition.PRECEDENCE:
  26358. return new PrecedencePredicateTransition(target, arg1);
  26359. case Transition.ATOM:
  26360. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  26361. case Transition.ACTION:
  26362. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  26363. case Transition.SET:
  26364. return new SetTransition(target, sets[arg1]);
  26365. case Transition.NOT_SET:
  26366. return new NotSetTransition(target, sets[arg1]);
  26367. case Transition.WILDCARD:
  26368. return new WildcardTransition(target);
  26369. default:
  26370. throw "The specified transition type: " + type + " is not valid.";
  26371. }
  26372. };
  26373. ATNDeserializer.prototype.stateFactory = function (type, ruleIndex) {
  26374. if (this.stateFactories === null) {
  26375. var sf = [];
  26376. sf[ATNState.INVALID_TYPE] = null;
  26377. sf[ATNState.BASIC] = function () {
  26378. return new BasicState();
  26379. };
  26380. sf[ATNState.RULE_START] = function () {
  26381. return new RuleStartState();
  26382. };
  26383. sf[ATNState.BLOCK_START] = function () {
  26384. return new BasicBlockStartState();
  26385. };
  26386. sf[ATNState.PLUS_BLOCK_START] = function () {
  26387. return new PlusBlockStartState();
  26388. };
  26389. sf[ATNState.STAR_BLOCK_START] = function () {
  26390. return new StarBlockStartState();
  26391. };
  26392. sf[ATNState.TOKEN_START] = function () {
  26393. return new TokensStartState();
  26394. };
  26395. sf[ATNState.RULE_STOP] = function () {
  26396. return new RuleStopState();
  26397. };
  26398. sf[ATNState.BLOCK_END] = function () {
  26399. return new BlockEndState();
  26400. };
  26401. sf[ATNState.STAR_LOOP_BACK] = function () {
  26402. return new StarLoopbackState();
  26403. };
  26404. sf[ATNState.STAR_LOOP_ENTRY] = function () {
  26405. return new StarLoopEntryState();
  26406. };
  26407. sf[ATNState.PLUS_LOOP_BACK] = function () {
  26408. return new PlusLoopbackState();
  26409. };
  26410. sf[ATNState.LOOP_END] = function () {
  26411. return new LoopEndState();
  26412. };
  26413. this.stateFactories = sf;
  26414. }
  26415. if (type > this.stateFactories.length || this.stateFactories[type] === null) {
  26416. throw "The specified state type " + type + " is not valid.";
  26417. } else {
  26418. var s = this.stateFactories[type]();
  26419. if (s !== null) {
  26420. s.ruleIndex = ruleIndex;
  26421. return s;
  26422. }
  26423. }
  26424. };
  26425. ATNDeserializer.prototype.lexerActionFactory = function (type, data1, data2) {
  26426. if (this.actionFactories === null) {
  26427. var af = [];
  26428. af[LexerActionType.CHANNEL] = function (data1, data2) {
  26429. return new LexerChannelAction(data1);
  26430. };
  26431. af[LexerActionType.CUSTOM] = function (data1, data2) {
  26432. return new LexerCustomAction(data1, data2);
  26433. };
  26434. af[LexerActionType.MODE] = function (data1, data2) {
  26435. return new LexerModeAction(data1);
  26436. };
  26437. af[LexerActionType.MORE] = function (data1, data2) {
  26438. return LexerMoreAction.INSTANCE;
  26439. };
  26440. af[LexerActionType.POP_MODE] = function (data1, data2) {
  26441. return LexerPopModeAction.INSTANCE;
  26442. };
  26443. af[LexerActionType.PUSH_MODE] = function (data1, data2) {
  26444. return new LexerPushModeAction(data1);
  26445. };
  26446. af[LexerActionType.SKIP] = function (data1, data2) {
  26447. return LexerSkipAction.INSTANCE;
  26448. };
  26449. af[LexerActionType.TYPE] = function (data1, data2) {
  26450. return new LexerTypeAction(data1);
  26451. };
  26452. this.actionFactories = af;
  26453. }
  26454. if (type > this.actionFactories.length || this.actionFactories[type] === null) {
  26455. throw "The specified lexer action type " + type + " is not valid.";
  26456. } else {
  26457. return this.actionFactories[type](data1, data2);
  26458. }
  26459. };
  26460. exports.ATNDeserializer = ATNDeserializer;
  26461. /***/ }),
  26462. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  26463. /*!*************************************************!*\
  26464. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  26465. \*************************************************/
  26466. /*! no static exports found */
  26467. /***/ (function(module, exports, __webpack_require__) {
  26468. "use strict";
  26469. //
  26470. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26471. * Use of this file is governed by the BSD 3-clause license that
  26472. * can be found in the LICENSE.txt file in the project root.
  26473. */
  26474. ///
  26475. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  26476. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  26477. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  26478. function ATNSimulator(atn, sharedContextCache) {
  26479. // The context cache maps all PredictionContext objects that are ==
  26480. // to a single cached copy. This cache is shared across all contexts
  26481. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  26482. // to use only cached nodes/graphs in addDFAState(). We don't want to
  26483. // fill this during closure() since there are lots of contexts that
  26484. // pop up but are not used ever again. It also greatly slows down closure().
  26485. //
  26486. // <p>This cache makes a huge difference in memory and a little bit in speed.
  26487. // For the Java grammar on java.*, it dropped the memory requirements
  26488. // at the end from 25M to 16M. We don't store any of the full context
  26489. // graphs in the DFA because they are limited to local context only,
  26490. // but apparently there's a lot of repetition there as well. We optimize
  26491. // the config contexts before storing the config set in the DFA states
  26492. // by literally rebuilding them with cached subgraphs only.</p>
  26493. //
  26494. // <p>I tried a cache for use during closure operations, that was
  26495. // whacked after each adaptivePredict(). It cost a little bit
  26496. // more time I think and doesn't save on the overall footprint
  26497. // so it's not worth the complexity.</p>
  26498. ///
  26499. this.atn = atn;
  26500. this.sharedContextCache = sharedContextCache;
  26501. return this;
  26502. }
  26503. // Must distinguish between missing edge and edge we know leads nowhere///
  26504. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  26505. ATNSimulator.prototype.getCachedContext = function (context) {
  26506. if (this.sharedContextCache === null) {
  26507. return context;
  26508. }
  26509. var visited = {};
  26510. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  26511. };
  26512. exports.ATNSimulator = ATNSimulator;
  26513. /***/ }),
  26514. /***/ "./node_modules/antlr4/atn/ATNState.js":
  26515. /*!*********************************************!*\
  26516. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  26517. \*********************************************/
  26518. /*! no static exports found */
  26519. /***/ (function(module, exports, __webpack_require__) {
  26520. "use strict";
  26521. //
  26522. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26523. * Use of this file is governed by the BSD 3-clause license that
  26524. * can be found in the LICENSE.txt file in the project root.
  26525. */
  26526. //
  26527. // The following images show the relation of states and
  26528. // {@link ATNState//transitions} for various grammar constructs.
  26529. //
  26530. // <ul>
  26531. //
  26532. // <li>Solid edges marked with an &//0949; indicate a required
  26533. // {@link EpsilonTransition}.</li>
  26534. //
  26535. // <li>Dashed edges indicate locations where any transition derived from
  26536. // {@link Transition} might appear.</li>
  26537. //
  26538. // <li>Dashed nodes are place holders for either a sequence of linked
  26539. // {@link BasicState} states or the inclusion of a block representing a nested
  26540. // construct in one of the forms below.</li>
  26541. //
  26542. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  26543. // any number of alternatives (one or more). Nodes without the {@code ...} only
  26544. // support the exact number of alternatives shown in the diagram.</li>
  26545. //
  26546. // </ul>
  26547. //
  26548. // <h2>Basic Blocks</h2>
  26549. //
  26550. // <h3>Rule</h3>
  26551. //
  26552. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  26553. //
  26554. // <h3>Block of 1 or more alternatives</h3>
  26555. //
  26556. // <embed src="images/Block.svg" type="image/svg+xml"/>
  26557. //
  26558. // <h2>Greedy Loops</h2>
  26559. //
  26560. // <h3>Greedy Closure: {@code (...)*}</h3>
  26561. //
  26562. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  26563. //
  26564. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  26565. //
  26566. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  26567. //
  26568. // <h3>Greedy Optional: {@code (...)?}</h3>
  26569. //
  26570. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  26571. //
  26572. // <h2>Non-Greedy Loops</h2>
  26573. //
  26574. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  26575. //
  26576. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  26577. //
  26578. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  26579. //
  26580. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  26581. //
  26582. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  26583. //
  26584. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  26585. //
  26586. var INITIAL_NUM_TRANSITIONS = 4;
  26587. function ATNState() {
  26588. // Which ATN are we in?
  26589. this.atn = null;
  26590. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  26591. this.stateType = null;
  26592. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  26593. this.epsilonOnlyTransitions = false;
  26594. // Track the transitions emanating from this ATN state.
  26595. this.transitions = [];
  26596. // Used to cache lookahead during parsing, not used during construction
  26597. this.nextTokenWithinRule = null;
  26598. return this;
  26599. }
  26600. // constants for serialization
  26601. ATNState.INVALID_TYPE = 0;
  26602. ATNState.BASIC = 1;
  26603. ATNState.RULE_START = 2;
  26604. ATNState.BLOCK_START = 3;
  26605. ATNState.PLUS_BLOCK_START = 4;
  26606. ATNState.STAR_BLOCK_START = 5;
  26607. ATNState.TOKEN_START = 6;
  26608. ATNState.RULE_STOP = 7;
  26609. ATNState.BLOCK_END = 8;
  26610. ATNState.STAR_LOOP_BACK = 9;
  26611. ATNState.STAR_LOOP_ENTRY = 10;
  26612. ATNState.PLUS_LOOP_BACK = 11;
  26613. ATNState.LOOP_END = 12;
  26614. 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"];
  26615. ATNState.INVALID_STATE_NUMBER = -1;
  26616. ATNState.prototype.toString = function () {
  26617. return this.stateNumber;
  26618. };
  26619. ATNState.prototype.equals = function (other) {
  26620. if (other instanceof ATNState) {
  26621. return this.stateNumber === other.stateNumber;
  26622. } else {
  26623. return false;
  26624. }
  26625. };
  26626. ATNState.prototype.isNonGreedyExitState = function () {
  26627. return false;
  26628. };
  26629. ATNState.prototype.addTransition = function (trans, index) {
  26630. if (index === undefined) {
  26631. index = -1;
  26632. }
  26633. if (this.transitions.length === 0) {
  26634. this.epsilonOnlyTransitions = trans.isEpsilon;
  26635. } else if (this.epsilonOnlyTransitions !== trans.isEpsilon) {
  26636. this.epsilonOnlyTransitions = false;
  26637. }
  26638. if (index === -1) {
  26639. this.transitions.push(trans);
  26640. } else {
  26641. this.transitions.splice(index, 1, trans);
  26642. }
  26643. };
  26644. function BasicState() {
  26645. ATNState.call(this);
  26646. this.stateType = ATNState.BASIC;
  26647. return this;
  26648. }
  26649. BasicState.prototype = Object.create(ATNState.prototype);
  26650. BasicState.prototype.constructor = BasicState;
  26651. function DecisionState() {
  26652. ATNState.call(this);
  26653. this.decision = -1;
  26654. this.nonGreedy = false;
  26655. return this;
  26656. }
  26657. DecisionState.prototype = Object.create(ATNState.prototype);
  26658. DecisionState.prototype.constructor = DecisionState;
  26659. // The start of a regular {@code (...)} block.
  26660. function BlockStartState() {
  26661. DecisionState.call(this);
  26662. this.endState = null;
  26663. return this;
  26664. }
  26665. BlockStartState.prototype = Object.create(DecisionState.prototype);
  26666. BlockStartState.prototype.constructor = BlockStartState;
  26667. function BasicBlockStartState() {
  26668. BlockStartState.call(this);
  26669. this.stateType = ATNState.BLOCK_START;
  26670. return this;
  26671. }
  26672. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  26673. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  26674. // Terminal node of a simple {@code (a|b|c)} block.
  26675. function BlockEndState() {
  26676. ATNState.call(this);
  26677. this.stateType = ATNState.BLOCK_END;
  26678. this.startState = null;
  26679. return this;
  26680. }
  26681. BlockEndState.prototype = Object.create(ATNState.prototype);
  26682. BlockEndState.prototype.constructor = BlockEndState;
  26683. // The last node in the ATN for a rule, unless that rule is the start symbol.
  26684. // In that case, there is one transition to EOF. Later, we might encode
  26685. // references to all calls to this rule to compute FOLLOW sets for
  26686. // error handling.
  26687. //
  26688. function RuleStopState() {
  26689. ATNState.call(this);
  26690. this.stateType = ATNState.RULE_STOP;
  26691. return this;
  26692. }
  26693. RuleStopState.prototype = Object.create(ATNState.prototype);
  26694. RuleStopState.prototype.constructor = RuleStopState;
  26695. function RuleStartState() {
  26696. ATNState.call(this);
  26697. this.stateType = ATNState.RULE_START;
  26698. this.stopState = null;
  26699. this.isPrecedenceRule = false;
  26700. return this;
  26701. }
  26702. RuleStartState.prototype = Object.create(ATNState.prototype);
  26703. RuleStartState.prototype.constructor = RuleStartState;
  26704. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  26705. // one to the loop back to start of the block and one to exit.
  26706. //
  26707. function PlusLoopbackState() {
  26708. DecisionState.call(this);
  26709. this.stateType = ATNState.PLUS_LOOP_BACK;
  26710. return this;
  26711. }
  26712. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  26713. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  26714. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  26715. // we don't use for code generation; somebody might need it, so I'm defining
  26716. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  26717. // real decision-making note for {@code A+}.
  26718. //
  26719. function PlusBlockStartState() {
  26720. BlockStartState.call(this);
  26721. this.stateType = ATNState.PLUS_BLOCK_START;
  26722. this.loopBackState = null;
  26723. return this;
  26724. }
  26725. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  26726. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  26727. // The block that begins a closure loop.
  26728. function StarBlockStartState() {
  26729. BlockStartState.call(this);
  26730. this.stateType = ATNState.STAR_BLOCK_START;
  26731. return this;
  26732. }
  26733. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  26734. StarBlockStartState.prototype.constructor = StarBlockStartState;
  26735. function StarLoopbackState() {
  26736. ATNState.call(this);
  26737. this.stateType = ATNState.STAR_LOOP_BACK;
  26738. return this;
  26739. }
  26740. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  26741. StarLoopbackState.prototype.constructor = StarLoopbackState;
  26742. function StarLoopEntryState() {
  26743. DecisionState.call(this);
  26744. this.stateType = ATNState.STAR_LOOP_ENTRY;
  26745. this.loopBackState = null;
  26746. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  26747. this.isPrecedenceDecision = null;
  26748. return this;
  26749. }
  26750. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  26751. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  26752. // Mark the end of a * or + loop.
  26753. function LoopEndState() {
  26754. ATNState.call(this);
  26755. this.stateType = ATNState.LOOP_END;
  26756. this.loopBackState = null;
  26757. return this;
  26758. }
  26759. LoopEndState.prototype = Object.create(ATNState.prototype);
  26760. LoopEndState.prototype.constructor = LoopEndState;
  26761. // The Tokens rule start state linking to each lexer rule start state */
  26762. function TokensStartState() {
  26763. DecisionState.call(this);
  26764. this.stateType = ATNState.TOKEN_START;
  26765. return this;
  26766. }
  26767. TokensStartState.prototype = Object.create(DecisionState.prototype);
  26768. TokensStartState.prototype.constructor = TokensStartState;
  26769. exports.ATNState = ATNState;
  26770. exports.BasicState = BasicState;
  26771. exports.DecisionState = DecisionState;
  26772. exports.BlockStartState = BlockStartState;
  26773. exports.BlockEndState = BlockEndState;
  26774. exports.LoopEndState = LoopEndState;
  26775. exports.RuleStartState = RuleStartState;
  26776. exports.RuleStopState = RuleStopState;
  26777. exports.TokensStartState = TokensStartState;
  26778. exports.PlusLoopbackState = PlusLoopbackState;
  26779. exports.StarLoopbackState = StarLoopbackState;
  26780. exports.StarLoopEntryState = StarLoopEntryState;
  26781. exports.PlusBlockStartState = PlusBlockStartState;
  26782. exports.StarBlockStartState = StarBlockStartState;
  26783. exports.BasicBlockStartState = BasicBlockStartState;
  26784. /***/ }),
  26785. /***/ "./node_modules/antlr4/atn/ATNType.js":
  26786. /*!********************************************!*\
  26787. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  26788. \********************************************/
  26789. /*! no static exports found */
  26790. /***/ (function(module, exports, __webpack_require__) {
  26791. "use strict";
  26792. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26793. * Use of this file is governed by the BSD 3-clause license that
  26794. * can be found in the LICENSE.txt file in the project root.
  26795. */
  26796. ///
  26797. // Represents the type of recognizer an ATN applies to.
  26798. function ATNType() {}
  26799. ATNType.LEXER = 0;
  26800. ATNType.PARSER = 1;
  26801. exports.ATNType = ATNType;
  26802. /***/ }),
  26803. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  26804. /*!******************************************************!*\
  26805. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  26806. \******************************************************/
  26807. /*! no static exports found */
  26808. /***/ (function(module, exports, __webpack_require__) {
  26809. "use strict";
  26810. //
  26811. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26812. * Use of this file is governed by the BSD 3-clause license that
  26813. * can be found in the LICENSE.txt file in the project root.
  26814. */
  26815. ///
  26816. // When we hit an accept state in either the DFA or the ATN, we
  26817. // have to notify the character stream to start buffering characters
  26818. // via {@link IntStream//mark} and record the current state. The current sim state
  26819. // includes the current index into the input, the current line,
  26820. // and current character position in that line. Note that the Lexer is
  26821. // tracking the starting line and characterization of the token. These
  26822. // variables track the "state" of the simulator when it hits an accept state.
  26823. //
  26824. // <p>We track these variables separately for the DFA and ATN simulation
  26825. // because the DFA simulation often has to fail over to the ATN
  26826. // simulation. If the ATN simulation fails, we need the DFA to fall
  26827. // back to its previously accepted state, if any. If the ATN succeeds,
  26828. // then the ATN does the accept and the DFA simulator that invoked it
  26829. // can simply return the predicted token type.</p>
  26830. ///
  26831. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  26832. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  26833. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  26834. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  26835. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  26836. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  26837. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  26838. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  26839. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  26840. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  26841. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  26842. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  26843. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  26844. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  26845. function resetSimState(sim) {
  26846. sim.index = -1;
  26847. sim.line = 0;
  26848. sim.column = -1;
  26849. sim.dfaState = null;
  26850. }
  26851. function SimState() {
  26852. resetSimState(this);
  26853. return this;
  26854. }
  26855. SimState.prototype.reset = function () {
  26856. resetSimState(this);
  26857. };
  26858. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  26859. ATNSimulator.call(this, atn, sharedContextCache);
  26860. this.decisionToDFA = decisionToDFA;
  26861. this.recog = recog;
  26862. // The current token's starting index into the character stream.
  26863. // Shared across DFA to ATN simulation in case the ATN fails and the
  26864. // DFA did not have a previous accept state. In this case, we use the
  26865. // ATN-generated exception object.
  26866. this.startIndex = -1;
  26867. // line number 1..n within the input///
  26868. this.line = 1;
  26869. // The index of the character relative to the beginning of the line
  26870. // 0..n-1///
  26871. this.column = 0;
  26872. this.mode = Lexer.DEFAULT_MODE;
  26873. // Used during DFA/ATN exec to record the most recent accept configuration
  26874. // info
  26875. this.prevAccept = new SimState();
  26876. // done
  26877. return this;
  26878. }
  26879. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  26880. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  26881. LexerATNSimulator.debug = false;
  26882. LexerATNSimulator.dfa_debug = false;
  26883. LexerATNSimulator.MIN_DFA_EDGE = 0;
  26884. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  26885. LexerATNSimulator.match_calls = 0;
  26886. LexerATNSimulator.prototype.copyState = function (simulator) {
  26887. this.column = simulator.column;
  26888. this.line = simulator.line;
  26889. this.mode = simulator.mode;
  26890. this.startIndex = simulator.startIndex;
  26891. };
  26892. LexerATNSimulator.prototype.match = function (input, mode) {
  26893. this.match_calls += 1;
  26894. this.mode = mode;
  26895. var mark = input.mark();
  26896. try {
  26897. this.startIndex = input.index;
  26898. this.prevAccept.reset();
  26899. var dfa = this.decisionToDFA[mode];
  26900. if (dfa.s0 === null) {
  26901. return this.matchATN(input);
  26902. } else {
  26903. return this.execATN(input, dfa.s0);
  26904. }
  26905. } finally {
  26906. input.release(mark);
  26907. }
  26908. };
  26909. LexerATNSimulator.prototype.reset = function () {
  26910. this.prevAccept.reset();
  26911. this.startIndex = -1;
  26912. this.line = 1;
  26913. this.column = 0;
  26914. this.mode = Lexer.DEFAULT_MODE;
  26915. };
  26916. LexerATNSimulator.prototype.matchATN = function (input) {
  26917. var startState = this.atn.modeToStartState[this.mode];
  26918. if (LexerATNSimulator.debug) {
  26919. console.log("matchATN mode " + this.mode + " start: " + startState);
  26920. }
  26921. var old_mode = this.mode;
  26922. var s0_closure = this.computeStartState(input, startState);
  26923. var suppressEdge = s0_closure.hasSemanticContext;
  26924. s0_closure.hasSemanticContext = false;
  26925. var next = this.addDFAState(s0_closure);
  26926. if (!suppressEdge) {
  26927. this.decisionToDFA[this.mode].s0 = next;
  26928. }
  26929. var predict = this.execATN(input, next);
  26930. if (LexerATNSimulator.debug) {
  26931. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  26932. }
  26933. return predict;
  26934. };
  26935. LexerATNSimulator.prototype.execATN = function (input, ds0) {
  26936. if (LexerATNSimulator.debug) {
  26937. console.log("start state closure=" + ds0.configs);
  26938. }
  26939. if (ds0.isAcceptState) {
  26940. // allow zero-length tokens
  26941. this.captureSimState(this.prevAccept, input, ds0);
  26942. }
  26943. var t = input.LA(1);
  26944. var s = ds0; // s is current/from DFA state
  26945. while (true) {
  26946. // while more work
  26947. if (LexerATNSimulator.debug) {
  26948. console.log("execATN loop starting closure: " + s.configs);
  26949. }
  26950. // As we move src->trg, src->trg, we keep track of the previous trg to
  26951. // avoid looking up the DFA state again, which is expensive.
  26952. // If the previous target was already part of the DFA, we might
  26953. // be able to avoid doing a reach operation upon t. If s!=null,
  26954. // it means that semantic predicates didn't prevent us from
  26955. // creating a DFA state. Once we know s!=null, we check to see if
  26956. // the DFA state has an edge already for t. If so, we can just reuse
  26957. // it's configuration set; there's no point in re-computing it.
  26958. // This is kind of like doing DFA simulation within the ATN
  26959. // simulation because DFA simulation is really just a way to avoid
  26960. // computing reach/closure sets. Technically, once we know that
  26961. // we have a previously added DFA state, we could jump over to
  26962. // the DFA simulator. But, that would mean popping back and forth
  26963. // a lot and making things more complicated algorithmically.
  26964. // This optimization makes a lot of sense for loops within DFA.
  26965. // A character will take us back to an existing DFA state
  26966. // that already has lots of edges out of it. e.g., .* in comments.
  26967. // print("Target for:" + str(s) + " and:" + str(t))
  26968. var target = this.getExistingTargetState(s, t);
  26969. // print("Existing:" + str(target))
  26970. if (target === null) {
  26971. target = this.computeTargetState(input, s, t);
  26972. // print("Computed:" + str(target))
  26973. }
  26974. if (target === ATNSimulator.ERROR) {
  26975. break;
  26976. }
  26977. // If this is a consumable input element, make sure to consume before
  26978. // capturing the accept state so the input index, line, and char
  26979. // position accurately reflect the state of the interpreter at the
  26980. // end of the token.
  26981. if (t !== Token.EOF) {
  26982. this.consume(input);
  26983. }
  26984. if (target.isAcceptState) {
  26985. this.captureSimState(this.prevAccept, input, target);
  26986. if (t === Token.EOF) {
  26987. break;
  26988. }
  26989. }
  26990. t = input.LA(1);
  26991. s = target; // flip; current DFA target becomes new src/from state
  26992. }
  26993. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  26994. };
  26995. // Get an existing target state for an edge in the DFA. If the target state
  26996. // for the edge has not yet been computed or is otherwise not available,
  26997. // this method returns {@code null}.
  26998. //
  26999. // @param s The current DFA state
  27000. // @param t The next input symbol
  27001. // @return The existing target DFA state for the given input symbol
  27002. // {@code t}, or {@code null} if the target state for this edge is not
  27003. // already cached
  27004. LexerATNSimulator.prototype.getExistingTargetState = function (s, t) {
  27005. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  27006. return null;
  27007. }
  27008. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  27009. if (target === undefined) {
  27010. target = null;
  27011. }
  27012. if (LexerATNSimulator.debug && target !== null) {
  27013. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  27014. }
  27015. return target;
  27016. };
  27017. // Compute a target state for an edge in the DFA, and attempt to add the
  27018. // computed state and corresponding edge to the DFA.
  27019. //
  27020. // @param input The input stream
  27021. // @param s The current DFA state
  27022. // @param t The next input symbol
  27023. //
  27024. // @return The computed target DFA state for the given input symbol
  27025. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  27026. // returns {@link //ERROR}.
  27027. LexerATNSimulator.prototype.computeTargetState = function (input, s, t) {
  27028. var reach = new OrderedATNConfigSet();
  27029. // if we don't find an existing DFA state
  27030. // Fill reach starting from closure, following t transitions
  27031. this.getReachableConfigSet(input, s.configs, reach, t);
  27032. if (reach.items.length === 0) {
  27033. // we got nowhere on t from s
  27034. if (!reach.hasSemanticContext) {
  27035. // we got nowhere on t, don't throw out this knowledge; it'd
  27036. // cause a failover from DFA later.
  27037. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  27038. }
  27039. // stop when we can't match any more char
  27040. return ATNSimulator.ERROR;
  27041. }
  27042. // Add an edge from s to target DFA found/created for reach
  27043. return this.addDFAEdge(s, t, null, reach);
  27044. };
  27045. LexerATNSimulator.prototype.failOrAccept = function (prevAccept, input, reach, t) {
  27046. if (this.prevAccept.dfaState !== null) {
  27047. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  27048. this.accept(input, lexerActionExecutor, this.startIndex, prevAccept.index, prevAccept.line, prevAccept.column);
  27049. return prevAccept.dfaState.prediction;
  27050. } else {
  27051. // if no accept and EOF is first char, return EOF
  27052. if (t === Token.EOF && input.index === this.startIndex) {
  27053. return Token.EOF;
  27054. }
  27055. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  27056. }
  27057. };
  27058. // Given a starting configuration set, figure out all ATN configurations
  27059. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  27060. // parameter.
  27061. LexerATNSimulator.prototype.getReachableConfigSet = function (input, closure, reach, t) {
  27062. // this is used to skip processing for configs which have a lower priority
  27063. // than a config that already reached an accept state for the same rule
  27064. var skipAlt = ATN.INVALID_ALT_NUMBER;
  27065. for (var i = 0; i < closure.items.length; i++) {
  27066. var cfg = closure.items[i];
  27067. var currentAltReachedAcceptState = cfg.alt === skipAlt;
  27068. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  27069. continue;
  27070. }
  27071. if (LexerATNSimulator.debug) {
  27072. console.log("testing %s at %s\n", this.getTokenName(t), cfg.toString(this.recog, true));
  27073. }
  27074. for (var j = 0; j < cfg.state.transitions.length; j++) {
  27075. var trans = cfg.state.transitions[j]; // for each transition
  27076. var target = this.getReachableTarget(trans, t);
  27077. if (target !== null) {
  27078. var lexerActionExecutor = cfg.lexerActionExecutor;
  27079. if (lexerActionExecutor !== null) {
  27080. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  27081. }
  27082. var treatEofAsEpsilon = t === Token.EOF;
  27083. var config = new LexerATNConfig({ state: target, lexerActionExecutor: lexerActionExecutor }, cfg);
  27084. if (this.closure(input, config, reach, currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  27085. // any remaining configs for this alt have a lower priority
  27086. // than the one that just reached an accept state.
  27087. skipAlt = cfg.alt;
  27088. }
  27089. }
  27090. }
  27091. }
  27092. };
  27093. LexerATNSimulator.prototype.accept = function (input, lexerActionExecutor, startIndex, index, line, charPos) {
  27094. if (LexerATNSimulator.debug) {
  27095. console.log("ACTION %s\n", lexerActionExecutor);
  27096. }
  27097. // seek to after last char in token
  27098. input.seek(index);
  27099. this.line = line;
  27100. this.column = charPos;
  27101. if (lexerActionExecutor !== null && this.recog !== null) {
  27102. lexerActionExecutor.execute(this.recog, input, startIndex);
  27103. }
  27104. };
  27105. LexerATNSimulator.prototype.getReachableTarget = function (trans, t) {
  27106. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  27107. return trans.target;
  27108. } else {
  27109. return null;
  27110. }
  27111. };
  27112. LexerATNSimulator.prototype.computeStartState = function (input, p) {
  27113. var initialContext = PredictionContext.EMPTY;
  27114. var configs = new OrderedATNConfigSet();
  27115. for (var i = 0; i < p.transitions.length; i++) {
  27116. var target = p.transitions[i].target;
  27117. var cfg = new LexerATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  27118. this.closure(input, cfg, configs, false, false, false);
  27119. }
  27120. return configs;
  27121. };
  27122. // Since the alternatives within any lexer decision are ordered by
  27123. // preference, this method stops pursuing the closure as soon as an accept
  27124. // state is reached. After the first accept state is reached by depth-first
  27125. // search from {@code config}, all other (potentially reachable) states for
  27126. // this rule would have a lower priority.
  27127. //
  27128. // @return {@code true} if an accept state is reached, otherwise
  27129. // {@code false}.
  27130. LexerATNSimulator.prototype.closure = function (input, config, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  27131. var cfg = null;
  27132. if (LexerATNSimulator.debug) {
  27133. console.log("closure(" + config.toString(this.recog, true) + ")");
  27134. }
  27135. if (config.state instanceof RuleStopState) {
  27136. if (LexerATNSimulator.debug) {
  27137. if (this.recog !== null) {
  27138. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  27139. } else {
  27140. console.log("closure at rule stop %s\n", config);
  27141. }
  27142. }
  27143. if (config.context === null || config.context.hasEmptyPath()) {
  27144. if (config.context === null || config.context.isEmpty()) {
  27145. configs.add(config);
  27146. return true;
  27147. } else {
  27148. configs.add(new LexerATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config));
  27149. currentAltReachedAcceptState = true;
  27150. }
  27151. }
  27152. if (config.context !== null && !config.context.isEmpty()) {
  27153. for (var i = 0; i < config.context.length; i++) {
  27154. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  27155. var newContext = config.context.getParent(i); // "pop" return state
  27156. var returnState = this.atn.states[config.context.getReturnState(i)];
  27157. cfg = new LexerATNConfig({ state: returnState, context: newContext }, config);
  27158. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  27159. }
  27160. }
  27161. }
  27162. return currentAltReachedAcceptState;
  27163. }
  27164. // optimization
  27165. if (!config.state.epsilonOnlyTransitions) {
  27166. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  27167. configs.add(config);
  27168. }
  27169. }
  27170. for (var j = 0; j < config.state.transitions.length; j++) {
  27171. var trans = config.state.transitions[j];
  27172. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  27173. if (cfg !== null) {
  27174. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  27175. }
  27176. }
  27177. return currentAltReachedAcceptState;
  27178. };
  27179. // side-effect: can alter configs.hasSemanticContext
  27180. LexerATNSimulator.prototype.getEpsilonTarget = function (input, config, trans, configs, speculative, treatEofAsEpsilon) {
  27181. var cfg = null;
  27182. if (trans.serializationType === Transition.RULE) {
  27183. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  27184. cfg = new LexerATNConfig({ state: trans.target, context: newContext }, config);
  27185. } else if (trans.serializationType === Transition.PRECEDENCE) {
  27186. throw "Precedence predicates are not supported in lexers.";
  27187. } else if (trans.serializationType === Transition.PREDICATE) {
  27188. // Track traversing semantic predicates. If we traverse,
  27189. // we cannot add a DFA state for this "reach" computation
  27190. // because the DFA would not test the predicate again in the
  27191. // future. Rather than creating collections of semantic predicates
  27192. // like v3 and testing them on prediction, v4 will test them on the
  27193. // fly all the time using the ATN not the DFA. This is slower but
  27194. // semantically it's not used that often. One of the key elements to
  27195. // this predicate mechanism is not adding DFA states that see
  27196. // predicates immediately afterwards in the ATN. For example,
  27197. // a : ID {p1}? | ID {p2}? ;
  27198. // should create the start state for rule 'a' (to save start state
  27199. // competition), but should not create target of ID state. The
  27200. // collection of ATN states the following ID references includes
  27201. // states reached by traversing predicates. Since this is when we
  27202. // test them, we cannot cash the DFA state target of ID.
  27203. if (LexerATNSimulator.debug) {
  27204. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  27205. }
  27206. configs.hasSemanticContext = true;
  27207. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  27208. cfg = new LexerATNConfig({ state: trans.target }, config);
  27209. }
  27210. } else if (trans.serializationType === Transition.ACTION) {
  27211. if (config.context === null || config.context.hasEmptyPath()) {
  27212. // execute actions anywhere in the start rule for a token.
  27213. //
  27214. // TODO: if the entry rule is invoked recursively, some
  27215. // actions may be executed during the recursive call. The
  27216. // problem can appear when hasEmptyPath() is true but
  27217. // isEmpty() is false. In this case, the config needs to be
  27218. // split into two contexts - one with just the empty path
  27219. // and another with everything but the empty path.
  27220. // Unfortunately, the current algorithm does not allow
  27221. // getEpsilonTarget to return two configurations, so
  27222. // additional modifications are needed before we can support
  27223. // the split operation.
  27224. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor, this.atn.lexerActions[trans.actionIndex]);
  27225. cfg = new LexerATNConfig({ state: trans.target, lexerActionExecutor: lexerActionExecutor }, config);
  27226. } else {
  27227. // ignore actions in referenced rules
  27228. cfg = new LexerATNConfig({ state: trans.target }, config);
  27229. }
  27230. } else if (trans.serializationType === Transition.EPSILON) {
  27231. cfg = new LexerATNConfig({ state: trans.target }, config);
  27232. } else if (trans.serializationType === Transition.ATOM || trans.serializationType === Transition.RANGE || trans.serializationType === Transition.SET) {
  27233. if (treatEofAsEpsilon) {
  27234. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  27235. cfg = new LexerATNConfig({ state: trans.target }, config);
  27236. }
  27237. }
  27238. }
  27239. return cfg;
  27240. };
  27241. // Evaluate a predicate specified in the lexer.
  27242. //
  27243. // <p>If {@code speculative} is {@code true}, this method was called before
  27244. // {@link //consume} for the matched character. This method should call
  27245. // {@link //consume} before evaluating the predicate to ensure position
  27246. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  27247. // and {@link Lexer//getcolumn}, properly reflect the current
  27248. // lexer state. This method should restore {@code input} and the simulator
  27249. // to the original state before returning (i.e. undo the actions made by the
  27250. // call to {@link //consume}.</p>
  27251. //
  27252. // @param input The input stream.
  27253. // @param ruleIndex The rule containing the predicate.
  27254. // @param predIndex The index of the predicate within the rule.
  27255. // @param speculative {@code true} if the current index in {@code input} is
  27256. // one character before the predicate's location.
  27257. //
  27258. // @return {@code true} if the specified predicate evaluates to
  27259. // {@code true}.
  27260. // /
  27261. LexerATNSimulator.prototype.evaluatePredicate = function (input, ruleIndex, predIndex, speculative) {
  27262. // assume true if no recognizer was provided
  27263. if (this.recog === null) {
  27264. return true;
  27265. }
  27266. if (!speculative) {
  27267. return this.recog.sempred(null, ruleIndex, predIndex);
  27268. }
  27269. var savedcolumn = this.column;
  27270. var savedLine = this.line;
  27271. var index = input.index;
  27272. var marker = input.mark();
  27273. try {
  27274. this.consume(input);
  27275. return this.recog.sempred(null, ruleIndex, predIndex);
  27276. } finally {
  27277. this.column = savedcolumn;
  27278. this.line = savedLine;
  27279. input.seek(index);
  27280. input.release(marker);
  27281. }
  27282. };
  27283. LexerATNSimulator.prototype.captureSimState = function (settings, input, dfaState) {
  27284. settings.index = input.index;
  27285. settings.line = this.line;
  27286. settings.column = this.column;
  27287. settings.dfaState = dfaState;
  27288. };
  27289. LexerATNSimulator.prototype.addDFAEdge = function (from_, tk, to, cfgs) {
  27290. if (to === undefined) {
  27291. to = null;
  27292. }
  27293. if (cfgs === undefined) {
  27294. cfgs = null;
  27295. }
  27296. if (to === null && cfgs !== null) {
  27297. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  27298. // marker indicating dynamic predicate evaluation makes this edge
  27299. // dependent on the specific input sequence, so the static edge in the
  27300. // DFA should be omitted. The target DFAState is still created since
  27301. // execATN has the ability to resynchronize with the DFA state cache
  27302. // following the predicate evaluation step.
  27303. //
  27304. // TJP notes: next time through the DFA, we see a pred again and eval.
  27305. // If that gets us to a previously created (but dangling) DFA
  27306. // state, we can continue in pure DFA mode from there.
  27307. // /
  27308. var suppressEdge = cfgs.hasSemanticContext;
  27309. cfgs.hasSemanticContext = false;
  27310. to = this.addDFAState(cfgs);
  27311. if (suppressEdge) {
  27312. return to;
  27313. }
  27314. }
  27315. // add the edge
  27316. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  27317. // Only track edges within the DFA bounds
  27318. return to;
  27319. }
  27320. if (LexerATNSimulator.debug) {
  27321. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  27322. }
  27323. if (from_.edges === null) {
  27324. // make room for tokens 1..n and -1 masquerading as index 0
  27325. from_.edges = [];
  27326. }
  27327. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  27328. return to;
  27329. };
  27330. // Add a new DFA state if there isn't one with this set of
  27331. // configurations already. This method also detects the first
  27332. // configuration containing an ATN rule stop state. Later, when
  27333. // traversing the DFA, we will know which rule to accept.
  27334. LexerATNSimulator.prototype.addDFAState = function (configs) {
  27335. var proposed = new DFAState(null, configs);
  27336. var firstConfigWithRuleStopState = null;
  27337. for (var i = 0; i < configs.items.length; i++) {
  27338. var cfg = configs.items[i];
  27339. if (cfg.state instanceof RuleStopState) {
  27340. firstConfigWithRuleStopState = cfg;
  27341. break;
  27342. }
  27343. }
  27344. if (firstConfigWithRuleStopState !== null) {
  27345. proposed.isAcceptState = true;
  27346. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  27347. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  27348. }
  27349. var dfa = this.decisionToDFA[this.mode];
  27350. var existing = dfa.states.get(proposed);
  27351. if (existing !== null) {
  27352. return existing;
  27353. }
  27354. var newState = proposed;
  27355. newState.stateNumber = dfa.states.length;
  27356. configs.setReadonly(true);
  27357. newState.configs = configs;
  27358. dfa.states.add(newState);
  27359. return newState;
  27360. };
  27361. LexerATNSimulator.prototype.getDFA = function (mode) {
  27362. return this.decisionToDFA[mode];
  27363. };
  27364. // Get the text matched so far for the current token.
  27365. LexerATNSimulator.prototype.getText = function (input) {
  27366. // index is first lookahead char, don't include.
  27367. return input.getText(this.startIndex, input.index - 1);
  27368. };
  27369. LexerATNSimulator.prototype.consume = function (input) {
  27370. var curChar = input.LA(1);
  27371. if (curChar === "\n".charCodeAt(0)) {
  27372. this.line += 1;
  27373. this.column = 0;
  27374. } else {
  27375. this.column += 1;
  27376. }
  27377. input.consume();
  27378. };
  27379. LexerATNSimulator.prototype.getTokenName = function (tt) {
  27380. if (tt === -1) {
  27381. return "EOF";
  27382. } else {
  27383. return "'" + String.fromCharCode(tt) + "'";
  27384. }
  27385. };
  27386. exports.LexerATNSimulator = LexerATNSimulator;
  27387. /***/ }),
  27388. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  27389. /*!************************************************!*\
  27390. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  27391. \************************************************/
  27392. /*! no static exports found */
  27393. /***/ (function(module, exports, __webpack_require__) {
  27394. "use strict";
  27395. //
  27396. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27397. * Use of this file is governed by the BSD 3-clause license that
  27398. * can be found in the LICENSE.txt file in the project root.
  27399. */
  27400. //
  27401. function LexerActionType() {}
  27402. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  27403. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  27404. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  27405. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  27406. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  27407. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  27408. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  27409. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  27410. function LexerAction(action) {
  27411. this.actionType = action;
  27412. this.isPositionDependent = false;
  27413. return this;
  27414. }
  27415. LexerAction.prototype.hashCode = function () {
  27416. var hash = new Hash();
  27417. this.updateHashCode(hash);
  27418. return hash.finish();
  27419. };
  27420. LexerAction.prototype.updateHashCode = function (hash) {
  27421. hash.update(this.actionType);
  27422. };
  27423. LexerAction.prototype.equals = function (other) {
  27424. return this === other;
  27425. };
  27426. //
  27427. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  27428. //
  27429. // <p>The {@code skip} command does not have any parameters, so this action is
  27430. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27431. function LexerSkipAction() {
  27432. LexerAction.call(this, LexerActionType.SKIP);
  27433. return this;
  27434. }
  27435. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  27436. LexerSkipAction.prototype.constructor = LexerSkipAction;
  27437. // Provides a singleton instance of this parameterless lexer action.
  27438. LexerSkipAction.INSTANCE = new LexerSkipAction();
  27439. LexerSkipAction.prototype.execute = function (lexer) {
  27440. lexer.skip();
  27441. };
  27442. LexerSkipAction.prototype.toString = function () {
  27443. return "skip";
  27444. };
  27445. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  27446. // with the assigned type.
  27447. function LexerTypeAction(type) {
  27448. LexerAction.call(this, LexerActionType.TYPE);
  27449. this.type = type;
  27450. return this;
  27451. }
  27452. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  27453. LexerTypeAction.prototype.constructor = LexerTypeAction;
  27454. LexerTypeAction.prototype.execute = function (lexer) {
  27455. lexer.type = this.type;
  27456. };
  27457. LexerTypeAction.prototype.updateHashCode = function (hash) {
  27458. hash.update(this.actionType, this.type);
  27459. };
  27460. LexerTypeAction.prototype.equals = function (other) {
  27461. if (this === other) {
  27462. return true;
  27463. } else if (!(other instanceof LexerTypeAction)) {
  27464. return false;
  27465. } else {
  27466. return this.type === other.type;
  27467. }
  27468. };
  27469. LexerTypeAction.prototype.toString = function () {
  27470. return "type(" + this.type + ")";
  27471. };
  27472. // Implements the {@code pushMode} lexer action by calling
  27473. // {@link Lexer//pushMode} with the assigned mode.
  27474. function LexerPushModeAction(mode) {
  27475. LexerAction.call(this, LexerActionType.PUSH_MODE);
  27476. this.mode = mode;
  27477. return this;
  27478. }
  27479. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  27480. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  27481. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  27482. // value provided by {@link //getMode}.</p>
  27483. LexerPushModeAction.prototype.execute = function (lexer) {
  27484. lexer.pushMode(this.mode);
  27485. };
  27486. LexerPushModeAction.prototype.updateHashCode = function (hash) {
  27487. hash.update(this.actionType, this.mode);
  27488. };
  27489. LexerPushModeAction.prototype.equals = function (other) {
  27490. if (this === other) {
  27491. return true;
  27492. } else if (!(other instanceof LexerPushModeAction)) {
  27493. return false;
  27494. } else {
  27495. return this.mode === other.mode;
  27496. }
  27497. };
  27498. LexerPushModeAction.prototype.toString = function () {
  27499. return "pushMode(" + this.mode + ")";
  27500. };
  27501. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  27502. //
  27503. // <p>The {@code popMode} command does not have any parameters, so this action is
  27504. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27505. function LexerPopModeAction() {
  27506. LexerAction.call(this, LexerActionType.POP_MODE);
  27507. return this;
  27508. }
  27509. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  27510. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  27511. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  27512. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  27513. LexerPopModeAction.prototype.execute = function (lexer) {
  27514. lexer.popMode();
  27515. };
  27516. LexerPopModeAction.prototype.toString = function () {
  27517. return "popMode";
  27518. };
  27519. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  27520. //
  27521. // <p>The {@code more} command does not have any parameters, so this action is
  27522. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27523. function LexerMoreAction() {
  27524. LexerAction.call(this, LexerActionType.MORE);
  27525. return this;
  27526. }
  27527. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  27528. LexerMoreAction.prototype.constructor = LexerMoreAction;
  27529. LexerMoreAction.INSTANCE = new LexerMoreAction();
  27530. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  27531. LexerMoreAction.prototype.execute = function (lexer) {
  27532. lexer.more();
  27533. };
  27534. LexerMoreAction.prototype.toString = function () {
  27535. return "more";
  27536. };
  27537. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  27538. // the assigned mode.
  27539. function LexerModeAction(mode) {
  27540. LexerAction.call(this, LexerActionType.MODE);
  27541. this.mode = mode;
  27542. return this;
  27543. }
  27544. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  27545. LexerModeAction.prototype.constructor = LexerModeAction;
  27546. // <p>This action is implemented by calling {@link Lexer//mode} with the
  27547. // value provided by {@link //getMode}.</p>
  27548. LexerModeAction.prototype.execute = function (lexer) {
  27549. lexer.mode(this.mode);
  27550. };
  27551. LexerModeAction.prototype.updateHashCode = function (hash) {
  27552. hash.update(this.actionType, this.mode);
  27553. };
  27554. LexerModeAction.prototype.equals = function (other) {
  27555. if (this === other) {
  27556. return true;
  27557. } else if (!(other instanceof LexerModeAction)) {
  27558. return false;
  27559. } else {
  27560. return this.mode === other.mode;
  27561. }
  27562. };
  27563. LexerModeAction.prototype.toString = function () {
  27564. return "mode(" + this.mode + ")";
  27565. };
  27566. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  27567. // rule and action indexes assigned to the custom action. The implementation of
  27568. // a custom action is added to the generated code for the lexer in an override
  27569. // of {@link Recognizer//action} when the grammar is compiled.
  27570. //
  27571. // <p>This class may represent embedded actions created with the <code>{...}</code>
  27572. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  27573. // command argument could not be evaluated when the grammar was compiled.</p>
  27574. // Constructs a custom lexer action with the specified rule and action
  27575. // indexes.
  27576. //
  27577. // @param ruleIndex The rule index to use for calls to
  27578. // {@link Recognizer//action}.
  27579. // @param actionIndex The action index to use for calls to
  27580. // {@link Recognizer//action}.
  27581. function LexerCustomAction(ruleIndex, actionIndex) {
  27582. LexerAction.call(this, LexerActionType.CUSTOM);
  27583. this.ruleIndex = ruleIndex;
  27584. this.actionIndex = actionIndex;
  27585. this.isPositionDependent = true;
  27586. return this;
  27587. }
  27588. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  27589. LexerCustomAction.prototype.constructor = LexerCustomAction;
  27590. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  27591. // appropriate rule and action indexes.</p>
  27592. LexerCustomAction.prototype.execute = function (lexer) {
  27593. lexer.action(null, this.ruleIndex, this.actionIndex);
  27594. };
  27595. LexerCustomAction.prototype.updateHashCode = function (hash) {
  27596. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  27597. };
  27598. LexerCustomAction.prototype.equals = function (other) {
  27599. if (this === other) {
  27600. return true;
  27601. } else if (!(other instanceof LexerCustomAction)) {
  27602. return false;
  27603. } else {
  27604. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  27605. }
  27606. };
  27607. // Implements the {@code channel} lexer action by calling
  27608. // {@link Lexer//setChannel} with the assigned channel.
  27609. // Constructs a new {@code channel} action with the specified channel value.
  27610. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  27611. function LexerChannelAction(channel) {
  27612. LexerAction.call(this, LexerActionType.CHANNEL);
  27613. this.channel = channel;
  27614. return this;
  27615. }
  27616. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  27617. LexerChannelAction.prototype.constructor = LexerChannelAction;
  27618. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  27619. // value provided by {@link //getChannel}.</p>
  27620. LexerChannelAction.prototype.execute = function (lexer) {
  27621. lexer._channel = this.channel;
  27622. };
  27623. LexerChannelAction.prototype.updateHashCode = function (hash) {
  27624. hash.update(this.actionType, this.channel);
  27625. };
  27626. LexerChannelAction.prototype.equals = function (other) {
  27627. if (this === other) {
  27628. return true;
  27629. } else if (!(other instanceof LexerChannelAction)) {
  27630. return false;
  27631. } else {
  27632. return this.channel === other.channel;
  27633. }
  27634. };
  27635. LexerChannelAction.prototype.toString = function () {
  27636. return "channel(" + this.channel + ")";
  27637. };
  27638. // This implementation of {@link LexerAction} is used for tracking input offsets
  27639. // for position-dependent actions within a {@link LexerActionExecutor}.
  27640. //
  27641. // <p>This action is not serialized as part of the ATN, and is only required for
  27642. // position-dependent lexer actions which appear at a location other than the
  27643. // end of a rule. For more information about DFA optimizations employed for
  27644. // lexer actions, see {@link LexerActionExecutor//append} and
  27645. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  27646. // Constructs a new indexed custom action by associating a character offset
  27647. // with a {@link LexerAction}.
  27648. //
  27649. // <p>Note: This class is only required for lexer actions for which
  27650. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  27651. //
  27652. // @param offset The offset into the input {@link CharStream}, relative to
  27653. // the token start index, at which the specified lexer action should be
  27654. // executed.
  27655. // @param action The lexer action to execute at a particular offset in the
  27656. // input {@link CharStream}.
  27657. function LexerIndexedCustomAction(offset, action) {
  27658. LexerAction.call(this, action.actionType);
  27659. this.offset = offset;
  27660. this.action = action;
  27661. this.isPositionDependent = true;
  27662. return this;
  27663. }
  27664. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  27665. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  27666. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  27667. // using the provided {@code lexer}.</p>
  27668. LexerIndexedCustomAction.prototype.execute = function (lexer) {
  27669. // assume the input stream position was properly set by the calling code
  27670. this.action.execute(lexer);
  27671. };
  27672. LexerIndexedCustomAction.prototype.updateHashCode = function (hash) {
  27673. hash.update(this.actionType, this.offset, this.action);
  27674. };
  27675. LexerIndexedCustomAction.prototype.equals = function (other) {
  27676. if (this === other) {
  27677. return true;
  27678. } else if (!(other instanceof LexerIndexedCustomAction)) {
  27679. return false;
  27680. } else {
  27681. return this.offset === other.offset && this.action === other.action;
  27682. }
  27683. };
  27684. exports.LexerActionType = LexerActionType;
  27685. exports.LexerSkipAction = LexerSkipAction;
  27686. exports.LexerChannelAction = LexerChannelAction;
  27687. exports.LexerCustomAction = LexerCustomAction;
  27688. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  27689. exports.LexerMoreAction = LexerMoreAction;
  27690. exports.LexerTypeAction = LexerTypeAction;
  27691. exports.LexerPushModeAction = LexerPushModeAction;
  27692. exports.LexerPopModeAction = LexerPopModeAction;
  27693. exports.LexerModeAction = LexerModeAction;
  27694. /***/ }),
  27695. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  27696. /*!********************************************************!*\
  27697. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  27698. \********************************************************/
  27699. /*! no static exports found */
  27700. /***/ (function(module, exports, __webpack_require__) {
  27701. "use strict";
  27702. //
  27703. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27704. * Use of this file is governed by the BSD 3-clause license that
  27705. * can be found in the LICENSE.txt file in the project root.
  27706. */
  27707. ///
  27708. // Represents an executor for a sequence of lexer actions which traversed during
  27709. // the matching operation of a lexer rule (token).
  27710. //
  27711. // <p>The executor tracks position information for position-dependent lexer actions
  27712. // efficiently, ensuring that actions appearing only at the end of the rule do
  27713. // not cause bloating of the {@link DFA} created for the lexer.</p>
  27714. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  27715. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  27716. function LexerActionExecutor(lexerActions) {
  27717. this.lexerActions = lexerActions === null ? [] : lexerActions;
  27718. // Caches the result of {@link //hashCode} since the hash code is an element
  27719. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  27720. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  27721. // lexerActions]))
  27722. return this;
  27723. }
  27724. // Creates a {@link LexerActionExecutor} which executes the actions for
  27725. // the input {@code lexerActionExecutor} followed by a specified
  27726. // {@code lexerAction}.
  27727. //
  27728. // @param lexerActionExecutor The executor for actions already traversed by
  27729. // the lexer while matching a token within a particular
  27730. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  27731. // though it were an empty executor.
  27732. // @param lexerAction The lexer action to execute after the actions
  27733. // specified in {@code lexerActionExecutor}.
  27734. //
  27735. // @return A {@link LexerActionExecutor} for executing the combine actions
  27736. // of {@code lexerActionExecutor} and {@code lexerAction}.
  27737. LexerActionExecutor.append = function (lexerActionExecutor, lexerAction) {
  27738. if (lexerActionExecutor === null) {
  27739. return new LexerActionExecutor([lexerAction]);
  27740. }
  27741. var lexerActions = lexerActionExecutor.lexerActions.concat([lexerAction]);
  27742. return new LexerActionExecutor(lexerActions);
  27743. };
  27744. // Creates a {@link LexerActionExecutor} which encodes the current offset
  27745. // for position-dependent lexer actions.
  27746. //
  27747. // <p>Normally, when the executor encounters lexer actions where
  27748. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  27749. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  27750. // position to the <em>end</em> of the current token. This behavior provides
  27751. // for efficient DFA representation of lexer actions which appear at the end
  27752. // of a lexer rule, even when the lexer rule matches a variable number of
  27753. // characters.</p>
  27754. //
  27755. // <p>Prior to traversing a match transition in the ATN, the current offset
  27756. // from the token start index is assigned to all position-dependent lexer
  27757. // actions which have not already been assigned a fixed offset. By storing
  27758. // the offsets relative to the token start index, the DFA representation of
  27759. // lexer actions which appear in the middle of tokens remains efficient due
  27760. // to sharing among tokens of the same length, regardless of their absolute
  27761. // position in the input stream.</p>
  27762. //
  27763. // <p>If the current executor already has offsets assigned to all
  27764. // position-dependent lexer actions, the method returns {@code this}.</p>
  27765. //
  27766. // @param offset The current offset to assign to all position-dependent
  27767. // lexer actions which do not already have offsets assigned.
  27768. //
  27769. // @return A {@link LexerActionExecutor} which stores input stream offsets
  27770. // for all position-dependent lexer actions.
  27771. // /
  27772. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function (offset) {
  27773. var updatedLexerActions = null;
  27774. for (var i = 0; i < this.lexerActions.length; i++) {
  27775. if (this.lexerActions[i].isPositionDependent && !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  27776. if (updatedLexerActions === null) {
  27777. updatedLexerActions = this.lexerActions.concat([]);
  27778. }
  27779. updatedLexerActions[i] = new LexerIndexedCustomAction(offset, this.lexerActions[i]);
  27780. }
  27781. }
  27782. if (updatedLexerActions === null) {
  27783. return this;
  27784. } else {
  27785. return new LexerActionExecutor(updatedLexerActions);
  27786. }
  27787. };
  27788. // Execute the actions encapsulated by this executor within the context of a
  27789. // particular {@link Lexer}.
  27790. //
  27791. // <p>This method calls {@link IntStream//seek} to set the position of the
  27792. // {@code input} {@link CharStream} prior to calling
  27793. // {@link LexerAction//execute} on a position-dependent action. Before the
  27794. // method returns, the input position will be restored to the same position
  27795. // it was in when the method was invoked.</p>
  27796. //
  27797. // @param lexer The lexer instance.
  27798. // @param input The input stream which is the source for the current token.
  27799. // When this method is called, the current {@link IntStream//index} for
  27800. // {@code input} should be the start of the following token, i.e. 1
  27801. // character past the end of the current token.
  27802. // @param startIndex The token start index. This value may be passed to
  27803. // {@link IntStream//seek} to set the {@code input} position to the beginning
  27804. // of the token.
  27805. // /
  27806. LexerActionExecutor.prototype.execute = function (lexer, input, startIndex) {
  27807. var requiresSeek = false;
  27808. var stopIndex = input.index;
  27809. try {
  27810. for (var i = 0; i < this.lexerActions.length; i++) {
  27811. var lexerAction = this.lexerActions[i];
  27812. if (lexerAction instanceof LexerIndexedCustomAction) {
  27813. var offset = lexerAction.offset;
  27814. input.seek(startIndex + offset);
  27815. lexerAction = lexerAction.action;
  27816. requiresSeek = startIndex + offset !== stopIndex;
  27817. } else if (lexerAction.isPositionDependent) {
  27818. input.seek(stopIndex);
  27819. requiresSeek = false;
  27820. }
  27821. lexerAction.execute(lexer);
  27822. }
  27823. } finally {
  27824. if (requiresSeek) {
  27825. input.seek(stopIndex);
  27826. }
  27827. }
  27828. };
  27829. LexerActionExecutor.prototype.hashCode = function () {
  27830. return this.cachedHashCode;
  27831. };
  27832. LexerActionExecutor.prototype.updateHashCode = function (hash) {
  27833. hash.update(this.cachedHashCode);
  27834. };
  27835. LexerActionExecutor.prototype.equals = function (other) {
  27836. if (this === other) {
  27837. return true;
  27838. } else if (!(other instanceof LexerActionExecutor)) {
  27839. return false;
  27840. } else if (this.cachedHashCode != other.cachedHashCode) {
  27841. return false;
  27842. } else if (this.lexerActions.length != other.lexerActions.length) {
  27843. return false;
  27844. } else {
  27845. var numActions = this.lexerActions.length;
  27846. for (var idx = 0; idx < numActions; ++idx) {
  27847. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  27848. return false;
  27849. }
  27850. }
  27851. return true;
  27852. }
  27853. };
  27854. exports.LexerActionExecutor = LexerActionExecutor;
  27855. /***/ }),
  27856. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  27857. /*!*******************************************************!*\
  27858. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  27859. \*******************************************************/
  27860. /*! no static exports found */
  27861. /***/ (function(module, exports, __webpack_require__) {
  27862. "use strict";
  27863. //
  27864. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27865. * Use of this file is governed by the BSD 3-clause license that
  27866. * can be found in the LICENSE.txt file in the project root.
  27867. */
  27868. //
  27869. //
  27870. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  27871. //
  27872. // <p>
  27873. // The basic complexity of the adaptive strategy makes it harder to understand.
  27874. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  27875. // requests go through the DFA first. If they reach a state without an edge for
  27876. // the current symbol, the algorithm fails over to the ATN simulation to
  27877. // complete the DFA path for the current input (until it finds a conflict state
  27878. // or uniquely predicting state).</p>
  27879. //
  27880. // <p>
  27881. // All of that is done without using the outer context because we want to create
  27882. // a DFA that is not dependent upon the rule invocation stack when we do a
  27883. // prediction. One DFA works in all contexts. We avoid using context not
  27884. // necessarily because it's slower, although it can be, but because of the DFA
  27885. // caching problem. The closure routine only considers the rule invocation stack
  27886. // created during prediction beginning in the decision rule. For example, if
  27887. // prediction occurs without invoking another rule's ATN, there are no context
  27888. // stacks in the configurations. When lack of context leads to a conflict, we
  27889. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  27890. // strategy (versus full LL(*)).</p>
  27891. //
  27892. // <p>
  27893. // When SLL yields a configuration set with conflict, we rewind the input and
  27894. // retry the ATN simulation, this time using full outer context without adding
  27895. // to the DFA. Configuration context stacks will be the full invocation stacks
  27896. // from the start rule. If we get a conflict using full context, then we can
  27897. // definitively say we have a true ambiguity for that input sequence. If we
  27898. // don't get a conflict, it implies that the decision is sensitive to the outer
  27899. // context. (It is not context-sensitive in the sense of context-sensitive
  27900. // grammars.)</p>
  27901. //
  27902. // <p>
  27903. // The next time we reach this DFA state with an SLL conflict, through DFA
  27904. // simulation, we will again retry the ATN simulation using full context mode.
  27905. // This is slow because we can't save the results and have to "interpret" the
  27906. // ATN each time we get that input.</p>
  27907. //
  27908. // <p>
  27909. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  27910. //
  27911. // <p>
  27912. // We could cache results from full context to predicted alternative easily and
  27913. // that saves a lot of time but doesn't work in presence of predicates. The set
  27914. // of visible predicates from the ATN start state changes depending on the
  27915. // context, because closure can fall off the end of a rule. I tried to cache
  27916. // tuples (stack context, semantic context, predicted alt) but it was slower
  27917. // than interpreting and much more complicated. Also required a huge amount of
  27918. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  27919. // to keep this algorithm simple. By launching multiple threads, we can improve
  27920. // the speed of parsing across a large number of files.</p>
  27921. //
  27922. // <p>
  27923. // There is no strict ordering between the amount of input used by SLL vs LL,
  27924. // which makes it really hard to build a cache for full context. Let's say that
  27925. // we have input A B C that leads to an SLL conflict with full context X. That
  27926. // implies that using X we might only use A B but we could also use A B C D to
  27927. // resolve conflict. Input A B C D could predict alternative 1 in one position
  27928. // in the input and A B C E could predict alternative 2 in another position in
  27929. // input. The conflicting SLL configurations could still be non-unique in the
  27930. // full context prediction, which would lead us to requiring more input than the
  27931. // original A B C. To make a prediction cache work, we have to track the exact
  27932. // input used during the previous prediction. That amounts to a cache that maps
  27933. // X to a specific DFA for that context.</p>
  27934. //
  27935. // <p>
  27936. // Something should be done for left-recursive expression predictions. They are
  27937. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  27938. // with full LL thing Sam does.</p>
  27939. //
  27940. // <p>
  27941. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  27942. //
  27943. // <p>
  27944. // We avoid doing full context retry when the outer context is empty, we did not
  27945. // dip into the outer context by falling off the end of the decision state rule,
  27946. // or when we force SLL mode.</p>
  27947. //
  27948. // <p>
  27949. // As an example of the not dip into outer context case, consider as super
  27950. // constructor calls versus function calls. One grammar might look like
  27951. // this:</p>
  27952. //
  27953. // <pre>
  27954. // ctorBody
  27955. // : '{' superCall? stat* '}'
  27956. // ;
  27957. // </pre>
  27958. //
  27959. // <p>
  27960. // Or, you might see something like</p>
  27961. //
  27962. // <pre>
  27963. // stat
  27964. // : superCall ';'
  27965. // | expression ';'
  27966. // | ...
  27967. // ;
  27968. // </pre>
  27969. //
  27970. // <p>
  27971. // In both cases I believe that no closure operations will dip into the outer
  27972. // context. In the first case ctorBody in the worst case will stop at the '}'.
  27973. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  27974. // entry rule and not dip into the outer context.</p>
  27975. //
  27976. // <p>
  27977. // <strong>PREDICATES</strong></p>
  27978. //
  27979. // <p>
  27980. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  27981. // LL simulation deals with predicates differently. SLL collects predicates as
  27982. // it performs closure operations like ANTLR v3 did. It delays predicate
  27983. // evaluation until it reaches and accept state. This allows us to cache the SLL
  27984. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  27985. // closure, the DFA state configuration sets would be different and we couldn't
  27986. // build up a suitable DFA.</p>
  27987. //
  27988. // <p>
  27989. // When building a DFA accept state during ATN simulation, we evaluate any
  27990. // predicates and return the sole semantically valid alternative. If there is
  27991. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  27992. // we throw an exception. Alternatives without predicates act like they have
  27993. // true predicates. The simple way to think about it is to strip away all
  27994. // alternatives with false predicates and choose the minimum alternative that
  27995. // remains.</p>
  27996. //
  27997. // <p>
  27998. // When we start in the DFA and reach an accept state that's predicated, we test
  27999. // those and return the minimum semantically viable alternative. If no
  28000. // alternatives are viable, we throw an exception.</p>
  28001. //
  28002. // <p>
  28003. // During full LL ATN simulation, closure always evaluates predicates and
  28004. // on-the-fly. This is crucial to reducing the configuration set size during
  28005. // closure. It hits a landmine when parsing with the Java grammar, for example,
  28006. // without this on-the-fly evaluation.</p>
  28007. //
  28008. // <p>
  28009. // <strong>SHARING DFA</strong></p>
  28010. //
  28011. // <p>
  28012. // All instances of the same parser share the same decision DFAs through a
  28013. // static field. Each instance gets its own ATN simulator but they share the
  28014. // same {@link //decisionToDFA} field. They also share a
  28015. // {@link PredictionContextCache} object that makes sure that all
  28016. // {@link PredictionContext} objects are shared among the DFA states. This makes
  28017. // a big size difference.</p>
  28018. //
  28019. // <p>
  28020. // <strong>THREAD SAFETY</strong></p>
  28021. //
  28022. // <p>
  28023. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  28024. // it adds a new DFA object to that array. {@link //addDFAEdge}
  28025. // locks on the DFA for the current decision when setting the
  28026. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  28027. // the DFA for the current decision when looking up a DFA state to see if it
  28028. // already exists. We must make sure that all requests to add DFA states that
  28029. // are equivalent result in the same shared DFA object. This is because lots of
  28030. // threads will be trying to update the DFA at once. The
  28031. // {@link //addDFAState} method also locks inside the DFA lock
  28032. // but this time on the shared context cache when it rebuilds the
  28033. // configurations' {@link PredictionContext} objects using cached
  28034. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  28035. // safe as long as we can guarantee that all threads referencing
  28036. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  28037. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  28038. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  28039. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  28040. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  28041. // {@code dfa.edges[t]} to be non-null. The
  28042. // {@link //addDFAEdge} method could be racing to set the field
  28043. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  28044. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  28045. // way it will work because it's not doing a test and set operation.</p>
  28046. //
  28047. // <p>
  28048. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  28049. // Parsing)</strong></p>
  28050. //
  28051. // <p>
  28052. // Sam pointed out that if SLL does not give a syntax error, then there is no
  28053. // point in doing full LL, which is slower. We only have to try LL if we get a
  28054. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  28055. // mode with the {@link BailErrorStrategy}:</p>
  28056. //
  28057. // <pre>
  28058. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  28059. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  28060. // </pre>
  28061. //
  28062. // <p>
  28063. // If it does not get a syntax error, then we're done. If it does get a syntax
  28064. // error, we need to retry with the combined SLL/LL strategy.</p>
  28065. //
  28066. // <p>
  28067. // The reason this works is as follows. If there are no SLL conflicts, then the
  28068. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  28069. // the full LL analysis must yield a set of viable alternatives which is a
  28070. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  28071. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  28072. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  28073. // is truly ambiguous on the current input. If the LL set is smaller, then the
  28074. // SLL conflict resolution might choose an alternative that the full LL would
  28075. // rule out as a possibility based upon better context information. If that's
  28076. // the case, then the SLL parse will definitely get an error because the full LL
  28077. // analysis says it's not viable. If SLL conflict resolution chooses an
  28078. // alternative within the LL set, them both SLL and LL would choose the same
  28079. // alternative because they both choose the minimum of multiple conflicting
  28080. // alternatives.</p>
  28081. //
  28082. // <p>
  28083. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  28084. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  28085. // parsing will get an error because SLL will pursue alternative 1. If
  28086. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  28087. // choose the same alternative because alternative one is the minimum of either
  28088. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  28089. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  28090. //
  28091. // <p>
  28092. // Of course, if the input is invalid, then we will get an error for sure in
  28093. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  28094. // the input.</p>
  28095. //
  28096. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  28097. var Set = Utils.Set;
  28098. var BitSet = Utils.BitSet;
  28099. var DoubleDict = Utils.DoubleDict;
  28100. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  28101. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  28102. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  28103. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  28104. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  28105. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  28106. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  28107. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  28108. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  28109. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  28110. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  28111. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  28112. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  28113. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  28114. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  28115. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  28116. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  28117. var Transition = Transitions.Transition;
  28118. var SetTransition = Transitions.SetTransition;
  28119. var NotSetTransition = Transitions.NotSetTransition;
  28120. var RuleTransition = Transitions.RuleTransition;
  28121. var ActionTransition = Transitions.ActionTransition;
  28122. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  28123. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  28124. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  28125. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  28126. ATNSimulator.call(this, atn, sharedContextCache);
  28127. this.parser = parser;
  28128. this.decisionToDFA = decisionToDFA;
  28129. // SLL, LL, or LL + exact ambig detection?//
  28130. this.predictionMode = PredictionMode.LL;
  28131. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  28132. this._input = null;
  28133. this._startIndex = 0;
  28134. this._outerContext = null;
  28135. this._dfa = null;
  28136. // Each prediction operation uses a cache for merge of prediction contexts.
  28137. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  28138. // isn't synchronized but we're ok since two threads shouldn't reuse same
  28139. // parser/atnsim object because it can only handle one input at a time.
  28140. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  28141. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  28142. // also be examined during cache lookup.
  28143. //
  28144. this.mergeCache = null;
  28145. return this;
  28146. }
  28147. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  28148. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  28149. ParserATNSimulator.prototype.debug = false;
  28150. ParserATNSimulator.prototype.debug_closure = false;
  28151. ParserATNSimulator.prototype.debug_add = false;
  28152. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  28153. ParserATNSimulator.prototype.dfa_debug = false;
  28154. ParserATNSimulator.prototype.retry_debug = false;
  28155. ParserATNSimulator.prototype.reset = function () {};
  28156. ParserATNSimulator.prototype.adaptivePredict = function (input, decision, outerContext) {
  28157. if (this.debug || this.debug_list_atn_decisions) {
  28158. console.log("adaptivePredict decision " + decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  28159. }
  28160. this._input = input;
  28161. this._startIndex = input.index;
  28162. this._outerContext = outerContext;
  28163. var dfa = this.decisionToDFA[decision];
  28164. this._dfa = dfa;
  28165. var m = input.mark();
  28166. var index = input.index;
  28167. // Now we are certain to have a specific decision's DFA
  28168. // But, do we still need an initial state?
  28169. try {
  28170. var s0;
  28171. if (dfa.precedenceDfa) {
  28172. // the start state for a precedence DFA depends on the current
  28173. // parser precedence, and is provided by a DFA method.
  28174. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  28175. } else {
  28176. // the start state for a "regular" DFA is just s0
  28177. s0 = dfa.s0;
  28178. }
  28179. if (s0 === null) {
  28180. if (outerContext === null) {
  28181. outerContext = RuleContext.EMPTY;
  28182. }
  28183. if (this.debug || this.debug_list_atn_decisions) {
  28184. console.log("predictATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  28185. }
  28186. var fullCtx = false;
  28187. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  28188. if (dfa.precedenceDfa) {
  28189. // If this is a precedence DFA, we use applyPrecedenceFilter
  28190. // to convert the computed start state to a precedence start
  28191. // state. We then use DFA.setPrecedenceStartState to set the
  28192. // appropriate start state for the precedence level rather
  28193. // than simply setting DFA.s0.
  28194. //
  28195. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  28196. s0_closure = this.applyPrecedenceFilter(s0_closure);
  28197. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28198. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  28199. } else {
  28200. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28201. dfa.s0 = s0;
  28202. }
  28203. }
  28204. var alt = this.execATN(dfa, s0, input, index, outerContext);
  28205. if (this.debug) {
  28206. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  28207. }
  28208. return alt;
  28209. } finally {
  28210. this._dfa = null;
  28211. this.mergeCache = null; // wack cache after each prediction
  28212. input.seek(index);
  28213. input.release(m);
  28214. }
  28215. };
  28216. // Performs ATN simulation to compute a predicted alternative based
  28217. // upon the remaining input, but also updates the DFA cache to avoid
  28218. // having to traverse the ATN again for the same input sequence.
  28219. // There are some key conditions we're looking for after computing a new
  28220. // set of ATN configs (proposed DFA state):
  28221. // if the set is empty, there is no viable alternative for current symbol
  28222. // does the state uniquely predict an alternative?
  28223. // does the state have a conflict that would prevent us from
  28224. // putting it on the work list?
  28225. // We also have some key operations to do:
  28226. // add an edge from previous DFA state to potentially new DFA state, D,
  28227. // upon current symbol but only if adding to work list, which means in all
  28228. // cases except no viable alternative (and possibly non-greedy decisions?)
  28229. // collecting predicates and adding semantic context to DFA accept states
  28230. // adding rule context to context-sensitive DFA accept states
  28231. // consuming an input symbol
  28232. // reporting a conflict
  28233. // reporting an ambiguity
  28234. // reporting a context sensitivity
  28235. // reporting insufficient predicates
  28236. // cover these cases:
  28237. // dead end
  28238. // single alt
  28239. // single alt + preds
  28240. // conflict
  28241. // conflict + preds
  28242. //
  28243. ParserATNSimulator.prototype.execATN = function (dfa, s0, input, startIndex, outerContext) {
  28244. if (this.debug || this.debug_list_atn_decisions) {
  28245. console.log("execATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  28246. }
  28247. var alt;
  28248. var previousD = s0;
  28249. if (this.debug) {
  28250. console.log("s0 = " + s0);
  28251. }
  28252. var t = input.LA(1);
  28253. while (true) {
  28254. // while more work
  28255. var D = this.getExistingTargetState(previousD, t);
  28256. if (D === null) {
  28257. D = this.computeTargetState(dfa, previousD, t);
  28258. }
  28259. if (D === ATNSimulator.ERROR) {
  28260. // if any configs in previous dipped into outer context, that
  28261. // means that input up to t actually finished entry rule
  28262. // at least for SLL decision. Full LL doesn't dip into outer
  28263. // so don't need special case.
  28264. // We will get an error no matter what so delay until after
  28265. // decision; better error message. Also, no reachable target
  28266. // ATN states in SLL implies LL will also get nowhere.
  28267. // If conflict in states that dip out, choose min since we
  28268. // will get error no matter what.
  28269. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  28270. input.seek(startIndex);
  28271. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  28272. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28273. return alt;
  28274. } else {
  28275. throw e;
  28276. }
  28277. }
  28278. if (D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  28279. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  28280. var conflictingAlts = null;
  28281. if (D.predicates !== null) {
  28282. if (this.debug) {
  28283. console.log("DFA state has preds in DFA sim LL failover");
  28284. }
  28285. var conflictIndex = input.index;
  28286. if (conflictIndex !== startIndex) {
  28287. input.seek(startIndex);
  28288. }
  28289. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  28290. if (conflictingAlts.length === 1) {
  28291. if (this.debug) {
  28292. console.log("Full LL avoided");
  28293. }
  28294. return conflictingAlts.minValue();
  28295. }
  28296. if (conflictIndex !== startIndex) {
  28297. // restore the index so reporting the fallback to full
  28298. // context occurs with the index at the correct spot
  28299. input.seek(conflictIndex);
  28300. }
  28301. }
  28302. if (this.dfa_debug) {
  28303. console.log("ctx sensitive state " + outerContext + " in " + D);
  28304. }
  28305. var fullCtx = true;
  28306. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  28307. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  28308. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  28309. return alt;
  28310. }
  28311. if (D.isAcceptState) {
  28312. if (D.predicates === null) {
  28313. return D.prediction;
  28314. }
  28315. var stopIndex = input.index;
  28316. input.seek(startIndex);
  28317. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  28318. if (alts.length === 0) {
  28319. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  28320. } else if (alts.length === 1) {
  28321. return alts.minValue();
  28322. } else {
  28323. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  28324. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  28325. return alts.minValue();
  28326. }
  28327. }
  28328. previousD = D;
  28329. if (t !== Token.EOF) {
  28330. input.consume();
  28331. t = input.LA(1);
  28332. }
  28333. }
  28334. };
  28335. //
  28336. // Get an existing target state for an edge in the DFA. If the target state
  28337. // for the edge has not yet been computed or is otherwise not available,
  28338. // this method returns {@code null}.
  28339. //
  28340. // @param previousD The current DFA state
  28341. // @param t The next input symbol
  28342. // @return The existing target DFA state for the given input symbol
  28343. // {@code t}, or {@code null} if the target state for this edge is not
  28344. // already cached
  28345. //
  28346. ParserATNSimulator.prototype.getExistingTargetState = function (previousD, t) {
  28347. var edges = previousD.edges;
  28348. if (edges === null) {
  28349. return null;
  28350. } else {
  28351. return edges[t + 1] || null;
  28352. }
  28353. };
  28354. //
  28355. // Compute a target state for an edge in the DFA, and attempt to add the
  28356. // computed state and corresponding edge to the DFA.
  28357. //
  28358. // @param dfa The DFA
  28359. // @param previousD The current DFA state
  28360. // @param t The next input symbol
  28361. //
  28362. // @return The computed target DFA state for the given input symbol
  28363. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  28364. // returns {@link //ERROR}.
  28365. //
  28366. ParserATNSimulator.prototype.computeTargetState = function (dfa, previousD, t) {
  28367. var reach = this.computeReachSet(previousD.configs, t, false);
  28368. if (reach === null) {
  28369. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  28370. return ATNSimulator.ERROR;
  28371. }
  28372. // create new target state; we'll add to DFA after it's complete
  28373. var D = new DFAState(null, reach);
  28374. var predictedAlt = this.getUniqueAlt(reach);
  28375. if (this.debug) {
  28376. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  28377. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) + ", previous=" + previousD.configs + ", configs=" + reach + ", predict=" + predictedAlt + ", allSubsetsConflict=" + PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" + this.getConflictingAlts(reach));
  28378. }
  28379. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  28380. // NO CONFLICT, UNIQUELY PREDICTED ALT
  28381. D.isAcceptState = true;
  28382. D.configs.uniqueAlt = predictedAlt;
  28383. D.prediction = predictedAlt;
  28384. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  28385. // MORE THAN ONE VIABLE ALTERNATIVE
  28386. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  28387. D.requiresFullContext = true;
  28388. // in SLL-only mode, we will stop at this state and return the minimum alt
  28389. D.isAcceptState = true;
  28390. D.prediction = D.configs.conflictingAlts.minValue();
  28391. }
  28392. if (D.isAcceptState && D.configs.hasSemanticContext) {
  28393. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  28394. if (D.predicates !== null) {
  28395. D.prediction = ATN.INVALID_ALT_NUMBER;
  28396. }
  28397. }
  28398. // all adds to dfa are done after we've created full D state
  28399. D = this.addDFAEdge(dfa, previousD, t, D);
  28400. return D;
  28401. };
  28402. ParserATNSimulator.prototype.predicateDFAState = function (dfaState, decisionState) {
  28403. // We need to test all predicates, even in DFA states that
  28404. // uniquely predict alternative.
  28405. var nalts = decisionState.transitions.length;
  28406. // Update DFA so reach becomes accept state with (predicate,alt)
  28407. // pairs if preds found for conflicting alts
  28408. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  28409. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  28410. if (altToPred !== null) {
  28411. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  28412. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  28413. } else {
  28414. // There are preds in configs but they might go away
  28415. // when OR'd together like {p}? || NONE == NONE. If neither
  28416. // alt has preds, resolve to min alt
  28417. dfaState.prediction = altsToCollectPredsFrom.minValue();
  28418. }
  28419. };
  28420. // comes back with reach.uniqueAlt set to a valid alt
  28421. ParserATNSimulator.prototype.execATNWithFullContext = function (dfa, D, // how far we got before failing over
  28422. s0, input, startIndex, outerContext) {
  28423. if (this.debug || this.debug_list_atn_decisions) {
  28424. console.log("execATNWithFullContext " + s0);
  28425. }
  28426. var fullCtx = true;
  28427. var foundExactAmbig = false;
  28428. var reach = null;
  28429. var previous = s0;
  28430. input.seek(startIndex);
  28431. var t = input.LA(1);
  28432. var predictedAlt = -1;
  28433. while (true) {
  28434. // while more work
  28435. reach = this.computeReachSet(previous, t, fullCtx);
  28436. if (reach === null) {
  28437. // if any configs in previous dipped into outer context, that
  28438. // means that input up to t actually finished entry rule
  28439. // at least for LL decision. Full LL doesn't dip into outer
  28440. // so don't need special case.
  28441. // We will get an error no matter what so delay until after
  28442. // decision; better error message. Also, no reachable target
  28443. // ATN states in SLL implies LL will also get nowhere.
  28444. // If conflict in states that dip out, choose min since we
  28445. // will get error no matter what.
  28446. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  28447. input.seek(startIndex);
  28448. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  28449. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28450. return alt;
  28451. } else {
  28452. throw e;
  28453. }
  28454. }
  28455. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  28456. if (this.debug) {
  28457. console.log("LL altSubSets=" + altSubSets + ", predict=" + PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" + PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  28458. }
  28459. reach.uniqueAlt = this.getUniqueAlt(reach);
  28460. // unique prediction?
  28461. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  28462. predictedAlt = reach.uniqueAlt;
  28463. break;
  28464. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  28465. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  28466. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  28467. break;
  28468. }
  28469. } else {
  28470. // In exact ambiguity mode, we never try to terminate early.
  28471. // Just keeps scarfing until we know what the conflict is
  28472. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  28473. foundExactAmbig = true;
  28474. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  28475. break;
  28476. }
  28477. // else there are multiple non-conflicting subsets or
  28478. // we're not sure what the ambiguity is yet.
  28479. // So, keep going.
  28480. }
  28481. previous = reach;
  28482. if (t !== Token.EOF) {
  28483. input.consume();
  28484. t = input.LA(1);
  28485. }
  28486. }
  28487. // If the configuration set uniquely predicts an alternative,
  28488. // without conflict, then we know that it's a full LL decision
  28489. // not SLL.
  28490. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  28491. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  28492. return predictedAlt;
  28493. }
  28494. // We do not check predicates here because we have checked them
  28495. // on-the-fly when doing full context prediction.
  28496. //
  28497. // In non-exact ambiguity detection mode, we might actually be able to
  28498. // detect an exact ambiguity, but I'm not going to spend the cycles
  28499. // needed to check. We only emit ambiguity warnings in exact ambiguity
  28500. // mode.
  28501. //
  28502. // For example, we might know that we have conflicting configurations.
  28503. // But, that does not mean that there is no way forward without a
  28504. // conflict. It's possible to have nonconflicting alt subsets as in:
  28505. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  28506. // from
  28507. //
  28508. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  28509. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  28510. //
  28511. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  28512. // would resolve this without conflict to alternative 1. Any other viable
  28513. // next sequence, however, is associated with a conflict. We stop
  28514. // looking for input because no amount of further lookahead will alter
  28515. // the fact that we should predict alternative 1. We just can't say for
  28516. // sure that there is an ambiguity without looking further.
  28517. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  28518. return predictedAlt;
  28519. };
  28520. ParserATNSimulator.prototype.computeReachSet = function (closure, t, fullCtx) {
  28521. if (this.debug) {
  28522. console.log("in computeReachSet, starting closure: " + closure);
  28523. }
  28524. if (this.mergeCache === null) {
  28525. this.mergeCache = new DoubleDict();
  28526. }
  28527. var intermediate = new ATNConfigSet(fullCtx);
  28528. // Configurations already in a rule stop state indicate reaching the end
  28529. // of the decision rule (local context) or end of the start rule (full
  28530. // context). Once reached, these configurations are never updated by a
  28531. // closure operation, so they are handled separately for the performance
  28532. // advantage of having a smaller intermediate set when calling closure.
  28533. //
  28534. // For full-context reach operations, separate handling is required to
  28535. // ensure that the alternative matching the longest overall sequence is
  28536. // chosen when multiple such configurations can match the input.
  28537. var skippedStopStates = null;
  28538. // First figure out where we can reach on input t
  28539. for (var i = 0; i < closure.items.length; i++) {
  28540. var c = closure.items[i];
  28541. if (this.debug_add) {
  28542. console.log("testing " + this.getTokenName(t) + " at " + c);
  28543. }
  28544. if (c.state instanceof RuleStopState) {
  28545. if (fullCtx || t === Token.EOF) {
  28546. if (skippedStopStates === null) {
  28547. skippedStopStates = [];
  28548. }
  28549. skippedStopStates.push(c);
  28550. if (this.debug_add) {
  28551. console.log("added " + c + " to skippedStopStates");
  28552. }
  28553. }
  28554. continue;
  28555. }
  28556. for (var j = 0; j < c.state.transitions.length; j++) {
  28557. var trans = c.state.transitions[j];
  28558. var target = this.getReachableTarget(trans, t);
  28559. if (target !== null) {
  28560. var cfg = new ATNConfig({ state: target }, c);
  28561. intermediate.add(cfg, this.mergeCache);
  28562. if (this.debug_add) {
  28563. console.log("added " + cfg + " to intermediate");
  28564. }
  28565. }
  28566. }
  28567. }
  28568. // Now figure out where the reach operation can take us...
  28569. var reach = null;
  28570. // This block optimizes the reach operation for intermediate sets which
  28571. // trivially indicate a termination state for the overall
  28572. // adaptivePredict operation.
  28573. //
  28574. // The conditions assume that intermediate
  28575. // contains all configurations relevant to the reach set, but this
  28576. // condition is not true when one or more configurations have been
  28577. // withheld in skippedStopStates, or when the current symbol is EOF.
  28578. //
  28579. if (skippedStopStates === null && t !== Token.EOF) {
  28580. if (intermediate.items.length === 1) {
  28581. // Don't pursue the closure if there is just one state.
  28582. // It can only have one alternative; just add to result
  28583. // Also don't pursue the closure if there is unique alternative
  28584. // among the configurations.
  28585. reach = intermediate;
  28586. } else if (this.getUniqueAlt(intermediate) !== ATN.INVALID_ALT_NUMBER) {
  28587. // Also don't pursue the closure if there is unique alternative
  28588. // among the configurations.
  28589. reach = intermediate;
  28590. }
  28591. }
  28592. // If the reach set could not be trivially determined, perform a closure
  28593. // operation on the intermediate set to compute its initial value.
  28594. //
  28595. if (reach === null) {
  28596. reach = new ATNConfigSet(fullCtx);
  28597. var closureBusy = new Set();
  28598. var treatEofAsEpsilon = t === Token.EOF;
  28599. for (var k = 0; k < intermediate.items.length; k++) {
  28600. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  28601. }
  28602. }
  28603. if (t === Token.EOF) {
  28604. // After consuming EOF no additional input is possible, so we are
  28605. // only interested in configurations which reached the end of the
  28606. // decision rule (local context) or end of the start rule (full
  28607. // context). Update reach to contain only these configurations. This
  28608. // handles both explicit EOF transitions in the grammar and implicit
  28609. // EOF transitions following the end of the decision or start rule.
  28610. //
  28611. // When reach==intermediate, no closure operation was performed. In
  28612. // this case, removeAllConfigsNotInRuleStopState needs to check for
  28613. // reachable rule stop states as well as configurations already in
  28614. // a rule stop state.
  28615. //
  28616. // This is handled before the configurations in skippedStopStates,
  28617. // because any configurations potentially added from that list are
  28618. // already guaranteed to meet this condition whether or not it's
  28619. // required.
  28620. //
  28621. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  28622. }
  28623. // If skippedStopStates!==null, then it contains at least one
  28624. // configuration. For full-context reach operations, these
  28625. // configurations reached the end of the start rule, in which case we
  28626. // only add them back to reach if no configuration during the current
  28627. // closure operation reached such a state. This ensures adaptivePredict
  28628. // chooses an alternative matching the longest overall sequence when
  28629. // multiple alternatives are viable.
  28630. //
  28631. if (skippedStopStates !== null && (!fullCtx || !PredictionMode.hasConfigInRuleStopState(reach))) {
  28632. for (var l = 0; l < skippedStopStates.length; l++) {
  28633. reach.add(skippedStopStates[l], this.mergeCache);
  28634. }
  28635. }
  28636. if (reach.items.length === 0) {
  28637. return null;
  28638. } else {
  28639. return reach;
  28640. }
  28641. };
  28642. //
  28643. // Return a configuration set containing only the configurations from
  28644. // {@code configs} which are in a {@link RuleStopState}. If all
  28645. // configurations in {@code configs} are already in a rule stop state, this
  28646. // method simply returns {@code configs}.
  28647. //
  28648. // <p>When {@code lookToEndOfRule} is true, this method uses
  28649. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  28650. // not already in a rule stop state to see if a rule stop state is reachable
  28651. // from the configuration via epsilon-only transitions.</p>
  28652. //
  28653. // @param configs the configuration set to update
  28654. // @param lookToEndOfRule when true, this method checks for rule stop states
  28655. // reachable by epsilon-only transitions from each configuration in
  28656. // {@code configs}.
  28657. //
  28658. // @return {@code configs} if all configurations in {@code configs} are in a
  28659. // rule stop state, otherwise return a new configuration set containing only
  28660. // the configurations from {@code configs} which are in a rule stop state
  28661. //
  28662. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function (configs, lookToEndOfRule) {
  28663. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  28664. return configs;
  28665. }
  28666. var result = new ATNConfigSet(configs.fullCtx);
  28667. for (var i = 0; i < configs.items.length; i++) {
  28668. var config = configs.items[i];
  28669. if (config.state instanceof RuleStopState) {
  28670. result.add(config, this.mergeCache);
  28671. continue;
  28672. }
  28673. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  28674. var nextTokens = this.atn.nextTokens(config.state);
  28675. if (nextTokens.contains(Token.EPSILON)) {
  28676. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  28677. result.add(new ATNConfig({ state: endOfRuleState }, config), this.mergeCache);
  28678. }
  28679. }
  28680. }
  28681. return result;
  28682. };
  28683. ParserATNSimulator.prototype.computeStartState = function (p, ctx, fullCtx) {
  28684. // always at least the implicit call to start rule
  28685. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  28686. var configs = new ATNConfigSet(fullCtx);
  28687. for (var i = 0; i < p.transitions.length; i++) {
  28688. var target = p.transitions[i].target;
  28689. var c = new ATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  28690. var closureBusy = new Set();
  28691. this.closure(c, configs, closureBusy, true, fullCtx, false);
  28692. }
  28693. return configs;
  28694. };
  28695. //
  28696. // This method transforms the start state computed by
  28697. // {@link //computeStartState} to the special start state used by a
  28698. // precedence DFA for a particular precedence value. The transformation
  28699. // process applies the following changes to the start state's configuration
  28700. // set.
  28701. //
  28702. // <ol>
  28703. // <li>Evaluate the precedence predicates for each configuration using
  28704. // {@link SemanticContext//evalPrecedence}.</li>
  28705. // <li>Remove all configurations which predict an alternative greater than
  28706. // 1, for which another configuration that predicts alternative 1 is in the
  28707. // same ATN state with the same prediction context. This transformation is
  28708. // valid for the following reasons:
  28709. // <ul>
  28710. // <li>The closure block cannot contain any epsilon transitions which bypass
  28711. // the body of the closure, so all states reachable via alternative 1 are
  28712. // part of the precedence alternatives of the transformed left-recursive
  28713. // rule.</li>
  28714. // <li>The "primary" portion of a left recursive rule cannot contain an
  28715. // epsilon transition, so the only way an alternative other than 1 can exist
  28716. // in a state that is also reachable via alternative 1 is by nesting calls
  28717. // to the left-recursive rule, with the outer calls not being at the
  28718. // preferred precedence level.</li>
  28719. // </ul>
  28720. // </li>
  28721. // </ol>
  28722. //
  28723. // <p>
  28724. // The prediction context must be considered by this filter to address
  28725. // situations like the following.
  28726. // </p>
  28727. // <code>
  28728. // <pre>
  28729. // grammar TA;
  28730. // prog: statement* EOF;
  28731. // statement: letterA | statement letterA 'b' ;
  28732. // letterA: 'a';
  28733. // </pre>
  28734. // </code>
  28735. // <p>
  28736. // If the above grammar, the ATN state immediately before the token
  28737. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  28738. // of both the primary and closure blocks of the left-recursive rule
  28739. // {@code statement}. The prediction context associated with each of these
  28740. // configurations distinguishes between them, and prevents the alternative
  28741. // which stepped out to {@code prog} (and then back in to {@code statement}
  28742. // from being eliminated by the filter.
  28743. // </p>
  28744. //
  28745. // @param configs The configuration set computed by
  28746. // {@link //computeStartState} as the start state for the DFA.
  28747. // @return The transformed configuration set representing the start state
  28748. // for a precedence DFA at a particular precedence level (determined by
  28749. // calling {@link Parser//getPrecedence}).
  28750. //
  28751. ParserATNSimulator.prototype.applyPrecedenceFilter = function (configs) {
  28752. var config;
  28753. var statesFromAlt1 = [];
  28754. var configSet = new ATNConfigSet(configs.fullCtx);
  28755. for (var i = 0; i < configs.items.length; i++) {
  28756. config = configs.items[i];
  28757. // handle alt 1 first
  28758. if (config.alt !== 1) {
  28759. continue;
  28760. }
  28761. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  28762. if (updatedContext === null) {
  28763. // the configuration was eliminated
  28764. continue;
  28765. }
  28766. statesFromAlt1[config.state.stateNumber] = config.context;
  28767. if (updatedContext !== config.semanticContext) {
  28768. configSet.add(new ATNConfig({ semanticContext: updatedContext }, config), this.mergeCache);
  28769. } else {
  28770. configSet.add(config, this.mergeCache);
  28771. }
  28772. }
  28773. for (i = 0; i < configs.items.length; i++) {
  28774. config = configs.items[i];
  28775. if (config.alt === 1) {
  28776. // already handled
  28777. continue;
  28778. }
  28779. // In the future, this elimination step could be updated to also
  28780. // filter the prediction context for alternatives predicting alt>1
  28781. // (basically a graph subtraction algorithm).
  28782. if (!config.precedenceFilterSuppressed) {
  28783. var context = statesFromAlt1[config.state.stateNumber] || null;
  28784. if (context !== null && context.equals(config.context)) {
  28785. // eliminated
  28786. continue;
  28787. }
  28788. }
  28789. configSet.add(config, this.mergeCache);
  28790. }
  28791. return configSet;
  28792. };
  28793. ParserATNSimulator.prototype.getReachableTarget = function (trans, ttype) {
  28794. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  28795. return trans.target;
  28796. } else {
  28797. return null;
  28798. }
  28799. };
  28800. ParserATNSimulator.prototype.getPredsForAmbigAlts = function (ambigAlts, configs, nalts) {
  28801. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  28802. // altToPred starts as an array of all null contexts. The entry at index i
  28803. // corresponds to alternative i. altToPred[i] may have one of three values:
  28804. // 1. null: no ATNConfig c is found such that c.alt==i
  28805. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  28806. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  28807. // alt i has at least one unpredicated config.
  28808. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  28809. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  28810. //
  28811. // From this, it is clear that NONE||anything==NONE.
  28812. //
  28813. var altToPred = [];
  28814. for (var i = 0; i < configs.items.length; i++) {
  28815. var c = configs.items[i];
  28816. if (ambigAlts.contains(c.alt)) {
  28817. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  28818. }
  28819. }
  28820. var nPredAlts = 0;
  28821. for (i = 1; i < nalts + 1; i++) {
  28822. var pred = altToPred[i] || null;
  28823. if (pred === null) {
  28824. altToPred[i] = SemanticContext.NONE;
  28825. } else if (pred !== SemanticContext.NONE) {
  28826. nPredAlts += 1;
  28827. }
  28828. }
  28829. // nonambig alts are null in altToPred
  28830. if (nPredAlts === 0) {
  28831. altToPred = null;
  28832. }
  28833. if (this.debug) {
  28834. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  28835. }
  28836. return altToPred;
  28837. };
  28838. ParserATNSimulator.prototype.getPredicatePredictions = function (ambigAlts, altToPred) {
  28839. var pairs = [];
  28840. var containsPredicate = false;
  28841. for (var i = 1; i < altToPred.length; i++) {
  28842. var pred = altToPred[i];
  28843. // unpredicated is indicated by SemanticContext.NONE
  28844. if (ambigAlts !== null && ambigAlts.contains(i)) {
  28845. pairs.push(new PredPrediction(pred, i));
  28846. }
  28847. if (pred !== SemanticContext.NONE) {
  28848. containsPredicate = true;
  28849. }
  28850. }
  28851. if (!containsPredicate) {
  28852. return null;
  28853. }
  28854. return pairs;
  28855. };
  28856. //
  28857. // This method is used to improve the localization of error messages by
  28858. // choosing an alternative rather than throwing a
  28859. // {@link NoViableAltException} in particular prediction scenarios where the
  28860. // {@link //ERROR} state was reached during ATN simulation.
  28861. //
  28862. // <p>
  28863. // The default implementation of this method uses the following
  28864. // algorithm to identify an ATN configuration which successfully parsed the
  28865. // decision entry rule. Choosing such an alternative ensures that the
  28866. // {@link ParserRuleContext} returned by the calling rule will be complete
  28867. // and valid, and the syntax error will be reported later at a more
  28868. // localized location.</p>
  28869. //
  28870. // <ul>
  28871. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  28872. // they are semantically valid if predicated, return the min associated alt.</li>
  28873. // <li>Else, if a semantically invalid but syntactically valid path exist
  28874. // or paths exist, return the minimum associated alt.
  28875. // </li>
  28876. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  28877. // </ul>
  28878. //
  28879. // <p>
  28880. // In some scenarios, the algorithm described above could predict an
  28881. // alternative which will result in a {@link FailedPredicateException} in
  28882. // the parser. Specifically, this could occur if the <em>only</em> configuration
  28883. // capable of successfully parsing to the end of the decision rule is
  28884. // blocked by a semantic predicate. By choosing this alternative within
  28885. // {@link //adaptivePredict} instead of throwing a
  28886. // {@link NoViableAltException}, the resulting
  28887. // {@link FailedPredicateException} in the parser will identify the specific
  28888. // predicate which is preventing the parser from successfully parsing the
  28889. // decision rule, which helps developers identify and correct logic errors
  28890. // in semantic predicates.
  28891. // </p>
  28892. //
  28893. // @param configs The ATN configurations which were valid immediately before
  28894. // the {@link //ERROR} state was reached
  28895. // @param outerContext The is the \gamma_0 initial parser context from the paper
  28896. // or the parser stack at the instant before prediction commences.
  28897. //
  28898. // @return The value to return from {@link //adaptivePredict}, or
  28899. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  28900. // identified and {@link //adaptivePredict} should report an error instead.
  28901. //
  28902. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function (configs, outerContext) {
  28903. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  28904. var semValidConfigs = cfgs[0];
  28905. var semInvalidConfigs = cfgs[1];
  28906. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  28907. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28908. // semantically/syntactically viable path exists
  28909. return alt;
  28910. }
  28911. // Is there a syntactically valid path with a failed pred?
  28912. if (semInvalidConfigs.items.length > 0) {
  28913. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  28914. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28915. // syntactically viable path exists
  28916. return alt;
  28917. }
  28918. }
  28919. return ATN.INVALID_ALT_NUMBER;
  28920. };
  28921. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function (configs) {
  28922. var alts = [];
  28923. for (var i = 0; i < configs.items.length; i++) {
  28924. var c = configs.items[i];
  28925. if (c.reachesIntoOuterContext > 0 || c.state instanceof RuleStopState && c.context.hasEmptyPath()) {
  28926. if (alts.indexOf(c.alt) < 0) {
  28927. alts.push(c.alt);
  28928. }
  28929. }
  28930. }
  28931. if (alts.length === 0) {
  28932. return ATN.INVALID_ALT_NUMBER;
  28933. } else {
  28934. return Math.min.apply(null, alts);
  28935. }
  28936. };
  28937. // Walk the list of configurations and split them according to
  28938. // those that have preds evaluating to true/false. If no pred, assume
  28939. // true pred and include in succeeded set. Returns Pair of sets.
  28940. //
  28941. // Create a new set so as not to alter the incoming parameter.
  28942. //
  28943. // Assumption: the input stream has been restored to the starting point
  28944. // prediction, which is where predicates need to evaluate.
  28945. //
  28946. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function (configs, outerContext) {
  28947. var succeeded = new ATNConfigSet(configs.fullCtx);
  28948. var failed = new ATNConfigSet(configs.fullCtx);
  28949. for (var i = 0; i < configs.items.length; i++) {
  28950. var c = configs.items[i];
  28951. if (c.semanticContext !== SemanticContext.NONE) {
  28952. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  28953. if (predicateEvaluationResult) {
  28954. succeeded.add(c);
  28955. } else {
  28956. failed.add(c);
  28957. }
  28958. } else {
  28959. succeeded.add(c);
  28960. }
  28961. }
  28962. return [succeeded, failed];
  28963. };
  28964. // Look through a list of predicate/alt pairs, returning alts for the
  28965. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  28966. // unpredicated config which behaves as "always true." If !complete
  28967. // then we stop at the first predicate that evaluates to true. This
  28968. // includes pairs with null predicates.
  28969. //
  28970. ParserATNSimulator.prototype.evalSemanticContext = function (predPredictions, outerContext, complete) {
  28971. var predictions = new BitSet();
  28972. for (var i = 0; i < predPredictions.length; i++) {
  28973. var pair = predPredictions[i];
  28974. if (pair.pred === SemanticContext.NONE) {
  28975. predictions.add(pair.alt);
  28976. if (!complete) {
  28977. break;
  28978. }
  28979. continue;
  28980. }
  28981. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  28982. if (this.debug || this.dfa_debug) {
  28983. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  28984. }
  28985. if (predicateEvaluationResult) {
  28986. if (this.debug || this.dfa_debug) {
  28987. console.log("PREDICT " + pair.alt);
  28988. }
  28989. predictions.add(pair.alt);
  28990. if (!complete) {
  28991. break;
  28992. }
  28993. }
  28994. }
  28995. return predictions;
  28996. };
  28997. // TODO: If we are doing predicates, there is no point in pursuing
  28998. // closure operations if we reach a DFA state that uniquely predicts
  28999. // alternative. We will not be caching that DFA state and it is a
  29000. // waste to pursue the closure. Might have to advance when we do
  29001. // ambig detection thought :(
  29002. //
  29003. ParserATNSimulator.prototype.closure = function (config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  29004. var initialDepth = 0;
  29005. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates, fullCtx, initialDepth, treatEofAsEpsilon);
  29006. };
  29007. ParserATNSimulator.prototype.closureCheckingStopState = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  29008. if (this.debug || this.debug_closure) {
  29009. console.log("closure(" + config.toString(this.parser, true) + ")");
  29010. // console.log("configs(" + configs.toString() + ")");
  29011. if (config.reachesIntoOuterContext > 50) {
  29012. throw "problem";
  29013. }
  29014. }
  29015. if (config.state instanceof RuleStopState) {
  29016. // We hit rule end. If we have context info, use it
  29017. // run thru all possible stack tops in ctx
  29018. if (!config.context.isEmpty()) {
  29019. for (var i = 0; i < config.context.length; i++) {
  29020. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  29021. if (fullCtx) {
  29022. configs.add(new ATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config), this.mergeCache);
  29023. continue;
  29024. } else {
  29025. // we have no context info, just chase follow links (if greedy)
  29026. if (this.debug) {
  29027. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  29028. }
  29029. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  29030. }
  29031. continue;
  29032. }
  29033. var returnState = this.atn.states[config.context.getReturnState(i)];
  29034. var newContext = config.context.getParent(i); // "pop" return state
  29035. var parms = { state: returnState, alt: config.alt, context: newContext, semanticContext: config.semanticContext };
  29036. var c = new ATNConfig(parms, null);
  29037. // While we have context to pop back from, we may have
  29038. // gotten that context AFTER having falling off a rule.
  29039. // Make sure we track that we are now out of context.
  29040. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  29041. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  29042. }
  29043. return;
  29044. } else if (fullCtx) {
  29045. // reached end of start rule
  29046. configs.add(config, this.mergeCache);
  29047. return;
  29048. } else {
  29049. // else if we have no context info, just chase follow links (if greedy)
  29050. if (this.debug) {
  29051. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  29052. }
  29053. }
  29054. }
  29055. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  29056. };
  29057. // Do the actual work of walking epsilon edges//
  29058. ParserATNSimulator.prototype.closure_ = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  29059. var p = config.state;
  29060. // optimization
  29061. if (!p.epsilonOnlyTransitions) {
  29062. configs.add(config, this.mergeCache);
  29063. // make sure to not return here, because EOF transitions can act as
  29064. // both epsilon transitions and non-epsilon transitions.
  29065. }
  29066. for (var i = 0; i < p.transitions.length; i++) {
  29067. if (i == 0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config)) continue;
  29068. var t = p.transitions[i];
  29069. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  29070. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  29071. if (c !== null) {
  29072. if (!t.isEpsilon && closureBusy.add(c) !== c) {
  29073. // avoid infinite recursion for EOF* and EOF+
  29074. continue;
  29075. }
  29076. var newDepth = depth;
  29077. if (config.state instanceof RuleStopState) {
  29078. // target fell off end of rule; mark resulting c as having dipped into outer context
  29079. // We can't get here if incoming config was rule stop and we had context
  29080. // track how far we dip into outer context. Might
  29081. // come in handy and we avoid evaluating context dependent
  29082. // preds if this is > 0.
  29083. if (closureBusy.add(c) !== c) {
  29084. // avoid infinite recursion for right-recursive rules
  29085. continue;
  29086. }
  29087. if (this._dfa !== null && this._dfa.precedenceDfa) {
  29088. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  29089. c.precedenceFilterSuppressed = true;
  29090. }
  29091. }
  29092. c.reachesIntoOuterContext += 1;
  29093. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  29094. newDepth -= 1;
  29095. if (this.debug) {
  29096. console.log("dips into outer ctx: " + c);
  29097. }
  29098. } else if (t instanceof RuleTransition) {
  29099. // latch when newDepth goes negative - once we step out of the entry context we can't return
  29100. if (newDepth >= 0) {
  29101. newDepth += 1;
  29102. }
  29103. }
  29104. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  29105. }
  29106. }
  29107. };
  29108. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function (config) {
  29109. // return False
  29110. var p = config.state;
  29111. // First check to see if we are in StarLoopEntryState generated during
  29112. // left-recursion elimination. For efficiency, also check if
  29113. // the context has an empty stack case. If so, it would mean
  29114. // global FOLLOW so we can't perform optimization
  29115. // Are we the special loop entry/exit state? or SLL wildcard
  29116. if (p.stateType != ATNState.STAR_LOOP_ENTRY) return false;
  29117. if (p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision || config.context.isEmpty() || config.context.hasEmptyPath()) return false;
  29118. // Require all return states to return back to the same rule that p is in.
  29119. var numCtxs = config.context.length;
  29120. for (var i = 0; i < numCtxs; i++) {
  29121. // for each stack context
  29122. var returnState = this.atn.states[config.context.getReturnState(i)];
  29123. if (returnState.ruleIndex != p.ruleIndex) return false;
  29124. }
  29125. var decisionStartState = p.transitions[0].target;
  29126. var blockEndStateNum = decisionStartState.endState.stateNumber;
  29127. var blockEndState = this.atn.states[blockEndStateNum];
  29128. // Verify that the top of each stack context leads to loop entry/exit
  29129. // state through epsilon edges and w/o leaving rule.
  29130. for (var i = 0; i < numCtxs; i++) {
  29131. // for each stack context
  29132. var returnStateNumber = config.context.getReturnState(i);
  29133. var returnState = this.atn.states[returnStateNumber];
  29134. // all states must have single outgoing epsilon edge
  29135. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon) return false;
  29136. // Look for prefix op case like 'not expr', (' type ')' expr
  29137. var returnStateTarget = returnState.transitions[0].target;
  29138. if (returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p) continue;
  29139. // Look for 'expr op expr' or case where expr's return state is block end
  29140. // of (...)* internal block; the block end points to loop back
  29141. // which points to p but we don't need to check that
  29142. if (returnState == blockEndState) continue;
  29143. // Look for ternary expr ? expr : expr. The return state points at block end,
  29144. // which points at loop entry state
  29145. if (returnStateTarget == blockEndState) continue;
  29146. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  29147. // return state points at block end state of (...)* internal block
  29148. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1 && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p) continue;
  29149. // anything else ain't conforming
  29150. return false;
  29151. }
  29152. return true;
  29153. };
  29154. ParserATNSimulator.prototype.getRuleName = function (index) {
  29155. if (this.parser !== null && index >= 0) {
  29156. return this.parser.ruleNames[index];
  29157. } else {
  29158. return "<rule " + index + ">";
  29159. }
  29160. };
  29161. ParserATNSimulator.prototype.getEpsilonTarget = function (config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  29162. switch (t.serializationType) {
  29163. case Transition.RULE:
  29164. return this.ruleTransition(config, t);
  29165. case Transition.PRECEDENCE:
  29166. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  29167. case Transition.PREDICATE:
  29168. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  29169. case Transition.ACTION:
  29170. return this.actionTransition(config, t);
  29171. case Transition.EPSILON:
  29172. return new ATNConfig({ state: t.target }, config);
  29173. case Transition.ATOM:
  29174. case Transition.RANGE:
  29175. case Transition.SET:
  29176. // EOF transitions act like epsilon transitions after the first EOF
  29177. // transition is traversed
  29178. if (treatEofAsEpsilon) {
  29179. if (t.matches(Token.EOF, 0, 1)) {
  29180. return new ATNConfig({ state: t.target }, config);
  29181. }
  29182. }
  29183. return null;
  29184. default:
  29185. return null;
  29186. }
  29187. };
  29188. ParserATNSimulator.prototype.actionTransition = function (config, t) {
  29189. if (this.debug) {
  29190. var index = t.actionIndex == -1 ? 65535 : t.actionIndex;
  29191. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  29192. }
  29193. return new ATNConfig({ state: t.target }, config);
  29194. };
  29195. ParserATNSimulator.prototype.precedenceTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29196. if (this.debug) {
  29197. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.precedence + ">=_p, ctx dependent=true");
  29198. if (this.parser !== null) {
  29199. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29200. }
  29201. }
  29202. var c = null;
  29203. if (collectPredicates && inContext) {
  29204. if (fullCtx) {
  29205. // In full context mode, we can evaluate predicates on-the-fly
  29206. // during closure, which dramatically reduces the size of
  29207. // the config sets. It also obviates the need to test predicates
  29208. // later during conflict resolution.
  29209. var currentPosition = this._input.index;
  29210. this._input.seek(this._startIndex);
  29211. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29212. this._input.seek(currentPosition);
  29213. if (predSucceeds) {
  29214. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29215. }
  29216. } else {
  29217. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29218. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29219. }
  29220. } else {
  29221. c = new ATNConfig({ state: pt.target }, config);
  29222. }
  29223. if (this.debug) {
  29224. console.log("config from pred transition=" + c);
  29225. }
  29226. return c;
  29227. };
  29228. ParserATNSimulator.prototype.predTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29229. if (this.debug) {
  29230. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex + ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  29231. if (this.parser !== null) {
  29232. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29233. }
  29234. }
  29235. var c = null;
  29236. if (collectPredicates && (pt.isCtxDependent && inContext || !pt.isCtxDependent)) {
  29237. if (fullCtx) {
  29238. // In full context mode, we can evaluate predicates on-the-fly
  29239. // during closure, which dramatically reduces the size of
  29240. // the config sets. It also obviates the need to test predicates
  29241. // later during conflict resolution.
  29242. var currentPosition = this._input.index;
  29243. this._input.seek(this._startIndex);
  29244. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29245. this._input.seek(currentPosition);
  29246. if (predSucceeds) {
  29247. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29248. }
  29249. } else {
  29250. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29251. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29252. }
  29253. } else {
  29254. c = new ATNConfig({ state: pt.target }, config);
  29255. }
  29256. if (this.debug) {
  29257. console.log("config from pred transition=" + c);
  29258. }
  29259. return c;
  29260. };
  29261. ParserATNSimulator.prototype.ruleTransition = function (config, t) {
  29262. if (this.debug) {
  29263. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  29264. }
  29265. var returnState = t.followState;
  29266. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  29267. return new ATNConfig({ state: t.target, context: newContext }, config);
  29268. };
  29269. ParserATNSimulator.prototype.getConflictingAlts = function (configs) {
  29270. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  29271. return PredictionMode.getAlts(altsets);
  29272. };
  29273. // Sam pointed out a problem with the previous definition, v3, of
  29274. // ambiguous states. If we have another state associated with conflicting
  29275. // alternatives, we should keep going. For example, the following grammar
  29276. //
  29277. // s : (ID | ID ID?) ';' ;
  29278. //
  29279. // When the ATN simulation reaches the state before ';', it has a DFA
  29280. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  29281. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  29282. // because alternative to has another way to continue, via [6|2|[]].
  29283. // The key is that we have a single state that has config's only associated
  29284. // with a single alternative, 2, and crucially the state transitions
  29285. // among the configurations are all non-epsilon transitions. That means
  29286. // we don't consider any conflicts that include alternative 2. So, we
  29287. // ignore the conflict between alts 1 and 2. We ignore a set of
  29288. // conflicting alts when there is an intersection with an alternative
  29289. // associated with a single alt state in the state&rarr;config-list map.
  29290. //
  29291. // It's also the case that we might have two conflicting configurations but
  29292. // also a 3rd nonconflicting configuration for a different alternative:
  29293. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  29294. //
  29295. // a : A | A | A B ;
  29296. //
  29297. // After matching input A, we reach the stop state for rule A, state 1.
  29298. // State 8 is the state right before B. Clearly alternatives 1 and 2
  29299. // conflict and no amount of further lookahead will separate the two.
  29300. // However, alternative 3 will be able to continue and so we do not
  29301. // stop working on this state. In the previous example, we're concerned
  29302. // with states associated with the conflicting alternatives. Here alt
  29303. // 3 is not associated with the conflicting configs, but since we can continue
  29304. // looking for input reasonably, I don't declare the state done. We
  29305. // ignore a set of conflicting alts when we have an alternative
  29306. // that we still need to pursue.
  29307. //
  29308. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function (configs) {
  29309. var conflictingAlts = null;
  29310. if (configs.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  29311. conflictingAlts = new BitSet();
  29312. conflictingAlts.add(configs.uniqueAlt);
  29313. } else {
  29314. conflictingAlts = configs.conflictingAlts;
  29315. }
  29316. return conflictingAlts;
  29317. };
  29318. ParserATNSimulator.prototype.getTokenName = function (t) {
  29319. if (t === Token.EOF) {
  29320. return "EOF";
  29321. }
  29322. if (this.parser !== null && this.parser.literalNames !== null) {
  29323. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  29324. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  29325. console.log("" + this.parser.getInputStream().getTokens());
  29326. } else {
  29327. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  29328. return name + "<" + t + ">";
  29329. }
  29330. }
  29331. return "" + t;
  29332. };
  29333. ParserATNSimulator.prototype.getLookaheadName = function (input) {
  29334. return this.getTokenName(input.LA(1));
  29335. };
  29336. // Used for debugging in adaptivePredict around execATN but I cut
  29337. // it out for clarity now that alg. works well. We can leave this
  29338. // "dead" code for a bit.
  29339. //
  29340. ParserATNSimulator.prototype.dumpDeadEndConfigs = function (nvae) {
  29341. console.log("dead end configs: ");
  29342. var decs = nvae.getDeadEndConfigs();
  29343. for (var i = 0; i < decs.length; i++) {
  29344. var c = decs[i];
  29345. var trans = "no edges";
  29346. if (c.state.transitions.length > 0) {
  29347. var t = c.state.transitions[0];
  29348. if (t instanceof AtomTransition) {
  29349. trans = "Atom " + this.getTokenName(t.label);
  29350. } else if (t instanceof SetTransition) {
  29351. var neg = t instanceof NotSetTransition;
  29352. trans = (neg ? "~" : "") + "Set " + t.set;
  29353. }
  29354. }
  29355. console.error(c.toString(this.parser, true) + ":" + trans);
  29356. }
  29357. };
  29358. ParserATNSimulator.prototype.noViableAlt = function (input, outerContext, configs, startIndex) {
  29359. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  29360. };
  29361. ParserATNSimulator.prototype.getUniqueAlt = function (configs) {
  29362. var alt = ATN.INVALID_ALT_NUMBER;
  29363. for (var i = 0; i < configs.items.length; i++) {
  29364. var c = configs.items[i];
  29365. if (alt === ATN.INVALID_ALT_NUMBER) {
  29366. alt = c.alt; // found first alt
  29367. } else if (c.alt !== alt) {
  29368. return ATN.INVALID_ALT_NUMBER;
  29369. }
  29370. }
  29371. return alt;
  29372. };
  29373. //
  29374. // Add an edge to the DFA, if possible. This method calls
  29375. // {@link //addDFAState} to ensure the {@code to} state is present in the
  29376. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  29377. // range of edges that can be represented in the DFA tables, this method
  29378. // returns without adding the edge to the DFA.
  29379. //
  29380. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  29381. // Otherwise, this method returns the {@link DFAState} returned by calling
  29382. // {@link //addDFAState} for the {@code to} state.</p>
  29383. //
  29384. // @param dfa The DFA
  29385. // @param from The source state for the edge
  29386. // @param t The input symbol
  29387. // @param to The target state for the edge
  29388. //
  29389. // @return If {@code to} is {@code null}, this method returns {@code null};
  29390. // otherwise this method returns the result of calling {@link //addDFAState}
  29391. // on {@code to}
  29392. //
  29393. ParserATNSimulator.prototype.addDFAEdge = function (dfa, from_, t, to) {
  29394. if (this.debug) {
  29395. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  29396. }
  29397. if (to === null) {
  29398. return null;
  29399. }
  29400. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  29401. if (from_ === null || t < -1 || t > this.atn.maxTokenType) {
  29402. return to;
  29403. }
  29404. if (from_.edges === null) {
  29405. from_.edges = [];
  29406. }
  29407. from_.edges[t + 1] = to; // connect
  29408. if (this.debug) {
  29409. var literalNames = this.parser === null ? null : this.parser.literalNames;
  29410. var symbolicNames = this.parser === null ? null : this.parser.symbolicNames;
  29411. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  29412. }
  29413. return to;
  29414. };
  29415. //
  29416. // Add state {@code D} to the DFA if it is not already present, and return
  29417. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  29418. // is already in the DFA, the existing state is returned. Otherwise this
  29419. // method returns {@code D} after adding it to the DFA.
  29420. //
  29421. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  29422. // does not change the DFA.</p>
  29423. //
  29424. // @param dfa The dfa
  29425. // @param D The DFA state to add
  29426. // @return The state stored in the DFA. This will be either the existing
  29427. // state if {@code D} is already in the DFA, or {@code D} itself if the
  29428. // state was not already present.
  29429. //
  29430. ParserATNSimulator.prototype.addDFAState = function (dfa, D) {
  29431. if (D == ATNSimulator.ERROR) {
  29432. return D;
  29433. }
  29434. var existing = dfa.states.get(D);
  29435. if (existing !== null) {
  29436. return existing;
  29437. }
  29438. D.stateNumber = dfa.states.length;
  29439. if (!D.configs.readOnly) {
  29440. D.configs.optimizeConfigs(this);
  29441. D.configs.setReadonly(true);
  29442. }
  29443. dfa.states.add(D);
  29444. if (this.debug) {
  29445. console.log("adding new DFA state: " + D);
  29446. }
  29447. return D;
  29448. };
  29449. ParserATNSimulator.prototype.reportAttemptingFullContext = function (dfa, conflictingAlts, configs, startIndex, stopIndex) {
  29450. if (this.debug || this.retry_debug) {
  29451. var interval = new Interval(startIndex, stopIndex + 1);
  29452. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29453. }
  29454. if (this.parser !== null) {
  29455. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  29456. }
  29457. };
  29458. ParserATNSimulator.prototype.reportContextSensitivity = function (dfa, prediction, configs, startIndex, stopIndex) {
  29459. if (this.debug || this.retry_debug) {
  29460. var interval = new Interval(startIndex, stopIndex + 1);
  29461. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29462. }
  29463. if (this.parser !== null) {
  29464. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  29465. }
  29466. };
  29467. // If context sensitive parsing, we know it's ambiguity not conflict//
  29468. ParserATNSimulator.prototype.reportAmbiguity = function (dfa, D, startIndex, stopIndex, exact, ambigAlts, configs) {
  29469. if (this.debug || this.retry_debug) {
  29470. var interval = new Interval(startIndex, stopIndex + 1);
  29471. console.log("reportAmbiguity " + ambigAlts + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29472. }
  29473. if (this.parser !== null) {
  29474. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  29475. }
  29476. };
  29477. exports.ParserATNSimulator = ParserATNSimulator;
  29478. /***/ }),
  29479. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  29480. /*!***************************************************!*\
  29481. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  29482. \***************************************************/
  29483. /*! no static exports found */
  29484. /***/ (function(module, exports, __webpack_require__) {
  29485. "use strict";
  29486. //
  29487. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29488. * Use of this file is governed by the BSD 3-clause license that
  29489. * can be found in the LICENSE.txt file in the project root.
  29490. */
  29491. //
  29492. //
  29493. // This enumeration defines the prediction modes available in ANTLR 4 along with
  29494. // utility methods for analyzing configuration sets for conflicts and/or
  29495. // ambiguities.
  29496. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  29497. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  29498. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  29499. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  29500. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  29501. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  29502. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  29503. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  29504. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  29505. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  29506. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  29507. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  29508. function PredictionMode() {
  29509. return this;
  29510. }
  29511. //
  29512. // The SLL(*) prediction mode. This prediction mode ignores the current
  29513. // parser context when making predictions. This is the fastest prediction
  29514. // mode, and provides correct results for many grammars. This prediction
  29515. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  29516. // may result in syntax errors for grammar and input combinations which are
  29517. // not SLL.
  29518. //
  29519. // <p>
  29520. // When using this prediction mode, the parser will either return a correct
  29521. // parse tree (i.e. the same parse tree that would be returned with the
  29522. // {@link //LL} prediction mode), or it will report a syntax error. If a
  29523. // syntax error is encountered when using the {@link //SLL} prediction mode,
  29524. // it may be due to either an actual syntax error in the input or indicate
  29525. // that the particular combination of grammar and input requires the more
  29526. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  29527. //
  29528. // <p>
  29529. // This prediction mode does not provide any guarantees for prediction
  29530. // behavior for syntactically-incorrect inputs.</p>
  29531. //
  29532. PredictionMode.SLL = 0;
  29533. //
  29534. // The LL(*) prediction mode. This prediction mode allows the current parser
  29535. // context to be used for resolving SLL conflicts that occur during
  29536. // prediction. This is the fastest prediction mode that guarantees correct
  29537. // parse results for all combinations of grammars with syntactically correct
  29538. // inputs.
  29539. //
  29540. // <p>
  29541. // When using this prediction mode, the parser will make correct decisions
  29542. // for all syntactically-correct grammar and input combinations. However, in
  29543. // cases where the grammar is truly ambiguous this prediction mode might not
  29544. // report a precise answer for <em>exactly which</em> alternatives are
  29545. // ambiguous.</p>
  29546. //
  29547. // <p>
  29548. // This prediction mode does not provide any guarantees for prediction
  29549. // behavior for syntactically-incorrect inputs.</p>
  29550. //
  29551. PredictionMode.LL = 1;
  29552. //
  29553. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  29554. // the correctness guarantees provided by the {@link //LL} prediction mode,
  29555. // this prediction mode instructs the prediction algorithm to determine the
  29556. // complete and exact set of ambiguous alternatives for every ambiguous
  29557. // decision encountered while parsing.
  29558. //
  29559. // <p>
  29560. // This prediction mode may be used for diagnosing ambiguities during
  29561. // grammar development. Due to the performance overhead of calculating sets
  29562. // of ambiguous alternatives, this prediction mode should be avoided when
  29563. // the exact results are not necessary.</p>
  29564. //
  29565. // <p>
  29566. // This prediction mode does not provide any guarantees for prediction
  29567. // behavior for syntactically-incorrect inputs.</p>
  29568. //
  29569. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  29570. //
  29571. // Computes the SLL prediction termination condition.
  29572. //
  29573. // <p>
  29574. // This method computes the SLL prediction termination condition for both of
  29575. // the following cases.</p>
  29576. //
  29577. // <ul>
  29578. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  29579. // <li>Pure SLL without LL fallback</li>
  29580. // </ul>
  29581. //
  29582. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  29583. //
  29584. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  29585. // ensured regardless of how the termination condition is computed by this
  29586. // method. Due to the substantially higher cost of LL prediction, the
  29587. // prediction should only fall back to LL when the additional lookahead
  29588. // cannot lead to a unique SLL prediction.</p>
  29589. //
  29590. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  29591. // conflicting subsets should fall back to full LL, even if the
  29592. // configuration sets don't resolve to the same alternative (e.g.
  29593. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  29594. // configuration, SLL could continue with the hopes that more lookahead will
  29595. // resolve via one of those non-conflicting configurations.</p>
  29596. //
  29597. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  29598. // stops when it sees only conflicting configuration subsets. In contrast,
  29599. // full LL keeps going when there is uncertainty.</p>
  29600. //
  29601. // <p><strong>HEURISTIC</strong></p>
  29602. //
  29603. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  29604. // unless we see a state that only has one alternative associated with it.
  29605. // The single-alt-state thing lets prediction continue upon rules like
  29606. // (otherwise, it would admit defeat too soon):</p>
  29607. //
  29608. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  29609. //
  29610. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  29611. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  29612. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  29613. // processing this node because alternative to has another way to continue,
  29614. // via {@code [6|2|[]]}.</p>
  29615. //
  29616. // <p>It also let's us continue for this rule:</p>
  29617. //
  29618. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  29619. //
  29620. // <p>After matching input A, we reach the stop state for rule A, state 1.
  29621. // State 8 is the state right before B. Clearly alternatives 1 and 2
  29622. // conflict and no amount of further lookahead will separate the two.
  29623. // However, alternative 3 will be able to continue and so we do not stop
  29624. // working on this state. In the previous example, we're concerned with
  29625. // states associated with the conflicting alternatives. Here alt 3 is not
  29626. // associated with the conflicting configs, but since we can continue
  29627. // looking for input reasonably, don't declare the state done.</p>
  29628. //
  29629. // <p><strong>PURE SLL PARSING</strong></p>
  29630. //
  29631. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  29632. // combine stack contexts for configurations that differ only by semantic
  29633. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  29634. //
  29635. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  29636. //
  29637. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  29638. // states because they need to create the DFA cache that works in all
  29639. // semantic situations. In contrast, full LL evaluates predicates collected
  29640. // during start state computation so it can ignore predicates thereafter.
  29641. // This means that SLL termination detection can totally ignore semantic
  29642. // predicates.</p>
  29643. //
  29644. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  29645. // semantic predicate contexts so we might see two configurations like the
  29646. // following.</p>
  29647. //
  29648. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  29649. //
  29650. // <p>Before testing these configurations against others, we have to merge
  29651. // {@code x} and {@code x'} (without modifying the existing configurations).
  29652. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  29653. // the following configurations.</p>
  29654. //
  29655. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  29656. //
  29657. // <p>If the configuration set has predicates (as indicated by
  29658. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  29659. // the configurations to strip out all of the predicates so that a standard
  29660. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  29661. //
  29662. PredictionMode.hasSLLConflictTerminatingPrediction = function (mode, configs) {
  29663. // Configs in rule stop states indicate reaching the end of the decision
  29664. // rule (local context) or end of start rule (full context). If all
  29665. // configs meet this condition, then none of the configurations is able
  29666. // to match additional input so we terminate prediction.
  29667. //
  29668. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  29669. return true;
  29670. }
  29671. // pure SLL mode parsing
  29672. if (mode === PredictionMode.SLL) {
  29673. // Don't bother with combining configs from different semantic
  29674. // contexts if we can fail over to full LL; costs more time
  29675. // since we'll often fail over anyway.
  29676. if (configs.hasSemanticContext) {
  29677. // dup configs, tossing out semantic predicates
  29678. var dup = new ATNConfigSet();
  29679. for (var i = 0; i < configs.items.length; i++) {
  29680. var c = configs.items[i];
  29681. c = new ATNConfig({ semanticContext: SemanticContext.NONE }, c);
  29682. dup.add(c);
  29683. }
  29684. configs = dup;
  29685. }
  29686. // now we have combined contexts for configs with dissimilar preds
  29687. }
  29688. // pure SLL or combined SLL+LL mode parsing
  29689. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  29690. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  29691. };
  29692. // Checks if any configuration in {@code configs} is in a
  29693. // {@link RuleStopState}. Configurations meeting this condition have reached
  29694. // the end of the decision rule (local context) or end of start rule (full
  29695. // context).
  29696. //
  29697. // @param configs the configuration set to test
  29698. // @return {@code true} if any configuration in {@code configs} is in a
  29699. // {@link RuleStopState}, otherwise {@code false}
  29700. PredictionMode.hasConfigInRuleStopState = function (configs) {
  29701. for (var i = 0; i < configs.items.length; i++) {
  29702. var c = configs.items[i];
  29703. if (c.state instanceof RuleStopState) {
  29704. return true;
  29705. }
  29706. }
  29707. return false;
  29708. };
  29709. // Checks if all configurations in {@code configs} are in a
  29710. // {@link RuleStopState}. Configurations meeting this condition have reached
  29711. // the end of the decision rule (local context) or end of start rule (full
  29712. // context).
  29713. //
  29714. // @param configs the configuration set to test
  29715. // @return {@code true} if all configurations in {@code configs} are in a
  29716. // {@link RuleStopState}, otherwise {@code false}
  29717. PredictionMode.allConfigsInRuleStopStates = function (configs) {
  29718. for (var i = 0; i < configs.items.length; i++) {
  29719. var c = configs.items[i];
  29720. if (!(c.state instanceof RuleStopState)) {
  29721. return false;
  29722. }
  29723. }
  29724. return true;
  29725. };
  29726. //
  29727. // Full LL prediction termination.
  29728. //
  29729. // <p>Can we stop looking ahead during ATN simulation or is there some
  29730. // uncertainty as to which alternative we will ultimately pick, after
  29731. // consuming more input? Even if there are partial conflicts, we might know
  29732. // that everything is going to resolve to the same minimum alternative. That
  29733. // means we can stop since no more lookahead will change that fact. On the
  29734. // other hand, there might be multiple conflicts that resolve to different
  29735. // minimums. That means we need more look ahead to decide which of those
  29736. // alternatives we should predict.</p>
  29737. //
  29738. // <p>The basic idea is to split the set of configurations {@code C}, into
  29739. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  29740. // non-conflicting configurations. Two configurations conflict if they have
  29741. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  29742. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  29743. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  29744. //
  29745. // <p>Reduce these configuration subsets to the set of possible alternatives.
  29746. // You can compute the alternative subsets in one pass as follows:</p>
  29747. //
  29748. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  29749. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  29750. //
  29751. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  29752. //
  29753. // <pre>
  29754. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  29755. // alt and not pred
  29756. // </pre>
  29757. //
  29758. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  29759. //
  29760. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  29761. // {@code s} and {@code ctx}.</p>
  29762. //
  29763. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  29764. // the union of these alternative subsets is a singleton, then no amount of
  29765. // more lookahead will help us. We will always pick that alternative. If,
  29766. // however, there is more than one alternative, then we are uncertain which
  29767. // alternative to predict and must continue looking for resolution. We may
  29768. // or may not discover an ambiguity in the future, even if there are no
  29769. // conflicting subsets this round.</p>
  29770. //
  29771. // <p>The biggest sin is to terminate early because it means we've made a
  29772. // decision but were uncertain as to the eventual outcome. We haven't used
  29773. // enough lookahead. On the other hand, announcing a conflict too late is no
  29774. // big deal; you will still have the conflict. It's just inefficient. It
  29775. // might even look until the end of file.</p>
  29776. //
  29777. // <p>No special consideration for semantic predicates is required because
  29778. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  29779. // no configuration contains a semantic context during the termination
  29780. // check.</p>
  29781. //
  29782. // <p><strong>CONFLICTING CONFIGS</strong></p>
  29783. //
  29784. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  29785. // when {@code i!=j} but {@code x=x'}. Because we merge all
  29786. // {@code (s, i, _)} configurations together, that means that there are at
  29787. // most {@code n} configurations associated with state {@code s} for
  29788. // {@code n} possible alternatives in the decision. The merged stacks
  29789. // complicate the comparison of configuration contexts {@code x} and
  29790. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  29791. // merge and checking to see if the merged result is either {@code x} or
  29792. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  29793. // is the superset, then {@code i} is the only possible prediction since the
  29794. // others resolve to {@code min(i)} as well. However, if {@code x} is
  29795. // associated with {@code j>i} then at least one stack configuration for
  29796. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  29797. // should keep going, looking for more lookahead due to the uncertainty.</p>
  29798. //
  29799. // <p>For simplicity, I'm doing a equality check between {@code x} and
  29800. // {@code x'} that lets the algorithm continue to consume lookahead longer
  29801. // than necessary. The reason I like the equality is of course the
  29802. // simplicity but also because that is the test you need to detect the
  29803. // alternatives that are actually in conflict.</p>
  29804. //
  29805. // <p><strong>CONTINUE/STOP RULE</strong></p>
  29806. //
  29807. // <p>Continue if union of resolved alternative sets from non-conflicting and
  29808. // conflicting alternative subsets has more than one alternative. We are
  29809. // uncertain about which alternative to predict.</p>
  29810. //
  29811. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  29812. // alternatives are still in the running for the amount of input we've
  29813. // consumed at this point. The conflicting sets let us to strip away
  29814. // configurations that won't lead to more states because we resolve
  29815. // conflicts to the configuration with a minimum alternate for the
  29816. // conflicting set.</p>
  29817. //
  29818. // <p><strong>CASES</strong></p>
  29819. //
  29820. // <ul>
  29821. //
  29822. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  29823. //
  29824. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  29825. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  29826. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  29827. // {@code {1,3}} =&gt; continue
  29828. // </li>
  29829. //
  29830. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  29831. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  29832. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  29833. // {@code {1}} =&gt; stop and predict 1</li>
  29834. //
  29835. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  29836. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  29837. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  29838. // ambiguity {@code {1,2}}</li>
  29839. //
  29840. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  29841. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  29842. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  29843. //
  29844. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  29845. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  29846. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  29847. //
  29848. // </ul>
  29849. //
  29850. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  29851. //
  29852. // <p>If all states report the same conflicting set of alternatives, then we
  29853. // know we have the exact ambiguity set.</p>
  29854. //
  29855. // <p><code>|A_<em>i</em>|&gt;1</code> and
  29856. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  29857. //
  29858. // <p>In other words, we continue examining lookahead until all {@code A_i}
  29859. // have more than one alternative and all {@code A_i} are the same. If
  29860. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  29861. // because the resolved set is {@code {1}}. To determine what the real
  29862. // ambiguity is, we have to know whether the ambiguity is between one and
  29863. // two or one and three so we keep going. We can only stop prediction when
  29864. // we need exact ambiguity detection when the sets look like
  29865. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  29866. //
  29867. PredictionMode.resolvesToJustOneViableAlt = function (altsets) {
  29868. return PredictionMode.getSingleViableAlt(altsets);
  29869. };
  29870. //
  29871. // Determines if every alternative subset in {@code altsets} contains more
  29872. // than one alternative.
  29873. //
  29874. // @param altsets a collection of alternative subsets
  29875. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  29876. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  29877. //
  29878. PredictionMode.allSubsetsConflict = function (altsets) {
  29879. return !PredictionMode.hasNonConflictingAltSet(altsets);
  29880. };
  29881. //
  29882. // Determines if any single alternative subset in {@code altsets} contains
  29883. // exactly one alternative.
  29884. //
  29885. // @param altsets a collection of alternative subsets
  29886. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  29887. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  29888. //
  29889. PredictionMode.hasNonConflictingAltSet = function (altsets) {
  29890. for (var i = 0; i < altsets.length; i++) {
  29891. var alts = altsets[i];
  29892. if (alts.length === 1) {
  29893. return true;
  29894. }
  29895. }
  29896. return false;
  29897. };
  29898. //
  29899. // Determines if any single alternative subset in {@code altsets} contains
  29900. // more than one alternative.
  29901. //
  29902. // @param altsets a collection of alternative subsets
  29903. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  29904. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  29905. //
  29906. PredictionMode.hasConflictingAltSet = function (altsets) {
  29907. for (var i = 0; i < altsets.length; i++) {
  29908. var alts = altsets[i];
  29909. if (alts.length > 1) {
  29910. return true;
  29911. }
  29912. }
  29913. return false;
  29914. };
  29915. //
  29916. // Determines if every alternative subset in {@code altsets} is equivalent.
  29917. //
  29918. // @param altsets a collection of alternative subsets
  29919. // @return {@code true} if every member of {@code altsets} is equal to the
  29920. // others, otherwise {@code false}
  29921. //
  29922. PredictionMode.allSubsetsEqual = function (altsets) {
  29923. var first = null;
  29924. for (var i = 0; i < altsets.length; i++) {
  29925. var alts = altsets[i];
  29926. if (first === null) {
  29927. first = alts;
  29928. } else if (alts !== first) {
  29929. return false;
  29930. }
  29931. }
  29932. return true;
  29933. };
  29934. //
  29935. // Returns the unique alternative predicted by all alternative subsets in
  29936. // {@code altsets}. If no such alternative exists, this method returns
  29937. // {@link ATN//INVALID_ALT_NUMBER}.
  29938. //
  29939. // @param altsets a collection of alternative subsets
  29940. //
  29941. PredictionMode.getUniqueAlt = function (altsets) {
  29942. var all = PredictionMode.getAlts(altsets);
  29943. if (all.length === 1) {
  29944. return all.minValue();
  29945. } else {
  29946. return ATN.INVALID_ALT_NUMBER;
  29947. }
  29948. };
  29949. // Gets the complete set of represented alternatives for a collection of
  29950. // alternative subsets. This method returns the union of each {@link BitSet}
  29951. // in {@code altsets}.
  29952. //
  29953. // @param altsets a collection of alternative subsets
  29954. // @return the set of represented alternatives in {@code altsets}
  29955. //
  29956. PredictionMode.getAlts = function (altsets) {
  29957. var all = new BitSet();
  29958. altsets.map(function (alts) {
  29959. all.or(alts);
  29960. });
  29961. return all;
  29962. };
  29963. //
  29964. // This function gets the conflicting alt subsets from a configuration set.
  29965. // For each configuration {@code c} in {@code configs}:
  29966. //
  29967. // <pre>
  29968. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  29969. // alt and not pred
  29970. // </pre>
  29971. PredictionMode.getConflictingAltSubsets = function (configs) {
  29972. var configToAlts = new Map();
  29973. configToAlts.hashFunction = function (cfg) {
  29974. hashStuff(cfg.state.stateNumber, cfg.context);
  29975. };
  29976. configToAlts.equalsFunction = function (c1, c2) {
  29977. return c1.state.stateNumber == c2.state.stateNumber && c1.context.equals(c2.context);
  29978. };
  29979. configs.items.map(function (cfg) {
  29980. var alts = configToAlts.get(cfg);
  29981. if (alts === null) {
  29982. alts = new BitSet();
  29983. configToAlts.put(cfg, alts);
  29984. }
  29985. alts.add(cfg.alt);
  29986. });
  29987. return configToAlts.getValues();
  29988. };
  29989. //
  29990. // Get a map from state to alt subset from a configuration set. For each
  29991. // configuration {@code c} in {@code configs}:
  29992. //
  29993. // <pre>
  29994. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  29995. // </pre>
  29996. //
  29997. PredictionMode.getStateToAltMap = function (configs) {
  29998. var m = new AltDict();
  29999. configs.items.map(function (c) {
  30000. var alts = m.get(c.state);
  30001. if (alts === null) {
  30002. alts = new BitSet();
  30003. m.put(c.state, alts);
  30004. }
  30005. alts.add(c.alt);
  30006. });
  30007. return m;
  30008. };
  30009. PredictionMode.hasStateAssociatedWithOneAlt = function (configs) {
  30010. var values = PredictionMode.getStateToAltMap(configs).values();
  30011. for (var i = 0; i < values.length; i++) {
  30012. if (values[i].length === 1) {
  30013. return true;
  30014. }
  30015. }
  30016. return false;
  30017. };
  30018. PredictionMode.getSingleViableAlt = function (altsets) {
  30019. var result = null;
  30020. for (var i = 0; i < altsets.length; i++) {
  30021. var alts = altsets[i];
  30022. var minAlt = alts.minValue();
  30023. if (result === null) {
  30024. result = minAlt;
  30025. } else if (result !== minAlt) {
  30026. // more than 1 viable alt
  30027. return ATN.INVALID_ALT_NUMBER;
  30028. }
  30029. }
  30030. return result;
  30031. };
  30032. exports.PredictionMode = PredictionMode;
  30033. /***/ }),
  30034. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  30035. /*!****************************************************!*\
  30036. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  30037. \****************************************************/
  30038. /*! no static exports found */
  30039. /***/ (function(module, exports, __webpack_require__) {
  30040. "use strict";
  30041. //
  30042. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30043. * Use of this file is governed by the BSD 3-clause license that
  30044. * can be found in the LICENSE.txt file in the project root.
  30045. */
  30046. //
  30047. // A tree structure used to record the semantic context in which
  30048. // an ATN configuration is valid. It's either a single predicate,
  30049. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  30050. //
  30051. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  30052. // {@link SemanticContext} within the scope of this outer class.</p>
  30053. //
  30054. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  30055. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  30056. function SemanticContext() {
  30057. return this;
  30058. }
  30059. SemanticContext.prototype.hashCode = function () {
  30060. var hash = new Hash();
  30061. this.updateHashCode(hash);
  30062. return hash.finish();
  30063. };
  30064. // For context independent predicates, we evaluate them without a local
  30065. // context (i.e., null context). That way, we can evaluate them without
  30066. // having to create proper rule-specific context during prediction (as
  30067. // opposed to the parser, which creates them naturally). In a practical
  30068. // sense, this avoids a cast exception from RuleContext to myruleContext.
  30069. //
  30070. // <p>For context dependent predicates, we must pass in a local context so that
  30071. // references such as $arg evaluate properly as _localctx.arg. We only
  30072. // capture context dependent predicates in the context in which we begin
  30073. // prediction, so we passed in the outer context here in case of context
  30074. // dependent predicate evaluation.</p>
  30075. //
  30076. SemanticContext.prototype.evaluate = function (parser, outerContext) {};
  30077. //
  30078. // Evaluate the precedence predicates for the context and reduce the result.
  30079. //
  30080. // @param parser The parser instance.
  30081. // @param outerContext The current parser context object.
  30082. // @return The simplified semantic context after precedence predicates are
  30083. // evaluated, which will be one of the following values.
  30084. // <ul>
  30085. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  30086. // precedence predicates are evaluated.</li>
  30087. // <li>{@code null}: if the predicate simplifies to {@code false} after
  30088. // precedence predicates are evaluated.</li>
  30089. // <li>{@code this}: if the semantic context is not changed as a result of
  30090. // precedence predicate evaluation.</li>
  30091. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  30092. // semantic context after precedence predicates are evaluated.</li>
  30093. // </ul>
  30094. //
  30095. SemanticContext.prototype.evalPrecedence = function (parser, outerContext) {
  30096. return this;
  30097. };
  30098. SemanticContext.andContext = function (a, b) {
  30099. if (a === null || a === SemanticContext.NONE) {
  30100. return b;
  30101. }
  30102. if (b === null || b === SemanticContext.NONE) {
  30103. return a;
  30104. }
  30105. var result = new AND(a, b);
  30106. if (result.opnds.length === 1) {
  30107. return result.opnds[0];
  30108. } else {
  30109. return result;
  30110. }
  30111. };
  30112. SemanticContext.orContext = function (a, b) {
  30113. if (a === null) {
  30114. return b;
  30115. }
  30116. if (b === null) {
  30117. return a;
  30118. }
  30119. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  30120. return SemanticContext.NONE;
  30121. }
  30122. var result = new OR(a, b);
  30123. if (result.opnds.length === 1) {
  30124. return result.opnds[0];
  30125. } else {
  30126. return result;
  30127. }
  30128. };
  30129. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  30130. SemanticContext.call(this);
  30131. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  30132. this.predIndex = predIndex === undefined ? -1 : predIndex;
  30133. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  30134. return this;
  30135. }
  30136. Predicate.prototype = Object.create(SemanticContext.prototype);
  30137. Predicate.prototype.constructor = Predicate;
  30138. //The default {@link SemanticContext}, which is semantically equivalent to
  30139. //a predicate of the form {@code {true}?}.
  30140. //
  30141. SemanticContext.NONE = new Predicate();
  30142. Predicate.prototype.evaluate = function (parser, outerContext) {
  30143. var localctx = this.isCtxDependent ? outerContext : null;
  30144. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  30145. };
  30146. Predicate.prototype.updateHashCode = function (hash) {
  30147. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  30148. };
  30149. Predicate.prototype.equals = function (other) {
  30150. if (this === other) {
  30151. return true;
  30152. } else if (!(other instanceof Predicate)) {
  30153. return false;
  30154. } else {
  30155. return this.ruleIndex === other.ruleIndex && this.predIndex === other.predIndex && this.isCtxDependent === other.isCtxDependent;
  30156. }
  30157. };
  30158. Predicate.prototype.toString = function () {
  30159. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  30160. };
  30161. function PrecedencePredicate(precedence) {
  30162. SemanticContext.call(this);
  30163. this.precedence = precedence === undefined ? 0 : precedence;
  30164. }
  30165. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  30166. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  30167. PrecedencePredicate.prototype.evaluate = function (parser, outerContext) {
  30168. return parser.precpred(outerContext, this.precedence);
  30169. };
  30170. PrecedencePredicate.prototype.evalPrecedence = function (parser, outerContext) {
  30171. if (parser.precpred(outerContext, this.precedence)) {
  30172. return SemanticContext.NONE;
  30173. } else {
  30174. return null;
  30175. }
  30176. };
  30177. PrecedencePredicate.prototype.compareTo = function (other) {
  30178. return this.precedence - other.precedence;
  30179. };
  30180. PrecedencePredicate.prototype.updateHashCode = function (hash) {
  30181. hash.update(31);
  30182. };
  30183. PrecedencePredicate.prototype.equals = function (other) {
  30184. if (this === other) {
  30185. return true;
  30186. } else if (!(other instanceof PrecedencePredicate)) {
  30187. return false;
  30188. } else {
  30189. return this.precedence === other.precedence;
  30190. }
  30191. };
  30192. PrecedencePredicate.prototype.toString = function () {
  30193. return "{" + this.precedence + ">=prec}?";
  30194. };
  30195. PrecedencePredicate.filterPrecedencePredicates = function (set) {
  30196. var result = [];
  30197. set.values().map(function (context) {
  30198. if (context instanceof PrecedencePredicate) {
  30199. result.push(context);
  30200. }
  30201. });
  30202. return result;
  30203. };
  30204. // A semantic context which is true whenever none of the contained contexts
  30205. // is false.
  30206. //
  30207. function AND(a, b) {
  30208. SemanticContext.call(this);
  30209. var operands = new Set();
  30210. if (a instanceof AND) {
  30211. a.opnds.map(function (o) {
  30212. operands.add(o);
  30213. });
  30214. } else {
  30215. operands.add(a);
  30216. }
  30217. if (b instanceof AND) {
  30218. b.opnds.map(function (o) {
  30219. operands.add(o);
  30220. });
  30221. } else {
  30222. operands.add(b);
  30223. }
  30224. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  30225. if (precedencePredicates.length > 0) {
  30226. // interested in the transition with the lowest precedence
  30227. var reduced = null;
  30228. precedencePredicates.map(function (p) {
  30229. if (reduced === null || p.precedence < reduced.precedence) {
  30230. reduced = p;
  30231. }
  30232. });
  30233. operands.add(reduced);
  30234. }
  30235. this.opnds = operands.values();
  30236. return this;
  30237. }
  30238. AND.prototype = Object.create(SemanticContext.prototype);
  30239. AND.prototype.constructor = AND;
  30240. AND.prototype.equals = function (other) {
  30241. if (this === other) {
  30242. return true;
  30243. } else if (!(other instanceof AND)) {
  30244. return false;
  30245. } else {
  30246. return this.opnds === other.opnds;
  30247. }
  30248. };
  30249. AND.prototype.updateHashCode = function (hash) {
  30250. hash.update(this.opnds, "AND");
  30251. };
  30252. //
  30253. // {@inheritDoc}
  30254. //
  30255. // <p>
  30256. // The evaluation of predicates by this context is short-circuiting, but
  30257. // unordered.</p>
  30258. //
  30259. AND.prototype.evaluate = function (parser, outerContext) {
  30260. for (var i = 0; i < this.opnds.length; i++) {
  30261. if (!this.opnds[i].evaluate(parser, outerContext)) {
  30262. return false;
  30263. }
  30264. }
  30265. return true;
  30266. };
  30267. AND.prototype.evalPrecedence = function (parser, outerContext) {
  30268. var differs = false;
  30269. var operands = [];
  30270. for (var i = 0; i < this.opnds.length; i++) {
  30271. var context = this.opnds[i];
  30272. var evaluated = context.evalPrecedence(parser, outerContext);
  30273. differs |= evaluated !== context;
  30274. if (evaluated === null) {
  30275. // The AND context is false if any element is false
  30276. return null;
  30277. } else if (evaluated !== SemanticContext.NONE) {
  30278. // Reduce the result by skipping true elements
  30279. operands.push(evaluated);
  30280. }
  30281. }
  30282. if (!differs) {
  30283. return this;
  30284. }
  30285. if (operands.length === 0) {
  30286. // all elements were true, so the AND context is true
  30287. return SemanticContext.NONE;
  30288. }
  30289. var result = null;
  30290. operands.map(function (o) {
  30291. result = result === null ? o : SemanticContext.andContext(result, o);
  30292. });
  30293. return result;
  30294. };
  30295. AND.prototype.toString = function () {
  30296. var s = "";
  30297. this.opnds.map(function (o) {
  30298. s += "&& " + o.toString();
  30299. });
  30300. return s.length > 3 ? s.slice(3) : s;
  30301. };
  30302. //
  30303. // A semantic context which is true whenever at least one of the contained
  30304. // contexts is true.
  30305. //
  30306. function OR(a, b) {
  30307. SemanticContext.call(this);
  30308. var operands = new Set();
  30309. if (a instanceof OR) {
  30310. a.opnds.map(function (o) {
  30311. operands.add(o);
  30312. });
  30313. } else {
  30314. operands.add(a);
  30315. }
  30316. if (b instanceof OR) {
  30317. b.opnds.map(function (o) {
  30318. operands.add(o);
  30319. });
  30320. } else {
  30321. operands.add(b);
  30322. }
  30323. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  30324. if (precedencePredicates.length > 0) {
  30325. // interested in the transition with the highest precedence
  30326. var s = precedencePredicates.sort(function (a, b) {
  30327. return a.compareTo(b);
  30328. });
  30329. var reduced = s[s.length - 1];
  30330. operands.add(reduced);
  30331. }
  30332. this.opnds = operands.values();
  30333. return this;
  30334. }
  30335. OR.prototype = Object.create(SemanticContext.prototype);
  30336. OR.prototype.constructor = OR;
  30337. OR.prototype.constructor = function (other) {
  30338. if (this === other) {
  30339. return true;
  30340. } else if (!(other instanceof OR)) {
  30341. return false;
  30342. } else {
  30343. return this.opnds === other.opnds;
  30344. }
  30345. };
  30346. OR.prototype.updateHashCode = function (hash) {
  30347. hash.update(this.opnds, "OR");
  30348. };
  30349. // <p>
  30350. // The evaluation of predicates by this context is short-circuiting, but
  30351. // unordered.</p>
  30352. //
  30353. OR.prototype.evaluate = function (parser, outerContext) {
  30354. for (var i = 0; i < this.opnds.length; i++) {
  30355. if (this.opnds[i].evaluate(parser, outerContext)) {
  30356. return true;
  30357. }
  30358. }
  30359. return false;
  30360. };
  30361. OR.prototype.evalPrecedence = function (parser, outerContext) {
  30362. var differs = false;
  30363. var operands = [];
  30364. for (var i = 0; i < this.opnds.length; i++) {
  30365. var context = this.opnds[i];
  30366. var evaluated = context.evalPrecedence(parser, outerContext);
  30367. differs |= evaluated !== context;
  30368. if (evaluated === SemanticContext.NONE) {
  30369. // The OR context is true if any element is true
  30370. return SemanticContext.NONE;
  30371. } else if (evaluated !== null) {
  30372. // Reduce the result by skipping false elements
  30373. operands.push(evaluated);
  30374. }
  30375. }
  30376. if (!differs) {
  30377. return this;
  30378. }
  30379. if (operands.length === 0) {
  30380. // all elements were false, so the OR context is false
  30381. return null;
  30382. }
  30383. var result = null;
  30384. operands.map(function (o) {
  30385. return result === null ? o : SemanticContext.orContext(result, o);
  30386. });
  30387. return result;
  30388. };
  30389. OR.prototype.toString = function () {
  30390. var s = "";
  30391. this.opnds.map(function (o) {
  30392. s += "|| " + o.toString();
  30393. });
  30394. return s.length > 3 ? s.slice(3) : s;
  30395. };
  30396. exports.SemanticContext = SemanticContext;
  30397. exports.PrecedencePredicate = PrecedencePredicate;
  30398. exports.Predicate = Predicate;
  30399. /***/ }),
  30400. /***/ "./node_modules/antlr4/atn/Transition.js":
  30401. /*!***********************************************!*\
  30402. !*** ./node_modules/antlr4/atn/Transition.js ***!
  30403. \***********************************************/
  30404. /*! no static exports found */
  30405. /***/ (function(module, exports, __webpack_require__) {
  30406. "use strict";
  30407. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30408. * Use of this file is governed by the BSD 3-clause license that
  30409. * can be found in the LICENSE.txt file in the project root.
  30410. */
  30411. //
  30412. // An ATN transition between any two ATN states. Subclasses define
  30413. // atom, set, epsilon, action, predicate, rule transitions.
  30414. //
  30415. // <p>This is a one way link. It emanates from a state (usually via a list of
  30416. // transitions) and has a target state.</p>
  30417. //
  30418. // <p>Since we never have to change the ATN transitions once we construct it,
  30419. // we can fix these transitions as specific classes. The DFA transitions
  30420. // on the other hand need to update the labels as it adds transitions to
  30421. // the states. We'll use the term Edge for the DFA to distinguish them from
  30422. // ATN transitions.</p>
  30423. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  30424. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  30425. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  30426. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  30427. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  30428. function Transition(target) {
  30429. // The target of this transition.
  30430. if (target === undefined || target === null) {
  30431. throw "target cannot be null.";
  30432. }
  30433. this.target = target;
  30434. // Are we epsilon, action, sempred?
  30435. this.isEpsilon = false;
  30436. this.label = null;
  30437. return this;
  30438. }
  30439. // constants for serialization
  30440. Transition.EPSILON = 1;
  30441. Transition.RANGE = 2;
  30442. Transition.RULE = 3;
  30443. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  30444. Transition.ATOM = 5;
  30445. Transition.ACTION = 6;
  30446. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  30447. Transition.NOT_SET = 8;
  30448. Transition.WILDCARD = 9;
  30449. Transition.PRECEDENCE = 10;
  30450. Transition.serializationNames = ["INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE"];
  30451. Transition.serializationTypes = {
  30452. EpsilonTransition: Transition.EPSILON,
  30453. RangeTransition: Transition.RANGE,
  30454. RuleTransition: Transition.RULE,
  30455. PredicateTransition: Transition.PREDICATE,
  30456. AtomTransition: Transition.ATOM,
  30457. ActionTransition: Transition.ACTION,
  30458. SetTransition: Transition.SET,
  30459. NotSetTransition: Transition.NOT_SET,
  30460. WildcardTransition: Transition.WILDCARD,
  30461. PrecedencePredicateTransition: Transition.PRECEDENCE
  30462. };
  30463. // TODO: make all transitions sets? no, should remove set edges
  30464. function AtomTransition(target, label) {
  30465. Transition.call(this, target);
  30466. this.label_ = label; // The token type or character value; or, signifies special label.
  30467. this.label = this.makeLabel();
  30468. this.serializationType = Transition.ATOM;
  30469. return this;
  30470. }
  30471. AtomTransition.prototype = Object.create(Transition.prototype);
  30472. AtomTransition.prototype.constructor = AtomTransition;
  30473. AtomTransition.prototype.makeLabel = function () {
  30474. var s = new IntervalSet();
  30475. s.addOne(this.label_);
  30476. return s;
  30477. };
  30478. AtomTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30479. return this.label_ === symbol;
  30480. };
  30481. AtomTransition.prototype.toString = function () {
  30482. return this.label_;
  30483. };
  30484. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  30485. Transition.call(this, ruleStart);
  30486. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  30487. this.precedence = precedence;
  30488. this.followState = followState; // what node to begin computations following ref to rule
  30489. this.serializationType = Transition.RULE;
  30490. this.isEpsilon = true;
  30491. return this;
  30492. }
  30493. RuleTransition.prototype = Object.create(Transition.prototype);
  30494. RuleTransition.prototype.constructor = RuleTransition;
  30495. RuleTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30496. return false;
  30497. };
  30498. function EpsilonTransition(target, outermostPrecedenceReturn) {
  30499. Transition.call(this, target);
  30500. this.serializationType = Transition.EPSILON;
  30501. this.isEpsilon = true;
  30502. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  30503. return this;
  30504. }
  30505. EpsilonTransition.prototype = Object.create(Transition.prototype);
  30506. EpsilonTransition.prototype.constructor = EpsilonTransition;
  30507. EpsilonTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30508. return false;
  30509. };
  30510. EpsilonTransition.prototype.toString = function () {
  30511. return "epsilon";
  30512. };
  30513. function RangeTransition(target, start, stop) {
  30514. Transition.call(this, target);
  30515. this.serializationType = Transition.RANGE;
  30516. this.start = start;
  30517. this.stop = stop;
  30518. this.label = this.makeLabel();
  30519. return this;
  30520. }
  30521. RangeTransition.prototype = Object.create(Transition.prototype);
  30522. RangeTransition.prototype.constructor = RangeTransition;
  30523. RangeTransition.prototype.makeLabel = function () {
  30524. var s = new IntervalSet();
  30525. s.addRange(this.start, this.stop);
  30526. return s;
  30527. };
  30528. RangeTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30529. return symbol >= this.start && symbol <= this.stop;
  30530. };
  30531. RangeTransition.prototype.toString = function () {
  30532. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  30533. };
  30534. function AbstractPredicateTransition(target) {
  30535. Transition.call(this, target);
  30536. return this;
  30537. }
  30538. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  30539. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  30540. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  30541. AbstractPredicateTransition.call(this, target);
  30542. this.serializationType = Transition.PREDICATE;
  30543. this.ruleIndex = ruleIndex;
  30544. this.predIndex = predIndex;
  30545. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  30546. this.isEpsilon = true;
  30547. return this;
  30548. }
  30549. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  30550. PredicateTransition.prototype.constructor = PredicateTransition;
  30551. PredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30552. return false;
  30553. };
  30554. PredicateTransition.prototype.getPredicate = function () {
  30555. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  30556. };
  30557. PredicateTransition.prototype.toString = function () {
  30558. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  30559. };
  30560. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  30561. Transition.call(this, target);
  30562. this.serializationType = Transition.ACTION;
  30563. this.ruleIndex = ruleIndex;
  30564. this.actionIndex = actionIndex === undefined ? -1 : actionIndex;
  30565. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  30566. this.isEpsilon = true;
  30567. return this;
  30568. }
  30569. ActionTransition.prototype = Object.create(Transition.prototype);
  30570. ActionTransition.prototype.constructor = ActionTransition;
  30571. ActionTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30572. return false;
  30573. };
  30574. ActionTransition.prototype.toString = function () {
  30575. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  30576. };
  30577. // A transition containing a set of values.
  30578. function SetTransition(target, set) {
  30579. Transition.call(this, target);
  30580. this.serializationType = Transition.SET;
  30581. if (set !== undefined && set !== null) {
  30582. this.label = set;
  30583. } else {
  30584. this.label = new IntervalSet();
  30585. this.label.addOne(Token.INVALID_TYPE);
  30586. }
  30587. return this;
  30588. }
  30589. SetTransition.prototype = Object.create(Transition.prototype);
  30590. SetTransition.prototype.constructor = SetTransition;
  30591. SetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30592. return this.label.contains(symbol);
  30593. };
  30594. SetTransition.prototype.toString = function () {
  30595. return this.label.toString();
  30596. };
  30597. function NotSetTransition(target, set) {
  30598. SetTransition.call(this, target, set);
  30599. this.serializationType = Transition.NOT_SET;
  30600. return this;
  30601. }
  30602. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  30603. NotSetTransition.prototype.constructor = NotSetTransition;
  30604. NotSetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30605. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol && !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  30606. };
  30607. NotSetTransition.prototype.toString = function () {
  30608. return '~' + SetTransition.prototype.toString.call(this);
  30609. };
  30610. function WildcardTransition(target) {
  30611. Transition.call(this, target);
  30612. this.serializationType = Transition.WILDCARD;
  30613. return this;
  30614. }
  30615. WildcardTransition.prototype = Object.create(Transition.prototype);
  30616. WildcardTransition.prototype.constructor = WildcardTransition;
  30617. WildcardTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30618. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  30619. };
  30620. WildcardTransition.prototype.toString = function () {
  30621. return ".";
  30622. };
  30623. function PrecedencePredicateTransition(target, precedence) {
  30624. AbstractPredicateTransition.call(this, target);
  30625. this.serializationType = Transition.PRECEDENCE;
  30626. this.precedence = precedence;
  30627. this.isEpsilon = true;
  30628. return this;
  30629. }
  30630. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  30631. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  30632. PrecedencePredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30633. return false;
  30634. };
  30635. PrecedencePredicateTransition.prototype.getPredicate = function () {
  30636. return new PrecedencePredicate(this.precedence);
  30637. };
  30638. PrecedencePredicateTransition.prototype.toString = function () {
  30639. return this.precedence + " >= _p";
  30640. };
  30641. exports.Transition = Transition;
  30642. exports.AtomTransition = AtomTransition;
  30643. exports.SetTransition = SetTransition;
  30644. exports.NotSetTransition = NotSetTransition;
  30645. exports.RuleTransition = RuleTransition;
  30646. exports.ActionTransition = ActionTransition;
  30647. exports.EpsilonTransition = EpsilonTransition;
  30648. exports.RangeTransition = RangeTransition;
  30649. exports.WildcardTransition = WildcardTransition;
  30650. exports.PredicateTransition = PredicateTransition;
  30651. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  30652. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  30653. /***/ }),
  30654. /***/ "./node_modules/antlr4/atn/index.js":
  30655. /*!******************************************!*\
  30656. !*** ./node_modules/antlr4/atn/index.js ***!
  30657. \******************************************/
  30658. /*! no static exports found */
  30659. /***/ (function(module, exports, __webpack_require__) {
  30660. "use strict";
  30661. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30662. * Use of this file is governed by the BSD 3-clause license that
  30663. * can be found in the LICENSE.txt file in the project root.
  30664. */
  30665. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  30666. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  30667. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  30668. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  30669. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  30670. /***/ }),
  30671. /***/ "./node_modules/antlr4/dfa/DFA.js":
  30672. /*!****************************************!*\
  30673. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  30674. \****************************************/
  30675. /*! no static exports found */
  30676. /***/ (function(module, exports, __webpack_require__) {
  30677. "use strict";
  30678. //
  30679. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30680. * Use of this file is governed by the BSD 3-clause license that
  30681. * can be found in the LICENSE.txt file in the project root.
  30682. */
  30683. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  30684. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  30685. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  30686. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  30687. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  30688. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  30689. function DFA(atnStartState, decision) {
  30690. if (decision === undefined) {
  30691. decision = 0;
  30692. }
  30693. // From which ATN state did we create this DFA?
  30694. this.atnStartState = atnStartState;
  30695. this.decision = decision;
  30696. // A set of all DFA states. Use {@link Map} so we can get old state back
  30697. // ({@link Set} only allows you to see if it's there).
  30698. this._states = new Set();
  30699. this.s0 = null;
  30700. // {@code true} if this DFA is for a precedence decision; otherwise,
  30701. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  30702. // {@link //setPrecedenceDfa}.
  30703. this.precedenceDfa = false;
  30704. if (atnStartState instanceof StarLoopEntryState) {
  30705. if (atnStartState.isPrecedenceDecision) {
  30706. this.precedenceDfa = true;
  30707. var precedenceState = new DFAState(null, new ATNConfigSet());
  30708. precedenceState.edges = [];
  30709. precedenceState.isAcceptState = false;
  30710. precedenceState.requiresFullContext = false;
  30711. this.s0 = precedenceState;
  30712. }
  30713. }
  30714. return this;
  30715. }
  30716. // Get the start state for a specific precedence value.
  30717. //
  30718. // @param precedence The current precedence.
  30719. // @return The start state corresponding to the specified precedence, or
  30720. // {@code null} if no start state exists for the specified precedence.
  30721. //
  30722. // @throws IllegalStateException if this is not a precedence DFA.
  30723. // @see //isPrecedenceDfa()
  30724. DFA.prototype.getPrecedenceStartState = function (precedence) {
  30725. if (!this.precedenceDfa) {
  30726. throw "Only precedence DFAs may contain a precedence start state.";
  30727. }
  30728. // s0.edges is never null for a precedence DFA
  30729. if (precedence < 0 || precedence >= this.s0.edges.length) {
  30730. return null;
  30731. }
  30732. return this.s0.edges[precedence] || null;
  30733. };
  30734. // Set the start state for a specific precedence value.
  30735. //
  30736. // @param precedence The current precedence.
  30737. // @param startState The start state corresponding to the specified
  30738. // precedence.
  30739. //
  30740. // @throws IllegalStateException if this is not a precedence DFA.
  30741. // @see //isPrecedenceDfa()
  30742. //
  30743. DFA.prototype.setPrecedenceStartState = function (precedence, startState) {
  30744. if (!this.precedenceDfa) {
  30745. throw "Only precedence DFAs may contain a precedence start state.";
  30746. }
  30747. if (precedence < 0) {
  30748. return;
  30749. }
  30750. // synchronization on s0 here is ok. when the DFA is turned into a
  30751. // precedence DFA, s0 will be initialized once and not updated again
  30752. // s0.edges is never null for a precedence DFA
  30753. this.s0.edges[precedence] = startState;
  30754. };
  30755. //
  30756. // Sets whether this is a precedence DFA. If the specified value differs
  30757. // from the current DFA configuration, the following actions are taken;
  30758. // otherwise no changes are made to the current DFA.
  30759. //
  30760. // <ul>
  30761. // <li>The {@link //states} map is cleared</li>
  30762. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  30763. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  30764. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  30765. // store the start states for individual precedence values.</li>
  30766. // <li>The {@link //precedenceDfa} field is updated</li>
  30767. // </ul>
  30768. //
  30769. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  30770. // {@code false}
  30771. DFA.prototype.setPrecedenceDfa = function (precedenceDfa) {
  30772. if (this.precedenceDfa !== precedenceDfa) {
  30773. this._states = new DFAStatesSet();
  30774. if (precedenceDfa) {
  30775. var precedenceState = new DFAState(null, new ATNConfigSet());
  30776. precedenceState.edges = [];
  30777. precedenceState.isAcceptState = false;
  30778. precedenceState.requiresFullContext = false;
  30779. this.s0 = precedenceState;
  30780. } else {
  30781. this.s0 = null;
  30782. }
  30783. this.precedenceDfa = precedenceDfa;
  30784. }
  30785. };
  30786. Object.defineProperty(DFA.prototype, "states", {
  30787. get: function get() {
  30788. return this._states;
  30789. }
  30790. });
  30791. // Return a list of all states in this DFA, ordered by state number.
  30792. DFA.prototype.sortedStates = function () {
  30793. var list = this._states.values();
  30794. return list.sort(function (a, b) {
  30795. return a.stateNumber - b.stateNumber;
  30796. });
  30797. };
  30798. DFA.prototype.toString = function (literalNames, symbolicNames) {
  30799. literalNames = literalNames || null;
  30800. symbolicNames = symbolicNames || null;
  30801. if (this.s0 === null) {
  30802. return "";
  30803. }
  30804. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  30805. return serializer.toString();
  30806. };
  30807. DFA.prototype.toLexerString = function () {
  30808. if (this.s0 === null) {
  30809. return "";
  30810. }
  30811. var serializer = new LexerDFASerializer(this);
  30812. return serializer.toString();
  30813. };
  30814. exports.DFA = DFA;
  30815. /***/ }),
  30816. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  30817. /*!**************************************************!*\
  30818. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  30819. \**************************************************/
  30820. /*! no static exports found */
  30821. /***/ (function(module, exports, __webpack_require__) {
  30822. "use strict";
  30823. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30824. * Use of this file is governed by the BSD 3-clause license that
  30825. * can be found in the LICENSE.txt file in the project root.
  30826. */
  30827. // A DFA walker that knows how to dump them to serialized strings.#/
  30828. function DFASerializer(dfa, literalNames, symbolicNames) {
  30829. this.dfa = dfa;
  30830. this.literalNames = literalNames || [];
  30831. this.symbolicNames = symbolicNames || [];
  30832. return this;
  30833. }
  30834. DFASerializer.prototype.toString = function () {
  30835. if (this.dfa.s0 === null) {
  30836. return null;
  30837. }
  30838. var buf = "";
  30839. var states = this.dfa.sortedStates();
  30840. for (var i = 0; i < states.length; i++) {
  30841. var s = states[i];
  30842. if (s.edges !== null) {
  30843. var n = s.edges.length;
  30844. for (var j = 0; j < n; j++) {
  30845. var t = s.edges[j] || null;
  30846. if (t !== null && t.stateNumber !== 0x7FFFFFFF) {
  30847. buf = buf.concat(this.getStateString(s));
  30848. buf = buf.concat("-");
  30849. buf = buf.concat(this.getEdgeLabel(j));
  30850. buf = buf.concat("->");
  30851. buf = buf.concat(this.getStateString(t));
  30852. buf = buf.concat('\n');
  30853. }
  30854. }
  30855. }
  30856. }
  30857. return buf.length === 0 ? null : buf;
  30858. };
  30859. DFASerializer.prototype.getEdgeLabel = function (i) {
  30860. if (i === 0) {
  30861. return "EOF";
  30862. } else if (this.literalNames !== null || this.symbolicNames !== null) {
  30863. return this.literalNames[i - 1] || this.symbolicNames[i - 1];
  30864. } else {
  30865. return String.fromCharCode(i - 1);
  30866. }
  30867. };
  30868. DFASerializer.prototype.getStateString = function (s) {
  30869. var baseStateStr = (s.isAcceptState ? ":" : "") + "s" + s.stateNumber + (s.requiresFullContext ? "^" : "");
  30870. if (s.isAcceptState) {
  30871. if (s.predicates !== null) {
  30872. return baseStateStr + "=>" + s.predicates.toString();
  30873. } else {
  30874. return baseStateStr + "=>" + s.prediction.toString();
  30875. }
  30876. } else {
  30877. return baseStateStr;
  30878. }
  30879. };
  30880. function LexerDFASerializer(dfa) {
  30881. DFASerializer.call(this, dfa, null);
  30882. return this;
  30883. }
  30884. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  30885. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  30886. LexerDFASerializer.prototype.getEdgeLabel = function (i) {
  30887. return "'" + String.fromCharCode(i) + "'";
  30888. };
  30889. exports.DFASerializer = DFASerializer;
  30890. exports.LexerDFASerializer = LexerDFASerializer;
  30891. /***/ }),
  30892. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  30893. /*!*********************************************!*\
  30894. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  30895. \*********************************************/
  30896. /*! no static exports found */
  30897. /***/ (function(module, exports, __webpack_require__) {
  30898. "use strict";
  30899. //
  30900. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30901. * Use of this file is governed by the BSD 3-clause license that
  30902. * can be found in the LICENSE.txt file in the project root.
  30903. */
  30904. ///
  30905. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  30906. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  30907. var Hash = Utils.Hash;
  30908. var Set = Utils.Set;
  30909. // Map a predicate to a predicted alternative.///
  30910. function PredPrediction(pred, alt) {
  30911. this.alt = alt;
  30912. this.pred = pred;
  30913. return this;
  30914. }
  30915. PredPrediction.prototype.toString = function () {
  30916. return "(" + this.pred + ", " + this.alt + ")";
  30917. };
  30918. // A DFA state represents a set of possible ATN configurations.
  30919. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  30920. // to keep track of all possible states the ATN can be in after
  30921. // reading each input symbol. That is to say, after reading
  30922. // input a1a2..an, the DFA is in a state that represents the
  30923. // subset T of the states of the ATN that are reachable from the
  30924. // ATN's start state along some path labeled a1a2..an."
  30925. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  30926. // would be a bitset representing the set of states the
  30927. // ATN could be in. We need to track the alt predicted by each
  30928. // state as well, however. More importantly, we need to maintain
  30929. // a stack of states, tracking the closure operations as they
  30930. // jump from rule to rule, emulating rule invocations (method calls).
  30931. // I have to add a stack to simulate the proper lookahead sequences for
  30932. // the underlying LL grammar from which the ATN was derived.
  30933. //
  30934. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  30935. // is both a state (ala normal conversion) and a RuleContext describing
  30936. // the chain of rules (if any) followed to arrive at that state.</p>
  30937. //
  30938. // <p>A DFA state may have multiple references to a particular state,
  30939. // but with different ATN contexts (with same or different alts)
  30940. // meaning that state was reached via a different set of rule invocations.</p>
  30941. // /
  30942. function DFAState(stateNumber, configs) {
  30943. if (stateNumber === null) {
  30944. stateNumber = -1;
  30945. }
  30946. if (configs === null) {
  30947. configs = new ATNConfigSet();
  30948. }
  30949. this.stateNumber = stateNumber;
  30950. this.configs = configs;
  30951. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  30952. // {@link Token//EOF} maps to {@code edges[0]}.
  30953. this.edges = null;
  30954. this.isAcceptState = false;
  30955. // if accept state, what ttype do we match or alt do we predict?
  30956. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  30957. // //predicates}{@code !=null} or
  30958. // {@link //requiresFullContext}.
  30959. this.prediction = 0;
  30960. this.lexerActionExecutor = null;
  30961. // Indicates that this state was created during SLL prediction that
  30962. // discovered a conflict between the configurations in the state. Future
  30963. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  30964. // full context prediction if this field is true.
  30965. this.requiresFullContext = false;
  30966. // During SLL parsing, this is a list of predicates associated with the
  30967. // ATN configurations of the DFA state. When we have predicates,
  30968. // {@link //requiresFullContext} is {@code false} since full context
  30969. // prediction evaluates predicates
  30970. // on-the-fly. If this is not null, then {@link //prediction} is
  30971. // {@link ATN//INVALID_ALT_NUMBER}.
  30972. //
  30973. // <p>We only use these for non-{@link //requiresFullContext} but
  30974. // conflicting states. That
  30975. // means we know from the context (it's $ or we don't dip into outer
  30976. // context) that it's an ambiguity not a conflict.</p>
  30977. //
  30978. // <p>This list is computed by {@link
  30979. // ParserATNSimulator//predicateDFAState}.</p>
  30980. this.predicates = null;
  30981. return this;
  30982. }
  30983. // Get the set of all alts mentioned by all ATN configurations in this
  30984. // DFA state.
  30985. DFAState.prototype.getAltSet = function () {
  30986. var alts = new Set();
  30987. if (this.configs !== null) {
  30988. for (var i = 0; i < this.configs.length; i++) {
  30989. var c = this.configs[i];
  30990. alts.add(c.alt);
  30991. }
  30992. }
  30993. if (alts.length === 0) {
  30994. return null;
  30995. } else {
  30996. return alts;
  30997. }
  30998. };
  30999. // Two {@link DFAState} instances are equal if their ATN configuration sets
  31000. // are the same. This method is used to see if a state already exists.
  31001. //
  31002. // <p>Because the number of alternatives and number of ATN configurations are
  31003. // finite, there is a finite number of DFA states that can be processed.
  31004. // This is necessary to show that the algorithm terminates.</p>
  31005. //
  31006. // <p>Cannot test the DFA state numbers here because in
  31007. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  31008. // exists that has this exact set of ATN configurations. The
  31009. // {@link //stateNumber} is irrelevant.</p>
  31010. DFAState.prototype.equals = function (other) {
  31011. // compare set of ATN configurations in this set with other
  31012. return this === other || other instanceof DFAState && this.configs.equals(other.configs);
  31013. };
  31014. DFAState.prototype.toString = function () {
  31015. var s = "" + this.stateNumber + ":" + this.configs;
  31016. if (this.isAcceptState) {
  31017. s = s + "=>";
  31018. if (this.predicates !== null) s = s + this.predicates;else s = s + this.prediction;
  31019. }
  31020. return s;
  31021. };
  31022. DFAState.prototype.hashCode = function () {
  31023. var hash = new Hash();
  31024. hash.update(this.configs);
  31025. if (this.isAcceptState) {
  31026. if (this.predicates !== null) hash.update(this.predicates);else hash.update(this.prediction);
  31027. }
  31028. return hash.finish();
  31029. };
  31030. exports.DFAState = DFAState;
  31031. exports.PredPrediction = PredPrediction;
  31032. /***/ }),
  31033. /***/ "./node_modules/antlr4/dfa/index.js":
  31034. /*!******************************************!*\
  31035. !*** ./node_modules/antlr4/dfa/index.js ***!
  31036. \******************************************/
  31037. /*! no static exports found */
  31038. /***/ (function(module, exports, __webpack_require__) {
  31039. "use strict";
  31040. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31041. * Use of this file is governed by the BSD 3-clause license that
  31042. * can be found in the LICENSE.txt file in the project root.
  31043. */
  31044. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  31045. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  31046. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  31047. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  31048. /***/ }),
  31049. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  31050. /*!**************************************************************!*\
  31051. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  31052. \**************************************************************/
  31053. /*! no static exports found */
  31054. /***/ (function(module, exports, __webpack_require__) {
  31055. "use strict";
  31056. //
  31057. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31058. * Use of this file is governed by the BSD 3-clause license that
  31059. * can be found in the LICENSE.txt file in the project root.
  31060. */
  31061. //
  31062. //
  31063. // This implementation of {@link ANTLRErrorListener} can be used to identify
  31064. // certain potential correctness and performance problems in grammars. "Reports"
  31065. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  31066. // message.
  31067. //
  31068. // <ul>
  31069. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  31070. // grammar can match the input.</li>
  31071. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  31072. // prediction resolved an SLL conflict to a unique alternative which equaled the
  31073. // minimum alternative of the SLL conflict.</li>
  31074. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  31075. // full-context prediction resolved an SLL conflict to a unique alternative,
  31076. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  31077. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  31078. // this situation occurs.</li>
  31079. // </ul>
  31080. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  31081. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  31082. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31083. function DiagnosticErrorListener(exactOnly) {
  31084. ErrorListener.call(this);
  31085. exactOnly = exactOnly || true;
  31086. // whether all ambiguities or only exact ambiguities are reported.
  31087. this.exactOnly = exactOnly;
  31088. return this;
  31089. }
  31090. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  31091. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  31092. DiagnosticErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  31093. if (this.exactOnly && !exact) {
  31094. return;
  31095. }
  31096. var msg = "reportAmbiguity d=" + this.getDecisionDescription(recognizer, dfa) + ": ambigAlts=" + this.getConflictingAlts(ambigAlts, configs) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31097. recognizer.notifyErrorListeners(msg);
  31098. };
  31099. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  31100. var msg = "reportAttemptingFullContext d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31101. recognizer.notifyErrorListeners(msg);
  31102. };
  31103. DiagnosticErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  31104. var msg = "reportContextSensitivity d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31105. recognizer.notifyErrorListeners(msg);
  31106. };
  31107. DiagnosticErrorListener.prototype.getDecisionDescription = function (recognizer, dfa) {
  31108. var decision = dfa.decision;
  31109. var ruleIndex = dfa.atnStartState.ruleIndex;
  31110. var ruleNames = recognizer.ruleNames;
  31111. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  31112. return "" + decision;
  31113. }
  31114. var ruleName = ruleNames[ruleIndex] || null;
  31115. if (ruleName === null || ruleName.length === 0) {
  31116. return "" + decision;
  31117. }
  31118. return "" + decision + " (" + ruleName + ")";
  31119. };
  31120. //
  31121. // Computes the set of conflicting or ambiguous alternatives from a
  31122. // configuration set, if that information was not already provided by the
  31123. // parser.
  31124. //
  31125. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  31126. // reported by the parser.
  31127. // @param configs The conflicting or ambiguous configuration set.
  31128. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  31129. // returns the set of alternatives represented in {@code configs}.
  31130. //
  31131. DiagnosticErrorListener.prototype.getConflictingAlts = function (reportedAlts, configs) {
  31132. if (reportedAlts !== null) {
  31133. return reportedAlts;
  31134. }
  31135. var result = new BitSet();
  31136. for (var i = 0; i < configs.items.length; i++) {
  31137. result.add(configs.items[i].alt);
  31138. }
  31139. return "{" + result.values().join(", ") + "}";
  31140. };
  31141. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  31142. /***/ }),
  31143. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  31144. /*!****************************************************!*\
  31145. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  31146. \****************************************************/
  31147. /*! no static exports found */
  31148. /***/ (function(module, exports, __webpack_require__) {
  31149. "use strict";
  31150. //
  31151. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31152. * Use of this file is governed by the BSD 3-clause license that
  31153. * can be found in the LICENSE.txt file in the project root.
  31154. */
  31155. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  31156. // default implementation of each method does nothing, but can be overridden as
  31157. // necessary.
  31158. function ErrorListener() {
  31159. return this;
  31160. }
  31161. ErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {};
  31162. ErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {};
  31163. ErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {};
  31164. ErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {};
  31165. function ConsoleErrorListener() {
  31166. ErrorListener.call(this);
  31167. return this;
  31168. }
  31169. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  31170. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  31171. //
  31172. // Provides a default instance of {@link ConsoleErrorListener}.
  31173. //
  31174. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  31175. //
  31176. // {@inheritDoc}
  31177. //
  31178. // <p>
  31179. // This implementation prints messages to {@link System//err} containing the
  31180. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  31181. // the following format.</p>
  31182. //
  31183. // <pre>
  31184. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  31185. // </pre>
  31186. //
  31187. ConsoleErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31188. console.error("line " + line + ":" + column + " " + msg);
  31189. };
  31190. function ProxyErrorListener(delegates) {
  31191. ErrorListener.call(this);
  31192. if (delegates === null) {
  31193. throw "delegates";
  31194. }
  31195. this.delegates = delegates;
  31196. return this;
  31197. }
  31198. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  31199. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  31200. ProxyErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31201. this.delegates.map(function (d) {
  31202. d.syntaxError(recognizer, offendingSymbol, line, column, msg, e);
  31203. });
  31204. };
  31205. ProxyErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  31206. this.delegates.map(function (d) {
  31207. d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  31208. });
  31209. };
  31210. ProxyErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  31211. this.delegates.map(function (d) {
  31212. d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
  31213. });
  31214. };
  31215. ProxyErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  31216. this.delegates.map(function (d) {
  31217. d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs);
  31218. });
  31219. };
  31220. exports.ErrorListener = ErrorListener;
  31221. exports.ConsoleErrorListener = ConsoleErrorListener;
  31222. exports.ProxyErrorListener = ProxyErrorListener;
  31223. /***/ }),
  31224. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  31225. /*!****************************************************!*\
  31226. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  31227. \****************************************************/
  31228. /*! no static exports found */
  31229. /***/ (function(module, exports, __webpack_require__) {
  31230. "use strict";
  31231. //
  31232. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31233. * Use of this file is governed by the BSD 3-clause license that
  31234. * can be found in the LICENSE.txt file in the project root.
  31235. */
  31236. //
  31237. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31238. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  31239. var NoViableAltException = Errors.NoViableAltException;
  31240. var InputMismatchException = Errors.InputMismatchException;
  31241. var FailedPredicateException = Errors.FailedPredicateException;
  31242. var ParseCancellationException = Errors.ParseCancellationException;
  31243. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  31244. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31245. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31246. function ErrorStrategy() {}
  31247. ErrorStrategy.prototype.reset = function (recognizer) {};
  31248. ErrorStrategy.prototype.recoverInline = function (recognizer) {};
  31249. ErrorStrategy.prototype.recover = function (recognizer, e) {};
  31250. ErrorStrategy.prototype.sync = function (recognizer) {};
  31251. ErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {};
  31252. ErrorStrategy.prototype.reportError = function (recognizer) {};
  31253. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  31254. // error reporting and recovery in ANTLR parsers.
  31255. //
  31256. function DefaultErrorStrategy() {
  31257. ErrorStrategy.call(this);
  31258. // Indicates whether the error strategy is currently "recovering from an
  31259. // error". This is used to suppress reporting multiple error messages while
  31260. // attempting to recover from a detected syntax error.
  31261. //
  31262. // @see //inErrorRecoveryMode
  31263. //
  31264. this.errorRecoveryMode = false;
  31265. // The index into the input stream where the last error occurred.
  31266. // This is used to prevent infinite loops where an error is found
  31267. // but no token is consumed during recovery...another error is found,
  31268. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  31269. // one token/tree node is consumed for two errors.
  31270. //
  31271. this.lastErrorIndex = -1;
  31272. this.lastErrorStates = null;
  31273. return this;
  31274. }
  31275. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  31276. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  31277. // <p>The default implementation simply calls {@link //endErrorCondition} to
  31278. // ensure that the handler is not in error recovery mode.</p>
  31279. DefaultErrorStrategy.prototype.reset = function (recognizer) {
  31280. this.endErrorCondition(recognizer);
  31281. };
  31282. //
  31283. // This method is called to enter error recovery mode when a recognition
  31284. // exception is reported.
  31285. //
  31286. // @param recognizer the parser instance
  31287. //
  31288. DefaultErrorStrategy.prototype.beginErrorCondition = function (recognizer) {
  31289. this.errorRecoveryMode = true;
  31290. };
  31291. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {
  31292. return this.errorRecoveryMode;
  31293. };
  31294. //
  31295. // This method is called to leave error recovery mode after recovering from
  31296. // a recognition exception.
  31297. //
  31298. // @param recognizer
  31299. //
  31300. DefaultErrorStrategy.prototype.endErrorCondition = function (recognizer) {
  31301. this.errorRecoveryMode = false;
  31302. this.lastErrorStates = null;
  31303. this.lastErrorIndex = -1;
  31304. };
  31305. //
  31306. // {@inheritDoc}
  31307. //
  31308. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  31309. //
  31310. DefaultErrorStrategy.prototype.reportMatch = function (recognizer) {
  31311. this.endErrorCondition(recognizer);
  31312. };
  31313. //
  31314. // {@inheritDoc}
  31315. //
  31316. // <p>The default implementation returns immediately if the handler is already
  31317. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  31318. // and dispatches the reporting task based on the runtime type of {@code e}
  31319. // according to the following table.</p>
  31320. //
  31321. // <ul>
  31322. // <li>{@link NoViableAltException}: Dispatches the call to
  31323. // {@link //reportNoViableAlternative}</li>
  31324. // <li>{@link InputMismatchException}: Dispatches the call to
  31325. // {@link //reportInputMismatch}</li>
  31326. // <li>{@link FailedPredicateException}: Dispatches the call to
  31327. // {@link //reportFailedPredicate}</li>
  31328. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  31329. // the exception</li>
  31330. // </ul>
  31331. //
  31332. DefaultErrorStrategy.prototype.reportError = function (recognizer, e) {
  31333. // if we've already reported an error and have not matched a token
  31334. // yet successfully, don't report any errors.
  31335. if (this.inErrorRecoveryMode(recognizer)) {
  31336. return; // don't report spurious errors
  31337. }
  31338. this.beginErrorCondition(recognizer);
  31339. if (e instanceof NoViableAltException) {
  31340. this.reportNoViableAlternative(recognizer, e);
  31341. } else if (e instanceof InputMismatchException) {
  31342. this.reportInputMismatch(recognizer, e);
  31343. } else if (e instanceof FailedPredicateException) {
  31344. this.reportFailedPredicate(recognizer, e);
  31345. } else {
  31346. console.log("unknown recognition error type: " + e.constructor.name);
  31347. console.log(e.stack);
  31348. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  31349. }
  31350. };
  31351. //
  31352. // {@inheritDoc}
  31353. //
  31354. // <p>The default implementation resynchronizes the parser by consuming tokens
  31355. // until we find one in the resynchronization set--loosely the set of tokens
  31356. // that can follow the current rule.</p>
  31357. //
  31358. DefaultErrorStrategy.prototype.recover = function (recognizer, e) {
  31359. if (this.lastErrorIndex === recognizer.getInputStream().index && this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state) >= 0) {
  31360. // uh oh, another error at same token index and previously-visited
  31361. // state in ATN; must be a case where LT(1) is in the recovery
  31362. // token set so nothing got consumed. Consume a single token
  31363. // at least to prevent an infinite loop; this is a failsafe.
  31364. recognizer.consume();
  31365. }
  31366. this.lastErrorIndex = recognizer._input.index;
  31367. if (this.lastErrorStates === null) {
  31368. this.lastErrorStates = [];
  31369. }
  31370. this.lastErrorStates.push(recognizer.state);
  31371. var followSet = this.getErrorRecoverySet(recognizer);
  31372. this.consumeUntil(recognizer, followSet);
  31373. };
  31374. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  31375. // that the current lookahead symbol is consistent with what were expecting
  31376. // at this point in the ATN. You can call this anytime but ANTLR only
  31377. // generates code to check before subrules/loops and each iteration.
  31378. //
  31379. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  31380. // subrules. E.g.,</p>
  31381. //
  31382. // <pre>
  31383. // a : sync ( stuff sync )* ;
  31384. // sync : {consume to what can follow sync} ;
  31385. // </pre>
  31386. //
  31387. // At the start of a sub rule upon error, {@link //sync} performs single
  31388. // token deletion, if possible. If it can't do that, it bails on the current
  31389. // rule and uses the default error recovery, which consumes until the
  31390. // resynchronization set of the current rule.
  31391. //
  31392. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  31393. // with an empty alternative), then the expected set includes what follows
  31394. // the subrule.</p>
  31395. //
  31396. // <p>During loop iteration, it consumes until it sees a token that can start a
  31397. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  31398. // stay in the loop as long as possible.</p>
  31399. //
  31400. // <p><strong>ORIGINS</strong></p>
  31401. //
  31402. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  31403. // A single mismatch token or missing token would force the parser to bail
  31404. // out of the entire rules surrounding the loop. So, for rule</p>
  31405. //
  31406. // <pre>
  31407. // classDef : 'class' ID '{' member* '}'
  31408. // </pre>
  31409. //
  31410. // input with an extra token between members would force the parser to
  31411. // consume until it found the next class definition rather than the next
  31412. // member definition of the current class.
  31413. //
  31414. // <p>This functionality cost a little bit of effort because the parser has to
  31415. // compare token set at the start of the loop and at each iteration. If for
  31416. // some reason speed is suffering for you, you can turn off this
  31417. // functionality by simply overriding this method as a blank { }.</p>
  31418. //
  31419. DefaultErrorStrategy.prototype.sync = function (recognizer) {
  31420. // If already recovering, don't try to sync
  31421. if (this.inErrorRecoveryMode(recognizer)) {
  31422. return;
  31423. }
  31424. var s = recognizer._interp.atn.states[recognizer.state];
  31425. var la = recognizer.getTokenStream().LA(1);
  31426. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  31427. var nextTokens = recognizer.atn.nextTokens(s);
  31428. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  31429. return;
  31430. }
  31431. switch (s.stateType) {
  31432. case ATNState.BLOCK_START:
  31433. case ATNState.STAR_BLOCK_START:
  31434. case ATNState.PLUS_BLOCK_START:
  31435. case ATNState.STAR_LOOP_ENTRY:
  31436. // report error and recover if possible
  31437. if (this.singleTokenDeletion(recognizer) !== null) {
  31438. return;
  31439. } else {
  31440. throw new InputMismatchException(recognizer);
  31441. }
  31442. break;
  31443. case ATNState.PLUS_LOOP_BACK:
  31444. case ATNState.STAR_LOOP_BACK:
  31445. this.reportUnwantedToken(recognizer);
  31446. var expecting = new IntervalSet();
  31447. expecting.addSet(recognizer.getExpectedTokens());
  31448. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  31449. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  31450. break;
  31451. default:
  31452. // do nothing if we can't identify the exact kind of ATN state
  31453. }
  31454. };
  31455. // This is called by {@link //reportError} when the exception is a
  31456. // {@link NoViableAltException}.
  31457. //
  31458. // @see //reportError
  31459. //
  31460. // @param recognizer the parser instance
  31461. // @param e the recognition exception
  31462. //
  31463. DefaultErrorStrategy.prototype.reportNoViableAlternative = function (recognizer, e) {
  31464. var tokens = recognizer.getTokenStream();
  31465. var input;
  31466. if (tokens !== null) {
  31467. if (e.startToken.type === Token.EOF) {
  31468. input = "<EOF>";
  31469. } else {
  31470. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  31471. }
  31472. } else {
  31473. input = "<unknown input>";
  31474. }
  31475. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  31476. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31477. };
  31478. //
  31479. // This is called by {@link //reportError} when the exception is an
  31480. // {@link InputMismatchException}.
  31481. //
  31482. // @see //reportError
  31483. //
  31484. // @param recognizer the parser instance
  31485. // @param e the recognition exception
  31486. //
  31487. DefaultErrorStrategy.prototype.reportInputMismatch = function (recognizer, e) {
  31488. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) + " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  31489. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31490. };
  31491. //
  31492. // This is called by {@link //reportError} when the exception is a
  31493. // {@link FailedPredicateException}.
  31494. //
  31495. // @see //reportError
  31496. //
  31497. // @param recognizer the parser instance
  31498. // @param e the recognition exception
  31499. //
  31500. DefaultErrorStrategy.prototype.reportFailedPredicate = function (recognizer, e) {
  31501. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  31502. var msg = "rule " + ruleName + " " + e.message;
  31503. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31504. };
  31505. // This method is called to report a syntax error which requires the removal
  31506. // of a token from the input stream. At the time this method is called, the
  31507. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  31508. // removed from the input stream. When this method returns,
  31509. // {@code recognizer} is in error recovery mode.
  31510. //
  31511. // <p>This method is called when {@link //singleTokenDeletion} identifies
  31512. // single-token deletion as a viable recovery strategy for a mismatched
  31513. // input error.</p>
  31514. //
  31515. // <p>The default implementation simply returns if the handler is already in
  31516. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  31517. // enter error recovery mode, followed by calling
  31518. // {@link Parser//notifyErrorListeners}.</p>
  31519. //
  31520. // @param recognizer the parser instance
  31521. //
  31522. DefaultErrorStrategy.prototype.reportUnwantedToken = function (recognizer) {
  31523. if (this.inErrorRecoveryMode(recognizer)) {
  31524. return;
  31525. }
  31526. this.beginErrorCondition(recognizer);
  31527. var t = recognizer.getCurrentToken();
  31528. var tokenName = this.getTokenErrorDisplay(t);
  31529. var expecting = this.getExpectedTokens(recognizer);
  31530. var msg = "extraneous input " + tokenName + " expecting " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  31531. recognizer.notifyErrorListeners(msg, t, null);
  31532. };
  31533. // This method is called to report a syntax error which requires the
  31534. // insertion of a missing token into the input stream. At the time this
  31535. // method is called, the missing token has not yet been inserted. When this
  31536. // method returns, {@code recognizer} is in error recovery mode.
  31537. //
  31538. // <p>This method is called when {@link //singleTokenInsertion} identifies
  31539. // single-token insertion as a viable recovery strategy for a mismatched
  31540. // input error.</p>
  31541. //
  31542. // <p>The default implementation simply returns if the handler is already in
  31543. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  31544. // enter error recovery mode, followed by calling
  31545. // {@link Parser//notifyErrorListeners}.</p>
  31546. //
  31547. // @param recognizer the parser instance
  31548. //
  31549. DefaultErrorStrategy.prototype.reportMissingToken = function (recognizer) {
  31550. if (this.inErrorRecoveryMode(recognizer)) {
  31551. return;
  31552. }
  31553. this.beginErrorCondition(recognizer);
  31554. var t = recognizer.getCurrentToken();
  31555. var expecting = this.getExpectedTokens(recognizer);
  31556. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) + " at " + this.getTokenErrorDisplay(t);
  31557. recognizer.notifyErrorListeners(msg, t, null);
  31558. };
  31559. // <p>The default implementation attempts to recover from the mismatched input
  31560. // by using single token insertion and deletion as described below. If the
  31561. // recovery attempt fails, this method throws an
  31562. // {@link InputMismatchException}.</p>
  31563. //
  31564. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  31565. //
  31566. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  31567. // right token, however, then assume {@code LA(1)} is some extra spurious
  31568. // token and delete it. Then consume and return the next token (which was
  31569. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  31570. //
  31571. // <p>This recovery strategy is implemented by {@link
  31572. // //singleTokenDeletion}.</p>
  31573. //
  31574. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  31575. //
  31576. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  31577. // after the expected {@code LA(1)} token, then assume the token is missing
  31578. // and use the parser's {@link TokenFactory} to create it on the fly. The
  31579. // "insertion" is performed by returning the created token as the successful
  31580. // result of the match operation.</p>
  31581. //
  31582. // <p>This recovery strategy is implemented by {@link
  31583. // //singleTokenInsertion}.</p>
  31584. //
  31585. // <p><strong>EXAMPLE</strong></p>
  31586. //
  31587. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  31588. // the parser returns from the nested call to {@code expr}, it will have
  31589. // call chain:</p>
  31590. //
  31591. // <pre>
  31592. // stat &rarr; expr &rarr; atom
  31593. // </pre>
  31594. //
  31595. // and it will be trying to match the {@code ')'} at this point in the
  31596. // derivation:
  31597. //
  31598. // <pre>
  31599. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  31600. // ^
  31601. // </pre>
  31602. //
  31603. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  31604. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  31605. // is in the set of tokens that can follow the {@code ')'} token reference
  31606. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  31607. //
  31608. DefaultErrorStrategy.prototype.recoverInline = function (recognizer) {
  31609. // SINGLE TOKEN DELETION
  31610. var matchedSymbol = this.singleTokenDeletion(recognizer);
  31611. if (matchedSymbol !== null) {
  31612. // we have deleted the extra token.
  31613. // now, move past ttype token as if all were ok
  31614. recognizer.consume();
  31615. return matchedSymbol;
  31616. }
  31617. // SINGLE TOKEN INSERTION
  31618. if (this.singleTokenInsertion(recognizer)) {
  31619. return this.getMissingSymbol(recognizer);
  31620. }
  31621. // even that didn't work; must throw the exception
  31622. throw new InputMismatchException(recognizer);
  31623. };
  31624. //
  31625. // This method implements the single-token insertion inline error recovery
  31626. // strategy. It is called by {@link //recoverInline} if the single-token
  31627. // deletion strategy fails to recover from the mismatched input. If this
  31628. // method returns {@code true}, {@code recognizer} will be in error recovery
  31629. // mode.
  31630. //
  31631. // <p>This method determines whether or not single-token insertion is viable by
  31632. // checking if the {@code LA(1)} input symbol could be successfully matched
  31633. // if it were instead the {@code LA(2)} symbol. If this method returns
  31634. // {@code true}, the caller is responsible for creating and inserting a
  31635. // token with the correct type to produce this behavior.</p>
  31636. //
  31637. // @param recognizer the parser instance
  31638. // @return {@code true} if single-token insertion is a viable recovery
  31639. // strategy for the current mismatched input, otherwise {@code false}
  31640. //
  31641. DefaultErrorStrategy.prototype.singleTokenInsertion = function (recognizer) {
  31642. var currentSymbolType = recognizer.getTokenStream().LA(1);
  31643. // if current token is consistent with what could come after current
  31644. // ATN state, then we know we're missing a token; error recovery
  31645. // is free to conjure up and insert the missing token
  31646. var atn = recognizer._interp.atn;
  31647. var currentState = atn.states[recognizer.state];
  31648. var next = currentState.transitions[0].target;
  31649. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  31650. if (expectingAtLL2.contains(currentSymbolType)) {
  31651. this.reportMissingToken(recognizer);
  31652. return true;
  31653. } else {
  31654. return false;
  31655. }
  31656. };
  31657. // This method implements the single-token deletion inline error recovery
  31658. // strategy. It is called by {@link //recoverInline} to attempt to recover
  31659. // from mismatched input. If this method returns null, the parser and error
  31660. // handler state will not have changed. If this method returns non-null,
  31661. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  31662. // returned token was a successful match.
  31663. //
  31664. // <p>If the single-token deletion is successful, this method calls
  31665. // {@link //reportUnwantedToken} to report the error, followed by
  31666. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  31667. // before returning {@link //reportMatch} is called to signal a successful
  31668. // match.</p>
  31669. //
  31670. // @param recognizer the parser instance
  31671. // @return the successfully matched {@link Token} instance if single-token
  31672. // deletion successfully recovers from the mismatched input, otherwise
  31673. // {@code null}
  31674. //
  31675. DefaultErrorStrategy.prototype.singleTokenDeletion = function (recognizer) {
  31676. var nextTokenType = recognizer.getTokenStream().LA(2);
  31677. var expecting = this.getExpectedTokens(recognizer);
  31678. if (expecting.contains(nextTokenType)) {
  31679. this.reportUnwantedToken(recognizer);
  31680. // print("recoverFromMismatchedToken deleting " \
  31681. // + str(recognizer.getTokenStream().LT(1)) \
  31682. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  31683. // + " is what we want", file=sys.stderr)
  31684. recognizer.consume(); // simply delete extra token
  31685. // we want to return the token we're actually matching
  31686. var matchedSymbol = recognizer.getCurrentToken();
  31687. this.reportMatch(recognizer); // we know current token is correct
  31688. return matchedSymbol;
  31689. } else {
  31690. return null;
  31691. }
  31692. };
  31693. // Conjure up a missing token during error recovery.
  31694. //
  31695. // The recognizer attempts to recover from single missing
  31696. // symbols. But, actions might refer to that missing symbol.
  31697. // For example, x=ID {f($x);}. The action clearly assumes
  31698. // that there has been an identifier matched previously and that
  31699. // $x points at that token. If that token is missing, but
  31700. // the next token in the stream is what we want we assume that
  31701. // this token is missing and we keep going. Because we
  31702. // have to return some token to replace the missing token,
  31703. // we have to conjure one up. This method gives the user control
  31704. // over the tokens returned for missing tokens. Mostly,
  31705. // you will want to create something special for identifier
  31706. // tokens. For literals such as '{' and ',', the default
  31707. // action in the parser or tree parser works. It simply creates
  31708. // a CommonToken of the appropriate type. The text will be the token.
  31709. // If you change what tokens must be created by the lexer,
  31710. // override this method to create the appropriate tokens.
  31711. //
  31712. DefaultErrorStrategy.prototype.getMissingSymbol = function (recognizer) {
  31713. var currentSymbol = recognizer.getCurrentToken();
  31714. var expecting = this.getExpectedTokens(recognizer);
  31715. var expectedTokenType = expecting.first(); // get any element
  31716. var tokenText;
  31717. if (expectedTokenType === Token.EOF) {
  31718. tokenText = "<missing EOF>";
  31719. } else {
  31720. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  31721. }
  31722. var current = currentSymbol;
  31723. var lookback = recognizer.getTokenStream().LT(-1);
  31724. if (current.type === Token.EOF && lookback !== null) {
  31725. current = lookback;
  31726. }
  31727. return recognizer.getTokenFactory().create(current.source, expectedTokenType, tokenText, Token.DEFAULT_CHANNEL, -1, -1, current.line, current.column);
  31728. };
  31729. DefaultErrorStrategy.prototype.getExpectedTokens = function (recognizer) {
  31730. return recognizer.getExpectedTokens();
  31731. };
  31732. // How should a token be displayed in an error message? The default
  31733. // is to display just the text, but during development you might
  31734. // want to have a lot of information spit out. Override in that case
  31735. // to use t.toString() (which, for CommonToken, dumps everything about
  31736. // the token). This is better than forcing you to override a method in
  31737. // your token objects because you don't have to go modify your lexer
  31738. // so that it creates a new Java type.
  31739. //
  31740. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function (t) {
  31741. if (t === null) {
  31742. return "<no token>";
  31743. }
  31744. var s = t.text;
  31745. if (s === null) {
  31746. if (t.type === Token.EOF) {
  31747. s = "<EOF>";
  31748. } else {
  31749. s = "<" + t.type + ">";
  31750. }
  31751. }
  31752. return this.escapeWSAndQuote(s);
  31753. };
  31754. DefaultErrorStrategy.prototype.escapeWSAndQuote = function (s) {
  31755. s = s.replace(/\n/g, "\\n");
  31756. s = s.replace(/\r/g, "\\r");
  31757. s = s.replace(/\t/g, "\\t");
  31758. return "'" + s + "'";
  31759. };
  31760. // Compute the error recovery set for the current rule. During
  31761. // rule invocation, the parser pushes the set of tokens that can
  31762. // follow that rule reference on the stack; this amounts to
  31763. // computing FIRST of what follows the rule reference in the
  31764. // enclosing rule. See LinearApproximator.FIRST().
  31765. // This local follow set only includes tokens
  31766. // from within the rule; i.e., the FIRST computation done by
  31767. // ANTLR stops at the end of a rule.
  31768. //
  31769. // EXAMPLE
  31770. //
  31771. // When you find a "no viable alt exception", the input is not
  31772. // consistent with any of the alternatives for rule r. The best
  31773. // thing to do is to consume tokens until you see something that
  31774. // can legally follow a call to r//or* any rule that called r.
  31775. // You don't want the exact set of viable next tokens because the
  31776. // input might just be missing a token--you might consume the
  31777. // rest of the input looking for one of the missing tokens.
  31778. //
  31779. // Consider grammar:
  31780. //
  31781. // a : '[' b ']'
  31782. // | '(' b ')'
  31783. // ;
  31784. // b : c '^' INT ;
  31785. // c : ID
  31786. // | INT
  31787. // ;
  31788. //
  31789. // At each rule invocation, the set of tokens that could follow
  31790. // that rule is pushed on a stack. Here are the various
  31791. // context-sensitive follow sets:
  31792. //
  31793. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  31794. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  31795. // FOLLOW(c_in_b) = FIRST('^') = '^'
  31796. //
  31797. // Upon erroneous input "[]", the call chain is
  31798. //
  31799. // a -> b -> c
  31800. //
  31801. // and, hence, the follow context stack is:
  31802. //
  31803. // depth follow set start of rule execution
  31804. // 0 <EOF> a (from main())
  31805. // 1 ']' b
  31806. // 2 '^' c
  31807. //
  31808. // Notice that ')' is not included, because b would have to have
  31809. // been called from a different context in rule a for ')' to be
  31810. // included.
  31811. //
  31812. // For error recovery, we cannot consider FOLLOW(c)
  31813. // (context-sensitive or otherwise). We need the combined set of
  31814. // all context-sensitive FOLLOW sets--the set of all tokens that
  31815. // could follow any reference in the call chain. We need to
  31816. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  31817. // we resync'd to that token, we'd consume until EOF. We need to
  31818. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  31819. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  31820. // not consume anything. After printing an error, rule c would
  31821. // return normally. Rule b would not find the required '^' though.
  31822. // At this point, it gets a mismatched token error and throws an
  31823. // exception (since LA(1) is not in the viable following token
  31824. // set). The rule exception handler tries to recover, but finds
  31825. // the same recovery set and doesn't consume anything. Rule b
  31826. // exits normally returning to rule a. Now it finds the ']' (and
  31827. // with the successful match exits errorRecovery mode).
  31828. //
  31829. // So, you can see that the parser walks up the call chain looking
  31830. // for the token that was a member of the recovery set.
  31831. //
  31832. // Errors are not generated in errorRecovery mode.
  31833. //
  31834. // ANTLR's error recovery mechanism is based upon original ideas:
  31835. //
  31836. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  31837. //
  31838. // and
  31839. //
  31840. // "A note on error recovery in recursive descent parsers":
  31841. // http://portal.acm.org/citation.cfm?id=947902.947905
  31842. //
  31843. // Later, Josef Grosch had some good ideas:
  31844. //
  31845. // "Efficient and Comfortable Error Recovery in Recursive Descent
  31846. // Parsers":
  31847. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  31848. //
  31849. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  31850. // at run-time upon error to avoid overhead during parsing.
  31851. //
  31852. DefaultErrorStrategy.prototype.getErrorRecoverySet = function (recognizer) {
  31853. var atn = recognizer._interp.atn;
  31854. var ctx = recognizer._ctx;
  31855. var recoverSet = new IntervalSet();
  31856. while (ctx !== null && ctx.invokingState >= 0) {
  31857. // compute what follows who invoked us
  31858. var invokingState = atn.states[ctx.invokingState];
  31859. var rt = invokingState.transitions[0];
  31860. var follow = atn.nextTokens(rt.followState);
  31861. recoverSet.addSet(follow);
  31862. ctx = ctx.parentCtx;
  31863. }
  31864. recoverSet.removeOne(Token.EPSILON);
  31865. return recoverSet;
  31866. };
  31867. // Consume tokens until one matches the given token set.//
  31868. DefaultErrorStrategy.prototype.consumeUntil = function (recognizer, set) {
  31869. var ttype = recognizer.getTokenStream().LA(1);
  31870. while (ttype !== Token.EOF && !set.contains(ttype)) {
  31871. recognizer.consume();
  31872. ttype = recognizer.getTokenStream().LA(1);
  31873. }
  31874. };
  31875. //
  31876. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  31877. // by immediately canceling the parse operation with a
  31878. // {@link ParseCancellationException}. The implementation ensures that the
  31879. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  31880. // that were not completed prior to encountering the error.
  31881. //
  31882. // <p>
  31883. // This error strategy is useful in the following scenarios.</p>
  31884. //
  31885. // <ul>
  31886. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  31887. // stage of two-stage parsing to immediately terminate if an error is
  31888. // encountered, and immediately fall back to the second stage. In addition to
  31889. // avoiding wasted work by attempting to recover from errors here, the empty
  31890. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  31891. // the first stage.</li>
  31892. // <li><strong>Silent validation:</strong> When syntax errors are not being
  31893. // reported or logged, and the parse result is simply ignored if errors occur,
  31894. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  31895. // when the result will be ignored either way.</li>
  31896. // </ul>
  31897. //
  31898. // <p>
  31899. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  31900. //
  31901. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  31902. //
  31903. function BailErrorStrategy() {
  31904. DefaultErrorStrategy.call(this);
  31905. return this;
  31906. }
  31907. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  31908. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  31909. // Instead of recovering from exception {@code e}, re-throw it wrapped
  31910. // in a {@link ParseCancellationException} so it is not caught by the
  31911. // rule function catches. Use {@link Exception//getCause()} to get the
  31912. // original {@link RecognitionException}.
  31913. //
  31914. BailErrorStrategy.prototype.recover = function (recognizer, e) {
  31915. var context = recognizer._ctx;
  31916. while (context !== null) {
  31917. context.exception = e;
  31918. context = context.parentCtx;
  31919. }
  31920. throw new ParseCancellationException(e);
  31921. };
  31922. // Make sure we don't attempt to recover inline; if the parser
  31923. // successfully recovers, it won't throw an exception.
  31924. //
  31925. BailErrorStrategy.prototype.recoverInline = function (recognizer) {
  31926. this.recover(recognizer, new InputMismatchException(recognizer));
  31927. };
  31928. // Make sure we don't attempt to recover from problems in subrules.//
  31929. BailErrorStrategy.prototype.sync = function (recognizer) {
  31930. // pass
  31931. };
  31932. exports.BailErrorStrategy = BailErrorStrategy;
  31933. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  31934. /***/ }),
  31935. /***/ "./node_modules/antlr4/error/Errors.js":
  31936. /*!*********************************************!*\
  31937. !*** ./node_modules/antlr4/error/Errors.js ***!
  31938. \*********************************************/
  31939. /*! no static exports found */
  31940. /***/ (function(module, exports, __webpack_require__) {
  31941. "use strict";
  31942. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31943. * Use of this file is governed by the BSD 3-clause license that
  31944. * can be found in the LICENSE.txt file in the project root.
  31945. */
  31946. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  31947. // 3 kinds of errors: prediction errors, failed predicate errors, and
  31948. // mismatched input errors. In each case, the parser knows where it is
  31949. // in the input, where it is in the ATN, the rule invocation stack,
  31950. // and what kind of problem occurred.
  31951. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  31952. function RecognitionException(params) {
  31953. Error.call(this);
  31954. if (!!Error.captureStackTrace) {
  31955. Error.captureStackTrace(this, RecognitionException);
  31956. } else {
  31957. var stack = new Error().stack;
  31958. }
  31959. this.message = params.message;
  31960. this.recognizer = params.recognizer;
  31961. this.input = params.input;
  31962. this.ctx = params.ctx;
  31963. // The current {@link Token} when an error occurred. Since not all streams
  31964. // support accessing symbols by index, we have to track the {@link Token}
  31965. // instance itself.
  31966. this.offendingToken = null;
  31967. // Get the ATN state number the parser was in at the time the error
  31968. // occurred. For {@link NoViableAltException} and
  31969. // {@link LexerNoViableAltException} exceptions, this is the
  31970. // {@link DecisionState} number. For others, it is the state whose outgoing
  31971. // edge we couldn't match.
  31972. this.offendingState = -1;
  31973. if (this.recognizer !== null) {
  31974. this.offendingState = this.recognizer.state;
  31975. }
  31976. return this;
  31977. }
  31978. RecognitionException.prototype = Object.create(Error.prototype);
  31979. RecognitionException.prototype.constructor = RecognitionException;
  31980. // <p>If the state number is not known, this method returns -1.</p>
  31981. //
  31982. // Gets the set of input symbols which could potentially follow the
  31983. // previously matched symbol at the time this exception was thrown.
  31984. //
  31985. // <p>If the set of expected tokens is not known and could not be computed,
  31986. // this method returns {@code null}.</p>
  31987. //
  31988. // @return The set of token types that could potentially follow the current
  31989. // state in the ATN, or {@code null} if the information is not available.
  31990. // /
  31991. RecognitionException.prototype.getExpectedTokens = function () {
  31992. if (this.recognizer !== null) {
  31993. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  31994. } else {
  31995. return null;
  31996. }
  31997. };
  31998. RecognitionException.prototype.toString = function () {
  31999. return this.message;
  32000. };
  32001. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  32002. RecognitionException.call(this, { message: "", recognizer: lexer, input: input, ctx: null });
  32003. this.startIndex = startIndex;
  32004. this.deadEndConfigs = deadEndConfigs;
  32005. return this;
  32006. }
  32007. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  32008. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  32009. LexerNoViableAltException.prototype.toString = function () {
  32010. var symbol = "";
  32011. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  32012. symbol = this.input.getText((this.startIndex, this.startIndex));
  32013. }
  32014. return "LexerNoViableAltException" + symbol;
  32015. };
  32016. // Indicates that the parser could not decide which of two or more paths
  32017. // to take based upon the remaining input. It tracks the starting token
  32018. // of the offending input and also knows where the parser was
  32019. // in the various paths when the error. Reported by reportNoViableAlternative()
  32020. //
  32021. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  32022. ctx = ctx || recognizer._ctx;
  32023. offendingToken = offendingToken || recognizer.getCurrentToken();
  32024. startToken = startToken || recognizer.getCurrentToken();
  32025. input = input || recognizer.getInputStream();
  32026. RecognitionException.call(this, { message: "", recognizer: recognizer, input: input, ctx: ctx });
  32027. // Which configurations did we try at input.index() that couldn't match
  32028. // input.LT(1)?//
  32029. this.deadEndConfigs = deadEndConfigs;
  32030. // The token object at the start index; the input stream might
  32031. // not be buffering tokens so get a reference to it. (At the
  32032. // time the error occurred, of course the stream needs to keep a
  32033. // buffer all of the tokens but later we might not have access to those.)
  32034. this.startToken = startToken;
  32035. this.offendingToken = offendingToken;
  32036. }
  32037. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  32038. NoViableAltException.prototype.constructor = NoViableAltException;
  32039. // This signifies any kind of mismatched input exceptions such as
  32040. // when the current input does not match the expected token.
  32041. //
  32042. function InputMismatchException(recognizer) {
  32043. RecognitionException.call(this, { message: "", recognizer: recognizer, input: recognizer.getInputStream(), ctx: recognizer._ctx });
  32044. this.offendingToken = recognizer.getCurrentToken();
  32045. }
  32046. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  32047. InputMismatchException.prototype.constructor = InputMismatchException;
  32048. // A semantic predicate failed during validation. Validation of predicates
  32049. // occurs when normally parsing the alternative just like matching a token.
  32050. // Disambiguating predicate evaluation occurs when we test a predicate during
  32051. // prediction.
  32052. function FailedPredicateException(recognizer, predicate, message) {
  32053. RecognitionException.call(this, { message: this.formatMessage(predicate, message || null), recognizer: recognizer,
  32054. input: recognizer.getInputStream(), ctx: recognizer._ctx });
  32055. var s = recognizer._interp.atn.states[recognizer.state];
  32056. var trans = s.transitions[0];
  32057. if (trans instanceof PredicateTransition) {
  32058. this.ruleIndex = trans.ruleIndex;
  32059. this.predicateIndex = trans.predIndex;
  32060. } else {
  32061. this.ruleIndex = 0;
  32062. this.predicateIndex = 0;
  32063. }
  32064. this.predicate = predicate;
  32065. this.offendingToken = recognizer.getCurrentToken();
  32066. return this;
  32067. }
  32068. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  32069. FailedPredicateException.prototype.constructor = FailedPredicateException;
  32070. FailedPredicateException.prototype.formatMessage = function (predicate, message) {
  32071. if (message !== null) {
  32072. return message;
  32073. } else {
  32074. return "failed predicate: {" + predicate + "}?";
  32075. }
  32076. };
  32077. function ParseCancellationException() {
  32078. Error.call(this);
  32079. Error.captureStackTrace(this, ParseCancellationException);
  32080. return this;
  32081. }
  32082. ParseCancellationException.prototype = Object.create(Error.prototype);
  32083. ParseCancellationException.prototype.constructor = ParseCancellationException;
  32084. exports.RecognitionException = RecognitionException;
  32085. exports.NoViableAltException = NoViableAltException;
  32086. exports.LexerNoViableAltException = LexerNoViableAltException;
  32087. exports.InputMismatchException = InputMismatchException;
  32088. exports.FailedPredicateException = FailedPredicateException;
  32089. exports.ParseCancellationException = ParseCancellationException;
  32090. /***/ }),
  32091. /***/ "./node_modules/antlr4/error/index.js":
  32092. /*!********************************************!*\
  32093. !*** ./node_modules/antlr4/error/index.js ***!
  32094. \********************************************/
  32095. /*! no static exports found */
  32096. /***/ (function(module, exports, __webpack_require__) {
  32097. "use strict";
  32098. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32099. * Use of this file is governed by the BSD 3-clause license that
  32100. * can be found in the LICENSE.txt file in the project root.
  32101. */
  32102. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  32103. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  32104. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  32105. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  32106. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  32107. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  32108. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  32109. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  32110. /***/ }),
  32111. /***/ "./node_modules/antlr4/index.js":
  32112. /*!**************************************!*\
  32113. !*** ./node_modules/antlr4/index.js ***!
  32114. \**************************************/
  32115. /*! no static exports found */
  32116. /***/ (function(module, exports, __webpack_require__) {
  32117. "use strict";
  32118. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32119. * Use of this file is governed by the BSD 3-clause license that
  32120. * can be found in the LICENSE.txt file in the project root.
  32121. */
  32122. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  32123. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  32124. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  32125. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  32126. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  32127. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  32128. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  32129. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  32130. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  32131. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  32132. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  32133. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  32134. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  32135. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  32136. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  32137. exports.PredictionContextCache = pc.PredictionContextCache;
  32138. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  32139. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  32140. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  32141. /***/ }),
  32142. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  32143. /*!******************************************************!*\
  32144. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  32145. \******************************************************/
  32146. /*! no static exports found */
  32147. /***/ (function(module, exports, __webpack_require__) {
  32148. "use strict";
  32149. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  32150. if (!String.prototype.codePointAt) {
  32151. (function () {
  32152. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  32153. var defineProperty = function () {
  32154. // IE 8 only supports `Object.defineProperty` on DOM elements
  32155. try {
  32156. var object = {};
  32157. var $defineProperty = Object.defineProperty;
  32158. var result = $defineProperty(object, object, object) && $defineProperty;
  32159. } catch (error) {}
  32160. return result;
  32161. }();
  32162. var codePointAt = function codePointAt(position) {
  32163. if (this == null) {
  32164. throw TypeError();
  32165. }
  32166. var string = String(this);
  32167. var size = string.length;
  32168. // `ToInteger`
  32169. var index = position ? Number(position) : 0;
  32170. if (index != index) {
  32171. // better `isNaN`
  32172. index = 0;
  32173. }
  32174. // Account for out-of-bounds indices:
  32175. if (index < 0 || index >= size) {
  32176. return undefined;
  32177. }
  32178. // Get the first code unit
  32179. var first = string.charCodeAt(index);
  32180. var second;
  32181. if ( // check if it’s the start of a surrogate pair
  32182. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  32183. size > index + 1 // there is a next code unit
  32184. ) {
  32185. second = string.charCodeAt(index + 1);
  32186. if (second >= 0xDC00 && second <= 0xDFFF) {
  32187. // low surrogate
  32188. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32189. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  32190. }
  32191. }
  32192. return first;
  32193. };
  32194. if (defineProperty) {
  32195. defineProperty(String.prototype, 'codePointAt', {
  32196. 'value': codePointAt,
  32197. 'configurable': true,
  32198. 'writable': true
  32199. });
  32200. } else {
  32201. String.prototype.codePointAt = codePointAt;
  32202. }
  32203. })();
  32204. }
  32205. /***/ }),
  32206. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  32207. /*!********************************************************!*\
  32208. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  32209. \********************************************************/
  32210. /*! no static exports found */
  32211. /***/ (function(module, exports, __webpack_require__) {
  32212. "use strict";
  32213. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  32214. if (!String.fromCodePoint) {
  32215. (function () {
  32216. var defineProperty = function () {
  32217. // IE 8 only supports `Object.defineProperty` on DOM elements
  32218. try {
  32219. var object = {};
  32220. var $defineProperty = Object.defineProperty;
  32221. var result = $defineProperty(object, object, object) && $defineProperty;
  32222. } catch (error) {}
  32223. return result;
  32224. }();
  32225. var stringFromCharCode = String.fromCharCode;
  32226. var floor = Math.floor;
  32227. var fromCodePoint = function fromCodePoint(_) {
  32228. var MAX_SIZE = 0x4000;
  32229. var codeUnits = [];
  32230. var highSurrogate;
  32231. var lowSurrogate;
  32232. var index = -1;
  32233. var length = arguments.length;
  32234. if (!length) {
  32235. return '';
  32236. }
  32237. var result = '';
  32238. while (++index < length) {
  32239. var codePoint = Number(arguments[index]);
  32240. if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  32241. codePoint < 0 || // not a valid Unicode code point
  32242. codePoint > 0x10FFFF || // not a valid Unicode code point
  32243. floor(codePoint) != codePoint // not an integer
  32244. ) {
  32245. throw RangeError('Invalid code point: ' + codePoint);
  32246. }
  32247. if (codePoint <= 0xFFFF) {
  32248. // BMP code point
  32249. codeUnits.push(codePoint);
  32250. } else {
  32251. // Astral code point; split in surrogate halves
  32252. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32253. codePoint -= 0x10000;
  32254. highSurrogate = (codePoint >> 10) + 0xD800;
  32255. lowSurrogate = codePoint % 0x400 + 0xDC00;
  32256. codeUnits.push(highSurrogate, lowSurrogate);
  32257. }
  32258. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  32259. result += stringFromCharCode.apply(null, codeUnits);
  32260. codeUnits.length = 0;
  32261. }
  32262. }
  32263. return result;
  32264. };
  32265. if (defineProperty) {
  32266. defineProperty(String, 'fromCodePoint', {
  32267. 'value': fromCodePoint,
  32268. 'configurable': true,
  32269. 'writable': true
  32270. });
  32271. } else {
  32272. String.fromCodePoint = fromCodePoint;
  32273. }
  32274. })();
  32275. }
  32276. /***/ }),
  32277. /***/ "./node_modules/antlr4/tree/Tree.js":
  32278. /*!******************************************!*\
  32279. !*** ./node_modules/antlr4/tree/Tree.js ***!
  32280. \******************************************/
  32281. /*! no static exports found */
  32282. /***/ (function(module, exports, __webpack_require__) {
  32283. "use strict";
  32284. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32285. * Use of this file is governed by the BSD 3-clause license that
  32286. * can be found in the LICENSE.txt file in the project root.
  32287. */
  32288. ///
  32289. // The basic notion of a tree has a parent, a payload, and a list of children.
  32290. // It is the most abstract interface for all the trees used by ANTLR.
  32291. ///
  32292. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32293. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  32294. var INVALID_INTERVAL = new Interval(-1, -2);
  32295. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  32296. function Tree() {
  32297. return this;
  32298. }
  32299. function SyntaxTree() {
  32300. Tree.call(this);
  32301. return this;
  32302. }
  32303. SyntaxTree.prototype = Object.create(Tree.prototype);
  32304. SyntaxTree.prototype.constructor = SyntaxTree;
  32305. function ParseTree() {
  32306. SyntaxTree.call(this);
  32307. return this;
  32308. }
  32309. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  32310. ParseTree.prototype.constructor = ParseTree;
  32311. function RuleNode() {
  32312. ParseTree.call(this);
  32313. return this;
  32314. }
  32315. RuleNode.prototype = Object.create(ParseTree.prototype);
  32316. RuleNode.prototype.constructor = RuleNode;
  32317. function TerminalNode() {
  32318. ParseTree.call(this);
  32319. return this;
  32320. }
  32321. TerminalNode.prototype = Object.create(ParseTree.prototype);
  32322. TerminalNode.prototype.constructor = TerminalNode;
  32323. function ErrorNode() {
  32324. TerminalNode.call(this);
  32325. return this;
  32326. }
  32327. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  32328. ErrorNode.prototype.constructor = ErrorNode;
  32329. function ParseTreeVisitor() {
  32330. return this;
  32331. }
  32332. ParseTreeVisitor.prototype.visit = function (ctx) {
  32333. if (Array.isArray(ctx)) {
  32334. return ctx.map(function (child) {
  32335. return child.accept(this);
  32336. }, this);
  32337. } else {
  32338. return ctx.accept(this);
  32339. }
  32340. };
  32341. ParseTreeVisitor.prototype.visitChildren = function (ctx) {
  32342. return this.visit(ctx.children);
  32343. };
  32344. ParseTreeVisitor.prototype.visitTerminal = function (node) {};
  32345. ParseTreeVisitor.prototype.visitErrorNode = function (node) {};
  32346. function ParseTreeListener() {
  32347. return this;
  32348. }
  32349. ParseTreeListener.prototype.visitTerminal = function (node) {};
  32350. ParseTreeListener.prototype.visitErrorNode = function (node) {};
  32351. ParseTreeListener.prototype.enterEveryRule = function (node) {};
  32352. ParseTreeListener.prototype.exitEveryRule = function (node) {};
  32353. function TerminalNodeImpl(symbol) {
  32354. TerminalNode.call(this);
  32355. this.parentCtx = null;
  32356. this.symbol = symbol;
  32357. return this;
  32358. }
  32359. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  32360. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  32361. TerminalNodeImpl.prototype.getChild = function (i) {
  32362. return null;
  32363. };
  32364. TerminalNodeImpl.prototype.getSymbol = function () {
  32365. return this.symbol;
  32366. };
  32367. TerminalNodeImpl.prototype.getParent = function () {
  32368. return this.parentCtx;
  32369. };
  32370. TerminalNodeImpl.prototype.getPayload = function () {
  32371. return this.symbol;
  32372. };
  32373. TerminalNodeImpl.prototype.getSourceInterval = function () {
  32374. if (this.symbol === null) {
  32375. return INVALID_INTERVAL;
  32376. }
  32377. var tokenIndex = this.symbol.tokenIndex;
  32378. return new Interval(tokenIndex, tokenIndex);
  32379. };
  32380. TerminalNodeImpl.prototype.getChildCount = function () {
  32381. return 0;
  32382. };
  32383. TerminalNodeImpl.prototype.accept = function (visitor) {
  32384. return visitor.visitTerminal(this);
  32385. };
  32386. TerminalNodeImpl.prototype.getText = function () {
  32387. return this.symbol.text;
  32388. };
  32389. TerminalNodeImpl.prototype.toString = function () {
  32390. if (this.symbol.type === Token.EOF) {
  32391. return "<EOF>";
  32392. } else {
  32393. return this.symbol.text;
  32394. }
  32395. };
  32396. // Represents a token that was consumed during resynchronization
  32397. // rather than during a valid match operation. For example,
  32398. // we will create this kind of a node during single token insertion
  32399. // and deletion as well as during "consume until error recovery set"
  32400. // upon no viable alternative exceptions.
  32401. function ErrorNodeImpl(token) {
  32402. TerminalNodeImpl.call(this, token);
  32403. return this;
  32404. }
  32405. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  32406. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  32407. ErrorNodeImpl.prototype.isErrorNode = function () {
  32408. return true;
  32409. };
  32410. ErrorNodeImpl.prototype.accept = function (visitor) {
  32411. return visitor.visitErrorNode(this);
  32412. };
  32413. function ParseTreeWalker() {
  32414. return this;
  32415. }
  32416. ParseTreeWalker.prototype.walk = function (listener, t) {
  32417. var errorNode = t instanceof ErrorNode || t.isErrorNode !== undefined && t.isErrorNode();
  32418. if (errorNode) {
  32419. listener.visitErrorNode(t);
  32420. } else if (t instanceof TerminalNode) {
  32421. listener.visitTerminal(t);
  32422. } else {
  32423. this.enterRule(listener, t);
  32424. for (var i = 0; i < t.getChildCount(); i++) {
  32425. var child = t.getChild(i);
  32426. this.walk(listener, child);
  32427. }
  32428. this.exitRule(listener, t);
  32429. }
  32430. };
  32431. //
  32432. // The discovery of a rule node, involves sending two events: the generic
  32433. // {@link ParseTreeListener//enterEveryRule} and a
  32434. // {@link RuleContext}-specific event. First we trigger the generic and then
  32435. // the rule specific. We to them in reverse order upon finishing the node.
  32436. //
  32437. ParseTreeWalker.prototype.enterRule = function (listener, r) {
  32438. var ctx = r.getRuleContext();
  32439. listener.enterEveryRule(ctx);
  32440. ctx.enterRule(listener);
  32441. };
  32442. ParseTreeWalker.prototype.exitRule = function (listener, r) {
  32443. var ctx = r.getRuleContext();
  32444. ctx.exitRule(listener);
  32445. listener.exitEveryRule(ctx);
  32446. };
  32447. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  32448. exports.RuleNode = RuleNode;
  32449. exports.ErrorNode = ErrorNode;
  32450. exports.TerminalNode = TerminalNode;
  32451. exports.ErrorNodeImpl = ErrorNodeImpl;
  32452. exports.TerminalNodeImpl = TerminalNodeImpl;
  32453. exports.ParseTreeListener = ParseTreeListener;
  32454. exports.ParseTreeVisitor = ParseTreeVisitor;
  32455. exports.ParseTreeWalker = ParseTreeWalker;
  32456. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  32457. /***/ }),
  32458. /***/ "./node_modules/antlr4/tree/Trees.js":
  32459. /*!*******************************************!*\
  32460. !*** ./node_modules/antlr4/tree/Trees.js ***!
  32461. \*******************************************/
  32462. /*! no static exports found */
  32463. /***/ (function(module, exports, __webpack_require__) {
  32464. "use strict";
  32465. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32466. * Use of this file is governed by the BSD 3-clause license that
  32467. * can be found in the LICENSE.txt file in the project root.
  32468. */
  32469. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  32470. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32471. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  32472. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  32473. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  32474. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  32475. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  32476. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  32477. /** A set of utility routines useful for all kinds of ANTLR trees. */
  32478. function Trees() {}
  32479. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  32480. // node payloads to get the text for the nodes. Detect
  32481. // parse trees and extract data appropriately.
  32482. Trees.toStringTree = function (tree, ruleNames, recog) {
  32483. ruleNames = ruleNames || null;
  32484. recog = recog || null;
  32485. if (recog !== null) {
  32486. ruleNames = recog.ruleNames;
  32487. }
  32488. var s = Trees.getNodeText(tree, ruleNames);
  32489. s = Utils.escapeWhitespace(s, false);
  32490. var c = tree.getChildCount();
  32491. if (c === 0) {
  32492. return s;
  32493. }
  32494. var res = "(" + s + ' ';
  32495. if (c > 0) {
  32496. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  32497. res = res.concat(s);
  32498. }
  32499. for (var i = 1; i < c; i++) {
  32500. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  32501. res = res.concat(' ' + s);
  32502. }
  32503. res = res.concat(")");
  32504. return res;
  32505. };
  32506. Trees.getNodeText = function (t, ruleNames, recog) {
  32507. ruleNames = ruleNames || null;
  32508. recog = recog || null;
  32509. if (recog !== null) {
  32510. ruleNames = recog.ruleNames;
  32511. }
  32512. if (ruleNames !== null) {
  32513. if (t instanceof RuleContext) {
  32514. var altNumber = t.getAltNumber();
  32515. if (altNumber != INVALID_ALT_NUMBER) {
  32516. return ruleNames[t.ruleIndex] + ":" + altNumber;
  32517. }
  32518. return ruleNames[t.ruleIndex];
  32519. } else if (t instanceof ErrorNode) {
  32520. return t.toString();
  32521. } else if (t instanceof TerminalNode) {
  32522. if (t.symbol !== null) {
  32523. return t.symbol.text;
  32524. }
  32525. }
  32526. }
  32527. // no recog for rule names
  32528. var payload = t.getPayload();
  32529. if (payload instanceof Token) {
  32530. return payload.text;
  32531. }
  32532. return t.getPayload().toString();
  32533. };
  32534. // Return ordered list of all children of this node
  32535. Trees.getChildren = function (t) {
  32536. var list = [];
  32537. for (var i = 0; i < t.getChildCount(); i++) {
  32538. list.push(t.getChild(i));
  32539. }
  32540. return list;
  32541. };
  32542. // Return a list of all ancestors of this node. The first node of
  32543. // list is the root and the last is the parent of this node.
  32544. //
  32545. Trees.getAncestors = function (t) {
  32546. var ancestors = [];
  32547. t = t.getParent();
  32548. while (t !== null) {
  32549. ancestors = [t].concat(ancestors);
  32550. t = t.getParent();
  32551. }
  32552. return ancestors;
  32553. };
  32554. Trees.findAllTokenNodes = function (t, ttype) {
  32555. return Trees.findAllNodes(t, ttype, true);
  32556. };
  32557. Trees.findAllRuleNodes = function (t, ruleIndex) {
  32558. return Trees.findAllNodes(t, ruleIndex, false);
  32559. };
  32560. Trees.findAllNodes = function (t, index, findTokens) {
  32561. var nodes = [];
  32562. Trees._findAllNodes(t, index, findTokens, nodes);
  32563. return nodes;
  32564. };
  32565. Trees._findAllNodes = function (t, index, findTokens, nodes) {
  32566. // check this node (the root) first
  32567. if (findTokens && t instanceof TerminalNode) {
  32568. if (t.symbol.type === index) {
  32569. nodes.push(t);
  32570. }
  32571. } else if (!findTokens && t instanceof ParserRuleContext) {
  32572. if (t.ruleIndex === index) {
  32573. nodes.push(t);
  32574. }
  32575. }
  32576. // check children
  32577. for (var i = 0; i < t.getChildCount(); i++) {
  32578. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  32579. }
  32580. };
  32581. Trees.descendants = function (t) {
  32582. var nodes = [t];
  32583. for (var i = 0; i < t.getChildCount(); i++) {
  32584. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  32585. }
  32586. return nodes;
  32587. };
  32588. exports.Trees = Trees;
  32589. /***/ }),
  32590. /***/ "./node_modules/antlr4/tree/index.js":
  32591. /*!*******************************************!*\
  32592. !*** ./node_modules/antlr4/tree/index.js ***!
  32593. \*******************************************/
  32594. /*! no static exports found */
  32595. /***/ (function(module, exports, __webpack_require__) {
  32596. "use strict";
  32597. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32598. * Use of this file is governed by the BSD 3-clause license that
  32599. * can be found in the LICENSE.txt file in the project root.
  32600. */
  32601. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  32602. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  32603. exports.RuleNode = Tree.RuleNode;
  32604. exports.ParseTreeListener = Tree.ParseTreeListener;
  32605. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  32606. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  32607. /***/ }),
  32608. /***/ "./node_modules/decimal.js/decimal.js":
  32609. /*!********************************************!*\
  32610. !*** ./node_modules/decimal.js/decimal.js ***!
  32611. \********************************************/
  32612. /*! no static exports found */
  32613. /***/ (function(module, exports, __webpack_require__) {
  32614. "use strict";
  32615. var __WEBPACK_AMD_DEFINE_RESULT__;
  32616. 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; };
  32617. /*! decimal.js v10.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
  32618. ;(function (globalScope) {
  32619. 'use strict';
  32620. /*
  32621. * decimal.js v10.0.1
  32622. * An arbitrary-precision Decimal type for JavaScript.
  32623. * https://github.com/MikeMcl/decimal.js
  32624. * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
  32625. * MIT Licence
  32626. */
  32627. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  32628. // The maximum exponent magnitude.
  32629. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  32630. var EXP_LIMIT = 9e15,
  32631. // 0 to 9e15
  32632. // The limit on the value of `precision`, and on the value of the first argument to
  32633. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  32634. MAX_DIGITS = 1e9,
  32635. // 0 to 1e9
  32636. // Base conversion alphabet.
  32637. NUMERALS = '0123456789abcdef',
  32638. // The natural logarithm of 10 (1025 digits).
  32639. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  32640. // Pi (1025 digits).
  32641. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  32642. // The initial configuration properties of the Decimal constructor.
  32643. DEFAULTS = {
  32644. // These values must be integers within the stated ranges (inclusive).
  32645. // Most of these values can be changed at run-time using the `Decimal.config` method.
  32646. // The maximum number of significant digits of the result of a calculation or base conversion.
  32647. // E.g. `Decimal.config({ precision: 20 });`
  32648. precision: 20, // 1 to MAX_DIGITS
  32649. // The rounding mode used when rounding to `precision`.
  32650. //
  32651. // ROUND_UP 0 Away from zero.
  32652. // ROUND_DOWN 1 Towards zero.
  32653. // ROUND_CEIL 2 Towards +Infinity.
  32654. // ROUND_FLOOR 3 Towards -Infinity.
  32655. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  32656. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  32657. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  32658. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  32659. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  32660. //
  32661. // E.g.
  32662. // `Decimal.rounding = 4;`
  32663. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  32664. rounding: 4, // 0 to 8
  32665. // The modulo mode used when calculating the modulus: a mod n.
  32666. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  32667. // The remainder (r) is calculated as: r = a - n * q.
  32668. //
  32669. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  32670. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  32671. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  32672. // HALF_EVEN 6 The IEEE 754 remainder function.
  32673. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  32674. //
  32675. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  32676. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  32677. // be used, but they may not give useful results.
  32678. modulo: 1, // 0 to 9
  32679. // The exponent value at and beneath which `toString` returns exponential notation.
  32680. // JavaScript numbers: -7
  32681. toExpNeg: -7, // 0 to -EXP_LIMIT
  32682. // The exponent value at and above which `toString` returns exponential notation.
  32683. // JavaScript numbers: 21
  32684. toExpPos: 21, // 0 to EXP_LIMIT
  32685. // The minimum exponent value, beneath which underflow to zero occurs.
  32686. // JavaScript numbers: -324 (5e-324)
  32687. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  32688. // The maximum exponent value, above which overflow to Infinity occurs.
  32689. // JavaScript numbers: 308 (1.7976931348623157e+308)
  32690. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  32691. // Whether to use cryptographically-secure random number generation, if available.
  32692. crypto: false // true/false
  32693. },
  32694. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  32695. Decimal,
  32696. inexact,
  32697. noConflict,
  32698. quadrant,
  32699. external = true,
  32700. decimalError = '[DecimalError] ',
  32701. invalidArgument = decimalError + 'Invalid argument: ',
  32702. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  32703. cryptoUnavailable = decimalError + 'crypto unavailable',
  32704. mathfloor = Math.floor,
  32705. mathpow = Math.pow,
  32706. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  32707. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  32708. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  32709. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  32710. BASE = 1e7,
  32711. LOG_BASE = 7,
  32712. MAX_SAFE_INTEGER = 9007199254740991,
  32713. LN10_PRECISION = LN10.length - 1,
  32714. PI_PRECISION = PI.length - 1,
  32715. // Decimal.prototype object
  32716. P = { name: '[object Decimal]' };
  32717. // Decimal prototype methods
  32718. /*
  32719. * absoluteValue abs
  32720. * ceil
  32721. * comparedTo cmp
  32722. * cosine cos
  32723. * cubeRoot cbrt
  32724. * decimalPlaces dp
  32725. * dividedBy div
  32726. * dividedToIntegerBy divToInt
  32727. * equals eq
  32728. * floor
  32729. * greaterThan gt
  32730. * greaterThanOrEqualTo gte
  32731. * hyperbolicCosine cosh
  32732. * hyperbolicSine sinh
  32733. * hyperbolicTangent tanh
  32734. * inverseCosine acos
  32735. * inverseHyperbolicCosine acosh
  32736. * inverseHyperbolicSine asinh
  32737. * inverseHyperbolicTangent atanh
  32738. * inverseSine asin
  32739. * inverseTangent atan
  32740. * isFinite
  32741. * isInteger isInt
  32742. * isNaN
  32743. * isNegative isNeg
  32744. * isPositive isPos
  32745. * isZero
  32746. * lessThan lt
  32747. * lessThanOrEqualTo lte
  32748. * logarithm log
  32749. * [maximum] [max]
  32750. * [minimum] [min]
  32751. * minus sub
  32752. * modulo mod
  32753. * naturalExponential exp
  32754. * naturalLogarithm ln
  32755. * negated neg
  32756. * plus add
  32757. * precision sd
  32758. * round
  32759. * sine sin
  32760. * squareRoot sqrt
  32761. * tangent tan
  32762. * times mul
  32763. * toBinary
  32764. * toDecimalPlaces toDP
  32765. * toExponential
  32766. * toFixed
  32767. * toFraction
  32768. * toHexadecimal toHex
  32769. * toNearest
  32770. * toNumber
  32771. * toOctal
  32772. * toPower pow
  32773. * toPrecision
  32774. * toSignificantDigits toSD
  32775. * toString
  32776. * truncated trunc
  32777. * valueOf toJSON
  32778. */
  32779. /*
  32780. * Return a new Decimal whose value is the absolute value of this Decimal.
  32781. *
  32782. */
  32783. P.absoluteValue = P.abs = function () {
  32784. var x = new this.constructor(this);
  32785. if (x.s < 0) x.s = 1;
  32786. return finalise(x);
  32787. };
  32788. /*
  32789. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  32790. * direction of positive Infinity.
  32791. *
  32792. */
  32793. P.ceil = function () {
  32794. return finalise(new this.constructor(this), this.e + 1, 2);
  32795. };
  32796. /*
  32797. * Return
  32798. * 1 if the value of this Decimal is greater than the value of `y`,
  32799. * -1 if the value of this Decimal is less than the value of `y`,
  32800. * 0 if they have the same value,
  32801. * NaN if the value of either Decimal is NaN.
  32802. *
  32803. */
  32804. P.comparedTo = P.cmp = function (y) {
  32805. var i,
  32806. j,
  32807. xdL,
  32808. ydL,
  32809. x = this,
  32810. xd = x.d,
  32811. yd = (y = new x.constructor(y)).d,
  32812. xs = x.s,
  32813. ys = y.s;
  32814. // Either NaN or ±Infinity?
  32815. if (!xd || !yd) {
  32816. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  32817. }
  32818. // Either zero?
  32819. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  32820. // Signs differ?
  32821. if (xs !== ys) return xs;
  32822. // Compare exponents.
  32823. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  32824. xdL = xd.length;
  32825. ydL = yd.length;
  32826. // Compare digit by digit.
  32827. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  32828. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  32829. }
  32830. // Compare lengths.
  32831. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  32832. };
  32833. /*
  32834. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  32835. *
  32836. * Domain: [-Infinity, Infinity]
  32837. * Range: [-1, 1]
  32838. *
  32839. * cos(0) = 1
  32840. * cos(-0) = 1
  32841. * cos(Infinity) = NaN
  32842. * cos(-Infinity) = NaN
  32843. * cos(NaN) = NaN
  32844. *
  32845. */
  32846. P.cosine = P.cos = function () {
  32847. var pr,
  32848. rm,
  32849. x = this,
  32850. Ctor = x.constructor;
  32851. if (!x.d) return new Ctor(NaN);
  32852. // cos(0) = cos(-0) = 1
  32853. if (!x.d[0]) return new Ctor(1);
  32854. pr = Ctor.precision;
  32855. rm = Ctor.rounding;
  32856. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  32857. Ctor.rounding = 1;
  32858. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  32859. Ctor.precision = pr;
  32860. Ctor.rounding = rm;
  32861. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  32862. };
  32863. /*
  32864. *
  32865. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  32866. * `precision` significant digits using rounding mode `rounding`.
  32867. *
  32868. * cbrt(0) = 0
  32869. * cbrt(-0) = -0
  32870. * cbrt(1) = 1
  32871. * cbrt(-1) = -1
  32872. * cbrt(N) = N
  32873. * cbrt(-I) = -I
  32874. * cbrt(I) = I
  32875. *
  32876. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  32877. *
  32878. */
  32879. P.cubeRoot = P.cbrt = function () {
  32880. var e,
  32881. m,
  32882. n,
  32883. r,
  32884. rep,
  32885. s,
  32886. sd,
  32887. t,
  32888. t3,
  32889. t3plusx,
  32890. x = this,
  32891. Ctor = x.constructor;
  32892. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  32893. external = false;
  32894. // Initial estimate.
  32895. s = x.s * Math.pow(x.s * x, 1 / 3);
  32896. // Math.cbrt underflow/overflow?
  32897. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  32898. if (!s || Math.abs(s) == 1 / 0) {
  32899. n = digitsToString(x.d);
  32900. e = x.e;
  32901. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  32902. if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? '0' : '00';
  32903. s = Math.pow(n, 1 / 3);
  32904. // Rarely, e may be one less than the result exponent value.
  32905. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  32906. if (s == 1 / 0) {
  32907. n = '5e' + e;
  32908. } else {
  32909. n = s.toExponential();
  32910. n = n.slice(0, n.indexOf('e') + 1) + e;
  32911. }
  32912. r = new Ctor(n);
  32913. r.s = x.s;
  32914. } else {
  32915. r = new Ctor(s.toString());
  32916. }
  32917. sd = (e = Ctor.precision) + 3;
  32918. // Halley's method.
  32919. // TODO? Compare Newton's method.
  32920. for (;;) {
  32921. t = r;
  32922. t3 = t.times(t).times(t);
  32923. t3plusx = t3.plus(x);
  32924. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  32925. // TODO? Replace with for-loop and checkRoundingDigits.
  32926. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  32927. n = n.slice(sd - 3, sd + 1);
  32928. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  32929. // , i.e. approaching a rounding boundary, continue the iteration.
  32930. if (n == '9999' || !rep && n == '4999') {
  32931. // On the first iteration only, check to see if rounding up gives the exact result as the
  32932. // nines may infinitely repeat.
  32933. if (!rep) {
  32934. finalise(t, e + 1, 0);
  32935. if (t.times(t).times(t).eq(x)) {
  32936. r = t;
  32937. break;
  32938. }
  32939. }
  32940. sd += 4;
  32941. rep = 1;
  32942. } else {
  32943. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  32944. // If not, then there are further digits and m will be truthy.
  32945. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  32946. // Truncate to the first rounding digit.
  32947. finalise(r, e + 1, 1);
  32948. m = !r.times(r).times(r).eq(x);
  32949. }
  32950. break;
  32951. }
  32952. }
  32953. }
  32954. external = true;
  32955. return finalise(r, e, Ctor.rounding, m);
  32956. };
  32957. /*
  32958. * Return the number of decimal places of the value of this Decimal.
  32959. *
  32960. */
  32961. P.decimalPlaces = P.dp = function () {
  32962. var w,
  32963. d = this.d,
  32964. n = NaN;
  32965. if (d) {
  32966. w = d.length - 1;
  32967. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  32968. // Subtract the number of trailing zeros of the last word.
  32969. w = d[w];
  32970. if (w) for (; w % 10 == 0; w /= 10) {
  32971. n--;
  32972. }if (n < 0) n = 0;
  32973. }
  32974. return n;
  32975. };
  32976. /*
  32977. * n / 0 = I
  32978. * n / N = N
  32979. * n / I = 0
  32980. * 0 / n = 0
  32981. * 0 / 0 = N
  32982. * 0 / N = N
  32983. * 0 / I = 0
  32984. * N / n = N
  32985. * N / 0 = N
  32986. * N / N = N
  32987. * N / I = N
  32988. * I / n = I
  32989. * I / 0 = I
  32990. * I / N = N
  32991. * I / I = N
  32992. *
  32993. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  32994. * `precision` significant digits using rounding mode `rounding`.
  32995. *
  32996. */
  32997. P.dividedBy = P.div = function (y) {
  32998. return divide(this, new this.constructor(y));
  32999. };
  33000. /*
  33001. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  33002. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  33003. *
  33004. */
  33005. P.dividedToIntegerBy = P.divToInt = function (y) {
  33006. var x = this,
  33007. Ctor = x.constructor;
  33008. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  33009. };
  33010. /*
  33011. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  33012. *
  33013. */
  33014. P.equals = P.eq = function (y) {
  33015. return this.cmp(y) === 0;
  33016. };
  33017. /*
  33018. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  33019. * direction of negative Infinity.
  33020. *
  33021. */
  33022. P.floor = function () {
  33023. return finalise(new this.constructor(this), this.e + 1, 3);
  33024. };
  33025. /*
  33026. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  33027. * false.
  33028. *
  33029. */
  33030. P.greaterThan = P.gt = function (y) {
  33031. return this.cmp(y) > 0;
  33032. };
  33033. /*
  33034. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  33035. * otherwise return false.
  33036. *
  33037. */
  33038. P.greaterThanOrEqualTo = P.gte = function (y) {
  33039. var k = this.cmp(y);
  33040. return k == 1 || k === 0;
  33041. };
  33042. /*
  33043. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  33044. * Decimal.
  33045. *
  33046. * Domain: [-Infinity, Infinity]
  33047. * Range: [1, Infinity]
  33048. *
  33049. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  33050. *
  33051. * cosh(0) = 1
  33052. * cosh(-0) = 1
  33053. * cosh(Infinity) = Infinity
  33054. * cosh(-Infinity) = Infinity
  33055. * cosh(NaN) = NaN
  33056. *
  33057. * x time taken (ms) result
  33058. * 1000 9 9.8503555700852349694e+433
  33059. * 10000 25 4.4034091128314607936e+4342
  33060. * 100000 171 1.4033316802130615897e+43429
  33061. * 1000000 3817 1.5166076984010437725e+434294
  33062. * 10000000 abandoned after 2 minute wait
  33063. *
  33064. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  33065. *
  33066. */
  33067. P.hyperbolicCosine = P.cosh = function () {
  33068. var k,
  33069. n,
  33070. pr,
  33071. rm,
  33072. len,
  33073. x = this,
  33074. Ctor = x.constructor,
  33075. one = new Ctor(1);
  33076. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  33077. if (x.isZero()) return one;
  33078. pr = Ctor.precision;
  33079. rm = Ctor.rounding;
  33080. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  33081. Ctor.rounding = 1;
  33082. len = x.d.length;
  33083. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  33084. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  33085. // Estimate the optimum number of times to use the argument reduction.
  33086. // TODO? Estimation reused from cosine() and may not be optimal here.
  33087. if (len < 32) {
  33088. k = Math.ceil(len / 3);
  33089. n = Math.pow(4, -k).toString();
  33090. } else {
  33091. k = 16;
  33092. n = '2.3283064365386962890625e-10';
  33093. }
  33094. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  33095. // Reverse argument reduction
  33096. var cosh2_x,
  33097. i = k,
  33098. d8 = new Ctor(8);
  33099. for (; i--;) {
  33100. cosh2_x = x.times(x);
  33101. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  33102. }
  33103. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  33104. };
  33105. /*
  33106. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  33107. * Decimal.
  33108. *
  33109. * Domain: [-Infinity, Infinity]
  33110. * Range: [-Infinity, Infinity]
  33111. *
  33112. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  33113. *
  33114. * sinh(0) = 0
  33115. * sinh(-0) = -0
  33116. * sinh(Infinity) = Infinity
  33117. * sinh(-Infinity) = -Infinity
  33118. * sinh(NaN) = NaN
  33119. *
  33120. * x time taken (ms)
  33121. * 10 2 ms
  33122. * 100 5 ms
  33123. * 1000 14 ms
  33124. * 10000 82 ms
  33125. * 100000 886 ms 1.4033316802130615897e+43429
  33126. * 200000 2613 ms
  33127. * 300000 5407 ms
  33128. * 400000 8824 ms
  33129. * 500000 13026 ms 8.7080643612718084129e+217146
  33130. * 1000000 48543 ms
  33131. *
  33132. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  33133. *
  33134. */
  33135. P.hyperbolicSine = P.sinh = function () {
  33136. var k,
  33137. pr,
  33138. rm,
  33139. len,
  33140. x = this,
  33141. Ctor = x.constructor;
  33142. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33143. pr = Ctor.precision;
  33144. rm = Ctor.rounding;
  33145. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  33146. Ctor.rounding = 1;
  33147. len = x.d.length;
  33148. if (len < 3) {
  33149. x = taylorSeries(Ctor, 2, x, x, true);
  33150. } else {
  33151. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  33152. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  33153. // 3 multiplications and 1 addition
  33154. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  33155. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  33156. // 4 multiplications and 2 additions
  33157. // Estimate the optimum number of times to use the argument reduction.
  33158. k = 1.4 * Math.sqrt(len);
  33159. k = k > 16 ? 16 : k | 0;
  33160. x = x.times(Math.pow(5, -k));
  33161. x = taylorSeries(Ctor, 2, x, x, true);
  33162. // Reverse argument reduction
  33163. var sinh2_x,
  33164. d5 = new Ctor(5),
  33165. d16 = new Ctor(16),
  33166. d20 = new Ctor(20);
  33167. for (; k--;) {
  33168. sinh2_x = x.times(x);
  33169. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  33170. }
  33171. }
  33172. Ctor.precision = pr;
  33173. Ctor.rounding = rm;
  33174. return finalise(x, pr, rm, true);
  33175. };
  33176. /*
  33177. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  33178. * Decimal.
  33179. *
  33180. * Domain: [-Infinity, Infinity]
  33181. * Range: [-1, 1]
  33182. *
  33183. * tanh(x) = sinh(x) / cosh(x)
  33184. *
  33185. * tanh(0) = 0
  33186. * tanh(-0) = -0
  33187. * tanh(Infinity) = 1
  33188. * tanh(-Infinity) = -1
  33189. * tanh(NaN) = NaN
  33190. *
  33191. */
  33192. P.hyperbolicTangent = P.tanh = function () {
  33193. var pr,
  33194. rm,
  33195. x = this,
  33196. Ctor = x.constructor;
  33197. if (!x.isFinite()) return new Ctor(x.s);
  33198. if (x.isZero()) return new Ctor(x);
  33199. pr = Ctor.precision;
  33200. rm = Ctor.rounding;
  33201. Ctor.precision = pr + 7;
  33202. Ctor.rounding = 1;
  33203. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  33204. };
  33205. /*
  33206. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  33207. * this Decimal.
  33208. *
  33209. * Domain: [-1, 1]
  33210. * Range: [0, pi]
  33211. *
  33212. * acos(x) = pi/2 - asin(x)
  33213. *
  33214. * acos(0) = pi/2
  33215. * acos(-0) = pi/2
  33216. * acos(1) = 0
  33217. * acos(-1) = pi
  33218. * acos(1/2) = pi/3
  33219. * acos(-1/2) = 2*pi/3
  33220. * acos(|x| > 1) = NaN
  33221. * acos(NaN) = NaN
  33222. *
  33223. */
  33224. P.inverseCosine = P.acos = function () {
  33225. var halfPi,
  33226. x = this,
  33227. Ctor = x.constructor,
  33228. k = x.abs().cmp(1),
  33229. pr = Ctor.precision,
  33230. rm = Ctor.rounding;
  33231. if (k !== -1) {
  33232. return k === 0
  33233. // |x| is 1
  33234. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  33235. // |x| > 1 or x is NaN
  33236. : new Ctor(NaN);
  33237. }
  33238. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  33239. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  33240. Ctor.precision = pr + 6;
  33241. Ctor.rounding = 1;
  33242. x = x.asin();
  33243. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  33244. Ctor.precision = pr;
  33245. Ctor.rounding = rm;
  33246. return halfPi.minus(x);
  33247. };
  33248. /*
  33249. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  33250. * value of this Decimal.
  33251. *
  33252. * Domain: [1, Infinity]
  33253. * Range: [0, Infinity]
  33254. *
  33255. * acosh(x) = ln(x + sqrt(x^2 - 1))
  33256. *
  33257. * acosh(x < 1) = NaN
  33258. * acosh(NaN) = NaN
  33259. * acosh(Infinity) = Infinity
  33260. * acosh(-Infinity) = NaN
  33261. * acosh(0) = NaN
  33262. * acosh(-0) = NaN
  33263. * acosh(1) = 0
  33264. * acosh(-1) = NaN
  33265. *
  33266. */
  33267. P.inverseHyperbolicCosine = P.acosh = function () {
  33268. var pr,
  33269. rm,
  33270. x = this,
  33271. Ctor = x.constructor;
  33272. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  33273. if (!x.isFinite()) return new Ctor(x);
  33274. pr = Ctor.precision;
  33275. rm = Ctor.rounding;
  33276. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  33277. Ctor.rounding = 1;
  33278. external = false;
  33279. x = x.times(x).minus(1).sqrt().plus(x);
  33280. external = true;
  33281. Ctor.precision = pr;
  33282. Ctor.rounding = rm;
  33283. return x.ln();
  33284. };
  33285. /*
  33286. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  33287. * of this Decimal.
  33288. *
  33289. * Domain: [-Infinity, Infinity]
  33290. * Range: [-Infinity, Infinity]
  33291. *
  33292. * asinh(x) = ln(x + sqrt(x^2 + 1))
  33293. *
  33294. * asinh(NaN) = NaN
  33295. * asinh(Infinity) = Infinity
  33296. * asinh(-Infinity) = -Infinity
  33297. * asinh(0) = 0
  33298. * asinh(-0) = -0
  33299. *
  33300. */
  33301. P.inverseHyperbolicSine = P.asinh = function () {
  33302. var pr,
  33303. rm,
  33304. x = this,
  33305. Ctor = x.constructor;
  33306. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33307. pr = Ctor.precision;
  33308. rm = Ctor.rounding;
  33309. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  33310. Ctor.rounding = 1;
  33311. external = false;
  33312. x = x.times(x).plus(1).sqrt().plus(x);
  33313. external = true;
  33314. Ctor.precision = pr;
  33315. Ctor.rounding = rm;
  33316. return x.ln();
  33317. };
  33318. /*
  33319. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  33320. * value of this Decimal.
  33321. *
  33322. * Domain: [-1, 1]
  33323. * Range: [-Infinity, Infinity]
  33324. *
  33325. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  33326. *
  33327. * atanh(|x| > 1) = NaN
  33328. * atanh(NaN) = NaN
  33329. * atanh(Infinity) = NaN
  33330. * atanh(-Infinity) = NaN
  33331. * atanh(0) = 0
  33332. * atanh(-0) = -0
  33333. * atanh(1) = Infinity
  33334. * atanh(-1) = -Infinity
  33335. *
  33336. */
  33337. P.inverseHyperbolicTangent = P.atanh = function () {
  33338. var pr,
  33339. rm,
  33340. wpr,
  33341. xsd,
  33342. x = this,
  33343. Ctor = x.constructor;
  33344. if (!x.isFinite()) return new Ctor(NaN);
  33345. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  33346. pr = Ctor.precision;
  33347. rm = Ctor.rounding;
  33348. xsd = x.sd();
  33349. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  33350. Ctor.precision = wpr = xsd - x.e;
  33351. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  33352. Ctor.precision = pr + 4;
  33353. Ctor.rounding = 1;
  33354. x = x.ln();
  33355. Ctor.precision = pr;
  33356. Ctor.rounding = rm;
  33357. return x.times(0.5);
  33358. };
  33359. /*
  33360. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  33361. * Decimal.
  33362. *
  33363. * Domain: [-Infinity, Infinity]
  33364. * Range: [-pi/2, pi/2]
  33365. *
  33366. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  33367. *
  33368. * asin(0) = 0
  33369. * asin(-0) = -0
  33370. * asin(1/2) = pi/6
  33371. * asin(-1/2) = -pi/6
  33372. * asin(1) = pi/2
  33373. * asin(-1) = -pi/2
  33374. * asin(|x| > 1) = NaN
  33375. * asin(NaN) = NaN
  33376. *
  33377. * TODO? Compare performance of Taylor series.
  33378. *
  33379. */
  33380. P.inverseSine = P.asin = function () {
  33381. var halfPi,
  33382. k,
  33383. pr,
  33384. rm,
  33385. x = this,
  33386. Ctor = x.constructor;
  33387. if (x.isZero()) return new Ctor(x);
  33388. k = x.abs().cmp(1);
  33389. pr = Ctor.precision;
  33390. rm = Ctor.rounding;
  33391. if (k !== -1) {
  33392. // |x| is 1
  33393. if (k === 0) {
  33394. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  33395. halfPi.s = x.s;
  33396. return halfPi;
  33397. }
  33398. // |x| > 1 or x is NaN
  33399. return new Ctor(NaN);
  33400. }
  33401. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  33402. Ctor.precision = pr + 6;
  33403. Ctor.rounding = 1;
  33404. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  33405. Ctor.precision = pr;
  33406. Ctor.rounding = rm;
  33407. return x.times(2);
  33408. };
  33409. /*
  33410. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  33411. * of this Decimal.
  33412. *
  33413. * Domain: [-Infinity, Infinity]
  33414. * Range: [-pi/2, pi/2]
  33415. *
  33416. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  33417. *
  33418. * atan(0) = 0
  33419. * atan(-0) = -0
  33420. * atan(1) = pi/4
  33421. * atan(-1) = -pi/4
  33422. * atan(Infinity) = pi/2
  33423. * atan(-Infinity) = -pi/2
  33424. * atan(NaN) = NaN
  33425. *
  33426. */
  33427. P.inverseTangent = P.atan = function () {
  33428. var i,
  33429. j,
  33430. k,
  33431. n,
  33432. px,
  33433. t,
  33434. r,
  33435. wpr,
  33436. x2,
  33437. x = this,
  33438. Ctor = x.constructor,
  33439. pr = Ctor.precision,
  33440. rm = Ctor.rounding;
  33441. if (!x.isFinite()) {
  33442. if (!x.s) return new Ctor(NaN);
  33443. if (pr + 4 <= PI_PRECISION) {
  33444. r = getPi(Ctor, pr + 4, rm).times(0.5);
  33445. r.s = x.s;
  33446. return r;
  33447. }
  33448. } else if (x.isZero()) {
  33449. return new Ctor(x);
  33450. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  33451. r = getPi(Ctor, pr + 4, rm).times(0.25);
  33452. r.s = x.s;
  33453. return r;
  33454. }
  33455. Ctor.precision = wpr = pr + 10;
  33456. Ctor.rounding = 1;
  33457. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  33458. // Argument reduction
  33459. // Ensure |x| < 0.42
  33460. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  33461. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  33462. for (i = k; i; --i) {
  33463. x = x.div(x.times(x).plus(1).sqrt().plus(1));
  33464. }external = false;
  33465. j = Math.ceil(wpr / LOG_BASE);
  33466. n = 1;
  33467. x2 = x.times(x);
  33468. r = new Ctor(x);
  33469. px = x;
  33470. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  33471. for (; i !== -1;) {
  33472. px = px.times(x2);
  33473. t = r.minus(px.div(n += 2));
  33474. px = px.times(x2);
  33475. r = t.plus(px.div(n += 2));
  33476. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;) {}
  33477. }
  33478. if (k) r = r.times(2 << k - 1);
  33479. external = true;
  33480. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  33481. };
  33482. /*
  33483. * Return true if the value of this Decimal is a finite number, otherwise return false.
  33484. *
  33485. */
  33486. P.isFinite = function () {
  33487. return !!this.d;
  33488. };
  33489. /*
  33490. * Return true if the value of this Decimal is an integer, otherwise return false.
  33491. *
  33492. */
  33493. P.isInteger = P.isInt = function () {
  33494. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  33495. };
  33496. /*
  33497. * Return true if the value of this Decimal is NaN, otherwise return false.
  33498. *
  33499. */
  33500. P.isNaN = function () {
  33501. return !this.s;
  33502. };
  33503. /*
  33504. * Return true if the value of this Decimal is negative, otherwise return false.
  33505. *
  33506. */
  33507. P.isNegative = P.isNeg = function () {
  33508. return this.s < 0;
  33509. };
  33510. /*
  33511. * Return true if the value of this Decimal is positive, otherwise return false.
  33512. *
  33513. */
  33514. P.isPositive = P.isPos = function () {
  33515. return this.s > 0;
  33516. };
  33517. /*
  33518. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  33519. *
  33520. */
  33521. P.isZero = function () {
  33522. return !!this.d && this.d[0] === 0;
  33523. };
  33524. /*
  33525. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  33526. *
  33527. */
  33528. P.lessThan = P.lt = function (y) {
  33529. return this.cmp(y) < 0;
  33530. };
  33531. /*
  33532. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  33533. *
  33534. */
  33535. P.lessThanOrEqualTo = P.lte = function (y) {
  33536. return this.cmp(y) < 1;
  33537. };
  33538. /*
  33539. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  33540. * significant digits using rounding mode `rounding`.
  33541. *
  33542. * If no base is specified, return log[10](arg).
  33543. *
  33544. * log[base](arg) = ln(arg) / ln(base)
  33545. *
  33546. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  33547. * otherwise:
  33548. *
  33549. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  33550. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  33551. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  33552. *
  33553. * log[-b](a) = NaN
  33554. * log[0](a) = NaN
  33555. * log[1](a) = NaN
  33556. * log[NaN](a) = NaN
  33557. * log[Infinity](a) = NaN
  33558. * log[b](0) = -Infinity
  33559. * log[b](-0) = -Infinity
  33560. * log[b](-a) = NaN
  33561. * log[b](1) = 0
  33562. * log[b](Infinity) = Infinity
  33563. * log[b](NaN) = NaN
  33564. *
  33565. * [base] {number|string|Decimal} The base of the logarithm.
  33566. *
  33567. */
  33568. P.logarithm = P.log = function (base) {
  33569. var isBase10,
  33570. d,
  33571. denominator,
  33572. k,
  33573. inf,
  33574. num,
  33575. sd,
  33576. r,
  33577. arg = this,
  33578. Ctor = arg.constructor,
  33579. pr = Ctor.precision,
  33580. rm = Ctor.rounding,
  33581. guard = 5;
  33582. // Default base is 10.
  33583. if (base == null) {
  33584. base = new Ctor(10);
  33585. isBase10 = true;
  33586. } else {
  33587. base = new Ctor(base);
  33588. d = base.d;
  33589. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  33590. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  33591. isBase10 = base.eq(10);
  33592. }
  33593. d = arg.d;
  33594. // Is arg negative, non-finite, 0 or 1?
  33595. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  33596. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  33597. }
  33598. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  33599. // integer power of 10.
  33600. if (isBase10) {
  33601. if (d.length > 1) {
  33602. inf = true;
  33603. } else {
  33604. for (k = d[0]; k % 10 === 0;) {
  33605. k /= 10;
  33606. }inf = k !== 1;
  33607. }
  33608. }
  33609. external = false;
  33610. sd = pr + guard;
  33611. num = naturalLogarithm(arg, sd);
  33612. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  33613. // The result will have 5 rounding digits.
  33614. r = divide(num, denominator, sd, 1);
  33615. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  33616. // calculate 10 further digits.
  33617. //
  33618. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  33619. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  33620. // further digits, the last 14 are nines, round up and assume the result is exact.
  33621. // Also assume the result is exact if the last 14 are zero.
  33622. //
  33623. // Example of a result that will be incorrectly rounded:
  33624. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  33625. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  33626. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  33627. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  33628. // place is still 2.6.
  33629. if (checkRoundingDigits(r.d, k = pr, rm)) {
  33630. do {
  33631. sd += 10;
  33632. num = naturalLogarithm(arg, sd);
  33633. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  33634. r = divide(num, denominator, sd, 1);
  33635. if (!inf) {
  33636. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  33637. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  33638. r = finalise(r, pr + 1, 0);
  33639. }
  33640. break;
  33641. }
  33642. } while (checkRoundingDigits(r.d, k += 10, rm));
  33643. }
  33644. external = true;
  33645. return finalise(r, pr, rm);
  33646. };
  33647. /*
  33648. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  33649. *
  33650. * arguments {number|string|Decimal}
  33651. *
  33652. P.max = function () {
  33653. Array.prototype.push.call(arguments, this);
  33654. return maxOrMin(this.constructor, arguments, 'lt');
  33655. };
  33656. */
  33657. /*
  33658. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  33659. *
  33660. * arguments {number|string|Decimal}
  33661. *
  33662. P.min = function () {
  33663. Array.prototype.push.call(arguments, this);
  33664. return maxOrMin(this.constructor, arguments, 'gt');
  33665. };
  33666. */
  33667. /*
  33668. * n - 0 = n
  33669. * n - N = N
  33670. * n - I = -I
  33671. * 0 - n = -n
  33672. * 0 - 0 = 0
  33673. * 0 - N = N
  33674. * 0 - I = -I
  33675. * N - n = N
  33676. * N - 0 = N
  33677. * N - N = N
  33678. * N - I = N
  33679. * I - n = I
  33680. * I - 0 = I
  33681. * I - N = N
  33682. * I - I = N
  33683. *
  33684. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  33685. * significant digits using rounding mode `rounding`.
  33686. *
  33687. */
  33688. P.minus = P.sub = function (y) {
  33689. var d,
  33690. e,
  33691. i,
  33692. j,
  33693. k,
  33694. len,
  33695. pr,
  33696. rm,
  33697. xd,
  33698. xe,
  33699. xLTy,
  33700. yd,
  33701. x = this,
  33702. Ctor = x.constructor;
  33703. y = new Ctor(y);
  33704. // If either is not finite...
  33705. if (!x.d || !y.d) {
  33706. // Return NaN if either is NaN.
  33707. if (!x.s || !y.s) y = new Ctor(NaN);
  33708. // Return y negated if x is finite and y is ±Infinity.
  33709. else if (x.d) y.s = -y.s;
  33710. // Return x if y is finite and x is ±Infinity.
  33711. // Return x if both are ±Infinity with different signs.
  33712. // Return NaN if both are ±Infinity with the same sign.
  33713. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  33714. return y;
  33715. }
  33716. // If signs differ...
  33717. if (x.s != y.s) {
  33718. y.s = -y.s;
  33719. return x.plus(y);
  33720. }
  33721. xd = x.d;
  33722. yd = y.d;
  33723. pr = Ctor.precision;
  33724. rm = Ctor.rounding;
  33725. // If either is zero...
  33726. if (!xd[0] || !yd[0]) {
  33727. // Return y negated if x is zero and y is non-zero.
  33728. if (yd[0]) y.s = -y.s;
  33729. // Return x if y is zero and x is non-zero.
  33730. else if (xd[0]) y = new Ctor(x);
  33731. // Return zero if both are zero.
  33732. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  33733. else return new Ctor(rm === 3 ? -0 : 0);
  33734. return external ? finalise(y, pr, rm) : y;
  33735. }
  33736. // x and y are finite, non-zero numbers with the same sign.
  33737. // Calculate base 1e7 exponents.
  33738. e = mathfloor(y.e / LOG_BASE);
  33739. xe = mathfloor(x.e / LOG_BASE);
  33740. xd = xd.slice();
  33741. k = xe - e;
  33742. // If base 1e7 exponents differ...
  33743. if (k) {
  33744. xLTy = k < 0;
  33745. if (xLTy) {
  33746. d = xd;
  33747. k = -k;
  33748. len = yd.length;
  33749. } else {
  33750. d = yd;
  33751. e = xe;
  33752. len = xd.length;
  33753. }
  33754. // Numbers with massively different exponents would result in a very high number of
  33755. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  33756. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  33757. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  33758. if (k > i) {
  33759. k = i;
  33760. d.length = 1;
  33761. }
  33762. // Prepend zeros to equalise exponents.
  33763. d.reverse();
  33764. for (i = k; i--;) {
  33765. d.push(0);
  33766. }d.reverse();
  33767. // Base 1e7 exponents equal.
  33768. } else {
  33769. // Check digits to determine which is the bigger number.
  33770. i = xd.length;
  33771. len = yd.length;
  33772. xLTy = i < len;
  33773. if (xLTy) len = i;
  33774. for (i = 0; i < len; i++) {
  33775. if (xd[i] != yd[i]) {
  33776. xLTy = xd[i] < yd[i];
  33777. break;
  33778. }
  33779. }
  33780. k = 0;
  33781. }
  33782. if (xLTy) {
  33783. d = xd;
  33784. xd = yd;
  33785. yd = d;
  33786. y.s = -y.s;
  33787. }
  33788. len = xd.length;
  33789. // Append zeros to `xd` if shorter.
  33790. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  33791. for (i = yd.length - len; i > 0; --i) {
  33792. xd[len++] = 0;
  33793. } // Subtract yd from xd.
  33794. for (i = yd.length; i > k;) {
  33795. if (xd[--i] < yd[i]) {
  33796. for (j = i; j && xd[--j] === 0;) {
  33797. xd[j] = BASE - 1;
  33798. }--xd[j];
  33799. xd[i] += BASE;
  33800. }
  33801. xd[i] -= yd[i];
  33802. }
  33803. // Remove trailing zeros.
  33804. for (; xd[--len] === 0;) {
  33805. xd.pop();
  33806. } // Remove leading zeros and adjust exponent accordingly.
  33807. for (; xd[0] === 0; xd.shift()) {
  33808. --e;
  33809. } // Zero?
  33810. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  33811. y.d = xd;
  33812. y.e = getBase10Exponent(xd, e);
  33813. return external ? finalise(y, pr, rm) : y;
  33814. };
  33815. /*
  33816. * n % 0 = N
  33817. * n % N = N
  33818. * n % I = n
  33819. * 0 % n = 0
  33820. * -0 % n = -0
  33821. * 0 % 0 = N
  33822. * 0 % N = N
  33823. * 0 % I = 0
  33824. * N % n = N
  33825. * N % 0 = N
  33826. * N % N = N
  33827. * N % I = N
  33828. * I % n = N
  33829. * I % 0 = N
  33830. * I % N = N
  33831. * I % I = N
  33832. *
  33833. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  33834. * `precision` significant digits using rounding mode `rounding`.
  33835. *
  33836. * The result depends on the modulo mode.
  33837. *
  33838. */
  33839. P.modulo = P.mod = function (y) {
  33840. var q,
  33841. x = this,
  33842. Ctor = x.constructor;
  33843. y = new Ctor(y);
  33844. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  33845. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  33846. // Return x if y is ±Infinity or x is ±0.
  33847. if (!y.d || x.d && !x.d[0]) {
  33848. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  33849. }
  33850. // Prevent rounding of intermediate calculations.
  33851. external = false;
  33852. if (Ctor.modulo == 9) {
  33853. // Euclidian division: q = sign(y) * floor(x / abs(y))
  33854. // result = x - q * y where 0 <= result < abs(y)
  33855. q = divide(x, y.abs(), 0, 3, 1);
  33856. q.s *= y.s;
  33857. } else {
  33858. q = divide(x, y, 0, Ctor.modulo, 1);
  33859. }
  33860. q = q.times(y);
  33861. external = true;
  33862. return x.minus(q);
  33863. };
  33864. /*
  33865. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  33866. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  33867. * significant digits using rounding mode `rounding`.
  33868. *
  33869. */
  33870. P.naturalExponential = P.exp = function () {
  33871. return naturalExponential(this);
  33872. };
  33873. /*
  33874. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  33875. * rounded to `precision` significant digits using rounding mode `rounding`.
  33876. *
  33877. */
  33878. P.naturalLogarithm = P.ln = function () {
  33879. return naturalLogarithm(this);
  33880. };
  33881. /*
  33882. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  33883. * -1.
  33884. *
  33885. */
  33886. P.negated = P.neg = function () {
  33887. var x = new this.constructor(this);
  33888. x.s = -x.s;
  33889. return finalise(x);
  33890. };
  33891. /*
  33892. * n + 0 = n
  33893. * n + N = N
  33894. * n + I = I
  33895. * 0 + n = n
  33896. * 0 + 0 = 0
  33897. * 0 + N = N
  33898. * 0 + I = I
  33899. * N + n = N
  33900. * N + 0 = N
  33901. * N + N = N
  33902. * N + I = N
  33903. * I + n = I
  33904. * I + 0 = I
  33905. * I + N = N
  33906. * I + I = I
  33907. *
  33908. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  33909. * significant digits using rounding mode `rounding`.
  33910. *
  33911. */
  33912. P.plus = P.add = function (y) {
  33913. var carry,
  33914. d,
  33915. e,
  33916. i,
  33917. k,
  33918. len,
  33919. pr,
  33920. rm,
  33921. xd,
  33922. yd,
  33923. x = this,
  33924. Ctor = x.constructor;
  33925. y = new Ctor(y);
  33926. // If either is not finite...
  33927. if (!x.d || !y.d) {
  33928. // Return NaN if either is NaN.
  33929. if (!x.s || !y.s) y = new Ctor(NaN);
  33930. // Return x if y is finite and x is ±Infinity.
  33931. // Return x if both are ±Infinity with the same sign.
  33932. // Return NaN if both are ±Infinity with different signs.
  33933. // Return y if x is finite and y is ±Infinity.
  33934. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  33935. return y;
  33936. }
  33937. // If signs differ...
  33938. if (x.s != y.s) {
  33939. y.s = -y.s;
  33940. return x.minus(y);
  33941. }
  33942. xd = x.d;
  33943. yd = y.d;
  33944. pr = Ctor.precision;
  33945. rm = Ctor.rounding;
  33946. // If either is zero...
  33947. if (!xd[0] || !yd[0]) {
  33948. // Return x if y is zero.
  33949. // Return y if y is non-zero.
  33950. if (!yd[0]) y = new Ctor(x);
  33951. return external ? finalise(y, pr, rm) : y;
  33952. }
  33953. // x and y are finite, non-zero numbers with the same sign.
  33954. // Calculate base 1e7 exponents.
  33955. k = mathfloor(x.e / LOG_BASE);
  33956. e = mathfloor(y.e / LOG_BASE);
  33957. xd = xd.slice();
  33958. i = k - e;
  33959. // If base 1e7 exponents differ...
  33960. if (i) {
  33961. if (i < 0) {
  33962. d = xd;
  33963. i = -i;
  33964. len = yd.length;
  33965. } else {
  33966. d = yd;
  33967. e = k;
  33968. len = xd.length;
  33969. }
  33970. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  33971. k = Math.ceil(pr / LOG_BASE);
  33972. len = k > len ? k + 1 : len + 1;
  33973. if (i > len) {
  33974. i = len;
  33975. d.length = 1;
  33976. }
  33977. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  33978. d.reverse();
  33979. for (; i--;) {
  33980. d.push(0);
  33981. }d.reverse();
  33982. }
  33983. len = xd.length;
  33984. i = yd.length;
  33985. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  33986. if (len - i < 0) {
  33987. i = len;
  33988. d = yd;
  33989. yd = xd;
  33990. xd = d;
  33991. }
  33992. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  33993. for (carry = 0; i;) {
  33994. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  33995. xd[i] %= BASE;
  33996. }
  33997. if (carry) {
  33998. xd.unshift(carry);
  33999. ++e;
  34000. }
  34001. // Remove trailing zeros.
  34002. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  34003. for (len = xd.length; xd[--len] == 0;) {
  34004. xd.pop();
  34005. }y.d = xd;
  34006. y.e = getBase10Exponent(xd, e);
  34007. return external ? finalise(y, pr, rm) : y;
  34008. };
  34009. /*
  34010. * Return the number of significant digits of the value of this Decimal.
  34011. *
  34012. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  34013. *
  34014. */
  34015. P.precision = P.sd = function (z) {
  34016. var k,
  34017. x = this;
  34018. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  34019. if (x.d) {
  34020. k = getPrecision(x.d);
  34021. if (z && x.e + 1 > k) k = x.e + 1;
  34022. } else {
  34023. k = NaN;
  34024. }
  34025. return k;
  34026. };
  34027. /*
  34028. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  34029. * rounding mode `rounding`.
  34030. *
  34031. */
  34032. P.round = function () {
  34033. var x = this,
  34034. Ctor = x.constructor;
  34035. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  34036. };
  34037. /*
  34038. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  34039. *
  34040. * Domain: [-Infinity, Infinity]
  34041. * Range: [-1, 1]
  34042. *
  34043. * sin(x) = x - x^3/3! + x^5/5! - ...
  34044. *
  34045. * sin(0) = 0
  34046. * sin(-0) = -0
  34047. * sin(Infinity) = NaN
  34048. * sin(-Infinity) = NaN
  34049. * sin(NaN) = NaN
  34050. *
  34051. */
  34052. P.sine = P.sin = function () {
  34053. var pr,
  34054. rm,
  34055. x = this,
  34056. Ctor = x.constructor;
  34057. if (!x.isFinite()) return new Ctor(NaN);
  34058. if (x.isZero()) return new Ctor(x);
  34059. pr = Ctor.precision;
  34060. rm = Ctor.rounding;
  34061. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  34062. Ctor.rounding = 1;
  34063. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  34064. Ctor.precision = pr;
  34065. Ctor.rounding = rm;
  34066. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  34067. };
  34068. /*
  34069. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  34070. * significant digits using rounding mode `rounding`.
  34071. *
  34072. * sqrt(-n) = N
  34073. * sqrt(N) = N
  34074. * sqrt(-I) = N
  34075. * sqrt(I) = I
  34076. * sqrt(0) = 0
  34077. * sqrt(-0) = -0
  34078. *
  34079. */
  34080. P.squareRoot = P.sqrt = function () {
  34081. var m,
  34082. n,
  34083. sd,
  34084. r,
  34085. rep,
  34086. t,
  34087. x = this,
  34088. d = x.d,
  34089. e = x.e,
  34090. s = x.s,
  34091. Ctor = x.constructor;
  34092. // Negative/NaN/Infinity/zero?
  34093. if (s !== 1 || !d || !d[0]) {
  34094. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  34095. }
  34096. external = false;
  34097. // Initial estimate.
  34098. s = Math.sqrt(+x);
  34099. // Math.sqrt underflow/overflow?
  34100. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  34101. if (s == 0 || s == 1 / 0) {
  34102. n = digitsToString(d);
  34103. if ((n.length + e) % 2 == 0) n += '0';
  34104. s = Math.sqrt(n);
  34105. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  34106. if (s == 1 / 0) {
  34107. n = '1e' + e;
  34108. } else {
  34109. n = s.toExponential();
  34110. n = n.slice(0, n.indexOf('e') + 1) + e;
  34111. }
  34112. r = new Ctor(n);
  34113. } else {
  34114. r = new Ctor(s.toString());
  34115. }
  34116. sd = (e = Ctor.precision) + 3;
  34117. // Newton-Raphson iteration.
  34118. for (;;) {
  34119. t = r;
  34120. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  34121. // TODO? Replace with for-loop and checkRoundingDigits.
  34122. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  34123. n = n.slice(sd - 3, sd + 1);
  34124. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  34125. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  34126. if (n == '9999' || !rep && n == '4999') {
  34127. // On the first iteration only, check to see if rounding up gives the exact result as the
  34128. // nines may infinitely repeat.
  34129. if (!rep) {
  34130. finalise(t, e + 1, 0);
  34131. if (t.times(t).eq(x)) {
  34132. r = t;
  34133. break;
  34134. }
  34135. }
  34136. sd += 4;
  34137. rep = 1;
  34138. } else {
  34139. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  34140. // If not, then there are further digits and m will be truthy.
  34141. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  34142. // Truncate to the first rounding digit.
  34143. finalise(r, e + 1, 1);
  34144. m = !r.times(r).eq(x);
  34145. }
  34146. break;
  34147. }
  34148. }
  34149. }
  34150. external = true;
  34151. return finalise(r, e, Ctor.rounding, m);
  34152. };
  34153. /*
  34154. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  34155. *
  34156. * Domain: [-Infinity, Infinity]
  34157. * Range: [-Infinity, Infinity]
  34158. *
  34159. * tan(0) = 0
  34160. * tan(-0) = -0
  34161. * tan(Infinity) = NaN
  34162. * tan(-Infinity) = NaN
  34163. * tan(NaN) = NaN
  34164. *
  34165. */
  34166. P.tangent = P.tan = function () {
  34167. var pr,
  34168. rm,
  34169. x = this,
  34170. Ctor = x.constructor;
  34171. if (!x.isFinite()) return new Ctor(NaN);
  34172. if (x.isZero()) return new Ctor(x);
  34173. pr = Ctor.precision;
  34174. rm = Ctor.rounding;
  34175. Ctor.precision = pr + 10;
  34176. Ctor.rounding = 1;
  34177. x = x.sin();
  34178. x.s = 1;
  34179. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  34180. Ctor.precision = pr;
  34181. Ctor.rounding = rm;
  34182. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  34183. };
  34184. /*
  34185. * n * 0 = 0
  34186. * n * N = N
  34187. * n * I = I
  34188. * 0 * n = 0
  34189. * 0 * 0 = 0
  34190. * 0 * N = N
  34191. * 0 * I = N
  34192. * N * n = N
  34193. * N * 0 = N
  34194. * N * N = N
  34195. * N * I = N
  34196. * I * n = I
  34197. * I * 0 = N
  34198. * I * N = N
  34199. * I * I = I
  34200. *
  34201. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  34202. * digits using rounding mode `rounding`.
  34203. *
  34204. */
  34205. P.times = P.mul = function (y) {
  34206. var carry,
  34207. e,
  34208. i,
  34209. k,
  34210. r,
  34211. rL,
  34212. t,
  34213. xdL,
  34214. ydL,
  34215. x = this,
  34216. Ctor = x.constructor,
  34217. xd = x.d,
  34218. yd = (y = new Ctor(y)).d;
  34219. y.s *= x.s;
  34220. // If either is NaN, ±Infinity or ±0...
  34221. if (!xd || !xd[0] || !yd || !yd[0]) {
  34222. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  34223. // Return NaN if either is NaN.
  34224. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  34225. ? NaN
  34226. // Return ±Infinity if either is ±Infinity.
  34227. // Return ±0 if either is ±0.
  34228. : !xd || !yd ? y.s / 0 : y.s * 0);
  34229. }
  34230. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  34231. xdL = xd.length;
  34232. ydL = yd.length;
  34233. // Ensure xd points to the longer array.
  34234. if (xdL < ydL) {
  34235. r = xd;
  34236. xd = yd;
  34237. yd = r;
  34238. rL = xdL;
  34239. xdL = ydL;
  34240. ydL = rL;
  34241. }
  34242. // Initialise the result array with zeros.
  34243. r = [];
  34244. rL = xdL + ydL;
  34245. for (i = rL; i--;) {
  34246. r.push(0);
  34247. } // Multiply!
  34248. for (i = ydL; --i >= 0;) {
  34249. carry = 0;
  34250. for (k = xdL + i; k > i;) {
  34251. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  34252. r[k--] = t % BASE | 0;
  34253. carry = t / BASE | 0;
  34254. }
  34255. r[k] = (r[k] + carry) % BASE | 0;
  34256. }
  34257. // Remove trailing zeros.
  34258. for (; !r[--rL];) {
  34259. r.pop();
  34260. }if (carry) ++e;else r.shift();
  34261. y.d = r;
  34262. y.e = getBase10Exponent(r, e);
  34263. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  34264. };
  34265. /*
  34266. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  34267. * digits using rounding mode `rm`.
  34268. *
  34269. * If the optional `sd` argument is present then return binary exponential notation.
  34270. *
  34271. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34272. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34273. *
  34274. */
  34275. P.toBinary = function (sd, rm) {
  34276. return toStringBinary(this, 2, sd, rm);
  34277. };
  34278. /*
  34279. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  34280. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  34281. *
  34282. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  34283. *
  34284. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34285. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34286. *
  34287. */
  34288. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  34289. var x = this,
  34290. Ctor = x.constructor;
  34291. x = new Ctor(x);
  34292. if (dp === void 0) return x;
  34293. checkInt32(dp, 0, MAX_DIGITS);
  34294. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34295. return finalise(x, dp + x.e + 1, rm);
  34296. };
  34297. /*
  34298. * Return a string representing the value of this Decimal in exponential notation rounded to
  34299. * `dp` fixed decimal places using rounding mode `rounding`.
  34300. *
  34301. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34302. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34303. *
  34304. */
  34305. P.toExponential = function (dp, rm) {
  34306. var str,
  34307. x = this,
  34308. Ctor = x.constructor;
  34309. if (dp === void 0) {
  34310. str = finiteToString(x, true);
  34311. } else {
  34312. checkInt32(dp, 0, MAX_DIGITS);
  34313. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34314. x = finalise(new Ctor(x), dp + 1, rm);
  34315. str = finiteToString(x, true, dp + 1);
  34316. }
  34317. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34318. };
  34319. /*
  34320. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  34321. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  34322. * omitted.
  34323. *
  34324. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  34325. *
  34326. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34327. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34328. *
  34329. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  34330. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  34331. * (-0).toFixed(3) is '0.000'.
  34332. * (-0.5).toFixed(0) is '-0'.
  34333. *
  34334. */
  34335. P.toFixed = function (dp, rm) {
  34336. var str,
  34337. y,
  34338. x = this,
  34339. Ctor = x.constructor;
  34340. if (dp === void 0) {
  34341. str = finiteToString(x);
  34342. } else {
  34343. checkInt32(dp, 0, MAX_DIGITS);
  34344. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34345. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  34346. str = finiteToString(y, false, dp + y.e + 1);
  34347. }
  34348. // To determine whether to add the minus sign look at the value before it was rounded,
  34349. // i.e. look at `x` rather than `y`.
  34350. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34351. };
  34352. /*
  34353. * Return an array representing the value of this Decimal as a simple fraction with an integer
  34354. * numerator and an integer denominator.
  34355. *
  34356. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  34357. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  34358. * value necessary to represent the number exactly.
  34359. *
  34360. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  34361. *
  34362. */
  34363. P.toFraction = function (maxD) {
  34364. var d,
  34365. d0,
  34366. d1,
  34367. d2,
  34368. e,
  34369. k,
  34370. n,
  34371. n0,
  34372. n1,
  34373. pr,
  34374. q,
  34375. r,
  34376. x = this,
  34377. xd = x.d,
  34378. Ctor = x.constructor;
  34379. if (!xd) return new Ctor(x);
  34380. n1 = d0 = new Ctor(1);
  34381. d1 = n0 = new Ctor(0);
  34382. d = new Ctor(d1);
  34383. e = d.e = getPrecision(xd) - x.e - 1;
  34384. k = e % LOG_BASE;
  34385. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  34386. if (maxD == null) {
  34387. // d is 10**e, the minimum max-denominator needed.
  34388. maxD = e > 0 ? d : n1;
  34389. } else {
  34390. n = new Ctor(maxD);
  34391. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  34392. maxD = n.gt(d) ? e > 0 ? d : n1 : n;
  34393. }
  34394. external = false;
  34395. n = new Ctor(digitsToString(xd));
  34396. pr = Ctor.precision;
  34397. Ctor.precision = e = xd.length * LOG_BASE * 2;
  34398. for (;;) {
  34399. q = divide(n, d, 0, 1, 1);
  34400. d2 = d0.plus(q.times(d1));
  34401. if (d2.cmp(maxD) == 1) break;
  34402. d0 = d1;
  34403. d1 = d2;
  34404. d2 = n1;
  34405. n1 = n0.plus(q.times(d2));
  34406. n0 = d2;
  34407. d2 = d;
  34408. d = n.minus(q.times(d2));
  34409. n = d2;
  34410. }
  34411. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  34412. n0 = n0.plus(d2.times(n1));
  34413. d0 = d0.plus(d2.times(d1));
  34414. n0.s = n1.s = x.s;
  34415. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  34416. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
  34417. Ctor.precision = pr;
  34418. external = true;
  34419. return r;
  34420. };
  34421. /*
  34422. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  34423. * digits using rounding mode `rm`.
  34424. *
  34425. * If the optional `sd` argument is present then return binary exponential notation.
  34426. *
  34427. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34428. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34429. *
  34430. */
  34431. P.toHexadecimal = P.toHex = function (sd, rm) {
  34432. return toStringBinary(this, 16, sd, rm);
  34433. };
  34434. /*
  34435. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  34436. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  34437. *
  34438. * The return value will always have the same sign as this Decimal, unless either this Decimal
  34439. * or `y` is NaN, in which case the return value will be also be NaN.
  34440. *
  34441. * The return value is not affected by the value of `precision`.
  34442. *
  34443. * y {number|string|Decimal} The magnitude to round to a multiple of.
  34444. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34445. *
  34446. * 'toNearest() rounding mode not an integer: {rm}'
  34447. * 'toNearest() rounding mode out of range: {rm}'
  34448. *
  34449. */
  34450. P.toNearest = function (y, rm) {
  34451. var x = this,
  34452. Ctor = x.constructor;
  34453. x = new Ctor(x);
  34454. if (y == null) {
  34455. // If x is not finite, return x.
  34456. if (!x.d) return x;
  34457. y = new Ctor(1);
  34458. rm = Ctor.rounding;
  34459. } else {
  34460. y = new Ctor(y);
  34461. if (rm === void 0) {
  34462. rm = Ctor.rounding;
  34463. } else {
  34464. checkInt32(rm, 0, 8);
  34465. }
  34466. // If x is not finite, return x if y is not NaN, else NaN.
  34467. if (!x.d) return y.s ? x : y;
  34468. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  34469. if (!y.d) {
  34470. if (y.s) y.s = x.s;
  34471. return y;
  34472. }
  34473. }
  34474. // If y is not zero, calculate the nearest multiple of y to x.
  34475. if (y.d[0]) {
  34476. external = false;
  34477. x = divide(x, y, 0, rm, 1).times(y);
  34478. external = true;
  34479. finalise(x);
  34480. // If y is zero, return zero with the sign of x.
  34481. } else {
  34482. y.s = x.s;
  34483. x = y;
  34484. }
  34485. return x;
  34486. };
  34487. /*
  34488. * Return the value of this Decimal converted to a number primitive.
  34489. * Zero keeps its sign.
  34490. *
  34491. */
  34492. P.toNumber = function () {
  34493. return +this;
  34494. };
  34495. /*
  34496. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  34497. * digits using rounding mode `rm`.
  34498. *
  34499. * If the optional `sd` argument is present then return binary exponential notation.
  34500. *
  34501. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34502. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34503. *
  34504. */
  34505. P.toOctal = function (sd, rm) {
  34506. return toStringBinary(this, 8, sd, rm);
  34507. };
  34508. /*
  34509. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  34510. * to `precision` significant digits using rounding mode `rounding`.
  34511. *
  34512. * ECMAScript compliant.
  34513. *
  34514. * pow(x, NaN) = NaN
  34515. * pow(x, ±0) = 1
  34516. * pow(NaN, non-zero) = NaN
  34517. * pow(abs(x) > 1, +Infinity) = +Infinity
  34518. * pow(abs(x) > 1, -Infinity) = +0
  34519. * pow(abs(x) == 1, ±Infinity) = NaN
  34520. * pow(abs(x) < 1, +Infinity) = +0
  34521. * pow(abs(x) < 1, -Infinity) = +Infinity
  34522. * pow(+Infinity, y > 0) = +Infinity
  34523. * pow(+Infinity, y < 0) = +0
  34524. * pow(-Infinity, odd integer > 0) = -Infinity
  34525. * pow(-Infinity, even integer > 0) = +Infinity
  34526. * pow(-Infinity, odd integer < 0) = -0
  34527. * pow(-Infinity, even integer < 0) = +0
  34528. * pow(+0, y > 0) = +0
  34529. * pow(+0, y < 0) = +Infinity
  34530. * pow(-0, odd integer > 0) = -0
  34531. * pow(-0, even integer > 0) = +0
  34532. * pow(-0, odd integer < 0) = -Infinity
  34533. * pow(-0, even integer < 0) = +Infinity
  34534. * pow(finite x < 0, finite non-integer) = NaN
  34535. *
  34536. * For non-integer or very large exponents pow(x, y) is calculated using
  34537. *
  34538. * x^y = exp(y*ln(x))
  34539. *
  34540. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  34541. * probability of an incorrectly rounded result
  34542. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  34543. * i.e. 1 in 250,000,000,000,000
  34544. *
  34545. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  34546. *
  34547. * y {number|string|Decimal} The power to which to raise this Decimal.
  34548. *
  34549. */
  34550. P.toPower = P.pow = function (y) {
  34551. var e,
  34552. k,
  34553. pr,
  34554. r,
  34555. rm,
  34556. s,
  34557. x = this,
  34558. Ctor = x.constructor,
  34559. yn = +(y = new Ctor(y));
  34560. // Either ±Infinity, NaN or ±0?
  34561. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  34562. x = new Ctor(x);
  34563. if (x.eq(1)) return x;
  34564. pr = Ctor.precision;
  34565. rm = Ctor.rounding;
  34566. if (y.eq(1)) return finalise(x, pr, rm);
  34567. // y exponent
  34568. e = mathfloor(y.e / LOG_BASE);
  34569. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  34570. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  34571. r = intPow(Ctor, x, k, pr);
  34572. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  34573. }
  34574. s = x.s;
  34575. // if x is negative
  34576. if (s < 0) {
  34577. // if y is not an integer
  34578. if (e < y.d.length - 1) return new Ctor(NaN);
  34579. // Result is positive if x is negative and the last digit of integer y is even.
  34580. if ((y.d[e] & 1) == 0) s = 1;
  34581. // if x.eq(-1)
  34582. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  34583. x.s = s;
  34584. return x;
  34585. }
  34586. }
  34587. // Estimate result exponent.
  34588. // x^y = 10^e, where e = y * log10(x)
  34589. // log10(x) = log10(x_significand) + x_exponent
  34590. // log10(x_significand) = ln(x_significand) / ln(10)
  34591. k = mathpow(+x, yn);
  34592. e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + '').e;
  34593. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  34594. // Overflow/underflow?
  34595. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  34596. external = false;
  34597. Ctor.rounding = x.s = 1;
  34598. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  34599. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  34600. // new Decimal(2.32456).pow('2087987436534566.46411')
  34601. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  34602. k = Math.min(12, (e + '').length);
  34603. // r = x^y = exp(y*ln(x))
  34604. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  34605. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  34606. if (r.d) {
  34607. // Truncate to the required precision plus five rounding digits.
  34608. r = finalise(r, pr + 5, 1);
  34609. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  34610. // the result.
  34611. if (checkRoundingDigits(r.d, pr, rm)) {
  34612. e = pr + 10;
  34613. // Truncate to the increased precision plus five rounding digits.
  34614. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  34615. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  34616. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  34617. r = finalise(r, pr + 1, 0);
  34618. }
  34619. }
  34620. }
  34621. r.s = s;
  34622. external = true;
  34623. Ctor.rounding = rm;
  34624. return finalise(r, pr, rm);
  34625. };
  34626. /*
  34627. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  34628. * using rounding mode `rounding`.
  34629. *
  34630. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  34631. * the integer part of the value in normal notation.
  34632. *
  34633. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34634. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34635. *
  34636. */
  34637. P.toPrecision = function (sd, rm) {
  34638. var str,
  34639. x = this,
  34640. Ctor = x.constructor;
  34641. if (sd === void 0) {
  34642. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  34643. } else {
  34644. checkInt32(sd, 1, MAX_DIGITS);
  34645. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34646. x = finalise(new Ctor(x), sd, rm);
  34647. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  34648. }
  34649. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34650. };
  34651. /*
  34652. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  34653. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  34654. * omitted.
  34655. *
  34656. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34657. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34658. *
  34659. * 'toSD() digits out of range: {sd}'
  34660. * 'toSD() digits not an integer: {sd}'
  34661. * 'toSD() rounding mode not an integer: {rm}'
  34662. * 'toSD() rounding mode out of range: {rm}'
  34663. *
  34664. */
  34665. P.toSignificantDigits = P.toSD = function (sd, rm) {
  34666. var x = this,
  34667. Ctor = x.constructor;
  34668. if (sd === void 0) {
  34669. sd = Ctor.precision;
  34670. rm = Ctor.rounding;
  34671. } else {
  34672. checkInt32(sd, 1, MAX_DIGITS);
  34673. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34674. }
  34675. return finalise(new Ctor(x), sd, rm);
  34676. };
  34677. /*
  34678. * Return a string representing the value of this Decimal.
  34679. *
  34680. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  34681. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  34682. *
  34683. */
  34684. P.toString = function () {
  34685. var x = this,
  34686. Ctor = x.constructor,
  34687. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  34688. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34689. };
  34690. /*
  34691. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  34692. *
  34693. */
  34694. P.truncated = P.trunc = function () {
  34695. return finalise(new this.constructor(this), this.e + 1, 1);
  34696. };
  34697. /*
  34698. * Return a string representing the value of this Decimal.
  34699. * Unlike `toString`, negative zero will include the minus sign.
  34700. *
  34701. */
  34702. P.valueOf = P.toJSON = function () {
  34703. var x = this,
  34704. Ctor = x.constructor,
  34705. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  34706. return x.isNeg() ? '-' + str : str;
  34707. };
  34708. /*
  34709. // Add aliases to match BigDecimal method names.
  34710. // P.add = P.plus;
  34711. P.subtract = P.minus;
  34712. P.multiply = P.times;
  34713. P.divide = P.div;
  34714. P.remainder = P.mod;
  34715. P.compareTo = P.cmp;
  34716. P.negate = P.neg;
  34717. */
  34718. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  34719. /*
  34720. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  34721. * finiteToString, naturalExponential, naturalLogarithm
  34722. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  34723. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  34724. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  34725. * convertBase toStringBinary, parseOther
  34726. * cos P.cos
  34727. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  34728. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  34729. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  34730. * taylorSeries, atan2, parseOther
  34731. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  34732. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  34733. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  34734. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  34735. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  34736. * P.truncated, divide, getLn10, getPi, naturalExponential,
  34737. * naturalLogarithm, ceil, floor, round, trunc
  34738. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  34739. * toStringBinary
  34740. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  34741. * getLn10 P.logarithm, naturalLogarithm
  34742. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  34743. * getPrecision P.precision, P.toFraction
  34744. * getZeroString digitsToString, finiteToString
  34745. * intPow P.toPower, parseOther
  34746. * isOdd toLessThanHalfPi
  34747. * maxOrMin max, min
  34748. * naturalExponential P.naturalExponential, P.toPower
  34749. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  34750. * P.toPower, naturalExponential
  34751. * nonFiniteToString finiteToString, toStringBinary
  34752. * parseDecimal Decimal
  34753. * parseOther Decimal
  34754. * sin P.sin
  34755. * taylorSeries P.cosh, P.sinh, cos, sin
  34756. * toLessThanHalfPi P.cos, P.sin
  34757. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  34758. * truncate intPow
  34759. *
  34760. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  34761. * naturalLogarithm, config, parseOther, random, Decimal
  34762. */
  34763. function digitsToString(d) {
  34764. var i,
  34765. k,
  34766. ws,
  34767. indexOfLastWord = d.length - 1,
  34768. str = '',
  34769. w = d[0];
  34770. if (indexOfLastWord > 0) {
  34771. str += w;
  34772. for (i = 1; i < indexOfLastWord; i++) {
  34773. ws = d[i] + '';
  34774. k = LOG_BASE - ws.length;
  34775. if (k) str += getZeroString(k);
  34776. str += ws;
  34777. }
  34778. w = d[i];
  34779. ws = w + '';
  34780. k = LOG_BASE - ws.length;
  34781. if (k) str += getZeroString(k);
  34782. } else if (w === 0) {
  34783. return '0';
  34784. }
  34785. // Remove trailing zeros of last w.
  34786. for (; w % 10 === 0;) {
  34787. w /= 10;
  34788. }return str + w;
  34789. }
  34790. function checkInt32(i, min, max) {
  34791. if (i !== ~~i || i < min || i > max) {
  34792. throw Error(invalidArgument + i);
  34793. }
  34794. }
  34795. /*
  34796. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  34797. * `repeating == null` if caller is `log` or `pow`,
  34798. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  34799. */
  34800. function checkRoundingDigits(d, i, rm, repeating) {
  34801. var di, k, r, rd;
  34802. // Get the length of the first word of the array d.
  34803. for (k = d[0]; k >= 10; k /= 10) {
  34804. --i;
  34805. } // Is the rounding digit in the first word of d?
  34806. if (--i < 0) {
  34807. i += LOG_BASE;
  34808. di = 0;
  34809. } else {
  34810. di = Math.ceil((i + 1) / LOG_BASE);
  34811. i %= LOG_BASE;
  34812. }
  34813. // i is the index (0 - 6) of the rounding digit.
  34814. // E.g. if within the word 3487563 the first rounding digit is 5,
  34815. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  34816. k = mathpow(10, LOG_BASE - i);
  34817. rd = d[di] % k | 0;
  34818. if (repeating == null) {
  34819. if (i < 3) {
  34820. if (i == 0) rd = rd / 100 | 0;else if (i == 1) rd = rd / 10 | 0;
  34821. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  34822. } else {
  34823. 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;
  34824. }
  34825. } else {
  34826. if (i < 4) {
  34827. if (i == 0) rd = rd / 1000 | 0;else if (i == 1) rd = rd / 100 | 0;else if (i == 2) rd = rd / 10 | 0;
  34828. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  34829. } else {
  34830. 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;
  34831. }
  34832. }
  34833. return r;
  34834. }
  34835. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  34836. // Eg. convertBase('255', 10, 16) returns [15, 15].
  34837. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  34838. function convertBase(str, baseIn, baseOut) {
  34839. var j,
  34840. arr = [0],
  34841. arrL,
  34842. i = 0,
  34843. strL = str.length;
  34844. for (; i < strL;) {
  34845. for (arrL = arr.length; arrL--;) {
  34846. arr[arrL] *= baseIn;
  34847. }arr[0] += NUMERALS.indexOf(str.charAt(i++));
  34848. for (j = 0; j < arr.length; j++) {
  34849. if (arr[j] > baseOut - 1) {
  34850. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  34851. arr[j + 1] += arr[j] / baseOut | 0;
  34852. arr[j] %= baseOut;
  34853. }
  34854. }
  34855. }
  34856. return arr.reverse();
  34857. }
  34858. /*
  34859. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  34860. * |x| < pi/2
  34861. *
  34862. */
  34863. function cosine(Ctor, x) {
  34864. var k,
  34865. y,
  34866. len = x.d.length;
  34867. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  34868. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  34869. // Estimate the optimum number of times to use the argument reduction.
  34870. if (len < 32) {
  34871. k = Math.ceil(len / 3);
  34872. y = Math.pow(4, -k).toString();
  34873. } else {
  34874. k = 16;
  34875. y = '2.3283064365386962890625e-10';
  34876. }
  34877. Ctor.precision += k;
  34878. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  34879. // Reverse argument reduction
  34880. for (var i = k; i--;) {
  34881. var cos2x = x.times(x);
  34882. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  34883. }
  34884. Ctor.precision -= k;
  34885. return x;
  34886. }
  34887. /*
  34888. * Perform division in the specified base.
  34889. */
  34890. var divide = function () {
  34891. // Assumes non-zero x and k, and hence non-zero result.
  34892. function multiplyInteger(x, k, base) {
  34893. var temp,
  34894. carry = 0,
  34895. i = x.length;
  34896. for (x = x.slice(); i--;) {
  34897. temp = x[i] * k + carry;
  34898. x[i] = temp % base | 0;
  34899. carry = temp / base | 0;
  34900. }
  34901. if (carry) x.unshift(carry);
  34902. return x;
  34903. }
  34904. function compare(a, b, aL, bL) {
  34905. var i, r;
  34906. if (aL != bL) {
  34907. r = aL > bL ? 1 : -1;
  34908. } else {
  34909. for (i = r = 0; i < aL; i++) {
  34910. if (a[i] != b[i]) {
  34911. r = a[i] > b[i] ? 1 : -1;
  34912. break;
  34913. }
  34914. }
  34915. }
  34916. return r;
  34917. }
  34918. function subtract(a, b, aL, base) {
  34919. var i = 0;
  34920. // Subtract b from a.
  34921. for (; aL--;) {
  34922. a[aL] -= i;
  34923. i = a[aL] < b[aL] ? 1 : 0;
  34924. a[aL] = i * base + a[aL] - b[aL];
  34925. }
  34926. // Remove leading zeros.
  34927. for (; !a[0] && a.length > 1;) {
  34928. a.shift();
  34929. }
  34930. }
  34931. return function (x, y, pr, rm, dp, base) {
  34932. var cmp,
  34933. e,
  34934. i,
  34935. k,
  34936. logBase,
  34937. more,
  34938. prod,
  34939. prodL,
  34940. q,
  34941. qd,
  34942. rem,
  34943. remL,
  34944. rem0,
  34945. sd,
  34946. t,
  34947. xi,
  34948. xL,
  34949. yd0,
  34950. yL,
  34951. yz,
  34952. Ctor = x.constructor,
  34953. sign = x.s == y.s ? 1 : -1,
  34954. xd = x.d,
  34955. yd = y.d;
  34956. // Either NaN, Infinity or 0?
  34957. if (!xd || !xd[0] || !yd || !yd[0]) {
  34958. return new Ctor( // Return NaN if either NaN, or both Infinity or 0.
  34959. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  34960. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  34961. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  34962. }
  34963. if (base) {
  34964. logBase = 1;
  34965. e = x.e - y.e;
  34966. } else {
  34967. base = BASE;
  34968. logBase = LOG_BASE;
  34969. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  34970. }
  34971. yL = yd.length;
  34972. xL = xd.length;
  34973. q = new Ctor(sign);
  34974. qd = q.d = [];
  34975. // Result exponent may be one less than e.
  34976. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  34977. for (i = 0; yd[i] == (xd[i] || 0); i++) {}
  34978. if (yd[i] > (xd[i] || 0)) e--;
  34979. if (pr == null) {
  34980. sd = pr = Ctor.precision;
  34981. rm = Ctor.rounding;
  34982. } else if (dp) {
  34983. sd = pr + (x.e - y.e) + 1;
  34984. } else {
  34985. sd = pr;
  34986. }
  34987. if (sd < 0) {
  34988. qd.push(1);
  34989. more = true;
  34990. } else {
  34991. // Convert precision in number of base 10 digits to base 1e7 digits.
  34992. sd = sd / logBase + 2 | 0;
  34993. i = 0;
  34994. // divisor < 1e7
  34995. if (yL == 1) {
  34996. k = 0;
  34997. yd = yd[0];
  34998. sd++;
  34999. // k is the carry.
  35000. for (; (i < xL || k) && sd--; i++) {
  35001. t = k * base + (xd[i] || 0);
  35002. qd[i] = t / yd | 0;
  35003. k = t % yd | 0;
  35004. }
  35005. more = k || i < xL;
  35006. // divisor >= 1e7
  35007. } else {
  35008. // Normalise xd and yd so highest order digit of yd is >= base/2
  35009. k = base / (yd[0] + 1) | 0;
  35010. if (k > 1) {
  35011. yd = multiplyInteger(yd, k, base);
  35012. xd = multiplyInteger(xd, k, base);
  35013. yL = yd.length;
  35014. xL = xd.length;
  35015. }
  35016. xi = yL;
  35017. rem = xd.slice(0, yL);
  35018. remL = rem.length;
  35019. // Add zeros to make remainder as long as divisor.
  35020. for (; remL < yL;) {
  35021. rem[remL++] = 0;
  35022. }yz = yd.slice();
  35023. yz.unshift(0);
  35024. yd0 = yd[0];
  35025. if (yd[1] >= base / 2) ++yd0;
  35026. do {
  35027. k = 0;
  35028. // Compare divisor and remainder.
  35029. cmp = compare(yd, rem, yL, remL);
  35030. // If divisor < remainder.
  35031. if (cmp < 0) {
  35032. // Calculate trial digit, k.
  35033. rem0 = rem[0];
  35034. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  35035. // k will be how many times the divisor goes into the current remainder.
  35036. k = rem0 / yd0 | 0;
  35037. // Algorithm:
  35038. // 1. product = divisor * trial digit (k)
  35039. // 2. if product > remainder: product -= divisor, k--
  35040. // 3. remainder -= product
  35041. // 4. if product was < remainder at 2:
  35042. // 5. compare new remainder and divisor
  35043. // 6. If remainder > divisor: remainder -= divisor, k++
  35044. if (k > 1) {
  35045. if (k >= base) k = base - 1;
  35046. // product = divisor * trial digit.
  35047. prod = multiplyInteger(yd, k, base);
  35048. prodL = prod.length;
  35049. remL = rem.length;
  35050. // Compare product and remainder.
  35051. cmp = compare(prod, rem, prodL, remL);
  35052. // product > remainder.
  35053. if (cmp == 1) {
  35054. k--;
  35055. // Subtract divisor from product.
  35056. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  35057. }
  35058. } else {
  35059. // cmp is -1.
  35060. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  35061. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  35062. if (k == 0) cmp = k = 1;
  35063. prod = yd.slice();
  35064. }
  35065. prodL = prod.length;
  35066. if (prodL < remL) prod.unshift(0);
  35067. // Subtract product from remainder.
  35068. subtract(rem, prod, remL, base);
  35069. // If product was < previous remainder.
  35070. if (cmp == -1) {
  35071. remL = rem.length;
  35072. // Compare divisor and new remainder.
  35073. cmp = compare(yd, rem, yL, remL);
  35074. // If divisor < new remainder, subtract divisor from remainder.
  35075. if (cmp < 1) {
  35076. k++;
  35077. // Subtract divisor from remainder.
  35078. subtract(rem, yL < remL ? yz : yd, remL, base);
  35079. }
  35080. }
  35081. remL = rem.length;
  35082. } else if (cmp === 0) {
  35083. k++;
  35084. rem = [0];
  35085. } // if cmp === 1, k will be 0
  35086. // Add the next digit, k, to the result array.
  35087. qd[i++] = k;
  35088. // Update the remainder.
  35089. if (cmp && rem[0]) {
  35090. rem[remL++] = xd[xi] || 0;
  35091. } else {
  35092. rem = [xd[xi]];
  35093. remL = 1;
  35094. }
  35095. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  35096. more = rem[0] !== void 0;
  35097. }
  35098. // Leading zero?
  35099. if (!qd[0]) qd.shift();
  35100. }
  35101. // logBase is 1 when divide is being used for base conversion.
  35102. if (logBase == 1) {
  35103. q.e = e;
  35104. inexact = more;
  35105. } else {
  35106. // To calculate q.e, first get the number of digits of qd[0].
  35107. for (i = 1, k = qd[0]; k >= 10; k /= 10) {
  35108. i++;
  35109. }q.e = i + e * logBase - 1;
  35110. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  35111. }
  35112. return q;
  35113. };
  35114. }();
  35115. /*
  35116. * Round `x` to `sd` significant digits using rounding mode `rm`.
  35117. * Check for over/under-flow.
  35118. */
  35119. function finalise(x, sd, rm, isTruncated) {
  35120. var digits,
  35121. i,
  35122. j,
  35123. k,
  35124. rd,
  35125. roundUp,
  35126. w,
  35127. xd,
  35128. xdi,
  35129. Ctor = x.constructor;
  35130. // Don't round if sd is null or undefined.
  35131. out: if (sd != null) {
  35132. xd = x.d;
  35133. // Infinity/NaN.
  35134. if (!xd) return x;
  35135. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  35136. // w: the word of xd containing rd, a base 1e7 number.
  35137. // xdi: the index of w within xd.
  35138. // digits: the number of digits of w.
  35139. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  35140. // they had leading zeros)
  35141. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  35142. // Get the length of the first word of the digits array xd.
  35143. for (digits = 1, k = xd[0]; k >= 10; k /= 10) {
  35144. digits++;
  35145. }i = sd - digits;
  35146. // Is the rounding digit in the first word of xd?
  35147. if (i < 0) {
  35148. i += LOG_BASE;
  35149. j = sd;
  35150. w = xd[xdi = 0];
  35151. // Get the rounding digit at index j of w.
  35152. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  35153. } else {
  35154. xdi = Math.ceil((i + 1) / LOG_BASE);
  35155. k = xd.length;
  35156. if (xdi >= k) {
  35157. if (isTruncated) {
  35158. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  35159. for (; k++ <= xdi;) {
  35160. xd.push(0);
  35161. }w = rd = 0;
  35162. digits = 1;
  35163. i %= LOG_BASE;
  35164. j = i - LOG_BASE + 1;
  35165. } else {
  35166. break out;
  35167. }
  35168. } else {
  35169. w = k = xd[xdi];
  35170. // Get the number of digits of w.
  35171. for (digits = 1; k >= 10; k /= 10) {
  35172. digits++;
  35173. } // Get the index of rd within w.
  35174. i %= LOG_BASE;
  35175. // Get the index of rd within w, adjusted for leading zeros.
  35176. // The number of leading zeros of w is given by LOG_BASE - digits.
  35177. j = i - LOG_BASE + digits;
  35178. // Get the rounding digit at index j of w.
  35179. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  35180. }
  35181. }
  35182. // Are there any non-zero digits after the rounding digit?
  35183. isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  35184. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  35185. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  35186. // will give 714.
  35187. roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  35188. // Check whether the digit to the left of the rounding digit is odd.
  35189. (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
  35190. if (sd < 1 || !xd[0]) {
  35191. xd.length = 0;
  35192. if (roundUp) {
  35193. // Convert sd to decimal places.
  35194. sd -= x.e + 1;
  35195. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  35196. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  35197. x.e = -sd || 0;
  35198. } else {
  35199. // Zero.
  35200. xd[0] = x.e = 0;
  35201. }
  35202. return x;
  35203. }
  35204. // Remove excess digits.
  35205. if (i == 0) {
  35206. xd.length = xdi;
  35207. k = 1;
  35208. xdi--;
  35209. } else {
  35210. xd.length = xdi + 1;
  35211. k = mathpow(10, LOG_BASE - i);
  35212. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  35213. // j > 0 means i > number of leading zeros of w.
  35214. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  35215. }
  35216. if (roundUp) {
  35217. for (;;) {
  35218. // Is the digit to be rounded up in the first word of xd?
  35219. if (xdi == 0) {
  35220. // i will be the length of xd[0] before k is added.
  35221. for (i = 1, j = xd[0]; j >= 10; j /= 10) {
  35222. i++;
  35223. }j = xd[0] += k;
  35224. for (k = 1; j >= 10; j /= 10) {
  35225. k++;
  35226. } // if i != k the length has increased.
  35227. if (i != k) {
  35228. x.e++;
  35229. if (xd[0] == BASE) xd[0] = 1;
  35230. }
  35231. break;
  35232. } else {
  35233. xd[xdi] += k;
  35234. if (xd[xdi] != BASE) break;
  35235. xd[xdi--] = 0;
  35236. k = 1;
  35237. }
  35238. }
  35239. }
  35240. // Remove trailing zeros.
  35241. for (i = xd.length; xd[--i] === 0;) {
  35242. xd.pop();
  35243. }
  35244. }
  35245. if (external) {
  35246. // Overflow?
  35247. if (x.e > Ctor.maxE) {
  35248. // Infinity.
  35249. x.d = null;
  35250. x.e = NaN;
  35251. // Underflow?
  35252. } else if (x.e < Ctor.minE) {
  35253. // Zero.
  35254. x.e = 0;
  35255. x.d = [0];
  35256. // Ctor.underflow = true;
  35257. } // else Ctor.underflow = false;
  35258. }
  35259. return x;
  35260. }
  35261. function finiteToString(x, isExp, sd) {
  35262. if (!x.isFinite()) return nonFiniteToString(x);
  35263. var k,
  35264. e = x.e,
  35265. str = digitsToString(x.d),
  35266. len = str.length;
  35267. if (isExp) {
  35268. if (sd && (k = sd - len) > 0) {
  35269. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  35270. } else if (len > 1) {
  35271. str = str.charAt(0) + '.' + str.slice(1);
  35272. }
  35273. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  35274. } else if (e < 0) {
  35275. str = '0.' + getZeroString(-e - 1) + str;
  35276. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  35277. } else if (e >= len) {
  35278. str += getZeroString(e + 1 - len);
  35279. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  35280. } else {
  35281. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  35282. if (sd && (k = sd - len) > 0) {
  35283. if (e + 1 === len) str += '.';
  35284. str += getZeroString(k);
  35285. }
  35286. }
  35287. return str;
  35288. }
  35289. // Calculate the base 10 exponent from the base 1e7 exponent.
  35290. function getBase10Exponent(digits, e) {
  35291. var w = digits[0];
  35292. // Add the number of digits of the first word of the digits array.
  35293. for (e *= LOG_BASE; w >= 10; w /= 10) {
  35294. e++;
  35295. }return e;
  35296. }
  35297. function getLn10(Ctor, sd, pr) {
  35298. if (sd > LN10_PRECISION) {
  35299. // Reset global state in case the exception is caught.
  35300. external = true;
  35301. if (pr) Ctor.precision = pr;
  35302. throw Error(precisionLimitExceeded);
  35303. }
  35304. return finalise(new Ctor(LN10), sd, 1, true);
  35305. }
  35306. function getPi(Ctor, sd, rm) {
  35307. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  35308. return finalise(new Ctor(PI), sd, rm, true);
  35309. }
  35310. function getPrecision(digits) {
  35311. var w = digits.length - 1,
  35312. len = w * LOG_BASE + 1;
  35313. w = digits[w];
  35314. // If non-zero...
  35315. if (w) {
  35316. // Subtract the number of trailing zeros of the last word.
  35317. for (; w % 10 == 0; w /= 10) {
  35318. len--;
  35319. } // Add the number of digits of the first word.
  35320. for (w = digits[0]; w >= 10; w /= 10) {
  35321. len++;
  35322. }
  35323. }
  35324. return len;
  35325. }
  35326. function getZeroString(k) {
  35327. var zs = '';
  35328. for (; k--;) {
  35329. zs += '0';
  35330. }return zs;
  35331. }
  35332. /*
  35333. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  35334. * integer of type number.
  35335. *
  35336. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  35337. *
  35338. */
  35339. function intPow(Ctor, x, n, pr) {
  35340. var isTruncated,
  35341. r = new Ctor(1),
  35342. // Max n of 9007199254740991 takes 53 loop iterations.
  35343. // Maximum digits array length; leaves [28, 34] guard digits.
  35344. k = Math.ceil(pr / LOG_BASE + 4);
  35345. external = false;
  35346. for (;;) {
  35347. if (n % 2) {
  35348. r = r.times(x);
  35349. if (truncate(r.d, k)) isTruncated = true;
  35350. }
  35351. n = mathfloor(n / 2);
  35352. if (n === 0) {
  35353. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  35354. n = r.d.length - 1;
  35355. if (isTruncated && r.d[n] === 0) ++r.d[n];
  35356. break;
  35357. }
  35358. x = x.times(x);
  35359. truncate(x.d, k);
  35360. }
  35361. external = true;
  35362. return r;
  35363. }
  35364. function isOdd(n) {
  35365. return n.d[n.d.length - 1] & 1;
  35366. }
  35367. /*
  35368. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  35369. */
  35370. function maxOrMin(Ctor, args, ltgt) {
  35371. var y,
  35372. x = new Ctor(args[0]),
  35373. i = 0;
  35374. for (; ++i < args.length;) {
  35375. y = new Ctor(args[i]);
  35376. if (!y.s) {
  35377. x = y;
  35378. break;
  35379. } else if (x[ltgt](y)) {
  35380. x = y;
  35381. }
  35382. }
  35383. return x;
  35384. }
  35385. /*
  35386. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  35387. * digits.
  35388. *
  35389. * Taylor/Maclaurin series.
  35390. *
  35391. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  35392. *
  35393. * Argument reduction:
  35394. * Repeat x = x / 32, k += 5, until |x| < 0.1
  35395. * exp(x) = exp(x / 2^k)^(2^k)
  35396. *
  35397. * Previously, the argument was initially reduced by
  35398. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  35399. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  35400. * found to be slower than just dividing repeatedly by 32 as above.
  35401. *
  35402. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  35403. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  35404. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  35405. *
  35406. * exp(Infinity) = Infinity
  35407. * exp(-Infinity) = 0
  35408. * exp(NaN) = NaN
  35409. * exp(±0) = 1
  35410. *
  35411. * exp(x) is non-terminating for any finite, non-zero x.
  35412. *
  35413. * The result will always be correctly rounded.
  35414. *
  35415. */
  35416. function naturalExponential(x, sd) {
  35417. var denominator,
  35418. guard,
  35419. j,
  35420. pow,
  35421. sum,
  35422. t,
  35423. wpr,
  35424. rep = 0,
  35425. i = 0,
  35426. k = 0,
  35427. Ctor = x.constructor,
  35428. rm = Ctor.rounding,
  35429. pr = Ctor.precision;
  35430. // 0/NaN/Infinity?
  35431. if (!x.d || !x.d[0] || x.e > 17) {
  35432. return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  35433. }
  35434. if (sd == null) {
  35435. external = false;
  35436. wpr = pr;
  35437. } else {
  35438. wpr = sd;
  35439. }
  35440. t = new Ctor(0.03125);
  35441. // while abs(x) >= 0.1
  35442. while (x.e > -2) {
  35443. // x = x / 2^5
  35444. x = x.times(t);
  35445. k += 5;
  35446. }
  35447. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  35448. // necessary to ensure the first 4 rounding digits are correct.
  35449. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  35450. wpr += guard;
  35451. denominator = pow = sum = new Ctor(1);
  35452. Ctor.precision = wpr;
  35453. for (;;) {
  35454. pow = finalise(pow.times(x), wpr, 1);
  35455. denominator = denominator.times(++i);
  35456. t = sum.plus(divide(pow, denominator, wpr, 1));
  35457. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  35458. j = k;
  35459. while (j--) {
  35460. sum = finalise(sum.times(sum), wpr, 1);
  35461. } // Check to see if the first 4 rounding digits are [49]999.
  35462. // If so, repeat the summation with a higher precision, otherwise
  35463. // e.g. with precision: 18, rounding: 1
  35464. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  35465. // `wpr - guard` is the index of first rounding digit.
  35466. if (sd == null) {
  35467. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  35468. Ctor.precision = wpr += 10;
  35469. denominator = pow = t = new Ctor(1);
  35470. i = 0;
  35471. rep++;
  35472. } else {
  35473. return finalise(sum, Ctor.precision = pr, rm, external = true);
  35474. }
  35475. } else {
  35476. Ctor.precision = pr;
  35477. return sum;
  35478. }
  35479. }
  35480. sum = t;
  35481. }
  35482. }
  35483. /*
  35484. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  35485. * digits.
  35486. *
  35487. * ln(-n) = NaN
  35488. * ln(0) = -Infinity
  35489. * ln(-0) = -Infinity
  35490. * ln(1) = 0
  35491. * ln(Infinity) = Infinity
  35492. * ln(-Infinity) = NaN
  35493. * ln(NaN) = NaN
  35494. *
  35495. * ln(n) (n != 1) is non-terminating.
  35496. *
  35497. */
  35498. function naturalLogarithm(y, sd) {
  35499. var c,
  35500. c0,
  35501. denominator,
  35502. e,
  35503. numerator,
  35504. rep,
  35505. sum,
  35506. t,
  35507. wpr,
  35508. x1,
  35509. x2,
  35510. n = 1,
  35511. guard = 10,
  35512. x = y,
  35513. xd = x.d,
  35514. Ctor = x.constructor,
  35515. rm = Ctor.rounding,
  35516. pr = Ctor.precision;
  35517. // Is x negative or Infinity, NaN, 0 or 1?
  35518. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  35519. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  35520. }
  35521. if (sd == null) {
  35522. external = false;
  35523. wpr = pr;
  35524. } else {
  35525. wpr = sd;
  35526. }
  35527. Ctor.precision = wpr += guard;
  35528. c = digitsToString(xd);
  35529. c0 = c.charAt(0);
  35530. if (Math.abs(e = x.e) < 1.5e15) {
  35531. // Argument reduction.
  35532. // The series converges faster the closer the argument is to 1, so using
  35533. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  35534. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  35535. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  35536. // later be divided by this number, then separate out the power of 10 using
  35537. // ln(a*10^b) = ln(a) + b*ln(10).
  35538. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  35539. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  35540. // max n is 6 (gives 0.7 - 1.3)
  35541. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  35542. x = x.times(y);
  35543. c = digitsToString(x.d);
  35544. c0 = c.charAt(0);
  35545. n++;
  35546. }
  35547. e = x.e;
  35548. if (c0 > 1) {
  35549. x = new Ctor('0.' + c);
  35550. e++;
  35551. } else {
  35552. x = new Ctor(c0 + '.' + c.slice(1));
  35553. }
  35554. } else {
  35555. // The argument reduction method above may result in overflow if the argument y is a massive
  35556. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  35557. // function using ln(x*10^e) = ln(x) + e*ln(10).
  35558. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  35559. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  35560. Ctor.precision = pr;
  35561. return sd == null ? finalise(x, pr, rm, external = true) : x;
  35562. }
  35563. // x1 is x reduced to a value near 1.
  35564. x1 = x;
  35565. // Taylor series.
  35566. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  35567. // where x = (y - 1)/(y + 1) (|x| < 1)
  35568. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  35569. x2 = finalise(x.times(x), wpr, 1);
  35570. denominator = 3;
  35571. for (;;) {
  35572. numerator = finalise(numerator.times(x2), wpr, 1);
  35573. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  35574. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  35575. sum = sum.times(2);
  35576. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  35577. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  35578. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  35579. sum = divide(sum, new Ctor(n), wpr, 1);
  35580. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  35581. // been repeated previously) and the first 4 rounding digits 9999?
  35582. // If so, restart the summation with a higher precision, otherwise
  35583. // e.g. with precision: 12, rounding: 1
  35584. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  35585. // `wpr - guard` is the index of first rounding digit.
  35586. if (sd == null) {
  35587. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  35588. Ctor.precision = wpr += guard;
  35589. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  35590. x2 = finalise(x.times(x), wpr, 1);
  35591. denominator = rep = 1;
  35592. } else {
  35593. return finalise(sum, Ctor.precision = pr, rm, external = true);
  35594. }
  35595. } else {
  35596. Ctor.precision = pr;
  35597. return sum;
  35598. }
  35599. }
  35600. sum = t;
  35601. denominator += 2;
  35602. }
  35603. }
  35604. // ±Infinity, NaN.
  35605. function nonFiniteToString(x) {
  35606. // Unsigned.
  35607. return String(x.s * x.s / 0);
  35608. }
  35609. /*
  35610. * Parse the value of a new Decimal `x` from string `str`.
  35611. */
  35612. function parseDecimal(x, str) {
  35613. var e, i, len;
  35614. // Decimal point?
  35615. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  35616. // Exponential form?
  35617. if ((i = str.search(/e/i)) > 0) {
  35618. // Determine exponent.
  35619. if (e < 0) e = i;
  35620. e += +str.slice(i + 1);
  35621. str = str.substring(0, i);
  35622. } else if (e < 0) {
  35623. // Integer.
  35624. e = str.length;
  35625. }
  35626. // Determine leading zeros.
  35627. for (i = 0; str.charCodeAt(i) === 48; i++) {}
  35628. // Determine trailing zeros.
  35629. for (len = str.length; str.charCodeAt(len - 1) === 48; --len) {}
  35630. str = str.slice(i, len);
  35631. if (str) {
  35632. len -= i;
  35633. x.e = e = e - i - 1;
  35634. x.d = [];
  35635. // Transform base
  35636. // e is the base 10 exponent.
  35637. // i is where to slice str to get the first word of the digits array.
  35638. i = (e + 1) % LOG_BASE;
  35639. if (e < 0) i += LOG_BASE;
  35640. if (i < len) {
  35641. if (i) x.d.push(+str.slice(0, i));
  35642. for (len -= LOG_BASE; i < len;) {
  35643. x.d.push(+str.slice(i, i += LOG_BASE));
  35644. }str = str.slice(i);
  35645. i = LOG_BASE - str.length;
  35646. } else {
  35647. i -= len;
  35648. }
  35649. for (; i--;) {
  35650. str += '0';
  35651. }x.d.push(+str);
  35652. if (external) {
  35653. // Overflow?
  35654. if (x.e > x.constructor.maxE) {
  35655. // Infinity.
  35656. x.d = null;
  35657. x.e = NaN;
  35658. // Underflow?
  35659. } else if (x.e < x.constructor.minE) {
  35660. // Zero.
  35661. x.e = 0;
  35662. x.d = [0];
  35663. // x.constructor.underflow = true;
  35664. } // else x.constructor.underflow = false;
  35665. }
  35666. } else {
  35667. // Zero.
  35668. x.e = 0;
  35669. x.d = [0];
  35670. }
  35671. return x;
  35672. }
  35673. /*
  35674. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  35675. */
  35676. function parseOther(x, str) {
  35677. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  35678. if (str === 'Infinity' || str === 'NaN') {
  35679. if (!+str) x.s = NaN;
  35680. x.e = NaN;
  35681. x.d = null;
  35682. return x;
  35683. }
  35684. if (isHex.test(str)) {
  35685. base = 16;
  35686. str = str.toLowerCase();
  35687. } else if (isBinary.test(str)) {
  35688. base = 2;
  35689. } else if (isOctal.test(str)) {
  35690. base = 8;
  35691. } else {
  35692. throw Error(invalidArgument + str);
  35693. }
  35694. // Is there a binary exponent part?
  35695. i = str.search(/p/i);
  35696. if (i > 0) {
  35697. p = +str.slice(i + 1);
  35698. str = str.substring(2, i);
  35699. } else {
  35700. str = str.slice(2);
  35701. }
  35702. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  35703. // fraction part will be restored.
  35704. i = str.indexOf('.');
  35705. isFloat = i >= 0;
  35706. Ctor = x.constructor;
  35707. if (isFloat) {
  35708. str = str.replace('.', '');
  35709. len = str.length;
  35710. i = len - i;
  35711. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  35712. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  35713. }
  35714. xd = convertBase(str, base, BASE);
  35715. xe = xd.length - 1;
  35716. // Remove trailing zeros.
  35717. for (i = xe; xd[i] === 0; --i) {
  35718. xd.pop();
  35719. }if (i < 0) return new Ctor(x.s * 0);
  35720. x.e = getBase10Exponent(xd, xe);
  35721. x.d = xd;
  35722. external = false;
  35723. // At what precision to perform the division to ensure exact conversion?
  35724. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  35725. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  35726. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  35727. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  35728. // Therefore using 4 * the number of digits of str will always be enough.
  35729. if (isFloat) x = divide(x, divisor, len * 4);
  35730. // Multiply by the binary exponent part if present.
  35731. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  35732. external = true;
  35733. return x;
  35734. }
  35735. /*
  35736. * sin(x) = x - x^3/3! + x^5/5! - ...
  35737. * |x| < pi/2
  35738. *
  35739. */
  35740. function sine(Ctor, x) {
  35741. var k,
  35742. len = x.d.length;
  35743. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  35744. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  35745. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  35746. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  35747. // Estimate the optimum number of times to use the argument reduction.
  35748. k = 1.4 * Math.sqrt(len);
  35749. k = k > 16 ? 16 : k | 0;
  35750. // Max k before Math.pow precision loss is 22
  35751. x = x.times(Math.pow(5, -k));
  35752. x = taylorSeries(Ctor, 2, x, x);
  35753. // Reverse argument reduction
  35754. var sin2_x,
  35755. d5 = new Ctor(5),
  35756. d16 = new Ctor(16),
  35757. d20 = new Ctor(20);
  35758. for (; k--;) {
  35759. sin2_x = x.times(x);
  35760. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  35761. }
  35762. return x;
  35763. }
  35764. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  35765. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  35766. var j,
  35767. t,
  35768. u,
  35769. x2,
  35770. i = 1,
  35771. pr = Ctor.precision,
  35772. k = Math.ceil(pr / LOG_BASE);
  35773. external = false;
  35774. x2 = x.times(x);
  35775. u = new Ctor(y);
  35776. for (;;) {
  35777. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  35778. u = isHyperbolic ? y.plus(t) : y.minus(t);
  35779. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  35780. t = u.plus(y);
  35781. if (t.d[k] !== void 0) {
  35782. for (j = k; t.d[j] === u.d[j] && j--;) {}
  35783. if (j == -1) break;
  35784. }
  35785. j = u;
  35786. u = y;
  35787. y = t;
  35788. t = j;
  35789. i++;
  35790. }
  35791. external = true;
  35792. t.d.length = k + 1;
  35793. return t;
  35794. }
  35795. // Return the absolute value of `x` reduced to less than or equal to half pi.
  35796. function toLessThanHalfPi(Ctor, x) {
  35797. var t,
  35798. isNeg = x.s < 0,
  35799. pi = getPi(Ctor, Ctor.precision, 1),
  35800. halfPi = pi.times(0.5);
  35801. x = x.abs();
  35802. if (x.lte(halfPi)) {
  35803. quadrant = isNeg ? 4 : 1;
  35804. return x;
  35805. }
  35806. t = x.divToInt(pi);
  35807. if (t.isZero()) {
  35808. quadrant = isNeg ? 3 : 2;
  35809. } else {
  35810. x = x.minus(t.times(pi));
  35811. // 0 <= x < pi
  35812. if (x.lte(halfPi)) {
  35813. quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1;
  35814. return x;
  35815. }
  35816. quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2;
  35817. }
  35818. return x.minus(pi).abs();
  35819. }
  35820. /*
  35821. * Return the value of Decimal `x` as a string in base `baseOut`.
  35822. *
  35823. * If the optional `sd` argument is present include a binary exponent suffix.
  35824. */
  35825. function toStringBinary(x, baseOut, sd, rm) {
  35826. var base,
  35827. e,
  35828. i,
  35829. k,
  35830. len,
  35831. roundUp,
  35832. str,
  35833. xd,
  35834. y,
  35835. Ctor = x.constructor,
  35836. isExp = sd !== void 0;
  35837. if (isExp) {
  35838. checkInt32(sd, 1, MAX_DIGITS);
  35839. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  35840. } else {
  35841. sd = Ctor.precision;
  35842. rm = Ctor.rounding;
  35843. }
  35844. if (!x.isFinite()) {
  35845. str = nonFiniteToString(x);
  35846. } else {
  35847. str = finiteToString(x);
  35848. i = str.indexOf('.');
  35849. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  35850. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  35851. // minBinaryExponent = floor(decimalExponent * log[2](10))
  35852. // log[2](10) = 3.321928094887362347870319429489390175864
  35853. if (isExp) {
  35854. base = 2;
  35855. if (baseOut == 16) {
  35856. sd = sd * 4 - 3;
  35857. } else if (baseOut == 8) {
  35858. sd = sd * 3 - 2;
  35859. }
  35860. } else {
  35861. base = baseOut;
  35862. }
  35863. // Convert the number as an integer then divide the result by its base raised to a power such
  35864. // that the fraction part will be restored.
  35865. // Non-integer.
  35866. if (i >= 0) {
  35867. str = str.replace('.', '');
  35868. y = new Ctor(1);
  35869. y.e = str.length - i;
  35870. y.d = convertBase(finiteToString(y), 10, base);
  35871. y.e = y.d.length;
  35872. }
  35873. xd = convertBase(str, 10, base);
  35874. e = len = xd.length;
  35875. // Remove trailing zeros.
  35876. for (; xd[--len] == 0;) {
  35877. xd.pop();
  35878. }if (!xd[0]) {
  35879. str = isExp ? '0p+0' : '0';
  35880. } else {
  35881. if (i < 0) {
  35882. e--;
  35883. } else {
  35884. x = new Ctor(x);
  35885. x.d = xd;
  35886. x.e = e;
  35887. x = divide(x, y, sd, rm, 0, base);
  35888. xd = x.d;
  35889. e = x.e;
  35890. roundUp = inexact;
  35891. }
  35892. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  35893. i = xd[sd];
  35894. k = base / 2;
  35895. roundUp = roundUp || xd[sd + 1] !== void 0;
  35896. 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));
  35897. xd.length = sd;
  35898. if (roundUp) {
  35899. // Rounding up may mean the previous digit has to be rounded up and so on.
  35900. for (; ++xd[--sd] > base - 1;) {
  35901. xd[sd] = 0;
  35902. if (!sd) {
  35903. ++e;
  35904. xd.unshift(1);
  35905. }
  35906. }
  35907. }
  35908. // Determine trailing zeros.
  35909. for (len = xd.length; !xd[len - 1]; --len) {}
  35910. // E.g. [4, 11, 15] becomes 4bf.
  35911. for (i = 0, str = ''; i < len; i++) {
  35912. str += NUMERALS.charAt(xd[i]);
  35913. } // Add binary exponent suffix?
  35914. if (isExp) {
  35915. if (len > 1) {
  35916. if (baseOut == 16 || baseOut == 8) {
  35917. i = baseOut == 16 ? 4 : 3;
  35918. for (--len; len % i; len++) {
  35919. str += '0';
  35920. }xd = convertBase(str, base, baseOut);
  35921. for (len = xd.length; !xd[len - 1]; --len) {}
  35922. // xd[0] will always be be 1
  35923. for (i = 1, str = '1.'; i < len; i++) {
  35924. str += NUMERALS.charAt(xd[i]);
  35925. }
  35926. } else {
  35927. str = str.charAt(0) + '.' + str.slice(1);
  35928. }
  35929. }
  35930. str = str + (e < 0 ? 'p' : 'p+') + e;
  35931. } else if (e < 0) {
  35932. for (; ++e;) {
  35933. str = '0' + str;
  35934. }str = '0.' + str;
  35935. } else {
  35936. if (++e > len) for (e -= len; e--;) {
  35937. str += '0';
  35938. } else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  35939. }
  35940. }
  35941. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  35942. }
  35943. return x.s < 0 ? '-' + str : str;
  35944. }
  35945. // Does not strip trailing zeros.
  35946. function truncate(arr, len) {
  35947. if (arr.length > len) {
  35948. arr.length = len;
  35949. return true;
  35950. }
  35951. }
  35952. // Decimal methods
  35953. /*
  35954. * abs
  35955. * acos
  35956. * acosh
  35957. * add
  35958. * asin
  35959. * asinh
  35960. * atan
  35961. * atanh
  35962. * atan2
  35963. * cbrt
  35964. * ceil
  35965. * clone
  35966. * config
  35967. * cos
  35968. * cosh
  35969. * div
  35970. * exp
  35971. * floor
  35972. * hypot
  35973. * ln
  35974. * log
  35975. * log2
  35976. * log10
  35977. * max
  35978. * min
  35979. * mod
  35980. * mul
  35981. * pow
  35982. * random
  35983. * round
  35984. * set
  35985. * sign
  35986. * sin
  35987. * sinh
  35988. * sqrt
  35989. * sub
  35990. * tan
  35991. * tanh
  35992. * trunc
  35993. */
  35994. /*
  35995. * Return a new Decimal whose value is the absolute value of `x`.
  35996. *
  35997. * x {number|string|Decimal}
  35998. *
  35999. */
  36000. function abs(x) {
  36001. return new this(x).abs();
  36002. }
  36003. /*
  36004. * Return a new Decimal whose value is the arccosine in radians of `x`.
  36005. *
  36006. * x {number|string|Decimal}
  36007. *
  36008. */
  36009. function acos(x) {
  36010. return new this(x).acos();
  36011. }
  36012. /*
  36013. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  36014. * `precision` significant digits using rounding mode `rounding`.
  36015. *
  36016. * x {number|string|Decimal} A value in radians.
  36017. *
  36018. */
  36019. function acosh(x) {
  36020. return new this(x).acosh();
  36021. }
  36022. /*
  36023. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  36024. * digits using rounding mode `rounding`.
  36025. *
  36026. * x {number|string|Decimal}
  36027. * y {number|string|Decimal}
  36028. *
  36029. */
  36030. function add(x, y) {
  36031. return new this(x).plus(y);
  36032. }
  36033. /*
  36034. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  36035. * significant digits using rounding mode `rounding`.
  36036. *
  36037. * x {number|string|Decimal}
  36038. *
  36039. */
  36040. function asin(x) {
  36041. return new this(x).asin();
  36042. }
  36043. /*
  36044. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  36045. * `precision` significant digits using rounding mode `rounding`.
  36046. *
  36047. * x {number|string|Decimal} A value in radians.
  36048. *
  36049. */
  36050. function asinh(x) {
  36051. return new this(x).asinh();
  36052. }
  36053. /*
  36054. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  36055. * significant digits using rounding mode `rounding`.
  36056. *
  36057. * x {number|string|Decimal}
  36058. *
  36059. */
  36060. function atan(x) {
  36061. return new this(x).atan();
  36062. }
  36063. /*
  36064. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  36065. * `precision` significant digits using rounding mode `rounding`.
  36066. *
  36067. * x {number|string|Decimal} A value in radians.
  36068. *
  36069. */
  36070. function atanh(x) {
  36071. return new this(x).atanh();
  36072. }
  36073. /*
  36074. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  36075. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  36076. *
  36077. * Domain: [-Infinity, Infinity]
  36078. * Range: [-pi, pi]
  36079. *
  36080. * y {number|string|Decimal} The y-coordinate.
  36081. * x {number|string|Decimal} The x-coordinate.
  36082. *
  36083. * atan2(±0, -0) = ±pi
  36084. * atan2(±0, +0) = ±0
  36085. * atan2(±0, -x) = ±pi for x > 0
  36086. * atan2(±0, x) = ±0 for x > 0
  36087. * atan2(-y, ±0) = -pi/2 for y > 0
  36088. * atan2(y, ±0) = pi/2 for y > 0
  36089. * atan2(±y, -Infinity) = ±pi for finite y > 0
  36090. * atan2(±y, +Infinity) = ±0 for finite y > 0
  36091. * atan2(±Infinity, x) = ±pi/2 for finite x
  36092. * atan2(±Infinity, -Infinity) = ±3*pi/4
  36093. * atan2(±Infinity, +Infinity) = ±pi/4
  36094. * atan2(NaN, x) = NaN
  36095. * atan2(y, NaN) = NaN
  36096. *
  36097. */
  36098. function atan2(y, x) {
  36099. y = new this(y);
  36100. x = new this(x);
  36101. var r,
  36102. pr = this.precision,
  36103. rm = this.rounding,
  36104. wpr = pr + 4;
  36105. // Either NaN
  36106. if (!y.s || !x.s) {
  36107. r = new this(NaN);
  36108. // Both ±Infinity
  36109. } else if (!y.d && !x.d) {
  36110. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  36111. r.s = y.s;
  36112. // x is ±Infinity or y is ±0
  36113. } else if (!x.d || y.isZero()) {
  36114. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  36115. r.s = y.s;
  36116. // y is ±Infinity or x is ±0
  36117. } else if (!y.d || x.isZero()) {
  36118. r = getPi(this, wpr, 1).times(0.5);
  36119. r.s = y.s;
  36120. // Both non-zero and finite
  36121. } else if (x.s < 0) {
  36122. this.precision = wpr;
  36123. this.rounding = 1;
  36124. r = this.atan(divide(y, x, wpr, 1));
  36125. x = getPi(this, wpr, 1);
  36126. this.precision = pr;
  36127. this.rounding = rm;
  36128. r = y.s < 0 ? r.minus(x) : r.plus(x);
  36129. } else {
  36130. r = this.atan(divide(y, x, wpr, 1));
  36131. }
  36132. return r;
  36133. }
  36134. /*
  36135. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  36136. * digits using rounding mode `rounding`.
  36137. *
  36138. * x {number|string|Decimal}
  36139. *
  36140. */
  36141. function cbrt(x) {
  36142. return new this(x).cbrt();
  36143. }
  36144. /*
  36145. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  36146. *
  36147. * x {number|string|Decimal}
  36148. *
  36149. */
  36150. function ceil(x) {
  36151. return finalise(x = new this(x), x.e + 1, 2);
  36152. }
  36153. /*
  36154. * Configure global settings for a Decimal constructor.
  36155. *
  36156. * `obj` is an object with one or more of the following properties,
  36157. *
  36158. * precision {number}
  36159. * rounding {number}
  36160. * toExpNeg {number}
  36161. * toExpPos {number}
  36162. * maxE {number}
  36163. * minE {number}
  36164. * modulo {number}
  36165. * crypto {boolean|number}
  36166. * defaults {true}
  36167. *
  36168. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  36169. *
  36170. */
  36171. function config(obj) {
  36172. if (!obj || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') throw Error(decimalError + 'Object expected');
  36173. var i,
  36174. p,
  36175. v,
  36176. useDefaults = obj.defaults === true,
  36177. 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];
  36178. for (i = 0; i < ps.length; i += 3) {
  36179. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  36180. if ((v = obj[p]) !== void 0) {
  36181. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;else throw Error(invalidArgument + p + ': ' + v);
  36182. }
  36183. }
  36184. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  36185. if ((v = obj[p]) !== void 0) {
  36186. if (v === true || v === false || v === 0 || v === 1) {
  36187. if (v) {
  36188. if (typeof crypto != 'undefined' && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
  36189. this[p] = true;
  36190. } else {
  36191. throw Error(cryptoUnavailable);
  36192. }
  36193. } else {
  36194. this[p] = false;
  36195. }
  36196. } else {
  36197. throw Error(invalidArgument + p + ': ' + v);
  36198. }
  36199. }
  36200. return this;
  36201. }
  36202. /*
  36203. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  36204. * digits using rounding mode `rounding`.
  36205. *
  36206. * x {number|string|Decimal} A value in radians.
  36207. *
  36208. */
  36209. function cos(x) {
  36210. return new this(x).cos();
  36211. }
  36212. /*
  36213. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  36214. * significant digits using rounding mode `rounding`.
  36215. *
  36216. * x {number|string|Decimal} A value in radians.
  36217. *
  36218. */
  36219. function cosh(x) {
  36220. return new this(x).cosh();
  36221. }
  36222. /*
  36223. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  36224. * constructor.
  36225. *
  36226. */
  36227. function clone(obj) {
  36228. var i, p, ps;
  36229. /*
  36230. * The Decimal constructor and exported function.
  36231. * Return a new Decimal instance.
  36232. *
  36233. * v {number|string|Decimal} A numeric value.
  36234. *
  36235. */
  36236. function Decimal(v) {
  36237. var e,
  36238. i,
  36239. t,
  36240. x = this;
  36241. // Decimal called without new.
  36242. if (!(x instanceof Decimal)) return new Decimal(v);
  36243. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  36244. // which points to Object.
  36245. x.constructor = Decimal;
  36246. // Duplicate.
  36247. if (v instanceof Decimal) {
  36248. x.s = v.s;
  36249. x.e = v.e;
  36250. x.d = (v = v.d) ? v.slice() : v;
  36251. return;
  36252. }
  36253. t = typeof v === 'undefined' ? 'undefined' : _typeof(v);
  36254. if (t === 'number') {
  36255. if (v === 0) {
  36256. x.s = 1 / v < 0 ? -1 : 1;
  36257. x.e = 0;
  36258. x.d = [0];
  36259. return;
  36260. }
  36261. if (v < 0) {
  36262. v = -v;
  36263. x.s = -1;
  36264. } else {
  36265. x.s = 1;
  36266. }
  36267. // Fast path for small integers.
  36268. if (v === ~~v && v < 1e7) {
  36269. for (e = 0, i = v; i >= 10; i /= 10) {
  36270. e++;
  36271. }x.e = e;
  36272. x.d = [v];
  36273. return;
  36274. // Infinity, NaN.
  36275. } else if (v * 0 !== 0) {
  36276. if (!v) x.s = NaN;
  36277. x.e = NaN;
  36278. x.d = null;
  36279. return;
  36280. }
  36281. return parseDecimal(x, v.toString());
  36282. } else if (t !== 'string') {
  36283. throw Error(invalidArgument + v);
  36284. }
  36285. // Minus sign?
  36286. if (v.charCodeAt(0) === 45) {
  36287. v = v.slice(1);
  36288. x.s = -1;
  36289. } else {
  36290. x.s = 1;
  36291. }
  36292. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  36293. }
  36294. Decimal.prototype = P;
  36295. Decimal.ROUND_UP = 0;
  36296. Decimal.ROUND_DOWN = 1;
  36297. Decimal.ROUND_CEIL = 2;
  36298. Decimal.ROUND_FLOOR = 3;
  36299. Decimal.ROUND_HALF_UP = 4;
  36300. Decimal.ROUND_HALF_DOWN = 5;
  36301. Decimal.ROUND_HALF_EVEN = 6;
  36302. Decimal.ROUND_HALF_CEIL = 7;
  36303. Decimal.ROUND_HALF_FLOOR = 8;
  36304. Decimal.EUCLID = 9;
  36305. Decimal.config = Decimal.set = config;
  36306. Decimal.clone = clone;
  36307. Decimal.isDecimal = isDecimalInstance;
  36308. Decimal.abs = abs;
  36309. Decimal.acos = acos;
  36310. Decimal.acosh = acosh; // ES6
  36311. Decimal.add = add;
  36312. Decimal.asin = asin;
  36313. Decimal.asinh = asinh; // ES6
  36314. Decimal.atan = atan;
  36315. Decimal.atanh = atanh; // ES6
  36316. Decimal.atan2 = atan2;
  36317. Decimal.cbrt = cbrt; // ES6
  36318. Decimal.ceil = ceil;
  36319. Decimal.cos = cos;
  36320. Decimal.cosh = cosh; // ES6
  36321. Decimal.div = div;
  36322. Decimal.exp = exp;
  36323. Decimal.floor = floor;
  36324. Decimal.hypot = hypot; // ES6
  36325. Decimal.ln = ln;
  36326. Decimal.log = log;
  36327. Decimal.log10 = log10; // ES6
  36328. Decimal.log2 = log2; // ES6
  36329. Decimal.max = max;
  36330. Decimal.min = min;
  36331. Decimal.mod = mod;
  36332. Decimal.mul = mul;
  36333. Decimal.pow = pow;
  36334. Decimal.random = random;
  36335. Decimal.round = round;
  36336. Decimal.sign = sign; // ES6
  36337. Decimal.sin = sin;
  36338. Decimal.sinh = sinh; // ES6
  36339. Decimal.sqrt = sqrt;
  36340. Decimal.sub = sub;
  36341. Decimal.tan = tan;
  36342. Decimal.tanh = tanh; // ES6
  36343. Decimal.trunc = trunc; // ES6
  36344. if (obj === void 0) obj = {};
  36345. if (obj) {
  36346. if (obj.defaults !== true) {
  36347. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  36348. for (i = 0; i < ps.length;) {
  36349. if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  36350. }
  36351. }
  36352. }
  36353. Decimal.config(obj);
  36354. return Decimal;
  36355. }
  36356. /*
  36357. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  36358. * digits using rounding mode `rounding`.
  36359. *
  36360. * x {number|string|Decimal}
  36361. * y {number|string|Decimal}
  36362. *
  36363. */
  36364. function div(x, y) {
  36365. return new this(x).div(y);
  36366. }
  36367. /*
  36368. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  36369. * significant digits using rounding mode `rounding`.
  36370. *
  36371. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  36372. *
  36373. */
  36374. function exp(x) {
  36375. return new this(x).exp();
  36376. }
  36377. /*
  36378. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  36379. *
  36380. * x {number|string|Decimal}
  36381. *
  36382. */
  36383. function floor(x) {
  36384. return finalise(x = new this(x), x.e + 1, 3);
  36385. }
  36386. /*
  36387. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  36388. * rounded to `precision` significant digits using rounding mode `rounding`.
  36389. *
  36390. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  36391. *
  36392. */
  36393. function hypot() {
  36394. var i,
  36395. n,
  36396. t = new this(0);
  36397. external = false;
  36398. for (i = 0; i < arguments.length;) {
  36399. n = new this(arguments[i++]);
  36400. if (!n.d) {
  36401. if (n.s) {
  36402. external = true;
  36403. return new this(1 / 0);
  36404. }
  36405. t = n;
  36406. } else if (t.d) {
  36407. t = t.plus(n.times(n));
  36408. }
  36409. }
  36410. external = true;
  36411. return t.sqrt();
  36412. }
  36413. /*
  36414. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  36415. * otherwise return false.
  36416. *
  36417. */
  36418. function isDecimalInstance(obj) {
  36419. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  36420. }
  36421. /*
  36422. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  36423. * significant digits using rounding mode `rounding`.
  36424. *
  36425. * x {number|string|Decimal}
  36426. *
  36427. */
  36428. function ln(x) {
  36429. return new this(x).ln();
  36430. }
  36431. /*
  36432. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  36433. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  36434. *
  36435. * log[y](x)
  36436. *
  36437. * x {number|string|Decimal} The argument of the logarithm.
  36438. * y {number|string|Decimal} The base of the logarithm.
  36439. *
  36440. */
  36441. function log(x, y) {
  36442. return new this(x).log(y);
  36443. }
  36444. /*
  36445. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  36446. * significant digits using rounding mode `rounding`.
  36447. *
  36448. * x {number|string|Decimal}
  36449. *
  36450. */
  36451. function log2(x) {
  36452. return new this(x).log(2);
  36453. }
  36454. /*
  36455. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  36456. * significant digits using rounding mode `rounding`.
  36457. *
  36458. * x {number|string|Decimal}
  36459. *
  36460. */
  36461. function log10(x) {
  36462. return new this(x).log(10);
  36463. }
  36464. /*
  36465. * Return a new Decimal whose value is the maximum of the arguments.
  36466. *
  36467. * arguments {number|string|Decimal}
  36468. *
  36469. */
  36470. function max() {
  36471. return maxOrMin(this, arguments, 'lt');
  36472. }
  36473. /*
  36474. * Return a new Decimal whose value is the minimum of the arguments.
  36475. *
  36476. * arguments {number|string|Decimal}
  36477. *
  36478. */
  36479. function min() {
  36480. return maxOrMin(this, arguments, 'gt');
  36481. }
  36482. /*
  36483. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  36484. * using rounding mode `rounding`.
  36485. *
  36486. * x {number|string|Decimal}
  36487. * y {number|string|Decimal}
  36488. *
  36489. */
  36490. function mod(x, y) {
  36491. return new this(x).mod(y);
  36492. }
  36493. /*
  36494. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  36495. * digits using rounding mode `rounding`.
  36496. *
  36497. * x {number|string|Decimal}
  36498. * y {number|string|Decimal}
  36499. *
  36500. */
  36501. function mul(x, y) {
  36502. return new this(x).mul(y);
  36503. }
  36504. /*
  36505. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  36506. * significant digits using rounding mode `rounding`.
  36507. *
  36508. * x {number|string|Decimal} The base.
  36509. * y {number|string|Decimal} The exponent.
  36510. *
  36511. */
  36512. function pow(x, y) {
  36513. return new this(x).pow(y);
  36514. }
  36515. /*
  36516. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  36517. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  36518. * are produced).
  36519. *
  36520. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  36521. *
  36522. */
  36523. function random(sd) {
  36524. var d,
  36525. e,
  36526. k,
  36527. n,
  36528. i = 0,
  36529. r = new this(1),
  36530. rd = [];
  36531. if (sd === void 0) sd = this.precision;else checkInt32(sd, 1, MAX_DIGITS);
  36532. k = Math.ceil(sd / LOG_BASE);
  36533. if (!this.crypto) {
  36534. for (; i < k;) {
  36535. rd[i++] = Math.random() * 1e7 | 0;
  36536. } // Browsers supporting crypto.getRandomValues.
  36537. } else if (crypto.getRandomValues) {
  36538. d = crypto.getRandomValues(new Uint32Array(k));
  36539. for (; i < k;) {
  36540. n = d[i];
  36541. // 0 <= n < 4294967296
  36542. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  36543. if (n >= 4.29e9) {
  36544. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  36545. } else {
  36546. // 0 <= n <= 4289999999
  36547. // 0 <= (n % 1e7) <= 9999999
  36548. rd[i++] = n % 1e7;
  36549. }
  36550. }
  36551. // Node.js supporting crypto.randomBytes.
  36552. } else if (crypto.randomBytes) {
  36553. // buffer
  36554. d = crypto.randomBytes(k *= 4);
  36555. for (; i < k;) {
  36556. // 0 <= n < 2147483648
  36557. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  36558. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  36559. if (n >= 2.14e9) {
  36560. crypto.randomBytes(4).copy(d, i);
  36561. } else {
  36562. // 0 <= n <= 2139999999
  36563. // 0 <= (n % 1e7) <= 9999999
  36564. rd.push(n % 1e7);
  36565. i += 4;
  36566. }
  36567. }
  36568. i = k / 4;
  36569. } else {
  36570. throw Error(cryptoUnavailable);
  36571. }
  36572. k = rd[--i];
  36573. sd %= LOG_BASE;
  36574. // Convert trailing digits to zeros according to sd.
  36575. if (k && sd) {
  36576. n = mathpow(10, LOG_BASE - sd);
  36577. rd[i] = (k / n | 0) * n;
  36578. }
  36579. // Remove trailing words which are zero.
  36580. for (; rd[i] === 0; i--) {
  36581. rd.pop();
  36582. } // Zero?
  36583. if (i < 0) {
  36584. e = 0;
  36585. rd = [0];
  36586. } else {
  36587. e = -1;
  36588. // Remove leading words which are zero and adjust exponent accordingly.
  36589. for (; rd[0] === 0; e -= LOG_BASE) {
  36590. rd.shift();
  36591. } // Count the digits of the first word of rd to determine leading zeros.
  36592. for (k = 1, n = rd[0]; n >= 10; n /= 10) {
  36593. k++;
  36594. } // Adjust the exponent for leading zeros of the first word of rd.
  36595. if (k < LOG_BASE) e -= LOG_BASE - k;
  36596. }
  36597. r.e = e;
  36598. r.d = rd;
  36599. return r;
  36600. }
  36601. /*
  36602. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  36603. *
  36604. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  36605. *
  36606. * x {number|string|Decimal}
  36607. *
  36608. */
  36609. function round(x) {
  36610. return finalise(x = new this(x), x.e + 1, this.rounding);
  36611. }
  36612. /*
  36613. * Return
  36614. * 1 if x > 0,
  36615. * -1 if x < 0,
  36616. * 0 if x is 0,
  36617. * -0 if x is -0,
  36618. * NaN otherwise
  36619. *
  36620. */
  36621. function sign(x) {
  36622. x = new this(x);
  36623. return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN;
  36624. }
  36625. /*
  36626. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  36627. * using rounding mode `rounding`.
  36628. *
  36629. * x {number|string|Decimal} A value in radians.
  36630. *
  36631. */
  36632. function sin(x) {
  36633. return new this(x).sin();
  36634. }
  36635. /*
  36636. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  36637. * significant digits using rounding mode `rounding`.
  36638. *
  36639. * x {number|string|Decimal} A value in radians.
  36640. *
  36641. */
  36642. function sinh(x) {
  36643. return new this(x).sinh();
  36644. }
  36645. /*
  36646. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  36647. * digits using rounding mode `rounding`.
  36648. *
  36649. * x {number|string|Decimal}
  36650. *
  36651. */
  36652. function sqrt(x) {
  36653. return new this(x).sqrt();
  36654. }
  36655. /*
  36656. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  36657. * using rounding mode `rounding`.
  36658. *
  36659. * x {number|string|Decimal}
  36660. * y {number|string|Decimal}
  36661. *
  36662. */
  36663. function sub(x, y) {
  36664. return new this(x).sub(y);
  36665. }
  36666. /*
  36667. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  36668. * digits using rounding mode `rounding`.
  36669. *
  36670. * x {number|string|Decimal} A value in radians.
  36671. *
  36672. */
  36673. function tan(x) {
  36674. return new this(x).tan();
  36675. }
  36676. /*
  36677. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  36678. * significant digits using rounding mode `rounding`.
  36679. *
  36680. * x {number|string|Decimal} A value in radians.
  36681. *
  36682. */
  36683. function tanh(x) {
  36684. return new this(x).tanh();
  36685. }
  36686. /*
  36687. * Return a new Decimal whose value is `x` truncated to an integer.
  36688. *
  36689. * x {number|string|Decimal}
  36690. *
  36691. */
  36692. function trunc(x) {
  36693. return finalise(x = new this(x), x.e + 1, 1);
  36694. }
  36695. // Create and configure initial Decimal constructor.
  36696. Decimal = clone(DEFAULTS);
  36697. Decimal['default'] = Decimal.Decimal = Decimal;
  36698. // Create the internal constants from their string values.
  36699. LN10 = new Decimal(LN10);
  36700. PI = new Decimal(PI);
  36701. // Export.
  36702. // AMD.
  36703. if (true) {
  36704. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  36705. return Decimal;
  36706. }).call(exports, __webpack_require__, exports, module),
  36707. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  36708. // Node and other environments that support module.exports.
  36709. } else {}
  36710. })(undefined);
  36711. /***/ }),
  36712. /***/ "./node_modules/jquery/dist/jquery.js":
  36713. /*!********************************************!*\
  36714. !*** ./node_modules/jquery/dist/jquery.js ***!
  36715. \********************************************/
  36716. /*! no static exports found */
  36717. /***/ (function(module, exports, __webpack_require__) {
  36718. "use strict";
  36719. /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  36720. 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; };
  36721. /*!
  36722. * jQuery JavaScript Library v3.3.1
  36723. * https://jquery.com/
  36724. *
  36725. * Includes Sizzle.js
  36726. * https://sizzlejs.com/
  36727. *
  36728. * Copyright JS Foundation and other contributors
  36729. * Released under the MIT license
  36730. * https://jquery.org/license
  36731. *
  36732. * Date: 2018-01-20T17:24Z
  36733. */
  36734. (function (global, factory) {
  36735. "use strict";
  36736. if (( false ? undefined : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
  36737. // For CommonJS and CommonJS-like environments where a proper `window`
  36738. // is present, execute the factory and get jQuery.
  36739. // For environments that do not have a `window` with a `document`
  36740. // (such as Node.js), expose a factory as module.exports.
  36741. // This accentuates the need for the creation of a real `window`.
  36742. // e.g. var jQuery = require("jquery")(window);
  36743. // See ticket #14549 for more info.
  36744. module.exports = global.document ? factory(global, true) : function (w) {
  36745. if (!w.document) {
  36746. throw new Error("jQuery requires a window with a document");
  36747. }
  36748. return factory(w);
  36749. };
  36750. } else {
  36751. factory(global);
  36752. }
  36753. // Pass this if window is not defined yet
  36754. })(typeof window !== "undefined" ? window : undefined, function (window, noGlobal) {
  36755. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  36756. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  36757. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  36758. // enough that all such attempts are guarded in a try block.
  36759. "use strict";
  36760. var arr = [];
  36761. var document = window.document;
  36762. var getProto = Object.getPrototypeOf;
  36763. var _slice = arr.slice;
  36764. var concat = arr.concat;
  36765. var push = arr.push;
  36766. var indexOf = arr.indexOf;
  36767. var class2type = {};
  36768. var toString = class2type.toString;
  36769. var hasOwn = class2type.hasOwnProperty;
  36770. var fnToString = hasOwn.toString;
  36771. var ObjectFunctionString = fnToString.call(Object);
  36772. var support = {};
  36773. var isFunction = function isFunction(obj) {
  36774. // Support: Chrome <=57, Firefox <=52
  36775. // In some browsers, typeof returns "function" for HTML <object> elements
  36776. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  36777. // We don't want to classify *any* DOM node as a function.
  36778. return typeof obj === "function" && typeof obj.nodeType !== "number";
  36779. };
  36780. var isWindow = function isWindow(obj) {
  36781. return obj != null && obj === obj.window;
  36782. };
  36783. var preservedScriptAttributes = {
  36784. type: true,
  36785. src: true,
  36786. noModule: true
  36787. };
  36788. function DOMEval(code, doc, node) {
  36789. doc = doc || document;
  36790. var i,
  36791. script = doc.createElement("script");
  36792. script.text = code;
  36793. if (node) {
  36794. for (i in preservedScriptAttributes) {
  36795. if (node[i]) {
  36796. script[i] = node[i];
  36797. }
  36798. }
  36799. }
  36800. doc.head.appendChild(script).parentNode.removeChild(script);
  36801. }
  36802. function toType(obj) {
  36803. if (obj == null) {
  36804. return obj + "";
  36805. }
  36806. // Support: Android <=2.3 only (functionish RegExp)
  36807. return (typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  36808. }
  36809. /* global Symbol */
  36810. // Defining this global in .eslintrc.json would create a danger of using the global
  36811. // unguarded in another place, it seems safer to define global only for this module
  36812. var version = "3.3.1",
  36813. // Define a local copy of jQuery
  36814. jQuery = function jQuery(selector, context) {
  36815. // The jQuery object is actually just the init constructor 'enhanced'
  36816. // Need init if jQuery is called (just allow error to be thrown if not included)
  36817. return new jQuery.fn.init(selector, context);
  36818. },
  36819. // Support: Android <=4.0 only
  36820. // Make sure we trim BOM and NBSP
  36821. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  36822. jQuery.fn = jQuery.prototype = {
  36823. // The current version of jQuery being used
  36824. jquery: version,
  36825. constructor: jQuery,
  36826. // The default length of a jQuery object is 0
  36827. length: 0,
  36828. toArray: function toArray() {
  36829. return _slice.call(this);
  36830. },
  36831. // Get the Nth element in the matched element set OR
  36832. // Get the whole matched element set as a clean array
  36833. get: function get(num) {
  36834. // Return all the elements in a clean array
  36835. if (num == null) {
  36836. return _slice.call(this);
  36837. }
  36838. // Return just the one element from the set
  36839. return num < 0 ? this[num + this.length] : this[num];
  36840. },
  36841. // Take an array of elements and push it onto the stack
  36842. // (returning the new matched element set)
  36843. pushStack: function pushStack(elems) {
  36844. // Build a new jQuery matched element set
  36845. var ret = jQuery.merge(this.constructor(), elems);
  36846. // Add the old object onto the stack (as a reference)
  36847. ret.prevObject = this;
  36848. // Return the newly-formed element set
  36849. return ret;
  36850. },
  36851. // Execute a callback for every element in the matched set.
  36852. each: function each(callback) {
  36853. return jQuery.each(this, callback);
  36854. },
  36855. map: function map(callback) {
  36856. return this.pushStack(jQuery.map(this, function (elem, i) {
  36857. return callback.call(elem, i, elem);
  36858. }));
  36859. },
  36860. slice: function slice() {
  36861. return this.pushStack(_slice.apply(this, arguments));
  36862. },
  36863. first: function first() {
  36864. return this.eq(0);
  36865. },
  36866. last: function last() {
  36867. return this.eq(-1);
  36868. },
  36869. eq: function eq(i) {
  36870. var len = this.length,
  36871. j = +i + (i < 0 ? len : 0);
  36872. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  36873. },
  36874. end: function end() {
  36875. return this.prevObject || this.constructor();
  36876. },
  36877. // For internal use only.
  36878. // Behaves like an Array's method, not like a jQuery method.
  36879. push: push,
  36880. sort: arr.sort,
  36881. splice: arr.splice
  36882. };
  36883. jQuery.extend = jQuery.fn.extend = function () {
  36884. var options,
  36885. name,
  36886. src,
  36887. copy,
  36888. copyIsArray,
  36889. clone,
  36890. target = arguments[0] || {},
  36891. i = 1,
  36892. length = arguments.length,
  36893. deep = false;
  36894. // Handle a deep copy situation
  36895. if (typeof target === "boolean") {
  36896. deep = target;
  36897. // Skip the boolean and the target
  36898. target = arguments[i] || {};
  36899. i++;
  36900. }
  36901. // Handle case when target is a string or something (possible in deep copy)
  36902. if ((typeof target === "undefined" ? "undefined" : _typeof(target)) !== "object" && !isFunction(target)) {
  36903. target = {};
  36904. }
  36905. // Extend jQuery itself if only one argument is passed
  36906. if (i === length) {
  36907. target = this;
  36908. i--;
  36909. }
  36910. for (; i < length; i++) {
  36911. // Only deal with non-null/undefined values
  36912. if ((options = arguments[i]) != null) {
  36913. // Extend the base object
  36914. for (name in options) {
  36915. src = target[name];
  36916. copy = options[name];
  36917. // Prevent never-ending loop
  36918. if (target === copy) {
  36919. continue;
  36920. }
  36921. // Recurse if we're merging plain objects or arrays
  36922. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
  36923. if (copyIsArray) {
  36924. copyIsArray = false;
  36925. clone = src && Array.isArray(src) ? src : [];
  36926. } else {
  36927. clone = src && jQuery.isPlainObject(src) ? src : {};
  36928. }
  36929. // Never move original objects, clone them
  36930. target[name] = jQuery.extend(deep, clone, copy);
  36931. // Don't bring in undefined values
  36932. } else if (copy !== undefined) {
  36933. target[name] = copy;
  36934. }
  36935. }
  36936. }
  36937. }
  36938. // Return the modified object
  36939. return target;
  36940. };
  36941. jQuery.extend({
  36942. // Unique for each copy of jQuery on the page
  36943. expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
  36944. // Assume jQuery is ready without the ready module
  36945. isReady: true,
  36946. error: function error(msg) {
  36947. throw new Error(msg);
  36948. },
  36949. noop: function noop() {},
  36950. isPlainObject: function isPlainObject(obj) {
  36951. var proto, Ctor;
  36952. // Detect obvious negatives
  36953. // Use toString instead of jQuery.type to catch host objects
  36954. if (!obj || toString.call(obj) !== "[object Object]") {
  36955. return false;
  36956. }
  36957. proto = getProto(obj);
  36958. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  36959. if (!proto) {
  36960. return true;
  36961. }
  36962. // Objects with prototype are plain iff they were constructed by a global Object function
  36963. Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
  36964. return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
  36965. },
  36966. isEmptyObject: function isEmptyObject(obj) {
  36967. /* eslint-disable no-unused-vars */
  36968. // See https://github.com/eslint/eslint/issues/6125
  36969. var name;
  36970. for (name in obj) {
  36971. return false;
  36972. }
  36973. return true;
  36974. },
  36975. // Evaluates a script in a global context
  36976. globalEval: function globalEval(code) {
  36977. DOMEval(code);
  36978. },
  36979. each: function each(obj, callback) {
  36980. var length,
  36981. i = 0;
  36982. if (isArrayLike(obj)) {
  36983. length = obj.length;
  36984. for (; i < length; i++) {
  36985. if (callback.call(obj[i], i, obj[i]) === false) {
  36986. break;
  36987. }
  36988. }
  36989. } else {
  36990. for (i in obj) {
  36991. if (callback.call(obj[i], i, obj[i]) === false) {
  36992. break;
  36993. }
  36994. }
  36995. }
  36996. return obj;
  36997. },
  36998. // Support: Android <=4.0 only
  36999. trim: function trim(text) {
  37000. return text == null ? "" : (text + "").replace(rtrim, "");
  37001. },
  37002. // results is for internal usage only
  37003. makeArray: function makeArray(arr, results) {
  37004. var ret = results || [];
  37005. if (arr != null) {
  37006. if (isArrayLike(Object(arr))) {
  37007. jQuery.merge(ret, typeof arr === "string" ? [arr] : arr);
  37008. } else {
  37009. push.call(ret, arr);
  37010. }
  37011. }
  37012. return ret;
  37013. },
  37014. inArray: function inArray(elem, arr, i) {
  37015. return arr == null ? -1 : indexOf.call(arr, elem, i);
  37016. },
  37017. // Support: Android <=4.0 only, PhantomJS 1 only
  37018. // push.apply(_, arraylike) throws on ancient WebKit
  37019. merge: function merge(first, second) {
  37020. var len = +second.length,
  37021. j = 0,
  37022. i = first.length;
  37023. for (; j < len; j++) {
  37024. first[i++] = second[j];
  37025. }
  37026. first.length = i;
  37027. return first;
  37028. },
  37029. grep: function grep(elems, callback, invert) {
  37030. var callbackInverse,
  37031. matches = [],
  37032. i = 0,
  37033. length = elems.length,
  37034. callbackExpect = !invert;
  37035. // Go through the array, only saving the items
  37036. // that pass the validator function
  37037. for (; i < length; i++) {
  37038. callbackInverse = !callback(elems[i], i);
  37039. if (callbackInverse !== callbackExpect) {
  37040. matches.push(elems[i]);
  37041. }
  37042. }
  37043. return matches;
  37044. },
  37045. // arg is for internal usage only
  37046. map: function map(elems, callback, arg) {
  37047. var length,
  37048. value,
  37049. i = 0,
  37050. ret = [];
  37051. // Go through the array, translating each of the items to their new values
  37052. if (isArrayLike(elems)) {
  37053. length = elems.length;
  37054. for (; i < length; i++) {
  37055. value = callback(elems[i], i, arg);
  37056. if (value != null) {
  37057. ret.push(value);
  37058. }
  37059. }
  37060. // Go through every key on the object,
  37061. } else {
  37062. for (i in elems) {
  37063. value = callback(elems[i], i, arg);
  37064. if (value != null) {
  37065. ret.push(value);
  37066. }
  37067. }
  37068. }
  37069. // Flatten any nested arrays
  37070. return concat.apply([], ret);
  37071. },
  37072. // A global GUID counter for objects
  37073. guid: 1,
  37074. // jQuery.support is not used in Core but other projects attach their
  37075. // properties to it so it needs to exist.
  37076. support: support
  37077. });
  37078. if (typeof Symbol === "function") {
  37079. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  37080. }
  37081. // Populate the class2type map
  37082. jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (i, name) {
  37083. class2type["[object " + name + "]"] = name.toLowerCase();
  37084. });
  37085. function isArrayLike(obj) {
  37086. // Support: real iOS 8.2 only (not reproducible in simulator)
  37087. // `in` check used to prevent JIT error (gh-2145)
  37088. // hasOwn isn't used here due to false negatives
  37089. // regarding Nodelist length in IE
  37090. var length = !!obj && "length" in obj && obj.length,
  37091. type = toType(obj);
  37092. if (isFunction(obj) || isWindow(obj)) {
  37093. return false;
  37094. }
  37095. return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  37096. }
  37097. var Sizzle =
  37098. /*!
  37099. * Sizzle CSS Selector Engine v2.3.3
  37100. * https://sizzlejs.com/
  37101. *
  37102. * Copyright jQuery Foundation and other contributors
  37103. * Released under the MIT license
  37104. * http://jquery.org/license
  37105. *
  37106. * Date: 2016-08-08
  37107. */
  37108. function (window) {
  37109. var i,
  37110. support,
  37111. Expr,
  37112. getText,
  37113. isXML,
  37114. tokenize,
  37115. compile,
  37116. select,
  37117. outermostContext,
  37118. sortInput,
  37119. hasDuplicate,
  37120. // Local document vars
  37121. setDocument,
  37122. document,
  37123. docElem,
  37124. documentIsHTML,
  37125. rbuggyQSA,
  37126. rbuggyMatches,
  37127. matches,
  37128. contains,
  37129. // Instance-specific data
  37130. expando = "sizzle" + 1 * new Date(),
  37131. preferredDoc = window.document,
  37132. dirruns = 0,
  37133. done = 0,
  37134. classCache = createCache(),
  37135. tokenCache = createCache(),
  37136. compilerCache = createCache(),
  37137. sortOrder = function sortOrder(a, b) {
  37138. if (a === b) {
  37139. hasDuplicate = true;
  37140. }
  37141. return 0;
  37142. },
  37143. // Instance methods
  37144. hasOwn = {}.hasOwnProperty,
  37145. arr = [],
  37146. pop = arr.pop,
  37147. push_native = arr.push,
  37148. push = arr.push,
  37149. slice = arr.slice,
  37150. // Use a stripped-down indexOf as it's faster than native
  37151. // https://jsperf.com/thor-indexof-vs-for/5
  37152. indexOf = function indexOf(list, elem) {
  37153. var i = 0,
  37154. len = list.length;
  37155. for (; i < len; i++) {
  37156. if (list[i] === elem) {
  37157. return i;
  37158. }
  37159. }
  37160. return -1;
  37161. },
  37162. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  37163. // Regular expressions
  37164. // http://www.w3.org/TR/css3-selectors/#whitespace
  37165. whitespace = "[\\x20\\t\\r\\n\\f]",
  37166. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  37167. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  37168. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  37169. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  37170. // Operator (capture 2)
  37171. "*([*^$|!~]?=)" + whitespace +
  37172. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  37173. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
  37174. pseudos = ":(" + identifier + ")(?:\\((" +
  37175. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  37176. // 1. quoted (capture 3; capture 4 or capture 5)
  37177. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  37178. // 2. simple (capture 6)
  37179. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  37180. // 3. anything else (capture 2)
  37181. ".*" + ")\\)|)",
  37182. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  37183. rwhitespace = new RegExp(whitespace + "+", "g"),
  37184. rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
  37185. rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
  37186. rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
  37187. rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
  37188. rpseudo = new RegExp(pseudos),
  37189. ridentifier = new RegExp("^" + identifier + "$"),
  37190. matchExpr = {
  37191. "ID": new RegExp("^#(" + identifier + ")"),
  37192. "CLASS": new RegExp("^\\.(" + identifier + ")"),
  37193. "TAG": new RegExp("^(" + identifier + "|[*])"),
  37194. "ATTR": new RegExp("^" + attributes),
  37195. "PSEUDO": new RegExp("^" + pseudos),
  37196. "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
  37197. "bool": new RegExp("^(?:" + booleans + ")$", "i"),
  37198. // For use in libraries implementing .is()
  37199. // We use this for POS matching in `select`
  37200. "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  37201. },
  37202. rinputs = /^(?:input|select|textarea|button)$/i,
  37203. rheader = /^h\d$/i,
  37204. rnative = /^[^{]+\{\s*\[native \w/,
  37205. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  37206. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  37207. rsibling = /[+~]/,
  37208. // CSS escapes
  37209. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  37210. runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
  37211. funescape = function funescape(_, escaped, escapedWhitespace) {
  37212. var high = "0x" + escaped - 0x10000;
  37213. // NaN means non-codepoint
  37214. // Support: Firefox<24
  37215. // Workaround erroneous numeric interpretation of +"0x"
  37216. return high !== high || escapedWhitespace ? escaped : high < 0 ?
  37217. // BMP codepoint
  37218. String.fromCharCode(high + 0x10000) :
  37219. // Supplemental Plane codepoint (surrogate pair)
  37220. String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
  37221. },
  37222. // CSS string/identifier serialization
  37223. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  37224. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  37225. fcssescape = function fcssescape(ch, asCodePoint) {
  37226. if (asCodePoint) {
  37227. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  37228. if (ch === "\0") {
  37229. return "\uFFFD";
  37230. }
  37231. // Control characters and (dependent upon position) numbers get escaped as code points
  37232. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  37233. }
  37234. // Other potentially-special ASCII characters get backslash-escaped
  37235. return "\\" + ch;
  37236. },
  37237. // Used for iframes
  37238. // See setDocument()
  37239. // Removing the function wrapper causes a "Permission Denied"
  37240. // error in IE
  37241. unloadHandler = function unloadHandler() {
  37242. setDocument();
  37243. },
  37244. disabledAncestor = addCombinator(function (elem) {
  37245. return elem.disabled === true && ("form" in elem || "label" in elem);
  37246. }, { dir: "parentNode", next: "legend" });
  37247. // Optimize for push.apply( _, NodeList )
  37248. try {
  37249. push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);
  37250. // Support: Android<4.0
  37251. // Detect silently failing push.apply
  37252. arr[preferredDoc.childNodes.length].nodeType;
  37253. } catch (e) {
  37254. push = { apply: arr.length ?
  37255. // Leverage slice if possible
  37256. function (target, els) {
  37257. push_native.apply(target, slice.call(els));
  37258. } :
  37259. // Support: IE<9
  37260. // Otherwise append directly
  37261. function (target, els) {
  37262. var j = target.length,
  37263. i = 0;
  37264. // Can't trust NodeList.length
  37265. while (target[j++] = els[i++]) {}
  37266. target.length = j - 1;
  37267. }
  37268. };
  37269. }
  37270. function Sizzle(selector, context, results, seed) {
  37271. var m,
  37272. i,
  37273. elem,
  37274. nid,
  37275. match,
  37276. groups,
  37277. newSelector,
  37278. newContext = context && context.ownerDocument,
  37279. // nodeType defaults to 9, since context defaults to document
  37280. nodeType = context ? context.nodeType : 9;
  37281. results = results || [];
  37282. // Return early from calls with invalid selector or context
  37283. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  37284. return results;
  37285. }
  37286. // Try to shortcut find operations (as opposed to filters) in HTML documents
  37287. if (!seed) {
  37288. if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
  37289. setDocument(context);
  37290. }
  37291. context = context || document;
  37292. if (documentIsHTML) {
  37293. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  37294. // (excepting DocumentFragment context, where the methods don't exist)
  37295. if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
  37296. // ID selector
  37297. if (m = match[1]) {
  37298. // Document context
  37299. if (nodeType === 9) {
  37300. if (elem = context.getElementById(m)) {
  37301. // Support: IE, Opera, Webkit
  37302. // TODO: identify versions
  37303. // getElementById can match elements by name instead of ID
  37304. if (elem.id === m) {
  37305. results.push(elem);
  37306. return results;
  37307. }
  37308. } else {
  37309. return results;
  37310. }
  37311. // Element context
  37312. } else {
  37313. // Support: IE, Opera, Webkit
  37314. // TODO: identify versions
  37315. // getElementById can match elements by name instead of ID
  37316. if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {
  37317. results.push(elem);
  37318. return results;
  37319. }
  37320. }
  37321. // Type selector
  37322. } else if (match[2]) {
  37323. push.apply(results, context.getElementsByTagName(selector));
  37324. return results;
  37325. // Class selector
  37326. } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {
  37327. push.apply(results, context.getElementsByClassName(m));
  37328. return results;
  37329. }
  37330. }
  37331. // Take advantage of querySelectorAll
  37332. if (support.qsa && !compilerCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  37333. if (nodeType !== 1) {
  37334. newContext = context;
  37335. newSelector = selector;
  37336. // qSA looks outside Element context, which is not what we want
  37337. // Thanks to Andrew Dupont for this workaround technique
  37338. // Support: IE <=8
  37339. // Exclude object elements
  37340. } else if (context.nodeName.toLowerCase() !== "object") {
  37341. // Capture the context ID, setting it first if necessary
  37342. if (nid = context.getAttribute("id")) {
  37343. nid = nid.replace(rcssescape, fcssescape);
  37344. } else {
  37345. context.setAttribute("id", nid = expando);
  37346. }
  37347. // Prefix every selector in the list
  37348. groups = tokenize(selector);
  37349. i = groups.length;
  37350. while (i--) {
  37351. groups[i] = "#" + nid + " " + toSelector(groups[i]);
  37352. }
  37353. newSelector = groups.join(",");
  37354. // Expand context for sibling selectors
  37355. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  37356. }
  37357. if (newSelector) {
  37358. try {
  37359. push.apply(results, newContext.querySelectorAll(newSelector));
  37360. return results;
  37361. } catch (qsaError) {} finally {
  37362. if (nid === expando) {
  37363. context.removeAttribute("id");
  37364. }
  37365. }
  37366. }
  37367. }
  37368. }
  37369. }
  37370. // All others
  37371. return select(selector.replace(rtrim, "$1"), context, results, seed);
  37372. }
  37373. /**
  37374. * Create key-value caches of limited size
  37375. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  37376. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  37377. * deleting the oldest entry
  37378. */
  37379. function createCache() {
  37380. var keys = [];
  37381. function cache(key, value) {
  37382. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  37383. if (keys.push(key + " ") > Expr.cacheLength) {
  37384. // Only keep the most recent entries
  37385. delete cache[keys.shift()];
  37386. }
  37387. return cache[key + " "] = value;
  37388. }
  37389. return cache;
  37390. }
  37391. /**
  37392. * Mark a function for special use by Sizzle
  37393. * @param {Function} fn The function to mark
  37394. */
  37395. function markFunction(fn) {
  37396. fn[expando] = true;
  37397. return fn;
  37398. }
  37399. /**
  37400. * Support testing using an element
  37401. * @param {Function} fn Passed the created element and returns a boolean result
  37402. */
  37403. function assert(fn) {
  37404. var el = document.createElement("fieldset");
  37405. try {
  37406. return !!fn(el);
  37407. } catch (e) {
  37408. return false;
  37409. } finally {
  37410. // Remove from its parent by default
  37411. if (el.parentNode) {
  37412. el.parentNode.removeChild(el);
  37413. }
  37414. // release memory in IE
  37415. el = null;
  37416. }
  37417. }
  37418. /**
  37419. * Adds the same handler for all of the specified attrs
  37420. * @param {String} attrs Pipe-separated list of attributes
  37421. * @param {Function} handler The method that will be applied
  37422. */
  37423. function addHandle(attrs, handler) {
  37424. var arr = attrs.split("|"),
  37425. i = arr.length;
  37426. while (i--) {
  37427. Expr.attrHandle[arr[i]] = handler;
  37428. }
  37429. }
  37430. /**
  37431. * Checks document order of two siblings
  37432. * @param {Element} a
  37433. * @param {Element} b
  37434. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  37435. */
  37436. function siblingCheck(a, b) {
  37437. var cur = b && a,
  37438. diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex;
  37439. // Use IE sourceIndex if available on both nodes
  37440. if (diff) {
  37441. return diff;
  37442. }
  37443. // Check if b follows a
  37444. if (cur) {
  37445. while (cur = cur.nextSibling) {
  37446. if (cur === b) {
  37447. return -1;
  37448. }
  37449. }
  37450. }
  37451. return a ? 1 : -1;
  37452. }
  37453. /**
  37454. * Returns a function to use in pseudos for input types
  37455. * @param {String} type
  37456. */
  37457. function createInputPseudo(type) {
  37458. return function (elem) {
  37459. var name = elem.nodeName.toLowerCase();
  37460. return name === "input" && elem.type === type;
  37461. };
  37462. }
  37463. /**
  37464. * Returns a function to use in pseudos for buttons
  37465. * @param {String} type
  37466. */
  37467. function createButtonPseudo(type) {
  37468. return function (elem) {
  37469. var name = elem.nodeName.toLowerCase();
  37470. return (name === "input" || name === "button") && elem.type === type;
  37471. };
  37472. }
  37473. /**
  37474. * Returns a function to use in pseudos for :enabled/:disabled
  37475. * @param {Boolean} disabled true for :disabled; false for :enabled
  37476. */
  37477. function createDisabledPseudo(disabled) {
  37478. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  37479. return function (elem) {
  37480. // Only certain elements can match :enabled or :disabled
  37481. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  37482. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  37483. if ("form" in elem) {
  37484. // Check for inherited disabledness on relevant non-disabled elements:
  37485. // * listed form-associated elements in a disabled fieldset
  37486. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  37487. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  37488. // * option elements in a disabled optgroup
  37489. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  37490. // All such elements have a "form" property.
  37491. if (elem.parentNode && elem.disabled === false) {
  37492. // Option elements defer to a parent optgroup if present
  37493. if ("label" in elem) {
  37494. if ("label" in elem.parentNode) {
  37495. return elem.parentNode.disabled === disabled;
  37496. } else {
  37497. return elem.disabled === disabled;
  37498. }
  37499. }
  37500. // Support: IE 6 - 11
  37501. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  37502. return elem.isDisabled === disabled ||
  37503. // Where there is no isDisabled, check manually
  37504. /* jshint -W018 */
  37505. elem.isDisabled !== !disabled && disabledAncestor(elem) === disabled;
  37506. }
  37507. return elem.disabled === disabled;
  37508. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  37509. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  37510. // even exist on them, let alone have a boolean value.
  37511. } else if ("label" in elem) {
  37512. return elem.disabled === disabled;
  37513. }
  37514. // Remaining elements are neither :enabled nor :disabled
  37515. return false;
  37516. };
  37517. }
  37518. /**
  37519. * Returns a function to use in pseudos for positionals
  37520. * @param {Function} fn
  37521. */
  37522. function createPositionalPseudo(fn) {
  37523. return markFunction(function (argument) {
  37524. argument = +argument;
  37525. return markFunction(function (seed, matches) {
  37526. var j,
  37527. matchIndexes = fn([], seed.length, argument),
  37528. i = matchIndexes.length;
  37529. // Match elements found at the specified indexes
  37530. while (i--) {
  37531. if (seed[j = matchIndexes[i]]) {
  37532. seed[j] = !(matches[j] = seed[j]);
  37533. }
  37534. }
  37535. });
  37536. });
  37537. }
  37538. /**
  37539. * Checks a node for validity as a Sizzle context
  37540. * @param {Element|Object=} context
  37541. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  37542. */
  37543. function testContext(context) {
  37544. return context && typeof context.getElementsByTagName !== "undefined" && context;
  37545. }
  37546. // Expose support vars for convenience
  37547. support = Sizzle.support = {};
  37548. /**
  37549. * Detects XML nodes
  37550. * @param {Element|Object} elem An element or a document
  37551. * @returns {Boolean} True iff elem is a non-HTML XML node
  37552. */
  37553. isXML = Sizzle.isXML = function (elem) {
  37554. // documentElement is verified for cases where it doesn't yet exist
  37555. // (such as loading iframes in IE - #4833)
  37556. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  37557. return documentElement ? documentElement.nodeName !== "HTML" : false;
  37558. };
  37559. /**
  37560. * Sets document-related variables once based on the current document
  37561. * @param {Element|Object} [doc] An element or document object to use to set the document
  37562. * @returns {Object} Returns the current document
  37563. */
  37564. setDocument = Sizzle.setDocument = function (node) {
  37565. var hasCompare,
  37566. subWindow,
  37567. doc = node ? node.ownerDocument || node : preferredDoc;
  37568. // Return early if doc is invalid or already selected
  37569. if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
  37570. return document;
  37571. }
  37572. // Update global variables
  37573. document = doc;
  37574. docElem = document.documentElement;
  37575. documentIsHTML = !isXML(document);
  37576. // Support: IE 9-11, Edge
  37577. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  37578. if (preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {
  37579. // Support: IE 11, Edge
  37580. if (subWindow.addEventListener) {
  37581. subWindow.addEventListener("unload", unloadHandler, false);
  37582. // Support: IE 9 - 10 only
  37583. } else if (subWindow.attachEvent) {
  37584. subWindow.attachEvent("onunload", unloadHandler);
  37585. }
  37586. }
  37587. /* Attributes
  37588. ---------------------------------------------------------------------- */
  37589. // Support: IE<8
  37590. // Verify that getAttribute really returns attributes and not properties
  37591. // (excepting IE8 booleans)
  37592. support.attributes = assert(function (el) {
  37593. el.className = "i";
  37594. return !el.getAttribute("className");
  37595. });
  37596. /* getElement(s)By*
  37597. ---------------------------------------------------------------------- */
  37598. // Check if getElementsByTagName("*") returns only elements
  37599. support.getElementsByTagName = assert(function (el) {
  37600. el.appendChild(document.createComment(""));
  37601. return !el.getElementsByTagName("*").length;
  37602. });
  37603. // Support: IE<9
  37604. support.getElementsByClassName = rnative.test(document.getElementsByClassName);
  37605. // Support: IE<10
  37606. // Check if getElementById returns elements by name
  37607. // The broken getElementById methods don't pick up programmatically-set names,
  37608. // so use a roundabout getElementsByName test
  37609. support.getById = assert(function (el) {
  37610. docElem.appendChild(el).id = expando;
  37611. return !document.getElementsByName || !document.getElementsByName(expando).length;
  37612. });
  37613. // ID filter and find
  37614. if (support.getById) {
  37615. Expr.filter["ID"] = function (id) {
  37616. var attrId = id.replace(runescape, funescape);
  37617. return function (elem) {
  37618. return elem.getAttribute("id") === attrId;
  37619. };
  37620. };
  37621. Expr.find["ID"] = function (id, context) {
  37622. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  37623. var elem = context.getElementById(id);
  37624. return elem ? [elem] : [];
  37625. }
  37626. };
  37627. } else {
  37628. Expr.filter["ID"] = function (id) {
  37629. var attrId = id.replace(runescape, funescape);
  37630. return function (elem) {
  37631. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  37632. return node && node.value === attrId;
  37633. };
  37634. };
  37635. // Support: IE 6 - 7 only
  37636. // getElementById is not reliable as a find shortcut
  37637. Expr.find["ID"] = function (id, context) {
  37638. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  37639. var node,
  37640. i,
  37641. elems,
  37642. elem = context.getElementById(id);
  37643. if (elem) {
  37644. // Verify the id attribute
  37645. node = elem.getAttributeNode("id");
  37646. if (node && node.value === id) {
  37647. return [elem];
  37648. }
  37649. // Fall back on getElementsByName
  37650. elems = context.getElementsByName(id);
  37651. i = 0;
  37652. while (elem = elems[i++]) {
  37653. node = elem.getAttributeNode("id");
  37654. if (node && node.value === id) {
  37655. return [elem];
  37656. }
  37657. }
  37658. }
  37659. return [];
  37660. }
  37661. };
  37662. }
  37663. // Tag
  37664. Expr.find["TAG"] = support.getElementsByTagName ? function (tag, context) {
  37665. if (typeof context.getElementsByTagName !== "undefined") {
  37666. return context.getElementsByTagName(tag);
  37667. // DocumentFragment nodes don't have gEBTN
  37668. } else if (support.qsa) {
  37669. return context.querySelectorAll(tag);
  37670. }
  37671. } : function (tag, context) {
  37672. var elem,
  37673. tmp = [],
  37674. i = 0,
  37675. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  37676. results = context.getElementsByTagName(tag);
  37677. // Filter out possible comments
  37678. if (tag === "*") {
  37679. while (elem = results[i++]) {
  37680. if (elem.nodeType === 1) {
  37681. tmp.push(elem);
  37682. }
  37683. }
  37684. return tmp;
  37685. }
  37686. return results;
  37687. };
  37688. // Class
  37689. Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
  37690. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  37691. return context.getElementsByClassName(className);
  37692. }
  37693. };
  37694. /* QSA/matchesSelector
  37695. ---------------------------------------------------------------------- */
  37696. // QSA and matchesSelector support
  37697. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  37698. rbuggyMatches = [];
  37699. // qSa(:focus) reports false when true (Chrome 21)
  37700. // We allow this because of a bug in IE8/9 that throws an error
  37701. // whenever `document.activeElement` is accessed on an iframe
  37702. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  37703. // See https://bugs.jquery.com/ticket/13378
  37704. rbuggyQSA = [];
  37705. if (support.qsa = rnative.test(document.querySelectorAll)) {
  37706. // Build QSA regex
  37707. // Regex strategy adopted from Diego Perini
  37708. assert(function (el) {
  37709. // Select is set to empty string on purpose
  37710. // This is to test IE's treatment of not explicitly
  37711. // setting a boolean content attribute,
  37712. // since its presence should be enough
  37713. // https://bugs.jquery.com/ticket/12359
  37714. docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>";
  37715. // Support: IE8, Opera 11-12.16
  37716. // Nothing should be selected when empty strings follow ^= or $= or *=
  37717. // The test attribute must be unknown in Opera but "safe" for WinRT
  37718. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  37719. if (el.querySelectorAll("[msallowcapture^='']").length) {
  37720. rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
  37721. }
  37722. // Support: IE8
  37723. // Boolean attributes and "value" are not treated correctly
  37724. if (!el.querySelectorAll("[selected]").length) {
  37725. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  37726. }
  37727. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  37728. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  37729. rbuggyQSA.push("~=");
  37730. }
  37731. // Webkit/Opera - :checked should return selected option elements
  37732. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  37733. // IE8 throws error here and will not see later tests
  37734. if (!el.querySelectorAll(":checked").length) {
  37735. rbuggyQSA.push(":checked");
  37736. }
  37737. // Support: Safari 8+, iOS 8+
  37738. // https://bugs.webkit.org/show_bug.cgi?id=136851
  37739. // In-page `selector#id sibling-combinator selector` fails
  37740. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  37741. rbuggyQSA.push(".#.+[+~]");
  37742. }
  37743. });
  37744. assert(function (el) {
  37745. el.innerHTML = "<a href='' disabled='disabled'></a>" + "<select disabled='disabled'><option/></select>";
  37746. // Support: Windows 8 Native Apps
  37747. // The type and name attributes are restricted during .innerHTML assignment
  37748. var input = document.createElement("input");
  37749. input.setAttribute("type", "hidden");
  37750. el.appendChild(input).setAttribute("name", "D");
  37751. // Support: IE8
  37752. // Enforce case-sensitivity of name attribute
  37753. if (el.querySelectorAll("[name=d]").length) {
  37754. rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
  37755. }
  37756. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  37757. // IE8 throws error here and will not see later tests
  37758. if (el.querySelectorAll(":enabled").length !== 2) {
  37759. rbuggyQSA.push(":enabled", ":disabled");
  37760. }
  37761. // Support: IE9-11+
  37762. // IE's :disabled selector does not pick up the children of disabled fieldsets
  37763. docElem.appendChild(el).disabled = true;
  37764. if (el.querySelectorAll(":disabled").length !== 2) {
  37765. rbuggyQSA.push(":enabled", ":disabled");
  37766. }
  37767. // Opera 10-11 does not throw on post-comma invalid pseudos
  37768. el.querySelectorAll("*,:x");
  37769. rbuggyQSA.push(",.*:");
  37770. });
  37771. }
  37772. if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) {
  37773. assert(function (el) {
  37774. // Check to see if it's possible to do matchesSelector
  37775. // on a disconnected node (IE 9)
  37776. support.disconnectedMatch = matches.call(el, "*");
  37777. // This should fail with an exception
  37778. // Gecko does not error, returns false instead
  37779. matches.call(el, "[s!='']:x");
  37780. rbuggyMatches.push("!=", pseudos);
  37781. });
  37782. }
  37783. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  37784. rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
  37785. /* Contains
  37786. ---------------------------------------------------------------------- */
  37787. hasCompare = rnative.test(docElem.compareDocumentPosition);
  37788. // Element contains another
  37789. // Purposefully self-exclusive
  37790. // As in, an element does not contain itself
  37791. contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {
  37792. var adown = a.nodeType === 9 ? a.documentElement : a,
  37793. bup = b && b.parentNode;
  37794. return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  37795. } : function (a, b) {
  37796. if (b) {
  37797. while (b = b.parentNode) {
  37798. if (b === a) {
  37799. return true;
  37800. }
  37801. }
  37802. }
  37803. return false;
  37804. };
  37805. /* Sorting
  37806. ---------------------------------------------------------------------- */
  37807. // Document order sorting
  37808. sortOrder = hasCompare ? function (a, b) {
  37809. // Flag for duplicate removal
  37810. if (a === b) {
  37811. hasDuplicate = true;
  37812. return 0;
  37813. }
  37814. // Sort on method existence if only one input has compareDocumentPosition
  37815. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  37816. if (compare) {
  37817. return compare;
  37818. }
  37819. // Calculate position if both inputs belong to the same document
  37820. compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) :
  37821. // Otherwise we know they are disconnected
  37822. 1;
  37823. // Disconnected nodes
  37824. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  37825. // Choose the first element that is related to our preferred document
  37826. if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
  37827. return -1;
  37828. }
  37829. if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
  37830. return 1;
  37831. }
  37832. // Maintain original order
  37833. return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  37834. }
  37835. return compare & 4 ? -1 : 1;
  37836. } : function (a, b) {
  37837. // Exit early if the nodes are identical
  37838. if (a === b) {
  37839. hasDuplicate = true;
  37840. return 0;
  37841. }
  37842. var cur,
  37843. i = 0,
  37844. aup = a.parentNode,
  37845. bup = b.parentNode,
  37846. ap = [a],
  37847. bp = [b];
  37848. // Parentless nodes are either documents or disconnected
  37849. if (!aup || !bup) {
  37850. return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  37851. // If the nodes are siblings, we can do a quick check
  37852. } else if (aup === bup) {
  37853. return siblingCheck(a, b);
  37854. }
  37855. // Otherwise we need full lists of their ancestors for comparison
  37856. cur = a;
  37857. while (cur = cur.parentNode) {
  37858. ap.unshift(cur);
  37859. }
  37860. cur = b;
  37861. while (cur = cur.parentNode) {
  37862. bp.unshift(cur);
  37863. }
  37864. // Walk down the tree looking for a discrepancy
  37865. while (ap[i] === bp[i]) {
  37866. i++;
  37867. }
  37868. return i ?
  37869. // Do a sibling check if the nodes have a common ancestor
  37870. siblingCheck(ap[i], bp[i]) :
  37871. // Otherwise nodes in our document sort first
  37872. ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
  37873. };
  37874. return document;
  37875. };
  37876. Sizzle.matches = function (expr, elements) {
  37877. return Sizzle(expr, null, null, elements);
  37878. };
  37879. Sizzle.matchesSelector = function (elem, expr) {
  37880. // Set document vars if needed
  37881. if ((elem.ownerDocument || elem) !== document) {
  37882. setDocument(elem);
  37883. }
  37884. // Make sure that attribute selectors are quoted
  37885. expr = expr.replace(rattributeQuotes, "='$1']");
  37886. if (support.matchesSelector && documentIsHTML && !compilerCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  37887. try {
  37888. var ret = matches.call(elem, expr);
  37889. // IE 9's matchesSelector returns false on disconnected nodes
  37890. if (ret || support.disconnectedMatch ||
  37891. // As well, disconnected nodes are said to be in a document
  37892. // fragment in IE 9
  37893. elem.document && elem.document.nodeType !== 11) {
  37894. return ret;
  37895. }
  37896. } catch (e) {}
  37897. }
  37898. return Sizzle(expr, document, null, [elem]).length > 0;
  37899. };
  37900. Sizzle.contains = function (context, elem) {
  37901. // Set document vars if needed
  37902. if ((context.ownerDocument || context) !== document) {
  37903. setDocument(context);
  37904. }
  37905. return contains(context, elem);
  37906. };
  37907. Sizzle.attr = function (elem, name) {
  37908. // Set document vars if needed
  37909. if ((elem.ownerDocument || elem) !== document) {
  37910. setDocument(elem);
  37911. }
  37912. var fn = Expr.attrHandle[name.toLowerCase()],
  37913. // Don't get fooled by Object.prototype properties (jQuery #13807)
  37914. val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
  37915. return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  37916. };
  37917. Sizzle.escape = function (sel) {
  37918. return (sel + "").replace(rcssescape, fcssescape);
  37919. };
  37920. Sizzle.error = function (msg) {
  37921. throw new Error("Syntax error, unrecognized expression: " + msg);
  37922. };
  37923. /**
  37924. * Document sorting and removing duplicates
  37925. * @param {ArrayLike} results
  37926. */
  37927. Sizzle.uniqueSort = function (results) {
  37928. var elem,
  37929. duplicates = [],
  37930. j = 0,
  37931. i = 0;
  37932. // Unless we *know* we can detect duplicates, assume their presence
  37933. hasDuplicate = !support.detectDuplicates;
  37934. sortInput = !support.sortStable && results.slice(0);
  37935. results.sort(sortOrder);
  37936. if (hasDuplicate) {
  37937. while (elem = results[i++]) {
  37938. if (elem === results[i]) {
  37939. j = duplicates.push(i);
  37940. }
  37941. }
  37942. while (j--) {
  37943. results.splice(duplicates[j], 1);
  37944. }
  37945. }
  37946. // Clear input after sorting to release objects
  37947. // See https://github.com/jquery/sizzle/pull/225
  37948. sortInput = null;
  37949. return results;
  37950. };
  37951. /**
  37952. * Utility function for retrieving the text value of an array of DOM nodes
  37953. * @param {Array|Element} elem
  37954. */
  37955. getText = Sizzle.getText = function (elem) {
  37956. var node,
  37957. ret = "",
  37958. i = 0,
  37959. nodeType = elem.nodeType;
  37960. if (!nodeType) {
  37961. // If no nodeType, this is expected to be an array
  37962. while (node = elem[i++]) {
  37963. // Do not traverse comment nodes
  37964. ret += getText(node);
  37965. }
  37966. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  37967. // Use textContent for elements
  37968. // innerText usage removed for consistency of new lines (jQuery #11153)
  37969. if (typeof elem.textContent === "string") {
  37970. return elem.textContent;
  37971. } else {
  37972. // Traverse its children
  37973. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  37974. ret += getText(elem);
  37975. }
  37976. }
  37977. } else if (nodeType === 3 || nodeType === 4) {
  37978. return elem.nodeValue;
  37979. }
  37980. // Do not include comment or processing instruction nodes
  37981. return ret;
  37982. };
  37983. Expr = Sizzle.selectors = {
  37984. // Can be adjusted by the user
  37985. cacheLength: 50,
  37986. createPseudo: markFunction,
  37987. match: matchExpr,
  37988. attrHandle: {},
  37989. find: {},
  37990. relative: {
  37991. ">": { dir: "parentNode", first: true },
  37992. " ": { dir: "parentNode" },
  37993. "+": { dir: "previousSibling", first: true },
  37994. "~": { dir: "previousSibling" }
  37995. },
  37996. preFilter: {
  37997. "ATTR": function ATTR(match) {
  37998. match[1] = match[1].replace(runescape, funescape);
  37999. // Move the given value to match[3] whether quoted or unquoted
  38000. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  38001. if (match[2] === "~=") {
  38002. match[3] = " " + match[3] + " ";
  38003. }
  38004. return match.slice(0, 4);
  38005. },
  38006. "CHILD": function CHILD(match) {
  38007. /* matches from matchExpr["CHILD"]
  38008. 1 type (only|nth|...)
  38009. 2 what (child|of-type)
  38010. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  38011. 4 xn-component of xn+y argument ([+-]?\d*n|)
  38012. 5 sign of xn-component
  38013. 6 x of xn-component
  38014. 7 sign of y-component
  38015. 8 y of y-component
  38016. */
  38017. match[1] = match[1].toLowerCase();
  38018. if (match[1].slice(0, 3) === "nth") {
  38019. // nth-* requires argument
  38020. if (!match[3]) {
  38021. Sizzle.error(match[0]);
  38022. }
  38023. // numeric x and y parameters for Expr.filter.CHILD
  38024. // remember that false/true cast respectively to 0/1
  38025. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  38026. match[5] = +(match[7] + match[8] || match[3] === "odd");
  38027. // other types prohibit arguments
  38028. } else if (match[3]) {
  38029. Sizzle.error(match[0]);
  38030. }
  38031. return match;
  38032. },
  38033. "PSEUDO": function PSEUDO(match) {
  38034. var excess,
  38035. unquoted = !match[6] && match[2];
  38036. if (matchExpr["CHILD"].test(match[0])) {
  38037. return null;
  38038. }
  38039. // Accept quoted arguments as-is
  38040. if (match[3]) {
  38041. match[2] = match[4] || match[5] || "";
  38042. // Strip excess characters from unquoted arguments
  38043. } else if (unquoted && rpseudo.test(unquoted) && (
  38044. // Get excess from tokenize (recursively)
  38045. excess = tokenize(unquoted, true)) && (
  38046. // advance to the next closing parenthesis
  38047. excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  38048. // excess is a negative index
  38049. match[0] = match[0].slice(0, excess);
  38050. match[2] = unquoted.slice(0, excess);
  38051. }
  38052. // Return only captures needed by the pseudo filter method (type and argument)
  38053. return match.slice(0, 3);
  38054. }
  38055. },
  38056. filter: {
  38057. "TAG": function TAG(nodeNameSelector) {
  38058. var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  38059. return nodeNameSelector === "*" ? function () {
  38060. return true;
  38061. } : function (elem) {
  38062. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  38063. };
  38064. },
  38065. "CLASS": function CLASS(className) {
  38066. var pattern = classCache[className + " "];
  38067. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) {
  38068. return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
  38069. });
  38070. },
  38071. "ATTR": function ATTR(name, operator, check) {
  38072. return function (elem) {
  38073. var result = Sizzle.attr(elem, name);
  38074. if (result == null) {
  38075. return operator === "!=";
  38076. }
  38077. if (!operator) {
  38078. return true;
  38079. }
  38080. result += "";
  38081. 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;
  38082. };
  38083. },
  38084. "CHILD": function CHILD(type, what, argument, first, last) {
  38085. var simple = type.slice(0, 3) !== "nth",
  38086. forward = type.slice(-4) !== "last",
  38087. ofType = what === "of-type";
  38088. return first === 1 && last === 0 ?
  38089. // Shortcut for :nth-*(n)
  38090. function (elem) {
  38091. return !!elem.parentNode;
  38092. } : function (elem, context, xml) {
  38093. var cache,
  38094. uniqueCache,
  38095. outerCache,
  38096. node,
  38097. nodeIndex,
  38098. start,
  38099. dir = simple !== forward ? "nextSibling" : "previousSibling",
  38100. parent = elem.parentNode,
  38101. name = ofType && elem.nodeName.toLowerCase(),
  38102. useCache = !xml && !ofType,
  38103. diff = false;
  38104. if (parent) {
  38105. // :(first|last|only)-(child|of-type)
  38106. if (simple) {
  38107. while (dir) {
  38108. node = elem;
  38109. while (node = node[dir]) {
  38110. if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
  38111. return false;
  38112. }
  38113. }
  38114. // Reverse direction for :only-* (if we haven't yet done so)
  38115. start = dir = type === "only" && !start && "nextSibling";
  38116. }
  38117. return true;
  38118. }
  38119. start = [forward ? parent.firstChild : parent.lastChild];
  38120. // non-xml :nth-child(...) stores cache data on `parent`
  38121. if (forward && useCache) {
  38122. // Seek `elem` from a previously-cached index
  38123. // ...in a gzip-friendly way
  38124. node = parent;
  38125. outerCache = node[expando] || (node[expando] = {});
  38126. // Support: IE <9 only
  38127. // Defend against cloned attroperties (jQuery gh-1709)
  38128. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38129. cache = uniqueCache[type] || [];
  38130. nodeIndex = cache[0] === dirruns && cache[1];
  38131. diff = nodeIndex && cache[2];
  38132. node = nodeIndex && parent.childNodes[nodeIndex];
  38133. while (node = ++nodeIndex && node && node[dir] || (
  38134. // Fallback to seeking `elem` from the start
  38135. diff = nodeIndex = 0) || start.pop()) {
  38136. // When found, cache indexes on `parent` and break
  38137. if (node.nodeType === 1 && ++diff && node === elem) {
  38138. uniqueCache[type] = [dirruns, nodeIndex, diff];
  38139. break;
  38140. }
  38141. }
  38142. } else {
  38143. // Use previously-cached element index if available
  38144. if (useCache) {
  38145. // ...in a gzip-friendly way
  38146. node = elem;
  38147. outerCache = node[expando] || (node[expando] = {});
  38148. // Support: IE <9 only
  38149. // Defend against cloned attroperties (jQuery gh-1709)
  38150. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38151. cache = uniqueCache[type] || [];
  38152. nodeIndex = cache[0] === dirruns && cache[1];
  38153. diff = nodeIndex;
  38154. }
  38155. // xml :nth-child(...)
  38156. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  38157. if (diff === false) {
  38158. // Use the same loop as above to seek `elem` from the start
  38159. while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
  38160. if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
  38161. // Cache the index of each encountered element
  38162. if (useCache) {
  38163. outerCache = node[expando] || (node[expando] = {});
  38164. // Support: IE <9 only
  38165. // Defend against cloned attroperties (jQuery gh-1709)
  38166. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38167. uniqueCache[type] = [dirruns, diff];
  38168. }
  38169. if (node === elem) {
  38170. break;
  38171. }
  38172. }
  38173. }
  38174. }
  38175. }
  38176. // Incorporate the offset, then check against cycle size
  38177. diff -= last;
  38178. return diff === first || diff % first === 0 && diff / first >= 0;
  38179. }
  38180. };
  38181. },
  38182. "PSEUDO": function PSEUDO(pseudo, argument) {
  38183. // pseudo-class names are case-insensitive
  38184. // http://www.w3.org/TR/selectors/#pseudo-classes
  38185. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  38186. // Remember that setFilters inherits from pseudos
  38187. var args,
  38188. fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
  38189. // The user may use createPseudo to indicate that
  38190. // arguments are needed to create the filter function
  38191. // just as Sizzle does
  38192. if (fn[expando]) {
  38193. return fn(argument);
  38194. }
  38195. // But maintain support for old signatures
  38196. if (fn.length > 1) {
  38197. args = [pseudo, pseudo, "", argument];
  38198. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
  38199. var idx,
  38200. matched = fn(seed, argument),
  38201. i = matched.length;
  38202. while (i--) {
  38203. idx = indexOf(seed, matched[i]);
  38204. seed[idx] = !(matches[idx] = matched[i]);
  38205. }
  38206. }) : function (elem) {
  38207. return fn(elem, 0, args);
  38208. };
  38209. }
  38210. return fn;
  38211. }
  38212. },
  38213. pseudos: {
  38214. // Potentially complex pseudos
  38215. "not": markFunction(function (selector) {
  38216. // Trim the selector passed to compile
  38217. // to avoid treating leading and trailing
  38218. // spaces as combinators
  38219. var input = [],
  38220. results = [],
  38221. matcher = compile(selector.replace(rtrim, "$1"));
  38222. return matcher[expando] ? markFunction(function (seed, matches, context, xml) {
  38223. var elem,
  38224. unmatched = matcher(seed, null, xml, []),
  38225. i = seed.length;
  38226. // Match elements unmatched by `matcher`
  38227. while (i--) {
  38228. if (elem = unmatched[i]) {
  38229. seed[i] = !(matches[i] = elem);
  38230. }
  38231. }
  38232. }) : function (elem, context, xml) {
  38233. input[0] = elem;
  38234. matcher(input, null, xml, results);
  38235. // Don't keep the element (issue #299)
  38236. input[0] = null;
  38237. return !results.pop();
  38238. };
  38239. }),
  38240. "has": markFunction(function (selector) {
  38241. return function (elem) {
  38242. return Sizzle(selector, elem).length > 0;
  38243. };
  38244. }),
  38245. "contains": markFunction(function (text) {
  38246. text = text.replace(runescape, funescape);
  38247. return function (elem) {
  38248. return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
  38249. };
  38250. }),
  38251. // "Whether an element is represented by a :lang() selector
  38252. // is based solely on the element's language value
  38253. // being equal to the identifier C,
  38254. // or beginning with the identifier C immediately followed by "-".
  38255. // The matching of C against the element's language value is performed case-insensitively.
  38256. // The identifier C does not have to be a valid language name."
  38257. // http://www.w3.org/TR/selectors/#lang-pseudo
  38258. "lang": markFunction(function (lang) {
  38259. // lang value must be a valid identifier
  38260. if (!ridentifier.test(lang || "")) {
  38261. Sizzle.error("unsupported lang: " + lang);
  38262. }
  38263. lang = lang.replace(runescape, funescape).toLowerCase();
  38264. return function (elem) {
  38265. var elemLang;
  38266. do {
  38267. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
  38268. elemLang = elemLang.toLowerCase();
  38269. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  38270. }
  38271. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  38272. return false;
  38273. };
  38274. }),
  38275. // Miscellaneous
  38276. "target": function target(elem) {
  38277. var hash = window.location && window.location.hash;
  38278. return hash && hash.slice(1) === elem.id;
  38279. },
  38280. "root": function root(elem) {
  38281. return elem === docElem;
  38282. },
  38283. "focus": function focus(elem) {
  38284. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  38285. },
  38286. // Boolean properties
  38287. "enabled": createDisabledPseudo(false),
  38288. "disabled": createDisabledPseudo(true),
  38289. "checked": function checked(elem) {
  38290. // In CSS3, :checked should return both checked and selected elements
  38291. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  38292. var nodeName = elem.nodeName.toLowerCase();
  38293. return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected;
  38294. },
  38295. "selected": function selected(elem) {
  38296. // Accessing this property makes selected-by-default
  38297. // options in Safari work properly
  38298. if (elem.parentNode) {
  38299. elem.parentNode.selectedIndex;
  38300. }
  38301. return elem.selected === true;
  38302. },
  38303. // Contents
  38304. "empty": function empty(elem) {
  38305. // http://www.w3.org/TR/selectors/#empty-pseudo
  38306. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  38307. // but not by others (comment: 8; processing instruction: 7; etc.)
  38308. // nodeType < 6 works because attributes (2) do not appear as children
  38309. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  38310. if (elem.nodeType < 6) {
  38311. return false;
  38312. }
  38313. }
  38314. return true;
  38315. },
  38316. "parent": function parent(elem) {
  38317. return !Expr.pseudos["empty"](elem);
  38318. },
  38319. // Element/input types
  38320. "header": function header(elem) {
  38321. return rheader.test(elem.nodeName);
  38322. },
  38323. "input": function input(elem) {
  38324. return rinputs.test(elem.nodeName);
  38325. },
  38326. "button": function button(elem) {
  38327. var name = elem.nodeName.toLowerCase();
  38328. return name === "input" && elem.type === "button" || name === "button";
  38329. },
  38330. "text": function text(elem) {
  38331. var attr;
  38332. return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && (
  38333. // Support: IE<8
  38334. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  38335. (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  38336. },
  38337. // Position-in-collection
  38338. "first": createPositionalPseudo(function () {
  38339. return [0];
  38340. }),
  38341. "last": createPositionalPseudo(function (matchIndexes, length) {
  38342. return [length - 1];
  38343. }),
  38344. "eq": createPositionalPseudo(function (matchIndexes, length, argument) {
  38345. return [argument < 0 ? argument + length : argument];
  38346. }),
  38347. "even": createPositionalPseudo(function (matchIndexes, length) {
  38348. var i = 0;
  38349. for (; i < length; i += 2) {
  38350. matchIndexes.push(i);
  38351. }
  38352. return matchIndexes;
  38353. }),
  38354. "odd": createPositionalPseudo(function (matchIndexes, length) {
  38355. var i = 1;
  38356. for (; i < length; i += 2) {
  38357. matchIndexes.push(i);
  38358. }
  38359. return matchIndexes;
  38360. }),
  38361. "lt": createPositionalPseudo(function (matchIndexes, length, argument) {
  38362. var i = argument < 0 ? argument + length : argument;
  38363. for (; --i >= 0;) {
  38364. matchIndexes.push(i);
  38365. }
  38366. return matchIndexes;
  38367. }),
  38368. "gt": createPositionalPseudo(function (matchIndexes, length, argument) {
  38369. var i = argument < 0 ? argument + length : argument;
  38370. for (; ++i < length;) {
  38371. matchIndexes.push(i);
  38372. }
  38373. return matchIndexes;
  38374. })
  38375. }
  38376. };
  38377. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  38378. // Add button/input type pseudos
  38379. for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  38380. Expr.pseudos[i] = createInputPseudo(i);
  38381. }
  38382. for (i in { submit: true, reset: true }) {
  38383. Expr.pseudos[i] = createButtonPseudo(i);
  38384. }
  38385. // Easy API for creating new setFilters
  38386. function setFilters() {}
  38387. setFilters.prototype = Expr.filters = Expr.pseudos;
  38388. Expr.setFilters = new setFilters();
  38389. tokenize = Sizzle.tokenize = function (selector, parseOnly) {
  38390. var matched,
  38391. match,
  38392. tokens,
  38393. type,
  38394. soFar,
  38395. groups,
  38396. preFilters,
  38397. cached = tokenCache[selector + " "];
  38398. if (cached) {
  38399. return parseOnly ? 0 : cached.slice(0);
  38400. }
  38401. soFar = selector;
  38402. groups = [];
  38403. preFilters = Expr.preFilter;
  38404. while (soFar) {
  38405. // Comma and first run
  38406. if (!matched || (match = rcomma.exec(soFar))) {
  38407. if (match) {
  38408. // Don't consume trailing commas as valid
  38409. soFar = soFar.slice(match[0].length) || soFar;
  38410. }
  38411. groups.push(tokens = []);
  38412. }
  38413. matched = false;
  38414. // Combinators
  38415. if (match = rcombinators.exec(soFar)) {
  38416. matched = match.shift();
  38417. tokens.push({
  38418. value: matched,
  38419. // Cast descendant combinators to space
  38420. type: match[0].replace(rtrim, " ")
  38421. });
  38422. soFar = soFar.slice(matched.length);
  38423. }
  38424. // Filters
  38425. for (type in Expr.filter) {
  38426. if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
  38427. matched = match.shift();
  38428. tokens.push({
  38429. value: matched,
  38430. type: type,
  38431. matches: match
  38432. });
  38433. soFar = soFar.slice(matched.length);
  38434. }
  38435. }
  38436. if (!matched) {
  38437. break;
  38438. }
  38439. }
  38440. // Return the length of the invalid excess
  38441. // if we're just parsing
  38442. // Otherwise, throw an error or return tokens
  38443. return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) :
  38444. // Cache the tokens
  38445. tokenCache(selector, groups).slice(0);
  38446. };
  38447. function toSelector(tokens) {
  38448. var i = 0,
  38449. len = tokens.length,
  38450. selector = "";
  38451. for (; i < len; i++) {
  38452. selector += tokens[i].value;
  38453. }
  38454. return selector;
  38455. }
  38456. function addCombinator(matcher, combinator, base) {
  38457. var dir = combinator.dir,
  38458. skip = combinator.next,
  38459. key = skip || dir,
  38460. checkNonElements = base && key === "parentNode",
  38461. doneName = done++;
  38462. return combinator.first ?
  38463. // Check against closest ancestor/preceding element
  38464. function (elem, context, xml) {
  38465. while (elem = elem[dir]) {
  38466. if (elem.nodeType === 1 || checkNonElements) {
  38467. return matcher(elem, context, xml);
  38468. }
  38469. }
  38470. return false;
  38471. } :
  38472. // Check against all ancestor/preceding elements
  38473. function (elem, context, xml) {
  38474. var oldCache,
  38475. uniqueCache,
  38476. outerCache,
  38477. newCache = [dirruns, doneName];
  38478. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  38479. if (xml) {
  38480. while (elem = elem[dir]) {
  38481. if (elem.nodeType === 1 || checkNonElements) {
  38482. if (matcher(elem, context, xml)) {
  38483. return true;
  38484. }
  38485. }
  38486. }
  38487. } else {
  38488. while (elem = elem[dir]) {
  38489. if (elem.nodeType === 1 || checkNonElements) {
  38490. outerCache = elem[expando] || (elem[expando] = {});
  38491. // Support: IE <9 only
  38492. // Defend against cloned attroperties (jQuery gh-1709)
  38493. uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});
  38494. if (skip && skip === elem.nodeName.toLowerCase()) {
  38495. elem = elem[dir] || elem;
  38496. } else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  38497. // Assign to newCache so results back-propagate to previous elements
  38498. return newCache[2] = oldCache[2];
  38499. } else {
  38500. // Reuse newcache so results back-propagate to previous elements
  38501. uniqueCache[key] = newCache;
  38502. // A match means we're done; a fail means we have to keep checking
  38503. if (newCache[2] = matcher(elem, context, xml)) {
  38504. return true;
  38505. }
  38506. }
  38507. }
  38508. }
  38509. }
  38510. return false;
  38511. };
  38512. }
  38513. function elementMatcher(matchers) {
  38514. return matchers.length > 1 ? function (elem, context, xml) {
  38515. var i = matchers.length;
  38516. while (i--) {
  38517. if (!matchers[i](elem, context, xml)) {
  38518. return false;
  38519. }
  38520. }
  38521. return true;
  38522. } : matchers[0];
  38523. }
  38524. function multipleContexts(selector, contexts, results) {
  38525. var i = 0,
  38526. len = contexts.length;
  38527. for (; i < len; i++) {
  38528. Sizzle(selector, contexts[i], results);
  38529. }
  38530. return results;
  38531. }
  38532. function condense(unmatched, map, filter, context, xml) {
  38533. var elem,
  38534. newUnmatched = [],
  38535. i = 0,
  38536. len = unmatched.length,
  38537. mapped = map != null;
  38538. for (; i < len; i++) {
  38539. if (elem = unmatched[i]) {
  38540. if (!filter || filter(elem, context, xml)) {
  38541. newUnmatched.push(elem);
  38542. if (mapped) {
  38543. map.push(i);
  38544. }
  38545. }
  38546. }
  38547. }
  38548. return newUnmatched;
  38549. }
  38550. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  38551. if (postFilter && !postFilter[expando]) {
  38552. postFilter = setMatcher(postFilter);
  38553. }
  38554. if (postFinder && !postFinder[expando]) {
  38555. postFinder = setMatcher(postFinder, postSelector);
  38556. }
  38557. return markFunction(function (seed, results, context, xml) {
  38558. var temp,
  38559. i,
  38560. elem,
  38561. preMap = [],
  38562. postMap = [],
  38563. preexisting = results.length,
  38564. // Get initial elements from seed or context
  38565. elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
  38566. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  38567. matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
  38568. matcherOut = matcher ?
  38569. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  38570. postFinder || (seed ? preFilter : preexisting || postFilter) ?
  38571. // ...intermediate processing is necessary
  38572. [] :
  38573. // ...otherwise use results directly
  38574. results : matcherIn;
  38575. // Find primary matches
  38576. if (matcher) {
  38577. matcher(matcherIn, matcherOut, context, xml);
  38578. }
  38579. // Apply postFilter
  38580. if (postFilter) {
  38581. temp = condense(matcherOut, postMap);
  38582. postFilter(temp, [], context, xml);
  38583. // Un-match failing elements by moving them back to matcherIn
  38584. i = temp.length;
  38585. while (i--) {
  38586. if (elem = temp[i]) {
  38587. matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
  38588. }
  38589. }
  38590. }
  38591. if (seed) {
  38592. if (postFinder || preFilter) {
  38593. if (postFinder) {
  38594. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  38595. temp = [];
  38596. i = matcherOut.length;
  38597. while (i--) {
  38598. if (elem = matcherOut[i]) {
  38599. // Restore matcherIn since elem is not yet a final match
  38600. temp.push(matcherIn[i] = elem);
  38601. }
  38602. }
  38603. postFinder(null, matcherOut = [], temp, xml);
  38604. }
  38605. // Move matched elements from seed to results to keep them synchronized
  38606. i = matcherOut.length;
  38607. while (i--) {
  38608. if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
  38609. seed[temp] = !(results[temp] = elem);
  38610. }
  38611. }
  38612. }
  38613. // Add elements to results, through postFinder if defined
  38614. } else {
  38615. matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
  38616. if (postFinder) {
  38617. postFinder(null, results, matcherOut, xml);
  38618. } else {
  38619. push.apply(results, matcherOut);
  38620. }
  38621. }
  38622. });
  38623. }
  38624. function matcherFromTokens(tokens) {
  38625. var checkContext,
  38626. matcher,
  38627. j,
  38628. len = tokens.length,
  38629. leadingRelative = Expr.relative[tokens[0].type],
  38630. implicitRelative = leadingRelative || Expr.relative[" "],
  38631. i = leadingRelative ? 1 : 0,
  38632. // The foundational matcher ensures that elements are reachable from top-level context(s)
  38633. matchContext = addCombinator(function (elem) {
  38634. return elem === checkContext;
  38635. }, implicitRelative, true),
  38636. matchAnyContext = addCombinator(function (elem) {
  38637. return indexOf(checkContext, elem) > -1;
  38638. }, implicitRelative, true),
  38639. matchers = [function (elem, context, xml) {
  38640. var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  38641. // Avoid hanging onto element (issue #299)
  38642. checkContext = null;
  38643. return ret;
  38644. }];
  38645. for (; i < len; i++) {
  38646. if (matcher = Expr.relative[tokens[i].type]) {
  38647. matchers = [addCombinator(elementMatcher(matchers), matcher)];
  38648. } else {
  38649. matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
  38650. // Return special upon seeing a positional matcher
  38651. if (matcher[expando]) {
  38652. // Find the next relative operator (if any) for proper handling
  38653. j = ++i;
  38654. for (; j < len; j++) {
  38655. if (Expr.relative[tokens[j].type]) {
  38656. break;
  38657. }
  38658. }
  38659. return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(
  38660. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  38661. 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));
  38662. }
  38663. matchers.push(matcher);
  38664. }
  38665. }
  38666. return elementMatcher(matchers);
  38667. }
  38668. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  38669. var bySet = setMatchers.length > 0,
  38670. byElement = elementMatchers.length > 0,
  38671. superMatcher = function superMatcher(seed, context, xml, results, outermost) {
  38672. var elem,
  38673. j,
  38674. matcher,
  38675. matchedCount = 0,
  38676. i = "0",
  38677. unmatched = seed && [],
  38678. setMatched = [],
  38679. contextBackup = outermostContext,
  38680. // We must always have either seed elements or outermost context
  38681. elems = seed || byElement && Expr.find["TAG"]("*", outermost),
  38682. // Use integer dirruns iff this is the outermost matcher
  38683. dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,
  38684. len = elems.length;
  38685. if (outermost) {
  38686. outermostContext = context === document || context || outermost;
  38687. }
  38688. // Add elements passing elementMatchers directly to results
  38689. // Support: IE<9, Safari
  38690. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  38691. for (; i !== len && (elem = elems[i]) != null; i++) {
  38692. if (byElement && elem) {
  38693. j = 0;
  38694. if (!context && elem.ownerDocument !== document) {
  38695. setDocument(elem);
  38696. xml = !documentIsHTML;
  38697. }
  38698. while (matcher = elementMatchers[j++]) {
  38699. if (matcher(elem, context || document, xml)) {
  38700. results.push(elem);
  38701. break;
  38702. }
  38703. }
  38704. if (outermost) {
  38705. dirruns = dirrunsUnique;
  38706. }
  38707. }
  38708. // Track unmatched elements for set filters
  38709. if (bySet) {
  38710. // They will have gone through all possible matchers
  38711. if (elem = !matcher && elem) {
  38712. matchedCount--;
  38713. }
  38714. // Lengthen the array for every element, matched or not
  38715. if (seed) {
  38716. unmatched.push(elem);
  38717. }
  38718. }
  38719. }
  38720. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  38721. // makes the latter nonnegative.
  38722. matchedCount += i;
  38723. // Apply set filters to unmatched elements
  38724. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  38725. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  38726. // no element matchers and no seed.
  38727. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  38728. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  38729. // numerically zero.
  38730. if (bySet && i !== matchedCount) {
  38731. j = 0;
  38732. while (matcher = setMatchers[j++]) {
  38733. matcher(unmatched, setMatched, context, xml);
  38734. }
  38735. if (seed) {
  38736. // Reintegrate element matches to eliminate the need for sorting
  38737. if (matchedCount > 0) {
  38738. while (i--) {
  38739. if (!(unmatched[i] || setMatched[i])) {
  38740. setMatched[i] = pop.call(results);
  38741. }
  38742. }
  38743. }
  38744. // Discard index placeholder values to get only actual matches
  38745. setMatched = condense(setMatched);
  38746. }
  38747. // Add matches to results
  38748. push.apply(results, setMatched);
  38749. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  38750. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  38751. Sizzle.uniqueSort(results);
  38752. }
  38753. }
  38754. // Override manipulation of globals by nested matchers
  38755. if (outermost) {
  38756. dirruns = dirrunsUnique;
  38757. outermostContext = contextBackup;
  38758. }
  38759. return unmatched;
  38760. };
  38761. return bySet ? markFunction(superMatcher) : superMatcher;
  38762. }
  38763. compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
  38764. var i,
  38765. setMatchers = [],
  38766. elementMatchers = [],
  38767. cached = compilerCache[selector + " "];
  38768. if (!cached) {
  38769. // Generate a function of recursive functions that can be used to check each element
  38770. if (!match) {
  38771. match = tokenize(selector);
  38772. }
  38773. i = match.length;
  38774. while (i--) {
  38775. cached = matcherFromTokens(match[i]);
  38776. if (cached[expando]) {
  38777. setMatchers.push(cached);
  38778. } else {
  38779. elementMatchers.push(cached);
  38780. }
  38781. }
  38782. // Cache the compiled function
  38783. cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
  38784. // Save selector and tokenization
  38785. cached.selector = selector;
  38786. }
  38787. return cached;
  38788. };
  38789. /**
  38790. * A low-level selection function that works with Sizzle's compiled
  38791. * selector functions
  38792. * @param {String|Function} selector A selector or a pre-compiled
  38793. * selector function built with Sizzle.compile
  38794. * @param {Element} context
  38795. * @param {Array} [results]
  38796. * @param {Array} [seed] A set of elements to match against
  38797. */
  38798. select = Sizzle.select = function (selector, context, results, seed) {
  38799. var i,
  38800. tokens,
  38801. token,
  38802. type,
  38803. find,
  38804. compiled = typeof selector === "function" && selector,
  38805. match = !seed && tokenize(selector = compiled.selector || selector);
  38806. results = results || [];
  38807. // Try to minimize operations if there is only one selector in the list and no seed
  38808. // (the latter of which guarantees us context)
  38809. if (match.length === 1) {
  38810. // Reduce context if the leading compound selector is an ID
  38811. tokens = match[0] = match[0].slice(0);
  38812. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  38813. context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
  38814. if (!context) {
  38815. return results;
  38816. // Precompiled matchers will still verify ancestry, so step up a level
  38817. } else if (compiled) {
  38818. context = context.parentNode;
  38819. }
  38820. selector = selector.slice(tokens.shift().value.length);
  38821. }
  38822. // Fetch a seed set for right-to-left matching
  38823. i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
  38824. while (i--) {
  38825. token = tokens[i];
  38826. // Abort if we hit a combinator
  38827. if (Expr.relative[type = token.type]) {
  38828. break;
  38829. }
  38830. if (find = Expr.find[type]) {
  38831. // Search, expanding context for leading sibling combinators
  38832. if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
  38833. // If seed is empty or no tokens remain, we can return early
  38834. tokens.splice(i, 1);
  38835. selector = seed.length && toSelector(tokens);
  38836. if (!selector) {
  38837. push.apply(results, seed);
  38838. return results;
  38839. }
  38840. break;
  38841. }
  38842. }
  38843. }
  38844. }
  38845. // Compile and execute a filtering function if one is not provided
  38846. // Provide `match` to avoid retokenization if we modified the selector above
  38847. (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
  38848. return results;
  38849. };
  38850. // One-time assignments
  38851. // Sort stability
  38852. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  38853. // Support: Chrome 14-35+
  38854. // Always assume duplicates if they aren't passed to the comparison function
  38855. support.detectDuplicates = !!hasDuplicate;
  38856. // Initialize against the default document
  38857. setDocument();
  38858. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  38859. // Detached nodes confoundingly follow *each other*
  38860. support.sortDetached = assert(function (el) {
  38861. // Should return 1, but returns 4 (following)
  38862. return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
  38863. });
  38864. // Support: IE<8
  38865. // Prevent attribute/property "interpolation"
  38866. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  38867. if (!assert(function (el) {
  38868. el.innerHTML = "<a href='#'></a>";
  38869. return el.firstChild.getAttribute("href") === "#";
  38870. })) {
  38871. addHandle("type|href|height|width", function (elem, name, isXML) {
  38872. if (!isXML) {
  38873. return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
  38874. }
  38875. });
  38876. }
  38877. // Support: IE<9
  38878. // Use defaultValue in place of getAttribute("value")
  38879. if (!support.attributes || !assert(function (el) {
  38880. el.innerHTML = "<input/>";
  38881. el.firstChild.setAttribute("value", "");
  38882. return el.firstChild.getAttribute("value") === "";
  38883. })) {
  38884. addHandle("value", function (elem, name, isXML) {
  38885. if (!isXML && elem.nodeName.toLowerCase() === "input") {
  38886. return elem.defaultValue;
  38887. }
  38888. });
  38889. }
  38890. // Support: IE<9
  38891. // Use getAttributeNode to fetch booleans when getAttribute lies
  38892. if (!assert(function (el) {
  38893. return el.getAttribute("disabled") == null;
  38894. })) {
  38895. addHandle(booleans, function (elem, name, isXML) {
  38896. var val;
  38897. if (!isXML) {
  38898. return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  38899. }
  38900. });
  38901. }
  38902. return Sizzle;
  38903. }(window);
  38904. jQuery.find = Sizzle;
  38905. jQuery.expr = Sizzle.selectors;
  38906. // Deprecated
  38907. jQuery.expr[":"] = jQuery.expr.pseudos;
  38908. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  38909. jQuery.text = Sizzle.getText;
  38910. jQuery.isXMLDoc = Sizzle.isXML;
  38911. jQuery.contains = Sizzle.contains;
  38912. jQuery.escapeSelector = Sizzle.escape;
  38913. var dir = function dir(elem, _dir, until) {
  38914. var matched = [],
  38915. truncate = until !== undefined;
  38916. while ((elem = elem[_dir]) && elem.nodeType !== 9) {
  38917. if (elem.nodeType === 1) {
  38918. if (truncate && jQuery(elem).is(until)) {
  38919. break;
  38920. }
  38921. matched.push(elem);
  38922. }
  38923. }
  38924. return matched;
  38925. };
  38926. var _siblings = function _siblings(n, elem) {
  38927. var matched = [];
  38928. for (; n; n = n.nextSibling) {
  38929. if (n.nodeType === 1 && n !== elem) {
  38930. matched.push(n);
  38931. }
  38932. }
  38933. return matched;
  38934. };
  38935. var rneedsContext = jQuery.expr.match.needsContext;
  38936. function nodeName(elem, name) {
  38937. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  38938. };
  38939. var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
  38940. // Implement the identical functionality for filter and not
  38941. function winnow(elements, qualifier, not) {
  38942. if (isFunction(qualifier)) {
  38943. return jQuery.grep(elements, function (elem, i) {
  38944. return !!qualifier.call(elem, i, elem) !== not;
  38945. });
  38946. }
  38947. // Single element
  38948. if (qualifier.nodeType) {
  38949. return jQuery.grep(elements, function (elem) {
  38950. return elem === qualifier !== not;
  38951. });
  38952. }
  38953. // Arraylike of elements (jQuery, arguments, Array)
  38954. if (typeof qualifier !== "string") {
  38955. return jQuery.grep(elements, function (elem) {
  38956. return indexOf.call(qualifier, elem) > -1 !== not;
  38957. });
  38958. }
  38959. // Filtered directly for both simple and complex selectors
  38960. return jQuery.filter(qualifier, elements, not);
  38961. }
  38962. jQuery.filter = function (expr, elems, not) {
  38963. var elem = elems[0];
  38964. if (not) {
  38965. expr = ":not(" + expr + ")";
  38966. }
  38967. if (elems.length === 1 && elem.nodeType === 1) {
  38968. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  38969. }
  38970. return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
  38971. return elem.nodeType === 1;
  38972. }));
  38973. };
  38974. jQuery.fn.extend({
  38975. find: function find(selector) {
  38976. var i,
  38977. ret,
  38978. len = this.length,
  38979. self = this;
  38980. if (typeof selector !== "string") {
  38981. return this.pushStack(jQuery(selector).filter(function () {
  38982. for (i = 0; i < len; i++) {
  38983. if (jQuery.contains(self[i], this)) {
  38984. return true;
  38985. }
  38986. }
  38987. }));
  38988. }
  38989. ret = this.pushStack([]);
  38990. for (i = 0; i < len; i++) {
  38991. jQuery.find(selector, self[i], ret);
  38992. }
  38993. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  38994. },
  38995. filter: function filter(selector) {
  38996. return this.pushStack(winnow(this, selector || [], false));
  38997. },
  38998. not: function not(selector) {
  38999. return this.pushStack(winnow(this, selector || [], true));
  39000. },
  39001. is: function is(selector) {
  39002. return !!winnow(this,
  39003. // If this is a positional/relative selector, check membership in the returned set
  39004. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  39005. typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;
  39006. }
  39007. });
  39008. // Initialize a jQuery object
  39009. // A central reference to the root jQuery(document)
  39010. var rootjQuery,
  39011. // A simple way to check for HTML strings
  39012. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  39013. // Strict HTML recognition (#11290: must start with <)
  39014. // Shortcut simple #id case for speed
  39015. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  39016. init = jQuery.fn.init = function (selector, context, root) {
  39017. var match, elem;
  39018. // HANDLE: $(""), $(null), $(undefined), $(false)
  39019. if (!selector) {
  39020. return this;
  39021. }
  39022. // Method init() accepts an alternate rootjQuery
  39023. // so migrate can support jQuery.sub (gh-2101)
  39024. root = root || rootjQuery;
  39025. // Handle HTML strings
  39026. if (typeof selector === "string") {
  39027. if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
  39028. // Assume that strings that start and end with <> are HTML and skip the regex check
  39029. match = [null, selector, null];
  39030. } else {
  39031. match = rquickExpr.exec(selector);
  39032. }
  39033. // Match html or make sure no context is specified for #id
  39034. if (match && (match[1] || !context)) {
  39035. // HANDLE: $(html) -> $(array)
  39036. if (match[1]) {
  39037. context = context instanceof jQuery ? context[0] : context;
  39038. // Option to run scripts is true for back-compat
  39039. // Intentionally let the error be thrown if parseHTML is not present
  39040. jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
  39041. // HANDLE: $(html, props)
  39042. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  39043. for (match in context) {
  39044. // Properties of context are called as methods if possible
  39045. if (isFunction(this[match])) {
  39046. this[match](context[match]);
  39047. // ...and otherwise set as attributes
  39048. } else {
  39049. this.attr(match, context[match]);
  39050. }
  39051. }
  39052. }
  39053. return this;
  39054. // HANDLE: $(#id)
  39055. } else {
  39056. elem = document.getElementById(match[2]);
  39057. if (elem) {
  39058. // Inject the element directly into the jQuery object
  39059. this[0] = elem;
  39060. this.length = 1;
  39061. }
  39062. return this;
  39063. }
  39064. // HANDLE: $(expr, $(...))
  39065. } else if (!context || context.jquery) {
  39066. return (context || root).find(selector);
  39067. // HANDLE: $(expr, context)
  39068. // (which is just equivalent to: $(context).find(expr)
  39069. } else {
  39070. return this.constructor(context).find(selector);
  39071. }
  39072. // HANDLE: $(DOMElement)
  39073. } else if (selector.nodeType) {
  39074. this[0] = selector;
  39075. this.length = 1;
  39076. return this;
  39077. // HANDLE: $(function)
  39078. // Shortcut for document ready
  39079. } else if (isFunction(selector)) {
  39080. return root.ready !== undefined ? root.ready(selector) :
  39081. // Execute immediately if ready is not present
  39082. selector(jQuery);
  39083. }
  39084. return jQuery.makeArray(selector, this);
  39085. };
  39086. // Give the init function the jQuery prototype for later instantiation
  39087. init.prototype = jQuery.fn;
  39088. // Initialize central reference
  39089. rootjQuery = jQuery(document);
  39090. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  39091. // Methods guaranteed to produce a unique set when starting from a unique set
  39092. guaranteedUnique = {
  39093. children: true,
  39094. contents: true,
  39095. next: true,
  39096. prev: true
  39097. };
  39098. jQuery.fn.extend({
  39099. has: function has(target) {
  39100. var targets = jQuery(target, this),
  39101. l = targets.length;
  39102. return this.filter(function () {
  39103. var i = 0;
  39104. for (; i < l; i++) {
  39105. if (jQuery.contains(this, targets[i])) {
  39106. return true;
  39107. }
  39108. }
  39109. });
  39110. },
  39111. closest: function closest(selectors, context) {
  39112. var cur,
  39113. i = 0,
  39114. l = this.length,
  39115. matched = [],
  39116. targets = typeof selectors !== "string" && jQuery(selectors);
  39117. // Positional selectors never match, since there's no _selection_ context
  39118. if (!rneedsContext.test(selectors)) {
  39119. for (; i < l; i++) {
  39120. for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
  39121. // Always skip document fragments
  39122. if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 :
  39123. // Don't pass non-elements to Sizzle
  39124. cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  39125. matched.push(cur);
  39126. break;
  39127. }
  39128. }
  39129. }
  39130. }
  39131. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  39132. },
  39133. // Determine the position of an element within the set
  39134. index: function index(elem) {
  39135. // No argument, return index in parent
  39136. if (!elem) {
  39137. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  39138. }
  39139. // Index in selector
  39140. if (typeof elem === "string") {
  39141. return indexOf.call(jQuery(elem), this[0]);
  39142. }
  39143. // Locate the position of the desired element
  39144. return indexOf.call(this,
  39145. // If it receives a jQuery object, the first element is used
  39146. elem.jquery ? elem[0] : elem);
  39147. },
  39148. add: function add(selector, context) {
  39149. return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
  39150. },
  39151. addBack: function addBack(selector) {
  39152. return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
  39153. }
  39154. });
  39155. function sibling(cur, dir) {
  39156. while ((cur = cur[dir]) && cur.nodeType !== 1) {}
  39157. return cur;
  39158. }
  39159. jQuery.each({
  39160. parent: function parent(elem) {
  39161. var parent = elem.parentNode;
  39162. return parent && parent.nodeType !== 11 ? parent : null;
  39163. },
  39164. parents: function parents(elem) {
  39165. return dir(elem, "parentNode");
  39166. },
  39167. parentsUntil: function parentsUntil(elem, i, until) {
  39168. return dir(elem, "parentNode", until);
  39169. },
  39170. next: function next(elem) {
  39171. return sibling(elem, "nextSibling");
  39172. },
  39173. prev: function prev(elem) {
  39174. return sibling(elem, "previousSibling");
  39175. },
  39176. nextAll: function nextAll(elem) {
  39177. return dir(elem, "nextSibling");
  39178. },
  39179. prevAll: function prevAll(elem) {
  39180. return dir(elem, "previousSibling");
  39181. },
  39182. nextUntil: function nextUntil(elem, i, until) {
  39183. return dir(elem, "nextSibling", until);
  39184. },
  39185. prevUntil: function prevUntil(elem, i, until) {
  39186. return dir(elem, "previousSibling", until);
  39187. },
  39188. siblings: function siblings(elem) {
  39189. return _siblings((elem.parentNode || {}).firstChild, elem);
  39190. },
  39191. children: function children(elem) {
  39192. return _siblings(elem.firstChild);
  39193. },
  39194. contents: function contents(elem) {
  39195. if (nodeName(elem, "iframe")) {
  39196. return elem.contentDocument;
  39197. }
  39198. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  39199. // Treat the template element as a regular one in browsers that
  39200. // don't support it.
  39201. if (nodeName(elem, "template")) {
  39202. elem = elem.content || elem;
  39203. }
  39204. return jQuery.merge([], elem.childNodes);
  39205. }
  39206. }, function (name, fn) {
  39207. jQuery.fn[name] = function (until, selector) {
  39208. var matched = jQuery.map(this, fn, until);
  39209. if (name.slice(-5) !== "Until") {
  39210. selector = until;
  39211. }
  39212. if (selector && typeof selector === "string") {
  39213. matched = jQuery.filter(selector, matched);
  39214. }
  39215. if (this.length > 1) {
  39216. // Remove duplicates
  39217. if (!guaranteedUnique[name]) {
  39218. jQuery.uniqueSort(matched);
  39219. }
  39220. // Reverse order for parents* and prev-derivatives
  39221. if (rparentsprev.test(name)) {
  39222. matched.reverse();
  39223. }
  39224. }
  39225. return this.pushStack(matched);
  39226. };
  39227. });
  39228. var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
  39229. // Convert String-formatted options into Object-formatted ones
  39230. function createOptions(options) {
  39231. var object = {};
  39232. jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
  39233. object[flag] = true;
  39234. });
  39235. return object;
  39236. }
  39237. /*
  39238. * Create a callback list using the following parameters:
  39239. *
  39240. * options: an optional list of space-separated options that will change how
  39241. * the callback list behaves or a more traditional option object
  39242. *
  39243. * By default a callback list will act like an event callback list and can be
  39244. * "fired" multiple times.
  39245. *
  39246. * Possible options:
  39247. *
  39248. * once: will ensure the callback list can only be fired once (like a Deferred)
  39249. *
  39250. * memory: will keep track of previous values and will call any callback added
  39251. * after the list has been fired right away with the latest "memorized"
  39252. * values (like a Deferred)
  39253. *
  39254. * unique: will ensure a callback can only be added once (no duplicate in the list)
  39255. *
  39256. * stopOnFalse: interrupt callings when a callback returns false
  39257. *
  39258. */
  39259. jQuery.Callbacks = function (options) {
  39260. // Convert options from String-formatted to Object-formatted if needed
  39261. // (we check in cache first)
  39262. options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options);
  39263. var // Flag to know if list is currently firing
  39264. firing,
  39265. // Last fire value for non-forgettable lists
  39266. memory,
  39267. // Flag to know if list was already fired
  39268. _fired,
  39269. // Flag to prevent firing
  39270. _locked,
  39271. // Actual callback list
  39272. list = [],
  39273. // Queue of execution data for repeatable lists
  39274. queue = [],
  39275. // Index of currently firing callback (modified by add/remove as needed)
  39276. firingIndex = -1,
  39277. // Fire callbacks
  39278. fire = function fire() {
  39279. // Enforce single-firing
  39280. _locked = _locked || options.once;
  39281. // Execute callbacks for all pending executions,
  39282. // respecting firingIndex overrides and runtime changes
  39283. _fired = firing = true;
  39284. for (; queue.length; firingIndex = -1) {
  39285. memory = queue.shift();
  39286. while (++firingIndex < list.length) {
  39287. // Run callback and check for early termination
  39288. if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {
  39289. // Jump to end and forget the data so .add doesn't re-fire
  39290. firingIndex = list.length;
  39291. memory = false;
  39292. }
  39293. }
  39294. }
  39295. // Forget the data if we're done with it
  39296. if (!options.memory) {
  39297. memory = false;
  39298. }
  39299. firing = false;
  39300. // Clean up if we're done firing for good
  39301. if (_locked) {
  39302. // Keep an empty list if we have data for future add calls
  39303. if (memory) {
  39304. list = [];
  39305. // Otherwise, this object is spent
  39306. } else {
  39307. list = "";
  39308. }
  39309. }
  39310. },
  39311. // Actual Callbacks object
  39312. self = {
  39313. // Add a callback or a collection of callbacks to the list
  39314. add: function add() {
  39315. if (list) {
  39316. // If we have memory from a past run, we should fire after adding
  39317. if (memory && !firing) {
  39318. firingIndex = list.length - 1;
  39319. queue.push(memory);
  39320. }
  39321. (function add(args) {
  39322. jQuery.each(args, function (_, arg) {
  39323. if (isFunction(arg)) {
  39324. if (!options.unique || !self.has(arg)) {
  39325. list.push(arg);
  39326. }
  39327. } else if (arg && arg.length && toType(arg) !== "string") {
  39328. // Inspect recursively
  39329. add(arg);
  39330. }
  39331. });
  39332. })(arguments);
  39333. if (memory && !firing) {
  39334. fire();
  39335. }
  39336. }
  39337. return this;
  39338. },
  39339. // Remove a callback from the list
  39340. remove: function remove() {
  39341. jQuery.each(arguments, function (_, arg) {
  39342. var index;
  39343. while ((index = jQuery.inArray(arg, list, index)) > -1) {
  39344. list.splice(index, 1);
  39345. // Handle firing indexes
  39346. if (index <= firingIndex) {
  39347. firingIndex--;
  39348. }
  39349. }
  39350. });
  39351. return this;
  39352. },
  39353. // Check if a given callback is in the list.
  39354. // If no argument is given, return whether or not list has callbacks attached.
  39355. has: function has(fn) {
  39356. return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
  39357. },
  39358. // Remove all callbacks from the list
  39359. empty: function empty() {
  39360. if (list) {
  39361. list = [];
  39362. }
  39363. return this;
  39364. },
  39365. // Disable .fire and .add
  39366. // Abort any current/pending executions
  39367. // Clear all callbacks and values
  39368. disable: function disable() {
  39369. _locked = queue = [];
  39370. list = memory = "";
  39371. return this;
  39372. },
  39373. disabled: function disabled() {
  39374. return !list;
  39375. },
  39376. // Disable .fire
  39377. // Also disable .add unless we have memory (since it would have no effect)
  39378. // Abort any pending executions
  39379. lock: function lock() {
  39380. _locked = queue = [];
  39381. if (!memory && !firing) {
  39382. list = memory = "";
  39383. }
  39384. return this;
  39385. },
  39386. locked: function locked() {
  39387. return !!_locked;
  39388. },
  39389. // Call all callbacks with the given context and arguments
  39390. fireWith: function fireWith(context, args) {
  39391. if (!_locked) {
  39392. args = args || [];
  39393. args = [context, args.slice ? args.slice() : args];
  39394. queue.push(args);
  39395. if (!firing) {
  39396. fire();
  39397. }
  39398. }
  39399. return this;
  39400. },
  39401. // Call all the callbacks with the given arguments
  39402. fire: function fire() {
  39403. self.fireWith(this, arguments);
  39404. return this;
  39405. },
  39406. // To know if the callbacks have already been called at least once
  39407. fired: function fired() {
  39408. return !!_fired;
  39409. }
  39410. };
  39411. return self;
  39412. };
  39413. function Identity(v) {
  39414. return v;
  39415. }
  39416. function Thrower(ex) {
  39417. throw ex;
  39418. }
  39419. function adoptValue(value, resolve, reject, noValue) {
  39420. var method;
  39421. try {
  39422. // Check for promise aspect first to privilege synchronous behavior
  39423. if (value && isFunction(method = value.promise)) {
  39424. method.call(value).done(resolve).fail(reject);
  39425. // Other thenables
  39426. } else if (value && isFunction(method = value.then)) {
  39427. method.call(value, resolve, reject);
  39428. // Other non-thenables
  39429. } else {
  39430. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  39431. // * false: [ value ].slice( 0 ) => resolve( value )
  39432. // * true: [ value ].slice( 1 ) => resolve()
  39433. resolve.apply(undefined, [value].slice(noValue));
  39434. }
  39435. // For Promises/A+, convert exceptions into rejections
  39436. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  39437. // Deferred#then to conditionally suppress rejection.
  39438. } catch (value) {
  39439. // Support: Android 4.0 only
  39440. // Strict mode functions invoked without .call/.apply get global-object context
  39441. reject.apply(undefined, [value]);
  39442. }
  39443. }
  39444. jQuery.extend({
  39445. Deferred: function Deferred(func) {
  39446. var tuples = [
  39447. // action, add listener, callbacks,
  39448. // ... .then handlers, argument index, [final state]
  39449. ["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"]],
  39450. _state = "pending",
  39451. _promise = {
  39452. state: function state() {
  39453. return _state;
  39454. },
  39455. always: function always() {
  39456. deferred.done(arguments).fail(arguments);
  39457. return this;
  39458. },
  39459. "catch": function _catch(fn) {
  39460. return _promise.then(null, fn);
  39461. },
  39462. // Keep pipe for back-compat
  39463. pipe: function pipe() /* fnDone, fnFail, fnProgress */{
  39464. var fns = arguments;
  39465. return jQuery.Deferred(function (newDefer) {
  39466. jQuery.each(tuples, function (i, tuple) {
  39467. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  39468. var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
  39469. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  39470. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  39471. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  39472. deferred[tuple[1]](function () {
  39473. var returned = fn && fn.apply(this, arguments);
  39474. if (returned && isFunction(returned.promise)) {
  39475. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  39476. } else {
  39477. newDefer[tuple[0] + "With"](this, fn ? [returned] : arguments);
  39478. }
  39479. });
  39480. });
  39481. fns = null;
  39482. }).promise();
  39483. },
  39484. then: function then(onFulfilled, onRejected, onProgress) {
  39485. var maxDepth = 0;
  39486. function resolve(depth, deferred, handler, special) {
  39487. return function () {
  39488. var that = this,
  39489. args = arguments,
  39490. mightThrow = function mightThrow() {
  39491. var returned, then;
  39492. // Support: Promises/A+ section 2.3.3.3.3
  39493. // https://promisesaplus.com/#point-59
  39494. // Ignore double-resolution attempts
  39495. if (depth < maxDepth) {
  39496. return;
  39497. }
  39498. returned = handler.apply(that, args);
  39499. // Support: Promises/A+ section 2.3.1
  39500. // https://promisesaplus.com/#point-48
  39501. if (returned === deferred.promise()) {
  39502. throw new TypeError("Thenable self-resolution");
  39503. }
  39504. // Support: Promises/A+ sections 2.3.3.1, 3.5
  39505. // https://promisesaplus.com/#point-54
  39506. // https://promisesaplus.com/#point-75
  39507. // Retrieve `then` only once
  39508. then = returned && (
  39509. // Support: Promises/A+ section 2.3.4
  39510. // https://promisesaplus.com/#point-64
  39511. // Only check objects and functions for thenability
  39512. (typeof returned === "undefined" ? "undefined" : _typeof(returned)) === "object" || typeof returned === "function") && returned.then;
  39513. // Handle a returned thenable
  39514. if (isFunction(then)) {
  39515. // Special processors (notify) just wait for resolution
  39516. if (special) {
  39517. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));
  39518. // Normal processors (resolve) also hook into progress
  39519. } else {
  39520. // ...and disregard older resolution values
  39521. maxDepth++;
  39522. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));
  39523. }
  39524. // Handle all other returned values
  39525. } else {
  39526. // Only substitute handlers pass on context
  39527. // and multiple values (non-spec behavior)
  39528. if (handler !== Identity) {
  39529. that = undefined;
  39530. args = [returned];
  39531. }
  39532. // Process the value(s)
  39533. // Default process is resolve
  39534. (special || deferred.resolveWith)(that, args);
  39535. }
  39536. },
  39537. // Only normal processors (resolve) catch and reject exceptions
  39538. process = special ? mightThrow : function () {
  39539. try {
  39540. mightThrow();
  39541. } catch (e) {
  39542. if (jQuery.Deferred.exceptionHook) {
  39543. jQuery.Deferred.exceptionHook(e, process.stackTrace);
  39544. }
  39545. // Support: Promises/A+ section 2.3.3.3.4.1
  39546. // https://promisesaplus.com/#point-61
  39547. // Ignore post-resolution exceptions
  39548. if (depth + 1 >= maxDepth) {
  39549. // Only substitute handlers pass on context
  39550. // and multiple values (non-spec behavior)
  39551. if (handler !== Thrower) {
  39552. that = undefined;
  39553. args = [e];
  39554. }
  39555. deferred.rejectWith(that, args);
  39556. }
  39557. }
  39558. };
  39559. // Support: Promises/A+ section 2.3.3.3.1
  39560. // https://promisesaplus.com/#point-57
  39561. // Re-resolve promises immediately to dodge false rejection from
  39562. // subsequent errors
  39563. if (depth) {
  39564. process();
  39565. } else {
  39566. // Call an optional hook to record the stack, in case of exception
  39567. // since it's otherwise lost when execution goes async
  39568. if (jQuery.Deferred.getStackHook) {
  39569. process.stackTrace = jQuery.Deferred.getStackHook();
  39570. }
  39571. window.setTimeout(process);
  39572. }
  39573. };
  39574. }
  39575. return jQuery.Deferred(function (newDefer) {
  39576. // progress_handlers.add( ... )
  39577. tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith));
  39578. // fulfilled_handlers.add( ... )
  39579. tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity));
  39580. // rejected_handlers.add( ... )
  39581. tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));
  39582. }).promise();
  39583. },
  39584. // Get a promise for this deferred
  39585. // If obj is provided, the promise aspect is added to the object
  39586. promise: function promise(obj) {
  39587. return obj != null ? jQuery.extend(obj, _promise) : _promise;
  39588. }
  39589. },
  39590. deferred = {};
  39591. // Add list-specific methods
  39592. jQuery.each(tuples, function (i, tuple) {
  39593. var list = tuple[2],
  39594. stateString = tuple[5];
  39595. // promise.progress = list.add
  39596. // promise.done = list.add
  39597. // promise.fail = list.add
  39598. _promise[tuple[1]] = list.add;
  39599. // Handle state
  39600. if (stateString) {
  39601. list.add(function () {
  39602. // state = "resolved" (i.e., fulfilled)
  39603. // state = "rejected"
  39604. _state = stateString;
  39605. },
  39606. // rejected_callbacks.disable
  39607. // fulfilled_callbacks.disable
  39608. tuples[3 - i][2].disable,
  39609. // rejected_handlers.disable
  39610. // fulfilled_handlers.disable
  39611. tuples[3 - i][3].disable,
  39612. // progress_callbacks.lock
  39613. tuples[0][2].lock,
  39614. // progress_handlers.lock
  39615. tuples[0][3].lock);
  39616. }
  39617. // progress_handlers.fire
  39618. // fulfilled_handlers.fire
  39619. // rejected_handlers.fire
  39620. list.add(tuple[3].fire);
  39621. // deferred.notify = function() { deferred.notifyWith(...) }
  39622. // deferred.resolve = function() { deferred.resolveWith(...) }
  39623. // deferred.reject = function() { deferred.rejectWith(...) }
  39624. deferred[tuple[0]] = function () {
  39625. deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
  39626. return this;
  39627. };
  39628. // deferred.notifyWith = list.fireWith
  39629. // deferred.resolveWith = list.fireWith
  39630. // deferred.rejectWith = list.fireWith
  39631. deferred[tuple[0] + "With"] = list.fireWith;
  39632. });
  39633. // Make the deferred a promise
  39634. _promise.promise(deferred);
  39635. // Call given func if any
  39636. if (func) {
  39637. func.call(deferred, deferred);
  39638. }
  39639. // All done!
  39640. return deferred;
  39641. },
  39642. // Deferred helper
  39643. when: function when(singleValue) {
  39644. var
  39645. // count of uncompleted subordinates
  39646. remaining = arguments.length,
  39647. // count of unprocessed arguments
  39648. i = remaining,
  39649. // subordinate fulfillment data
  39650. resolveContexts = Array(i),
  39651. resolveValues = _slice.call(arguments),
  39652. // the master Deferred
  39653. master = jQuery.Deferred(),
  39654. // subordinate callback factory
  39655. updateFunc = function updateFunc(i) {
  39656. return function (value) {
  39657. resolveContexts[i] = this;
  39658. resolveValues[i] = arguments.length > 1 ? _slice.call(arguments) : value;
  39659. if (! --remaining) {
  39660. master.resolveWith(resolveContexts, resolveValues);
  39661. }
  39662. };
  39663. };
  39664. // Single- and empty arguments are adopted like Promise.resolve
  39665. if (remaining <= 1) {
  39666. adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining);
  39667. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  39668. if (master.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) {
  39669. return master.then();
  39670. }
  39671. }
  39672. // Multiple arguments are aggregated like Promise.all array elements
  39673. while (i--) {
  39674. adoptValue(resolveValues[i], updateFunc(i), master.reject);
  39675. }
  39676. return master.promise();
  39677. }
  39678. });
  39679. // These usually indicate a programmer mistake during development,
  39680. // warn about them ASAP rather than swallowing them by default.
  39681. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  39682. jQuery.Deferred.exceptionHook = function (error, stack) {
  39683. // Support: IE 8 - 9 only
  39684. // Console exists when dev tools are open, which can happen at any time
  39685. if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
  39686. window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
  39687. }
  39688. };
  39689. jQuery.readyException = function (error) {
  39690. window.setTimeout(function () {
  39691. throw error;
  39692. });
  39693. };
  39694. // The deferred used on DOM ready
  39695. var readyList = jQuery.Deferred();
  39696. jQuery.fn.ready = function (fn) {
  39697. readyList.then(fn)
  39698. // Wrap jQuery.readyException in a function so that the lookup
  39699. // happens at the time of error handling instead of callback
  39700. // registration.
  39701. .catch(function (error) {
  39702. jQuery.readyException(error);
  39703. });
  39704. return this;
  39705. };
  39706. jQuery.extend({
  39707. // Is the DOM ready to be used? Set to true once it occurs.
  39708. isReady: false,
  39709. // A counter to track how many items to wait for before
  39710. // the ready event fires. See #6781
  39711. readyWait: 1,
  39712. // Handle when the DOM is ready
  39713. ready: function ready(wait) {
  39714. // Abort if there are pending holds or we're already ready
  39715. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  39716. return;
  39717. }
  39718. // Remember that the DOM is ready
  39719. jQuery.isReady = true;
  39720. // If a normal DOM Ready event fired, decrement, and wait if need be
  39721. if (wait !== true && --jQuery.readyWait > 0) {
  39722. return;
  39723. }
  39724. // If there are functions bound, to execute
  39725. readyList.resolveWith(document, [jQuery]);
  39726. }
  39727. });
  39728. jQuery.ready.then = readyList.then;
  39729. // The ready event handler and self cleanup method
  39730. function completed() {
  39731. document.removeEventListener("DOMContentLoaded", completed);
  39732. window.removeEventListener("load", completed);
  39733. jQuery.ready();
  39734. }
  39735. // Catch cases where $(document).ready() is called
  39736. // after the browser event has already occurred.
  39737. // Support: IE <=9 - 10 only
  39738. // Older IE sometimes signals "interactive" too soon
  39739. if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) {
  39740. // Handle it asynchronously to allow scripts the opportunity to delay ready
  39741. window.setTimeout(jQuery.ready);
  39742. } else {
  39743. // Use the handy event callback
  39744. document.addEventListener("DOMContentLoaded", completed);
  39745. // A fallback to window.onload, that will always work
  39746. window.addEventListener("load", completed);
  39747. }
  39748. // Multifunctional method to get and set values of a collection
  39749. // The value/s can optionally be executed if it's a function
  39750. var access = function access(elems, fn, key, value, chainable, emptyGet, raw) {
  39751. var i = 0,
  39752. len = elems.length,
  39753. bulk = key == null;
  39754. // Sets many values
  39755. if (toType(key) === "object") {
  39756. chainable = true;
  39757. for (i in key) {
  39758. access(elems, fn, i, key[i], true, emptyGet, raw);
  39759. }
  39760. // Sets one value
  39761. } else if (value !== undefined) {
  39762. chainable = true;
  39763. if (!isFunction(value)) {
  39764. raw = true;
  39765. }
  39766. if (bulk) {
  39767. // Bulk operations run against the entire set
  39768. if (raw) {
  39769. fn.call(elems, value);
  39770. fn = null;
  39771. // ...except when executing function values
  39772. } else {
  39773. bulk = fn;
  39774. fn = function fn(elem, key, value) {
  39775. return bulk.call(jQuery(elem), value);
  39776. };
  39777. }
  39778. }
  39779. if (fn) {
  39780. for (; i < len; i++) {
  39781. fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
  39782. }
  39783. }
  39784. }
  39785. if (chainable) {
  39786. return elems;
  39787. }
  39788. // Gets
  39789. if (bulk) {
  39790. return fn.call(elems);
  39791. }
  39792. return len ? fn(elems[0], key) : emptyGet;
  39793. };
  39794. // Matches dashed string for camelizing
  39795. var rmsPrefix = /^-ms-/,
  39796. rdashAlpha = /-([a-z])/g;
  39797. // Used by camelCase as callback to replace()
  39798. function fcamelCase(all, letter) {
  39799. return letter.toUpperCase();
  39800. }
  39801. // Convert dashed to camelCase; used by the css and data modules
  39802. // Support: IE <=9 - 11, Edge 12 - 15
  39803. // Microsoft forgot to hump their vendor prefix (#9572)
  39804. function camelCase(string) {
  39805. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  39806. }
  39807. var acceptData = function acceptData(owner) {
  39808. // Accepts only:
  39809. // - Node
  39810. // - Node.ELEMENT_NODE
  39811. // - Node.DOCUMENT_NODE
  39812. // - Object
  39813. // - Any
  39814. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  39815. };
  39816. function Data() {
  39817. this.expando = jQuery.expando + Data.uid++;
  39818. }
  39819. Data.uid = 1;
  39820. Data.prototype = {
  39821. cache: function cache(owner) {
  39822. // Check if the owner object already has a cache
  39823. var value = owner[this.expando];
  39824. // If not, create one
  39825. if (!value) {
  39826. value = {};
  39827. // We can accept data for non-element nodes in modern browsers,
  39828. // but we should not, see #8335.
  39829. // Always return an empty object.
  39830. if (acceptData(owner)) {
  39831. // If it is a node unlikely to be stringify-ed or looped over
  39832. // use plain assignment
  39833. if (owner.nodeType) {
  39834. owner[this.expando] = value;
  39835. // Otherwise secure it in a non-enumerable property
  39836. // configurable must be true to allow the property to be
  39837. // deleted when data is removed
  39838. } else {
  39839. Object.defineProperty(owner, this.expando, {
  39840. value: value,
  39841. configurable: true
  39842. });
  39843. }
  39844. }
  39845. }
  39846. return value;
  39847. },
  39848. set: function set(owner, data, value) {
  39849. var prop,
  39850. cache = this.cache(owner);
  39851. // Handle: [ owner, key, value ] args
  39852. // Always use camelCase key (gh-2257)
  39853. if (typeof data === "string") {
  39854. cache[camelCase(data)] = value;
  39855. // Handle: [ owner, { properties } ] args
  39856. } else {
  39857. // Copy the properties one-by-one to the cache object
  39858. for (prop in data) {
  39859. cache[camelCase(prop)] = data[prop];
  39860. }
  39861. }
  39862. return cache;
  39863. },
  39864. get: function get(owner, key) {
  39865. return key === undefined ? this.cache(owner) :
  39866. // Always use camelCase key (gh-2257)
  39867. owner[this.expando] && owner[this.expando][camelCase(key)];
  39868. },
  39869. access: function access(owner, key, value) {
  39870. // In cases where either:
  39871. //
  39872. // 1. No key was specified
  39873. // 2. A string key was specified, but no value provided
  39874. //
  39875. // Take the "read" path and allow the get method to determine
  39876. // which value to return, respectively either:
  39877. //
  39878. // 1. The entire cache object
  39879. // 2. The data stored at the key
  39880. //
  39881. if (key === undefined || key && typeof key === "string" && value === undefined) {
  39882. return this.get(owner, key);
  39883. }
  39884. // When the key is not a string, or both a key and value
  39885. // are specified, set or extend (existing objects) with either:
  39886. //
  39887. // 1. An object of properties
  39888. // 2. A key and value
  39889. //
  39890. this.set(owner, key, value);
  39891. // Since the "set" path can have two possible entry points
  39892. // return the expected data based on which path was taken[*]
  39893. return value !== undefined ? value : key;
  39894. },
  39895. remove: function remove(owner, key) {
  39896. var i,
  39897. cache = owner[this.expando];
  39898. if (cache === undefined) {
  39899. return;
  39900. }
  39901. if (key !== undefined) {
  39902. // Support array or space separated string of keys
  39903. if (Array.isArray(key)) {
  39904. // If key is an array of keys...
  39905. // We always set camelCase keys, so remove that.
  39906. key = key.map(camelCase);
  39907. } else {
  39908. key = camelCase(key);
  39909. // If a key with the spaces exists, use it.
  39910. // Otherwise, create an array by matching non-whitespace
  39911. key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
  39912. }
  39913. i = key.length;
  39914. while (i--) {
  39915. delete cache[key[i]];
  39916. }
  39917. }
  39918. // Remove the expando if there's no more data
  39919. if (key === undefined || jQuery.isEmptyObject(cache)) {
  39920. // Support: Chrome <=35 - 45
  39921. // Webkit & Blink performance suffers when deleting properties
  39922. // from DOM nodes, so set to undefined instead
  39923. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  39924. if (owner.nodeType) {
  39925. owner[this.expando] = undefined;
  39926. } else {
  39927. delete owner[this.expando];
  39928. }
  39929. }
  39930. },
  39931. hasData: function hasData(owner) {
  39932. var cache = owner[this.expando];
  39933. return cache !== undefined && !jQuery.isEmptyObject(cache);
  39934. }
  39935. };
  39936. var dataPriv = new Data();
  39937. var dataUser = new Data();
  39938. // Implementation Summary
  39939. //
  39940. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  39941. // 2. Improve the module's maintainability by reducing the storage
  39942. // paths to a single mechanism.
  39943. // 3. Use the same single mechanism to support "private" and "user" data.
  39944. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  39945. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  39946. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  39947. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  39948. rmultiDash = /[A-Z]/g;
  39949. function getData(data) {
  39950. if (data === "true") {
  39951. return true;
  39952. }
  39953. if (data === "false") {
  39954. return false;
  39955. }
  39956. if (data === "null") {
  39957. return null;
  39958. }
  39959. // Only convert to a number if it doesn't change the string
  39960. if (data === +data + "") {
  39961. return +data;
  39962. }
  39963. if (rbrace.test(data)) {
  39964. return JSON.parse(data);
  39965. }
  39966. return data;
  39967. }
  39968. function dataAttr(elem, key, data) {
  39969. var name;
  39970. // If nothing was found internally, try to fetch any
  39971. // data from the HTML5 data-* attribute
  39972. if (data === undefined && elem.nodeType === 1) {
  39973. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  39974. data = elem.getAttribute(name);
  39975. if (typeof data === "string") {
  39976. try {
  39977. data = getData(data);
  39978. } catch (e) {}
  39979. // Make sure we set the data so it isn't changed later
  39980. dataUser.set(elem, key, data);
  39981. } else {
  39982. data = undefined;
  39983. }
  39984. }
  39985. return data;
  39986. }
  39987. jQuery.extend({
  39988. hasData: function hasData(elem) {
  39989. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  39990. },
  39991. data: function data(elem, name, _data) {
  39992. return dataUser.access(elem, name, _data);
  39993. },
  39994. removeData: function removeData(elem, name) {
  39995. dataUser.remove(elem, name);
  39996. },
  39997. // TODO: Now that all calls to _data and _removeData have been replaced
  39998. // with direct calls to dataPriv methods, these can be deprecated.
  39999. _data: function _data(elem, name, data) {
  40000. return dataPriv.access(elem, name, data);
  40001. },
  40002. _removeData: function _removeData(elem, name) {
  40003. dataPriv.remove(elem, name);
  40004. }
  40005. });
  40006. jQuery.fn.extend({
  40007. data: function data(key, value) {
  40008. var i,
  40009. name,
  40010. data,
  40011. elem = this[0],
  40012. attrs = elem && elem.attributes;
  40013. // Gets all values
  40014. if (key === undefined) {
  40015. if (this.length) {
  40016. data = dataUser.get(elem);
  40017. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  40018. i = attrs.length;
  40019. while (i--) {
  40020. // Support: IE 11 only
  40021. // The attrs elements can be null (#14894)
  40022. if (attrs[i]) {
  40023. name = attrs[i].name;
  40024. if (name.indexOf("data-") === 0) {
  40025. name = camelCase(name.slice(5));
  40026. dataAttr(elem, name, data[name]);
  40027. }
  40028. }
  40029. }
  40030. dataPriv.set(elem, "hasDataAttrs", true);
  40031. }
  40032. }
  40033. return data;
  40034. }
  40035. // Sets multiple values
  40036. if ((typeof key === "undefined" ? "undefined" : _typeof(key)) === "object") {
  40037. return this.each(function () {
  40038. dataUser.set(this, key);
  40039. });
  40040. }
  40041. return access(this, function (value) {
  40042. var data;
  40043. // The calling jQuery object (element matches) is not empty
  40044. // (and therefore has an element appears at this[ 0 ]) and the
  40045. // `value` parameter was not undefined. An empty jQuery object
  40046. // will result in `undefined` for elem = this[ 0 ] which will
  40047. // throw an exception if an attempt to read a data cache is made.
  40048. if (elem && value === undefined) {
  40049. // Attempt to get data from the cache
  40050. // The key will always be camelCased in Data
  40051. data = dataUser.get(elem, key);
  40052. if (data !== undefined) {
  40053. return data;
  40054. }
  40055. // Attempt to "discover" the data in
  40056. // HTML5 custom data-* attrs
  40057. data = dataAttr(elem, key);
  40058. if (data !== undefined) {
  40059. return data;
  40060. }
  40061. // We tried really hard, but the data doesn't exist.
  40062. return;
  40063. }
  40064. // Set the data...
  40065. this.each(function () {
  40066. // We always store the camelCased key
  40067. dataUser.set(this, key, value);
  40068. });
  40069. }, null, value, arguments.length > 1, null, true);
  40070. },
  40071. removeData: function removeData(key) {
  40072. return this.each(function () {
  40073. dataUser.remove(this, key);
  40074. });
  40075. }
  40076. });
  40077. jQuery.extend({
  40078. queue: function queue(elem, type, data) {
  40079. var queue;
  40080. if (elem) {
  40081. type = (type || "fx") + "queue";
  40082. queue = dataPriv.get(elem, type);
  40083. // Speed up dequeue by getting out quickly if this is just a lookup
  40084. if (data) {
  40085. if (!queue || Array.isArray(data)) {
  40086. queue = dataPriv.access(elem, type, jQuery.makeArray(data));
  40087. } else {
  40088. queue.push(data);
  40089. }
  40090. }
  40091. return queue || [];
  40092. }
  40093. },
  40094. dequeue: function dequeue(elem, type) {
  40095. type = type || "fx";
  40096. var queue = jQuery.queue(elem, type),
  40097. startLength = queue.length,
  40098. fn = queue.shift(),
  40099. hooks = jQuery._queueHooks(elem, type),
  40100. next = function next() {
  40101. jQuery.dequeue(elem, type);
  40102. };
  40103. // If the fx queue is dequeued, always remove the progress sentinel
  40104. if (fn === "inprogress") {
  40105. fn = queue.shift();
  40106. startLength--;
  40107. }
  40108. if (fn) {
  40109. // Add a progress sentinel to prevent the fx queue from being
  40110. // automatically dequeued
  40111. if (type === "fx") {
  40112. queue.unshift("inprogress");
  40113. }
  40114. // Clear up the last queue stop function
  40115. delete hooks.stop;
  40116. fn.call(elem, next, hooks);
  40117. }
  40118. if (!startLength && hooks) {
  40119. hooks.empty.fire();
  40120. }
  40121. },
  40122. // Not public - generate a queueHooks object, or return the current one
  40123. _queueHooks: function _queueHooks(elem, type) {
  40124. var key = type + "queueHooks";
  40125. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  40126. empty: jQuery.Callbacks("once memory").add(function () {
  40127. dataPriv.remove(elem, [type + "queue", key]);
  40128. })
  40129. });
  40130. }
  40131. });
  40132. jQuery.fn.extend({
  40133. queue: function queue(type, data) {
  40134. var setter = 2;
  40135. if (typeof type !== "string") {
  40136. data = type;
  40137. type = "fx";
  40138. setter--;
  40139. }
  40140. if (arguments.length < setter) {
  40141. return jQuery.queue(this[0], type);
  40142. }
  40143. return data === undefined ? this : this.each(function () {
  40144. var queue = jQuery.queue(this, type, data);
  40145. // Ensure a hooks for this queue
  40146. jQuery._queueHooks(this, type);
  40147. if (type === "fx" && queue[0] !== "inprogress") {
  40148. jQuery.dequeue(this, type);
  40149. }
  40150. });
  40151. },
  40152. dequeue: function dequeue(type) {
  40153. return this.each(function () {
  40154. jQuery.dequeue(this, type);
  40155. });
  40156. },
  40157. clearQueue: function clearQueue(type) {
  40158. return this.queue(type || "fx", []);
  40159. },
  40160. // Get a promise resolved when queues of a certain type
  40161. // are emptied (fx is the type by default)
  40162. promise: function promise(type, obj) {
  40163. var tmp,
  40164. count = 1,
  40165. defer = jQuery.Deferred(),
  40166. elements = this,
  40167. i = this.length,
  40168. resolve = function resolve() {
  40169. if (! --count) {
  40170. defer.resolveWith(elements, [elements]);
  40171. }
  40172. };
  40173. if (typeof type !== "string") {
  40174. obj = type;
  40175. type = undefined;
  40176. }
  40177. type = type || "fx";
  40178. while (i--) {
  40179. tmp = dataPriv.get(elements[i], type + "queueHooks");
  40180. if (tmp && tmp.empty) {
  40181. count++;
  40182. tmp.empty.add(resolve);
  40183. }
  40184. }
  40185. resolve();
  40186. return defer.promise(obj);
  40187. }
  40188. });
  40189. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  40190. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  40191. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  40192. var isHiddenWithinTree = function isHiddenWithinTree(elem, el) {
  40193. // isHiddenWithinTree might be called from jQuery#filter function;
  40194. // in that case, element will be second argument
  40195. elem = el || elem;
  40196. // Inline style trumps all
  40197. return elem.style.display === "none" || elem.style.display === "" &&
  40198. // Otherwise, check computed style
  40199. // Support: Firefox <=43 - 45
  40200. // Disconnected elements can have computed display: none, so first confirm that elem is
  40201. // in the document.
  40202. jQuery.contains(elem.ownerDocument, elem) && jQuery.css(elem, "display") === "none";
  40203. };
  40204. var swap = function swap(elem, options, callback, args) {
  40205. var ret,
  40206. name,
  40207. old = {};
  40208. // Remember the old values, and insert the new ones
  40209. for (name in options) {
  40210. old[name] = elem.style[name];
  40211. elem.style[name] = options[name];
  40212. }
  40213. ret = callback.apply(elem, args || []);
  40214. // Revert the old values
  40215. for (name in options) {
  40216. elem.style[name] = old[name];
  40217. }
  40218. return ret;
  40219. };
  40220. function adjustCSS(elem, prop, valueParts, tween) {
  40221. var adjusted,
  40222. scale,
  40223. maxIterations = 20,
  40224. currentValue = tween ? function () {
  40225. return tween.cur();
  40226. } : function () {
  40227. return jQuery.css(elem, prop, "");
  40228. },
  40229. initial = currentValue(),
  40230. unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
  40231. // Starting value computation is required for potential unit mismatches
  40232. initialInUnit = (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
  40233. if (initialInUnit && initialInUnit[3] !== unit) {
  40234. // Support: Firefox <=54
  40235. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  40236. initial = initial / 2;
  40237. // Trust units reported by jQuery.css
  40238. unit = unit || initialInUnit[3];
  40239. // Iteratively approximate from a nonzero starting point
  40240. initialInUnit = +initial || 1;
  40241. while (maxIterations--) {
  40242. // Evaluate and update our best guess (doubling guesses that zero out).
  40243. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  40244. jQuery.style(elem, prop, initialInUnit + unit);
  40245. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  40246. maxIterations = 0;
  40247. }
  40248. initialInUnit = initialInUnit / scale;
  40249. }
  40250. initialInUnit = initialInUnit * 2;
  40251. jQuery.style(elem, prop, initialInUnit + unit);
  40252. // Make sure we update the tween properties later on
  40253. valueParts = valueParts || [];
  40254. }
  40255. if (valueParts) {
  40256. initialInUnit = +initialInUnit || +initial || 0;
  40257. // Apply relative offset (+=/-=) if specified
  40258. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  40259. if (tween) {
  40260. tween.unit = unit;
  40261. tween.start = initialInUnit;
  40262. tween.end = adjusted;
  40263. }
  40264. }
  40265. return adjusted;
  40266. }
  40267. var defaultDisplayMap = {};
  40268. function getDefaultDisplay(elem) {
  40269. var temp,
  40270. doc = elem.ownerDocument,
  40271. nodeName = elem.nodeName,
  40272. display = defaultDisplayMap[nodeName];
  40273. if (display) {
  40274. return display;
  40275. }
  40276. temp = doc.body.appendChild(doc.createElement(nodeName));
  40277. display = jQuery.css(temp, "display");
  40278. temp.parentNode.removeChild(temp);
  40279. if (display === "none") {
  40280. display = "block";
  40281. }
  40282. defaultDisplayMap[nodeName] = display;
  40283. return display;
  40284. }
  40285. function showHide(elements, show) {
  40286. var display,
  40287. elem,
  40288. values = [],
  40289. index = 0,
  40290. length = elements.length;
  40291. // Determine new display value for elements that need to change
  40292. for (; index < length; index++) {
  40293. elem = elements[index];
  40294. if (!elem.style) {
  40295. continue;
  40296. }
  40297. display = elem.style.display;
  40298. if (show) {
  40299. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  40300. // check is required in this first loop unless we have a nonempty display value (either
  40301. // inline or about-to-be-restored)
  40302. if (display === "none") {
  40303. values[index] = dataPriv.get(elem, "display") || null;
  40304. if (!values[index]) {
  40305. elem.style.display = "";
  40306. }
  40307. }
  40308. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  40309. values[index] = getDefaultDisplay(elem);
  40310. }
  40311. } else {
  40312. if (display !== "none") {
  40313. values[index] = "none";
  40314. // Remember what we're overwriting
  40315. dataPriv.set(elem, "display", display);
  40316. }
  40317. }
  40318. }
  40319. // Set the display of the elements in a second loop to avoid constant reflow
  40320. for (index = 0; index < length; index++) {
  40321. if (values[index] != null) {
  40322. elements[index].style.display = values[index];
  40323. }
  40324. }
  40325. return elements;
  40326. }
  40327. jQuery.fn.extend({
  40328. show: function show() {
  40329. return showHide(this, true);
  40330. },
  40331. hide: function hide() {
  40332. return showHide(this);
  40333. },
  40334. toggle: function toggle(state) {
  40335. if (typeof state === "boolean") {
  40336. return state ? this.show() : this.hide();
  40337. }
  40338. return this.each(function () {
  40339. if (isHiddenWithinTree(this)) {
  40340. jQuery(this).show();
  40341. } else {
  40342. jQuery(this).hide();
  40343. }
  40344. });
  40345. }
  40346. });
  40347. var rcheckableType = /^(?:checkbox|radio)$/i;
  40348. var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i;
  40349. var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  40350. // We have to close these tags to support XHTML (#13200)
  40351. var wrapMap = {
  40352. // Support: IE <=9 only
  40353. option: [1, "<select multiple='multiple'>", "</select>"],
  40354. // XHTML parsers do not magically insert elements in the
  40355. // same way that tag soup parsers do. So we cannot shorten
  40356. // this by omitting <tbody> or other required elements.
  40357. thead: [1, "<table>", "</table>"],
  40358. col: [2, "<table><colgroup>", "</colgroup></table>"],
  40359. tr: [2, "<table><tbody>", "</tbody></table>"],
  40360. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  40361. _default: [0, "", ""]
  40362. };
  40363. // Support: IE <=9 only
  40364. wrapMap.optgroup = wrapMap.option;
  40365. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  40366. wrapMap.th = wrapMap.td;
  40367. function getAll(context, tag) {
  40368. // Support: IE <=9 - 11 only
  40369. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  40370. var ret;
  40371. if (typeof context.getElementsByTagName !== "undefined") {
  40372. ret = context.getElementsByTagName(tag || "*");
  40373. } else if (typeof context.querySelectorAll !== "undefined") {
  40374. ret = context.querySelectorAll(tag || "*");
  40375. } else {
  40376. ret = [];
  40377. }
  40378. if (tag === undefined || tag && nodeName(context, tag)) {
  40379. return jQuery.merge([context], ret);
  40380. }
  40381. return ret;
  40382. }
  40383. // Mark scripts as having already been evaluated
  40384. function setGlobalEval(elems, refElements) {
  40385. var i = 0,
  40386. l = elems.length;
  40387. for (; i < l; i++) {
  40388. dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval"));
  40389. }
  40390. }
  40391. var rhtml = /<|&#?\w+;/;
  40392. function buildFragment(elems, context, scripts, selection, ignored) {
  40393. var elem,
  40394. tmp,
  40395. tag,
  40396. wrap,
  40397. contains,
  40398. j,
  40399. fragment = context.createDocumentFragment(),
  40400. nodes = [],
  40401. i = 0,
  40402. l = elems.length;
  40403. for (; i < l; i++) {
  40404. elem = elems[i];
  40405. if (elem || elem === 0) {
  40406. // Add nodes directly
  40407. if (toType(elem) === "object") {
  40408. // Support: Android <=4.0 only, PhantomJS 1 only
  40409. // push.apply(_, arraylike) throws on ancient WebKit
  40410. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  40411. // Convert non-html into a text node
  40412. } else if (!rhtml.test(elem)) {
  40413. nodes.push(context.createTextNode(elem));
  40414. // Convert html into DOM nodes
  40415. } else {
  40416. tmp = tmp || fragment.appendChild(context.createElement("div"));
  40417. // Deserialize a standard representation
  40418. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  40419. wrap = wrapMap[tag] || wrapMap._default;
  40420. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  40421. // Descend through wrappers to the right content
  40422. j = wrap[0];
  40423. while (j--) {
  40424. tmp = tmp.lastChild;
  40425. }
  40426. // Support: Android <=4.0 only, PhantomJS 1 only
  40427. // push.apply(_, arraylike) throws on ancient WebKit
  40428. jQuery.merge(nodes, tmp.childNodes);
  40429. // Remember the top-level container
  40430. tmp = fragment.firstChild;
  40431. // Ensure the created nodes are orphaned (#12392)
  40432. tmp.textContent = "";
  40433. }
  40434. }
  40435. }
  40436. // Remove wrapper from fragment
  40437. fragment.textContent = "";
  40438. i = 0;
  40439. while (elem = nodes[i++]) {
  40440. // Skip elements already in the context collection (trac-4087)
  40441. if (selection && jQuery.inArray(elem, selection) > -1) {
  40442. if (ignored) {
  40443. ignored.push(elem);
  40444. }
  40445. continue;
  40446. }
  40447. contains = jQuery.contains(elem.ownerDocument, elem);
  40448. // Append to fragment
  40449. tmp = getAll(fragment.appendChild(elem), "script");
  40450. // Preserve script evaluation history
  40451. if (contains) {
  40452. setGlobalEval(tmp);
  40453. }
  40454. // Capture executables
  40455. if (scripts) {
  40456. j = 0;
  40457. while (elem = tmp[j++]) {
  40458. if (rscriptType.test(elem.type || "")) {
  40459. scripts.push(elem);
  40460. }
  40461. }
  40462. }
  40463. }
  40464. return fragment;
  40465. }
  40466. (function () {
  40467. var fragment = document.createDocumentFragment(),
  40468. div = fragment.appendChild(document.createElement("div")),
  40469. input = document.createElement("input");
  40470. // Support: Android 4.0 - 4.3 only
  40471. // Check state lost if the name is set (#11217)
  40472. // Support: Windows Web Apps (WWA)
  40473. // `name` and `type` must use .setAttribute for WWA (#14901)
  40474. input.setAttribute("type", "radio");
  40475. input.setAttribute("checked", "checked");
  40476. input.setAttribute("name", "t");
  40477. div.appendChild(input);
  40478. // Support: Android <=4.1 only
  40479. // Older WebKit doesn't clone checked state correctly in fragments
  40480. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  40481. // Support: IE <=11 only
  40482. // Make sure textarea (and checkbox) defaultValue is properly cloned
  40483. div.innerHTML = "<textarea>x</textarea>";
  40484. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  40485. })();
  40486. var documentElement = document.documentElement;
  40487. var rkeyEvent = /^key/,
  40488. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  40489. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  40490. function returnTrue() {
  40491. return true;
  40492. }
  40493. function returnFalse() {
  40494. return false;
  40495. }
  40496. // Support: IE <=9 only
  40497. // See #13393 for more info
  40498. function safeActiveElement() {
  40499. try {
  40500. return document.activeElement;
  40501. } catch (err) {}
  40502. }
  40503. function _on(elem, types, selector, data, fn, one) {
  40504. var origFn, type;
  40505. // Types can be a map of types/handlers
  40506. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  40507. // ( types-Object, selector, data )
  40508. if (typeof selector !== "string") {
  40509. // ( types-Object, data )
  40510. data = data || selector;
  40511. selector = undefined;
  40512. }
  40513. for (type in types) {
  40514. _on(elem, type, selector, data, types[type], one);
  40515. }
  40516. return elem;
  40517. }
  40518. if (data == null && fn == null) {
  40519. // ( types, fn )
  40520. fn = selector;
  40521. data = selector = undefined;
  40522. } else if (fn == null) {
  40523. if (typeof selector === "string") {
  40524. // ( types, selector, fn )
  40525. fn = data;
  40526. data = undefined;
  40527. } else {
  40528. // ( types, data, fn )
  40529. fn = data;
  40530. data = selector;
  40531. selector = undefined;
  40532. }
  40533. }
  40534. if (fn === false) {
  40535. fn = returnFalse;
  40536. } else if (!fn) {
  40537. return elem;
  40538. }
  40539. if (one === 1) {
  40540. origFn = fn;
  40541. fn = function fn(event) {
  40542. // Can use an empty set, since event contains the info
  40543. jQuery().off(event);
  40544. return origFn.apply(this, arguments);
  40545. };
  40546. // Use same guid so caller can remove using origFn
  40547. fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  40548. }
  40549. return elem.each(function () {
  40550. jQuery.event.add(this, types, fn, data, selector);
  40551. });
  40552. }
  40553. /*
  40554. * Helper functions for managing events -- not part of the public interface.
  40555. * Props to Dean Edwards' addEvent library for many of the ideas.
  40556. */
  40557. jQuery.event = {
  40558. global: {},
  40559. add: function add(elem, types, handler, data, selector) {
  40560. var handleObjIn,
  40561. eventHandle,
  40562. tmp,
  40563. events,
  40564. t,
  40565. handleObj,
  40566. special,
  40567. handlers,
  40568. type,
  40569. namespaces,
  40570. origType,
  40571. elemData = dataPriv.get(elem);
  40572. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  40573. if (!elemData) {
  40574. return;
  40575. }
  40576. // Caller can pass in an object of custom data in lieu of the handler
  40577. if (handler.handler) {
  40578. handleObjIn = handler;
  40579. handler = handleObjIn.handler;
  40580. selector = handleObjIn.selector;
  40581. }
  40582. // Ensure that invalid selectors throw exceptions at attach time
  40583. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  40584. if (selector) {
  40585. jQuery.find.matchesSelector(documentElement, selector);
  40586. }
  40587. // Make sure that the handler has a unique ID, used to find/remove it later
  40588. if (!handler.guid) {
  40589. handler.guid = jQuery.guid++;
  40590. }
  40591. // Init the element's event structure and main handler, if this is the first
  40592. if (!(events = elemData.events)) {
  40593. events = elemData.events = {};
  40594. }
  40595. if (!(eventHandle = elemData.handle)) {
  40596. eventHandle = elemData.handle = function (e) {
  40597. // Discard the second event of a jQuery.event.trigger() and
  40598. // when an event is called after a page has unloaded
  40599. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;
  40600. };
  40601. }
  40602. // Handle multiple events separated by a space
  40603. types = (types || "").match(rnothtmlwhite) || [""];
  40604. t = types.length;
  40605. while (t--) {
  40606. tmp = rtypenamespace.exec(types[t]) || [];
  40607. type = origType = tmp[1];
  40608. namespaces = (tmp[2] || "").split(".").sort();
  40609. // There *must* be a type, no attaching namespace-only handlers
  40610. if (!type) {
  40611. continue;
  40612. }
  40613. // If event changes its type, use the special event handlers for the changed type
  40614. special = jQuery.event.special[type] || {};
  40615. // If selector defined, determine special event api type, otherwise given type
  40616. type = (selector ? special.delegateType : special.bindType) || type;
  40617. // Update special based on newly reset type
  40618. special = jQuery.event.special[type] || {};
  40619. // handleObj is passed to all event handlers
  40620. handleObj = jQuery.extend({
  40621. type: type,
  40622. origType: origType,
  40623. data: data,
  40624. handler: handler,
  40625. guid: handler.guid,
  40626. selector: selector,
  40627. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  40628. namespace: namespaces.join(".")
  40629. }, handleObjIn);
  40630. // Init the event handler queue if we're the first
  40631. if (!(handlers = events[type])) {
  40632. handlers = events[type] = [];
  40633. handlers.delegateCount = 0;
  40634. // Only use addEventListener if the special events handler returns false
  40635. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  40636. if (elem.addEventListener) {
  40637. elem.addEventListener(type, eventHandle);
  40638. }
  40639. }
  40640. }
  40641. if (special.add) {
  40642. special.add.call(elem, handleObj);
  40643. if (!handleObj.handler.guid) {
  40644. handleObj.handler.guid = handler.guid;
  40645. }
  40646. }
  40647. // Add to the element's handler list, delegates in front
  40648. if (selector) {
  40649. handlers.splice(handlers.delegateCount++, 0, handleObj);
  40650. } else {
  40651. handlers.push(handleObj);
  40652. }
  40653. // Keep track of which events have ever been used, for event optimization
  40654. jQuery.event.global[type] = true;
  40655. }
  40656. },
  40657. // Detach an event or set of events from an element
  40658. remove: function remove(elem, types, handler, selector, mappedTypes) {
  40659. var j,
  40660. origCount,
  40661. tmp,
  40662. events,
  40663. t,
  40664. handleObj,
  40665. special,
  40666. handlers,
  40667. type,
  40668. namespaces,
  40669. origType,
  40670. elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  40671. if (!elemData || !(events = elemData.events)) {
  40672. return;
  40673. }
  40674. // Once for each type.namespace in types; type may be omitted
  40675. types = (types || "").match(rnothtmlwhite) || [""];
  40676. t = types.length;
  40677. while (t--) {
  40678. tmp = rtypenamespace.exec(types[t]) || [];
  40679. type = origType = tmp[1];
  40680. namespaces = (tmp[2] || "").split(".").sort();
  40681. // Unbind all events (on this namespace, if provided) for the element
  40682. if (!type) {
  40683. for (type in events) {
  40684. jQuery.event.remove(elem, type + types[t], handler, selector, true);
  40685. }
  40686. continue;
  40687. }
  40688. special = jQuery.event.special[type] || {};
  40689. type = (selector ? special.delegateType : special.bindType) || type;
  40690. handlers = events[type] || [];
  40691. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  40692. // Remove matching events
  40693. origCount = j = handlers.length;
  40694. while (j--) {
  40695. handleObj = handlers[j];
  40696. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  40697. handlers.splice(j, 1);
  40698. if (handleObj.selector) {
  40699. handlers.delegateCount--;
  40700. }
  40701. if (special.remove) {
  40702. special.remove.call(elem, handleObj);
  40703. }
  40704. }
  40705. }
  40706. // Remove generic event handler if we removed something and no more handlers exist
  40707. // (avoids potential for endless recursion during removal of special event handlers)
  40708. if (origCount && !handlers.length) {
  40709. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  40710. jQuery.removeEvent(elem, type, elemData.handle);
  40711. }
  40712. delete events[type];
  40713. }
  40714. }
  40715. // Remove data and the expando if it's no longer used
  40716. if (jQuery.isEmptyObject(events)) {
  40717. dataPriv.remove(elem, "handle events");
  40718. }
  40719. },
  40720. dispatch: function dispatch(nativeEvent) {
  40721. // Make a writable jQuery.Event from the native event object
  40722. var event = jQuery.event.fix(nativeEvent);
  40723. var i,
  40724. j,
  40725. ret,
  40726. matched,
  40727. handleObj,
  40728. handlerQueue,
  40729. args = new Array(arguments.length),
  40730. handlers = (dataPriv.get(this, "events") || {})[event.type] || [],
  40731. special = jQuery.event.special[event.type] || {};
  40732. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  40733. args[0] = event;
  40734. for (i = 1; i < arguments.length; i++) {
  40735. args[i] = arguments[i];
  40736. }
  40737. event.delegateTarget = this;
  40738. // Call the preDispatch hook for the mapped type, and let it bail if desired
  40739. if (special.preDispatch && special.preDispatch.call(this, event) === false) {
  40740. return;
  40741. }
  40742. // Determine handlers
  40743. handlerQueue = jQuery.event.handlers.call(this, event, handlers);
  40744. // Run delegates first; they may want to stop propagation beneath us
  40745. i = 0;
  40746. while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
  40747. event.currentTarget = matched.elem;
  40748. j = 0;
  40749. while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
  40750. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  40751. // a subset or equal to those in the bound event (both can have no namespace).
  40752. if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {
  40753. event.handleObj = handleObj;
  40754. event.data = handleObj.data;
  40755. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  40756. if (ret !== undefined) {
  40757. if ((event.result = ret) === false) {
  40758. event.preventDefault();
  40759. event.stopPropagation();
  40760. }
  40761. }
  40762. }
  40763. }
  40764. }
  40765. // Call the postDispatch hook for the mapped type
  40766. if (special.postDispatch) {
  40767. special.postDispatch.call(this, event);
  40768. }
  40769. return event.result;
  40770. },
  40771. handlers: function handlers(event, _handlers) {
  40772. var i,
  40773. handleObj,
  40774. sel,
  40775. matchedHandlers,
  40776. matchedSelectors,
  40777. handlerQueue = [],
  40778. delegateCount = _handlers.delegateCount,
  40779. cur = event.target;
  40780. // Find delegate handlers
  40781. if (delegateCount &&
  40782. // Support: IE <=9
  40783. // Black-hole SVG <use> instance trees (trac-13180)
  40784. cur.nodeType &&
  40785. // Support: Firefox <=42
  40786. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  40787. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  40788. // Support: IE 11 only
  40789. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  40790. !(event.type === "click" && event.button >= 1)) {
  40791. for (; cur !== this; cur = cur.parentNode || this) {
  40792. // Don't check non-elements (#13208)
  40793. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  40794. if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
  40795. matchedHandlers = [];
  40796. matchedSelectors = {};
  40797. for (i = 0; i < delegateCount; i++) {
  40798. handleObj = _handlers[i];
  40799. // Don't conflict with Object.prototype properties (#13203)
  40800. sel = handleObj.selector + " ";
  40801. if (matchedSelectors[sel] === undefined) {
  40802. matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  40803. }
  40804. if (matchedSelectors[sel]) {
  40805. matchedHandlers.push(handleObj);
  40806. }
  40807. }
  40808. if (matchedHandlers.length) {
  40809. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  40810. }
  40811. }
  40812. }
  40813. }
  40814. // Add the remaining (directly-bound) handlers
  40815. cur = this;
  40816. if (delegateCount < _handlers.length) {
  40817. handlerQueue.push({ elem: cur, handlers: _handlers.slice(delegateCount) });
  40818. }
  40819. return handlerQueue;
  40820. },
  40821. addProp: function addProp(name, hook) {
  40822. Object.defineProperty(jQuery.Event.prototype, name, {
  40823. enumerable: true,
  40824. configurable: true,
  40825. get: isFunction(hook) ? function () {
  40826. if (this.originalEvent) {
  40827. return hook(this.originalEvent);
  40828. }
  40829. } : function () {
  40830. if (this.originalEvent) {
  40831. return this.originalEvent[name];
  40832. }
  40833. },
  40834. set: function set(value) {
  40835. Object.defineProperty(this, name, {
  40836. enumerable: true,
  40837. configurable: true,
  40838. writable: true,
  40839. value: value
  40840. });
  40841. }
  40842. });
  40843. },
  40844. fix: function fix(originalEvent) {
  40845. return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
  40846. },
  40847. special: {
  40848. load: {
  40849. // Prevent triggered image.load events from bubbling to window.load
  40850. noBubble: true
  40851. },
  40852. focus: {
  40853. // Fire native event if possible so blur/focus sequence is correct
  40854. trigger: function trigger() {
  40855. if (this !== safeActiveElement() && this.focus) {
  40856. this.focus();
  40857. return false;
  40858. }
  40859. },
  40860. delegateType: "focusin"
  40861. },
  40862. blur: {
  40863. trigger: function trigger() {
  40864. if (this === safeActiveElement() && this.blur) {
  40865. this.blur();
  40866. return false;
  40867. }
  40868. },
  40869. delegateType: "focusout"
  40870. },
  40871. click: {
  40872. // For checkbox, fire native event so checked state will be right
  40873. trigger: function trigger() {
  40874. if (this.type === "checkbox" && this.click && nodeName(this, "input")) {
  40875. this.click();
  40876. return false;
  40877. }
  40878. },
  40879. // For cross-browser consistency, don't fire native .click() on links
  40880. _default: function _default(event) {
  40881. return nodeName(event.target, "a");
  40882. }
  40883. },
  40884. beforeunload: {
  40885. postDispatch: function postDispatch(event) {
  40886. // Support: Firefox 20+
  40887. // Firefox doesn't alert if the returnValue field is not set.
  40888. if (event.result !== undefined && event.originalEvent) {
  40889. event.originalEvent.returnValue = event.result;
  40890. }
  40891. }
  40892. }
  40893. }
  40894. };
  40895. jQuery.removeEvent = function (elem, type, handle) {
  40896. // This "if" is needed for plain objects
  40897. if (elem.removeEventListener) {
  40898. elem.removeEventListener(type, handle);
  40899. }
  40900. };
  40901. jQuery.Event = function (src, props) {
  40902. // Allow instantiation without the 'new' keyword
  40903. if (!(this instanceof jQuery.Event)) {
  40904. return new jQuery.Event(src, props);
  40905. }
  40906. // Event object
  40907. if (src && src.type) {
  40908. this.originalEvent = src;
  40909. this.type = src.type;
  40910. // Events bubbling up the document may have been marked as prevented
  40911. // by a handler lower down the tree; reflect the correct value.
  40912. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&
  40913. // Support: Android <=2.3 only
  40914. src.returnValue === false ? returnTrue : returnFalse;
  40915. // Create target properties
  40916. // Support: Safari <=6 - 7 only
  40917. // Target should not be a text node (#504, #13143)
  40918. this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
  40919. this.currentTarget = src.currentTarget;
  40920. this.relatedTarget = src.relatedTarget;
  40921. // Event type
  40922. } else {
  40923. this.type = src;
  40924. }
  40925. // Put explicitly provided properties onto the event object
  40926. if (props) {
  40927. jQuery.extend(this, props);
  40928. }
  40929. // Create a timestamp if incoming event doesn't have one
  40930. this.timeStamp = src && src.timeStamp || Date.now();
  40931. // Mark it as fixed
  40932. this[jQuery.expando] = true;
  40933. };
  40934. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  40935. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  40936. jQuery.Event.prototype = {
  40937. constructor: jQuery.Event,
  40938. isDefaultPrevented: returnFalse,
  40939. isPropagationStopped: returnFalse,
  40940. isImmediatePropagationStopped: returnFalse,
  40941. isSimulated: false,
  40942. preventDefault: function preventDefault() {
  40943. var e = this.originalEvent;
  40944. this.isDefaultPrevented = returnTrue;
  40945. if (e && !this.isSimulated) {
  40946. e.preventDefault();
  40947. }
  40948. },
  40949. stopPropagation: function stopPropagation() {
  40950. var e = this.originalEvent;
  40951. this.isPropagationStopped = returnTrue;
  40952. if (e && !this.isSimulated) {
  40953. e.stopPropagation();
  40954. }
  40955. },
  40956. stopImmediatePropagation: function stopImmediatePropagation() {
  40957. var e = this.originalEvent;
  40958. this.isImmediatePropagationStopped = returnTrue;
  40959. if (e && !this.isSimulated) {
  40960. e.stopImmediatePropagation();
  40961. }
  40962. this.stopPropagation();
  40963. }
  40964. };
  40965. // Includes all common event props including KeyEvent and MouseEvent specific props
  40966. jQuery.each({
  40967. altKey: true,
  40968. bubbles: true,
  40969. cancelable: true,
  40970. changedTouches: true,
  40971. ctrlKey: true,
  40972. detail: true,
  40973. eventPhase: true,
  40974. metaKey: true,
  40975. pageX: true,
  40976. pageY: true,
  40977. shiftKey: true,
  40978. view: true,
  40979. "char": true,
  40980. charCode: true,
  40981. key: true,
  40982. keyCode: true,
  40983. button: true,
  40984. buttons: true,
  40985. clientX: true,
  40986. clientY: true,
  40987. offsetX: true,
  40988. offsetY: true,
  40989. pointerId: true,
  40990. pointerType: true,
  40991. screenX: true,
  40992. screenY: true,
  40993. targetTouches: true,
  40994. toElement: true,
  40995. touches: true,
  40996. which: function which(event) {
  40997. var button = event.button;
  40998. // Add which for key events
  40999. if (event.which == null && rkeyEvent.test(event.type)) {
  41000. return event.charCode != null ? event.charCode : event.keyCode;
  41001. }
  41002. // Add which for click: 1 === left; 2 === middle; 3 === right
  41003. if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {
  41004. if (button & 1) {
  41005. return 1;
  41006. }
  41007. if (button & 2) {
  41008. return 3;
  41009. }
  41010. if (button & 4) {
  41011. return 2;
  41012. }
  41013. return 0;
  41014. }
  41015. return event.which;
  41016. }
  41017. }, jQuery.event.addProp);
  41018. // Create mouseenter/leave events using mouseover/out and event-time checks
  41019. // so that event delegation works in jQuery.
  41020. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  41021. //
  41022. // Support: Safari 7 only
  41023. // Safari sends mouseenter too often; see:
  41024. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  41025. // for the description of the bug (it existed in older Chrome versions as well).
  41026. jQuery.each({
  41027. mouseenter: "mouseover",
  41028. mouseleave: "mouseout",
  41029. pointerenter: "pointerover",
  41030. pointerleave: "pointerout"
  41031. }, function (orig, fix) {
  41032. jQuery.event.special[orig] = {
  41033. delegateType: fix,
  41034. bindType: fix,
  41035. handle: function handle(event) {
  41036. var ret,
  41037. target = this,
  41038. related = event.relatedTarget,
  41039. handleObj = event.handleObj;
  41040. // For mouseenter/leave call the handler if related is outside the target.
  41041. // NB: No relatedTarget if the mouse left/entered the browser window
  41042. if (!related || related !== target && !jQuery.contains(target, related)) {
  41043. event.type = handleObj.origType;
  41044. ret = handleObj.handler.apply(this, arguments);
  41045. event.type = fix;
  41046. }
  41047. return ret;
  41048. }
  41049. };
  41050. });
  41051. jQuery.fn.extend({
  41052. on: function on(types, selector, data, fn) {
  41053. return _on(this, types, selector, data, fn);
  41054. },
  41055. one: function one(types, selector, data, fn) {
  41056. return _on(this, types, selector, data, fn, 1);
  41057. },
  41058. off: function off(types, selector, fn) {
  41059. var handleObj, type;
  41060. if (types && types.preventDefault && types.handleObj) {
  41061. // ( event ) dispatched jQuery.Event
  41062. handleObj = types.handleObj;
  41063. jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
  41064. return this;
  41065. }
  41066. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  41067. // ( types-object [, selector] )
  41068. for (type in types) {
  41069. this.off(type, selector, types[type]);
  41070. }
  41071. return this;
  41072. }
  41073. if (selector === false || typeof selector === "function") {
  41074. // ( types [, fn] )
  41075. fn = selector;
  41076. selector = undefined;
  41077. }
  41078. if (fn === false) {
  41079. fn = returnFalse;
  41080. }
  41081. return this.each(function () {
  41082. jQuery.event.remove(this, types, fn, selector);
  41083. });
  41084. }
  41085. });
  41086. var
  41087. /* eslint-disable max-len */
  41088. // See https://github.com/eslint/eslint/issues/3229
  41089. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  41090. /* eslint-enable */
  41091. // Support: IE <=10 - 11, Edge 12 - 13 only
  41092. // In IE/Edge using regex groups here causes severe slowdowns.
  41093. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  41094. rnoInnerhtml = /<script|<style|<link/i,
  41095. // checked="checked" or checked
  41096. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  41097. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  41098. // Prefer a tbody over its parent table for containing new rows
  41099. function manipulationTarget(elem, content) {
  41100. if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  41101. return jQuery(elem).children("tbody")[0] || elem;
  41102. }
  41103. return elem;
  41104. }
  41105. // Replace/restore the type attribute of script elements for safe DOM manipulation
  41106. function disableScript(elem) {
  41107. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  41108. return elem;
  41109. }
  41110. function restoreScript(elem) {
  41111. if ((elem.type || "").slice(0, 5) === "true/") {
  41112. elem.type = elem.type.slice(5);
  41113. } else {
  41114. elem.removeAttribute("type");
  41115. }
  41116. return elem;
  41117. }
  41118. function cloneCopyEvent(src, dest) {
  41119. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  41120. if (dest.nodeType !== 1) {
  41121. return;
  41122. }
  41123. // 1. Copy private data: events, handlers, etc.
  41124. if (dataPriv.hasData(src)) {
  41125. pdataOld = dataPriv.access(src);
  41126. pdataCur = dataPriv.set(dest, pdataOld);
  41127. events = pdataOld.events;
  41128. if (events) {
  41129. delete pdataCur.handle;
  41130. pdataCur.events = {};
  41131. for (type in events) {
  41132. for (i = 0, l = events[type].length; i < l; i++) {
  41133. jQuery.event.add(dest, type, events[type][i]);
  41134. }
  41135. }
  41136. }
  41137. }
  41138. // 2. Copy user data
  41139. if (dataUser.hasData(src)) {
  41140. udataOld = dataUser.access(src);
  41141. udataCur = jQuery.extend({}, udataOld);
  41142. dataUser.set(dest, udataCur);
  41143. }
  41144. }
  41145. // Fix IE bugs, see support tests
  41146. function fixInput(src, dest) {
  41147. var nodeName = dest.nodeName.toLowerCase();
  41148. // Fails to persist the checked state of a cloned checkbox or radio button.
  41149. if (nodeName === "input" && rcheckableType.test(src.type)) {
  41150. dest.checked = src.checked;
  41151. // Fails to return the selected option to the default selected state when cloning options
  41152. } else if (nodeName === "input" || nodeName === "textarea") {
  41153. dest.defaultValue = src.defaultValue;
  41154. }
  41155. }
  41156. function domManip(collection, args, callback, ignored) {
  41157. // Flatten any nested arrays
  41158. args = concat.apply([], args);
  41159. var fragment,
  41160. first,
  41161. scripts,
  41162. hasScripts,
  41163. node,
  41164. doc,
  41165. i = 0,
  41166. l = collection.length,
  41167. iNoClone = l - 1,
  41168. value = args[0],
  41169. valueIsFunction = isFunction(value);
  41170. // We can't cloneNode fragments that contain checked, in WebKit
  41171. if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
  41172. return collection.each(function (index) {
  41173. var self = collection.eq(index);
  41174. if (valueIsFunction) {
  41175. args[0] = value.call(this, index, self.html());
  41176. }
  41177. domManip(self, args, callback, ignored);
  41178. });
  41179. }
  41180. if (l) {
  41181. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  41182. first = fragment.firstChild;
  41183. if (fragment.childNodes.length === 1) {
  41184. fragment = first;
  41185. }
  41186. // Require either new content or an interest in ignored elements to invoke the callback
  41187. if (first || ignored) {
  41188. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  41189. hasScripts = scripts.length;
  41190. // Use the original fragment for the last item
  41191. // instead of the first because it can end up
  41192. // being emptied incorrectly in certain situations (#8070).
  41193. for (; i < l; i++) {
  41194. node = fragment;
  41195. if (i !== iNoClone) {
  41196. node = jQuery.clone(node, true, true);
  41197. // Keep references to cloned scripts for later restoration
  41198. if (hasScripts) {
  41199. // Support: Android <=4.0 only, PhantomJS 1 only
  41200. // push.apply(_, arraylike) throws on ancient WebKit
  41201. jQuery.merge(scripts, getAll(node, "script"));
  41202. }
  41203. }
  41204. callback.call(collection[i], node, i);
  41205. }
  41206. if (hasScripts) {
  41207. doc = scripts[scripts.length - 1].ownerDocument;
  41208. // Reenable scripts
  41209. jQuery.map(scripts, restoreScript);
  41210. // Evaluate executable scripts on first document insertion
  41211. for (i = 0; i < hasScripts; i++) {
  41212. node = scripts[i];
  41213. if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
  41214. if (node.src && (node.type || "").toLowerCase() !== "module") {
  41215. // Optional AJAX dependency, but won't run scripts if not present
  41216. if (jQuery._evalUrl) {
  41217. jQuery._evalUrl(node.src);
  41218. }
  41219. } else {
  41220. DOMEval(node.textContent.replace(rcleanScript, ""), doc, node);
  41221. }
  41222. }
  41223. }
  41224. }
  41225. }
  41226. }
  41227. return collection;
  41228. }
  41229. function _remove(elem, selector, keepData) {
  41230. var node,
  41231. nodes = selector ? jQuery.filter(selector, elem) : elem,
  41232. i = 0;
  41233. for (; (node = nodes[i]) != null; i++) {
  41234. if (!keepData && node.nodeType === 1) {
  41235. jQuery.cleanData(getAll(node));
  41236. }
  41237. if (node.parentNode) {
  41238. if (keepData && jQuery.contains(node.ownerDocument, node)) {
  41239. setGlobalEval(getAll(node, "script"));
  41240. }
  41241. node.parentNode.removeChild(node);
  41242. }
  41243. }
  41244. return elem;
  41245. }
  41246. jQuery.extend({
  41247. htmlPrefilter: function htmlPrefilter(html) {
  41248. return html.replace(rxhtmlTag, "<$1></$2>");
  41249. },
  41250. clone: function clone(elem, dataAndEvents, deepDataAndEvents) {
  41251. var i,
  41252. l,
  41253. srcElements,
  41254. destElements,
  41255. clone = elem.cloneNode(true),
  41256. inPage = jQuery.contains(elem.ownerDocument, elem);
  41257. // Fix IE cloning issues
  41258. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  41259. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  41260. destElements = getAll(clone);
  41261. srcElements = getAll(elem);
  41262. for (i = 0, l = srcElements.length; i < l; i++) {
  41263. fixInput(srcElements[i], destElements[i]);
  41264. }
  41265. }
  41266. // Copy the events from the original to the clone
  41267. if (dataAndEvents) {
  41268. if (deepDataAndEvents) {
  41269. srcElements = srcElements || getAll(elem);
  41270. destElements = destElements || getAll(clone);
  41271. for (i = 0, l = srcElements.length; i < l; i++) {
  41272. cloneCopyEvent(srcElements[i], destElements[i]);
  41273. }
  41274. } else {
  41275. cloneCopyEvent(elem, clone);
  41276. }
  41277. }
  41278. // Preserve script evaluation history
  41279. destElements = getAll(clone, "script");
  41280. if (destElements.length > 0) {
  41281. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  41282. }
  41283. // Return the cloned set
  41284. return clone;
  41285. },
  41286. cleanData: function cleanData(elems) {
  41287. var data,
  41288. elem,
  41289. type,
  41290. special = jQuery.event.special,
  41291. i = 0;
  41292. for (; (elem = elems[i]) !== undefined; i++) {
  41293. if (acceptData(elem)) {
  41294. if (data = elem[dataPriv.expando]) {
  41295. if (data.events) {
  41296. for (type in data.events) {
  41297. if (special[type]) {
  41298. jQuery.event.remove(elem, type);
  41299. // This is a shortcut to avoid jQuery.event.remove's overhead
  41300. } else {
  41301. jQuery.removeEvent(elem, type, data.handle);
  41302. }
  41303. }
  41304. }
  41305. // Support: Chrome <=35 - 45+
  41306. // Assign undefined instead of using delete, see Data#remove
  41307. elem[dataPriv.expando] = undefined;
  41308. }
  41309. if (elem[dataUser.expando]) {
  41310. // Support: Chrome <=35 - 45+
  41311. // Assign undefined instead of using delete, see Data#remove
  41312. elem[dataUser.expando] = undefined;
  41313. }
  41314. }
  41315. }
  41316. }
  41317. });
  41318. jQuery.fn.extend({
  41319. detach: function detach(selector) {
  41320. return _remove(this, selector, true);
  41321. },
  41322. remove: function remove(selector) {
  41323. return _remove(this, selector);
  41324. },
  41325. text: function text(value) {
  41326. return access(this, function (value) {
  41327. return value === undefined ? jQuery.text(this) : this.empty().each(function () {
  41328. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41329. this.textContent = value;
  41330. }
  41331. });
  41332. }, null, value, arguments.length);
  41333. },
  41334. append: function append() {
  41335. return domManip(this, arguments, function (elem) {
  41336. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41337. var target = manipulationTarget(this, elem);
  41338. target.appendChild(elem);
  41339. }
  41340. });
  41341. },
  41342. prepend: function prepend() {
  41343. return domManip(this, arguments, function (elem) {
  41344. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41345. var target = manipulationTarget(this, elem);
  41346. target.insertBefore(elem, target.firstChild);
  41347. }
  41348. });
  41349. },
  41350. before: function before() {
  41351. return domManip(this, arguments, function (elem) {
  41352. if (this.parentNode) {
  41353. this.parentNode.insertBefore(elem, this);
  41354. }
  41355. });
  41356. },
  41357. after: function after() {
  41358. return domManip(this, arguments, function (elem) {
  41359. if (this.parentNode) {
  41360. this.parentNode.insertBefore(elem, this.nextSibling);
  41361. }
  41362. });
  41363. },
  41364. empty: function empty() {
  41365. var elem,
  41366. i = 0;
  41367. for (; (elem = this[i]) != null; i++) {
  41368. if (elem.nodeType === 1) {
  41369. // Prevent memory leaks
  41370. jQuery.cleanData(getAll(elem, false));
  41371. // Remove any remaining nodes
  41372. elem.textContent = "";
  41373. }
  41374. }
  41375. return this;
  41376. },
  41377. clone: function clone(dataAndEvents, deepDataAndEvents) {
  41378. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  41379. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  41380. return this.map(function () {
  41381. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  41382. });
  41383. },
  41384. html: function html(value) {
  41385. return access(this, function (value) {
  41386. var elem = this[0] || {},
  41387. i = 0,
  41388. l = this.length;
  41389. if (value === undefined && elem.nodeType === 1) {
  41390. return elem.innerHTML;
  41391. }
  41392. // See if we can take a shortcut and just use innerHTML
  41393. if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
  41394. value = jQuery.htmlPrefilter(value);
  41395. try {
  41396. for (; i < l; i++) {
  41397. elem = this[i] || {};
  41398. // Remove element nodes and prevent memory leaks
  41399. if (elem.nodeType === 1) {
  41400. jQuery.cleanData(getAll(elem, false));
  41401. elem.innerHTML = value;
  41402. }
  41403. }
  41404. elem = 0;
  41405. // If using innerHTML throws an exception, use the fallback method
  41406. } catch (e) {}
  41407. }
  41408. if (elem) {
  41409. this.empty().append(value);
  41410. }
  41411. }, null, value, arguments.length);
  41412. },
  41413. replaceWith: function replaceWith() {
  41414. var ignored = [];
  41415. // Make the changes, replacing each non-ignored context element with the new content
  41416. return domManip(this, arguments, function (elem) {
  41417. var parent = this.parentNode;
  41418. if (jQuery.inArray(this, ignored) < 0) {
  41419. jQuery.cleanData(getAll(this));
  41420. if (parent) {
  41421. parent.replaceChild(elem, this);
  41422. }
  41423. }
  41424. // Force callback invocation
  41425. }, ignored);
  41426. }
  41427. });
  41428. jQuery.each({
  41429. appendTo: "append",
  41430. prependTo: "prepend",
  41431. insertBefore: "before",
  41432. insertAfter: "after",
  41433. replaceAll: "replaceWith"
  41434. }, function (name, original) {
  41435. jQuery.fn[name] = function (selector) {
  41436. var elems,
  41437. ret = [],
  41438. insert = jQuery(selector),
  41439. last = insert.length - 1,
  41440. i = 0;
  41441. for (; i <= last; i++) {
  41442. elems = i === last ? this : this.clone(true);
  41443. jQuery(insert[i])[original](elems);
  41444. // Support: Android <=4.0 only, PhantomJS 1 only
  41445. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  41446. push.apply(ret, elems.get());
  41447. }
  41448. return this.pushStack(ret);
  41449. };
  41450. });
  41451. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  41452. var getStyles = function getStyles(elem) {
  41453. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  41454. // IE throws on elements created in popups
  41455. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  41456. var view = elem.ownerDocument.defaultView;
  41457. if (!view || !view.opener) {
  41458. view = window;
  41459. }
  41460. return view.getComputedStyle(elem);
  41461. };
  41462. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  41463. (function () {
  41464. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  41465. // so they're executed at the same time to save the second computation.
  41466. function computeStyleTests() {
  41467. // This is a singleton, we need to execute it only once
  41468. if (!div) {
  41469. return;
  41470. }
  41471. container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0";
  41472. div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%";
  41473. documentElement.appendChild(container).appendChild(div);
  41474. var divStyle = window.getComputedStyle(div);
  41475. pixelPositionVal = divStyle.top !== "1%";
  41476. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  41477. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  41478. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  41479. // Some styles come back with percentage values, even though they shouldn't
  41480. div.style.right = "60%";
  41481. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  41482. // Support: IE 9 - 11 only
  41483. // Detect misreporting of content dimensions for box-sizing:border-box elements
  41484. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  41485. // Support: IE 9 only
  41486. // Detect overflow:scroll screwiness (gh-3699)
  41487. div.style.position = "absolute";
  41488. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  41489. documentElement.removeChild(container);
  41490. // Nullify the div so it wouldn't be stored in the memory and
  41491. // it will also be a sign that checks already performed
  41492. div = null;
  41493. }
  41494. function roundPixelMeasures(measure) {
  41495. return Math.round(parseFloat(measure));
  41496. }
  41497. var pixelPositionVal,
  41498. boxSizingReliableVal,
  41499. scrollboxSizeVal,
  41500. pixelBoxStylesVal,
  41501. reliableMarginLeftVal,
  41502. container = document.createElement("div"),
  41503. div = document.createElement("div");
  41504. // Finish early in limited (non-browser) environments
  41505. if (!div.style) {
  41506. return;
  41507. }
  41508. // Support: IE <=9 - 11 only
  41509. // Style of cloned element affects source element cloned (#8908)
  41510. div.style.backgroundClip = "content-box";
  41511. div.cloneNode(true).style.backgroundClip = "";
  41512. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  41513. jQuery.extend(support, {
  41514. boxSizingReliable: function boxSizingReliable() {
  41515. computeStyleTests();
  41516. return boxSizingReliableVal;
  41517. },
  41518. pixelBoxStyles: function pixelBoxStyles() {
  41519. computeStyleTests();
  41520. return pixelBoxStylesVal;
  41521. },
  41522. pixelPosition: function pixelPosition() {
  41523. computeStyleTests();
  41524. return pixelPositionVal;
  41525. },
  41526. reliableMarginLeft: function reliableMarginLeft() {
  41527. computeStyleTests();
  41528. return reliableMarginLeftVal;
  41529. },
  41530. scrollboxSize: function scrollboxSize() {
  41531. computeStyleTests();
  41532. return scrollboxSizeVal;
  41533. }
  41534. });
  41535. })();
  41536. function curCSS(elem, name, computed) {
  41537. var width,
  41538. minWidth,
  41539. maxWidth,
  41540. ret,
  41541. // Support: Firefox 51+
  41542. // Retrieving style before computed somehow
  41543. // fixes an issue with getting wrong values
  41544. // on detached elements
  41545. style = elem.style;
  41546. computed = computed || getStyles(elem);
  41547. // getPropertyValue is needed for:
  41548. // .css('filter') (IE 9 only, #12537)
  41549. // .css('--customProperty) (#3144)
  41550. if (computed) {
  41551. ret = computed.getPropertyValue(name) || computed[name];
  41552. if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
  41553. ret = jQuery.style(elem, name);
  41554. }
  41555. // A tribute to the "awesome hack by Dean Edwards"
  41556. // Android Browser returns percentage for some values,
  41557. // but width seems to be reliably pixels.
  41558. // This is against the CSSOM draft spec:
  41559. // https://drafts.csswg.org/cssom/#resolved-values
  41560. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  41561. // Remember the original values
  41562. width = style.width;
  41563. minWidth = style.minWidth;
  41564. maxWidth = style.maxWidth;
  41565. // Put in the new values to get a computed value out
  41566. style.minWidth = style.maxWidth = style.width = ret;
  41567. ret = computed.width;
  41568. // Revert the changed values
  41569. style.width = width;
  41570. style.minWidth = minWidth;
  41571. style.maxWidth = maxWidth;
  41572. }
  41573. }
  41574. return ret !== undefined ?
  41575. // Support: IE <=9 - 11 only
  41576. // IE returns zIndex value as an integer.
  41577. ret + "" : ret;
  41578. }
  41579. function addGetHookIf(conditionFn, hookFn) {
  41580. // Define the hook, we'll check on the first run if it's really needed.
  41581. return {
  41582. get: function get() {
  41583. if (conditionFn()) {
  41584. // Hook not needed (or it's not possible to use it due
  41585. // to missing dependency), remove it.
  41586. delete this.get;
  41587. return;
  41588. }
  41589. // Hook needed; redefine it so that the support test is not executed again.
  41590. return (this.get = hookFn).apply(this, arguments);
  41591. }
  41592. };
  41593. }
  41594. var
  41595. // Swappable if display is none or starts with table
  41596. // except "table", "table-cell", or "table-caption"
  41597. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  41598. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  41599. rcustomProp = /^--/,
  41600. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  41601. cssNormalTransform = {
  41602. letterSpacing: "0",
  41603. fontWeight: "400"
  41604. },
  41605. cssPrefixes = ["Webkit", "Moz", "ms"],
  41606. emptyStyle = document.createElement("div").style;
  41607. // Return a css property mapped to a potentially vendor prefixed property
  41608. function vendorPropName(name) {
  41609. // Shortcut for names that are not vendor prefixed
  41610. if (name in emptyStyle) {
  41611. return name;
  41612. }
  41613. // Check for vendor prefixed names
  41614. var capName = name[0].toUpperCase() + name.slice(1),
  41615. i = cssPrefixes.length;
  41616. while (i--) {
  41617. name = cssPrefixes[i] + capName;
  41618. if (name in emptyStyle) {
  41619. return name;
  41620. }
  41621. }
  41622. }
  41623. // Return a property mapped along what jQuery.cssProps suggests or to
  41624. // a vendor prefixed property.
  41625. function finalPropName(name) {
  41626. var ret = jQuery.cssProps[name];
  41627. if (!ret) {
  41628. ret = jQuery.cssProps[name] = vendorPropName(name) || name;
  41629. }
  41630. return ret;
  41631. }
  41632. function setPositiveNumber(elem, value, subtract) {
  41633. // Any relative (+/-) values have already been
  41634. // normalized at this point
  41635. var matches = rcssNum.exec(value);
  41636. return matches ?
  41637. // Guard against undefined "subtract", e.g., when used as in cssHooks
  41638. Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  41639. }
  41640. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  41641. var i = dimension === "width" ? 1 : 0,
  41642. extra = 0,
  41643. delta = 0;
  41644. // Adjustment may not be necessary
  41645. if (box === (isBorderBox ? "border" : "content")) {
  41646. return 0;
  41647. }
  41648. for (; i < 4; i += 2) {
  41649. // Both box models exclude margin
  41650. if (box === "margin") {
  41651. delta += jQuery.css(elem, box + cssExpand[i], true, styles);
  41652. }
  41653. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  41654. if (!isBorderBox) {
  41655. // Add padding
  41656. delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  41657. // For "border" or "margin", add border
  41658. if (box !== "padding") {
  41659. delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  41660. // But still keep track of it otherwise
  41661. } else {
  41662. extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  41663. }
  41664. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  41665. // "padding" or "margin"
  41666. } else {
  41667. // For "content", subtract padding
  41668. if (box === "content") {
  41669. delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  41670. }
  41671. // For "content" or "padding", subtract border
  41672. if (box !== "margin") {
  41673. delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  41674. }
  41675. }
  41676. }
  41677. // Account for positive content-box scroll gutter when requested by providing computedVal
  41678. if (!isBorderBox && computedVal >= 0) {
  41679. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  41680. // Assuming integer scroll gutter, subtract the rest and round down
  41681. delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5));
  41682. }
  41683. return delta;
  41684. }
  41685. function getWidthOrHeight(elem, dimension, extra) {
  41686. // Start with computed style
  41687. var styles = getStyles(elem),
  41688. val = curCSS(elem, dimension, styles),
  41689. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  41690. valueIsBorderBox = isBorderBox;
  41691. // Support: Firefox <=54
  41692. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  41693. if (rnumnonpx.test(val)) {
  41694. if (!extra) {
  41695. return val;
  41696. }
  41697. val = "auto";
  41698. }
  41699. // Check for style in case a browser which returns unreliable values
  41700. // for getComputedStyle silently falls back to the reliable elem.style
  41701. valueIsBorderBox = valueIsBorderBox && (support.boxSizingReliable() || val === elem.style[dimension]);
  41702. // Fall back to offsetWidth/offsetHeight when value is "auto"
  41703. // This happens for inline elements with no explicit setting (gh-3571)
  41704. // Support: Android <=4.1 - 4.3 only
  41705. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  41706. if (val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") {
  41707. val = elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)];
  41708. // offsetWidth/offsetHeight provide border-box values
  41709. valueIsBorderBox = true;
  41710. }
  41711. // Normalize "" and auto
  41712. val = parseFloat(val) || 0;
  41713. // Adjust for the element's box model
  41714. return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles,
  41715. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  41716. val) + "px";
  41717. }
  41718. jQuery.extend({
  41719. // Add in style property hooks for overriding the default
  41720. // behavior of getting and setting a style property
  41721. cssHooks: {
  41722. opacity: {
  41723. get: function get(elem, computed) {
  41724. if (computed) {
  41725. // We should always get a number back from opacity
  41726. var ret = curCSS(elem, "opacity");
  41727. return ret === "" ? "1" : ret;
  41728. }
  41729. }
  41730. }
  41731. },
  41732. // Don't automatically add "px" to these possibly-unitless properties
  41733. cssNumber: {
  41734. "animationIterationCount": true,
  41735. "columnCount": true,
  41736. "fillOpacity": true,
  41737. "flexGrow": true,
  41738. "flexShrink": true,
  41739. "fontWeight": true,
  41740. "lineHeight": true,
  41741. "opacity": true,
  41742. "order": true,
  41743. "orphans": true,
  41744. "widows": true,
  41745. "zIndex": true,
  41746. "zoom": true
  41747. },
  41748. // Add in properties whose names you wish to fix before
  41749. // setting or getting the value
  41750. cssProps: {},
  41751. // Get and set the style property on a DOM Node
  41752. style: function style(elem, name, value, extra) {
  41753. // Don't set styles on text and comment nodes
  41754. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  41755. return;
  41756. }
  41757. // Make sure that we're working with the right name
  41758. var ret,
  41759. type,
  41760. hooks,
  41761. origName = camelCase(name),
  41762. isCustomProp = rcustomProp.test(name),
  41763. style = elem.style;
  41764. // Make sure that we're working with the right name. We don't
  41765. // want to query the value if it is a CSS custom property
  41766. // since they are user-defined.
  41767. if (!isCustomProp) {
  41768. name = finalPropName(origName);
  41769. }
  41770. // Gets hook for the prefixed version, then unprefixed version
  41771. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  41772. // Check if we're setting a value
  41773. if (value !== undefined) {
  41774. type = typeof value === "undefined" ? "undefined" : _typeof(value);
  41775. // Convert "+=" or "-=" to relative numbers (#7345)
  41776. if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  41777. value = adjustCSS(elem, name, ret);
  41778. // Fixes bug #9237
  41779. type = "number";
  41780. }
  41781. // Make sure that null and NaN values aren't set (#7116)
  41782. if (value == null || value !== value) {
  41783. return;
  41784. }
  41785. // If a number was passed in, add the unit (except for certain CSS properties)
  41786. if (type === "number") {
  41787. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  41788. }
  41789. // background-* props affect original clone's values
  41790. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  41791. style[name] = "inherit";
  41792. }
  41793. // If a hook was provided, use that value, otherwise just set the specified value
  41794. if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
  41795. if (isCustomProp) {
  41796. style.setProperty(name, value);
  41797. } else {
  41798. style[name] = value;
  41799. }
  41800. }
  41801. } else {
  41802. // If a hook was provided get the non-computed value from there
  41803. if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
  41804. return ret;
  41805. }
  41806. // Otherwise just get the value from the style object
  41807. return style[name];
  41808. }
  41809. },
  41810. css: function css(elem, name, extra, styles) {
  41811. var val,
  41812. num,
  41813. hooks,
  41814. origName = camelCase(name),
  41815. isCustomProp = rcustomProp.test(name);
  41816. // Make sure that we're working with the right name. We don't
  41817. // want to modify the value if it is a CSS custom property
  41818. // since they are user-defined.
  41819. if (!isCustomProp) {
  41820. name = finalPropName(origName);
  41821. }
  41822. // Try prefixed name followed by the unprefixed name
  41823. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  41824. // If a hook was provided get the computed value from there
  41825. if (hooks && "get" in hooks) {
  41826. val = hooks.get(elem, true, extra);
  41827. }
  41828. // Otherwise, if a way to get the computed value exists, use that
  41829. if (val === undefined) {
  41830. val = curCSS(elem, name, styles);
  41831. }
  41832. // Convert "normal" to computed value
  41833. if (val === "normal" && name in cssNormalTransform) {
  41834. val = cssNormalTransform[name];
  41835. }
  41836. // Make numeric if forced or a qualifier was provided and val looks numeric
  41837. if (extra === "" || extra) {
  41838. num = parseFloat(val);
  41839. return extra === true || isFinite(num) ? num || 0 : val;
  41840. }
  41841. return val;
  41842. }
  41843. });
  41844. jQuery.each(["height", "width"], function (i, dimension) {
  41845. jQuery.cssHooks[dimension] = {
  41846. get: function get(elem, computed, extra) {
  41847. if (computed) {
  41848. // Certain elements can have dimension info if we invisibly show them
  41849. // but it must have a current display style that would benefit
  41850. return rdisplayswap.test(jQuery.css(elem, "display")) && (
  41851. // Support: Safari 8+
  41852. // Table columns in Safari have non-zero offsetWidth & zero
  41853. // getBoundingClientRect().width unless display is changed.
  41854. // Support: IE <=11 only
  41855. // Running getBoundingClientRect on a disconnected node
  41856. // in IE throws an error.
  41857. !elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {
  41858. return getWidthOrHeight(elem, dimension, extra);
  41859. }) : getWidthOrHeight(elem, dimension, extra);
  41860. }
  41861. },
  41862. set: function set(elem, value, extra) {
  41863. var matches,
  41864. styles = getStyles(elem),
  41865. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  41866. subtract = extra && boxModelAdjustment(elem, dimension, extra, isBorderBox, styles);
  41867. // Account for unreliable border-box dimensions by comparing offset* to computed and
  41868. // faking a content-box to get border and padding (gh-3699)
  41869. if (isBorderBox && support.scrollboxSize() === styles.position) {
  41870. subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5);
  41871. }
  41872. // Convert to pixels if value adjustment is needed
  41873. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
  41874. elem.style[dimension] = value;
  41875. value = jQuery.css(elem, dimension);
  41876. }
  41877. return setPositiveNumber(elem, value, subtract);
  41878. }
  41879. };
  41880. });
  41881. jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {
  41882. if (computed) {
  41883. return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function () {
  41884. return elem.getBoundingClientRect().left;
  41885. })) + "px";
  41886. }
  41887. });
  41888. // These hooks are used by animate to expand properties
  41889. jQuery.each({
  41890. margin: "",
  41891. padding: "",
  41892. border: "Width"
  41893. }, function (prefix, suffix) {
  41894. jQuery.cssHooks[prefix + suffix] = {
  41895. expand: function expand(value) {
  41896. var i = 0,
  41897. expanded = {},
  41898. // Assumes a single number if not a string
  41899. parts = typeof value === "string" ? value.split(" ") : [value];
  41900. for (; i < 4; i++) {
  41901. expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
  41902. }
  41903. return expanded;
  41904. }
  41905. };
  41906. if (prefix !== "margin") {
  41907. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  41908. }
  41909. });
  41910. jQuery.fn.extend({
  41911. css: function css(name, value) {
  41912. return access(this, function (elem, name, value) {
  41913. var styles,
  41914. len,
  41915. map = {},
  41916. i = 0;
  41917. if (Array.isArray(name)) {
  41918. styles = getStyles(elem);
  41919. len = name.length;
  41920. for (; i < len; i++) {
  41921. map[name[i]] = jQuery.css(elem, name[i], false, styles);
  41922. }
  41923. return map;
  41924. }
  41925. return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
  41926. }, name, value, arguments.length > 1);
  41927. }
  41928. });
  41929. function Tween(elem, options, prop, end, easing) {
  41930. return new Tween.prototype.init(elem, options, prop, end, easing);
  41931. }
  41932. jQuery.Tween = Tween;
  41933. Tween.prototype = {
  41934. constructor: Tween,
  41935. init: function init(elem, options, prop, end, easing, unit) {
  41936. this.elem = elem;
  41937. this.prop = prop;
  41938. this.easing = easing || jQuery.easing._default;
  41939. this.options = options;
  41940. this.start = this.now = this.cur();
  41941. this.end = end;
  41942. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  41943. },
  41944. cur: function cur() {
  41945. var hooks = Tween.propHooks[this.prop];
  41946. return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
  41947. },
  41948. run: function run(percent) {
  41949. var eased,
  41950. hooks = Tween.propHooks[this.prop];
  41951. if (this.options.duration) {
  41952. this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);
  41953. } else {
  41954. this.pos = eased = percent;
  41955. }
  41956. this.now = (this.end - this.start) * eased + this.start;
  41957. if (this.options.step) {
  41958. this.options.step.call(this.elem, this.now, this);
  41959. }
  41960. if (hooks && hooks.set) {
  41961. hooks.set(this);
  41962. } else {
  41963. Tween.propHooks._default.set(this);
  41964. }
  41965. return this;
  41966. }
  41967. };
  41968. Tween.prototype.init.prototype = Tween.prototype;
  41969. Tween.propHooks = {
  41970. _default: {
  41971. get: function get(tween) {
  41972. var result;
  41973. // Use a property on the element directly when it is not a DOM element,
  41974. // or when there is no matching style property that exists.
  41975. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  41976. return tween.elem[tween.prop];
  41977. }
  41978. // Passing an empty string as a 3rd parameter to .css will automatically
  41979. // attempt a parseFloat and fallback to a string if the parse fails.
  41980. // Simple values such as "10px" are parsed to Float;
  41981. // complex values such as "rotate(1rad)" are returned as-is.
  41982. result = jQuery.css(tween.elem, tween.prop, "");
  41983. // Empty strings, null, undefined and "auto" are converted to 0.
  41984. return !result || result === "auto" ? 0 : result;
  41985. },
  41986. set: function set(tween) {
  41987. // Use step hook for back compat.
  41988. // Use cssHook if its there.
  41989. // Use .style if available and use plain properties where available.
  41990. if (jQuery.fx.step[tween.prop]) {
  41991. jQuery.fx.step[tween.prop](tween);
  41992. } else if (tween.elem.nodeType === 1 && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
  41993. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  41994. } else {
  41995. tween.elem[tween.prop] = tween.now;
  41996. }
  41997. }
  41998. }
  41999. };
  42000. // Support: IE <=9 only
  42001. // Panic based approach to setting things on disconnected nodes
  42002. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  42003. set: function set(tween) {
  42004. if (tween.elem.nodeType && tween.elem.parentNode) {
  42005. tween.elem[tween.prop] = tween.now;
  42006. }
  42007. }
  42008. };
  42009. jQuery.easing = {
  42010. linear: function linear(p) {
  42011. return p;
  42012. },
  42013. swing: function swing(p) {
  42014. return 0.5 - Math.cos(p * Math.PI) / 2;
  42015. },
  42016. _default: "swing"
  42017. };
  42018. jQuery.fx = Tween.prototype.init;
  42019. // Back compat <1.8 extension point
  42020. jQuery.fx.step = {};
  42021. var fxNow,
  42022. inProgress,
  42023. rfxtypes = /^(?:toggle|show|hide)$/,
  42024. rrun = /queueHooks$/;
  42025. function schedule() {
  42026. if (inProgress) {
  42027. if (document.hidden === false && window.requestAnimationFrame) {
  42028. window.requestAnimationFrame(schedule);
  42029. } else {
  42030. window.setTimeout(schedule, jQuery.fx.interval);
  42031. }
  42032. jQuery.fx.tick();
  42033. }
  42034. }
  42035. // Animations created synchronously will run synchronously
  42036. function createFxNow() {
  42037. window.setTimeout(function () {
  42038. fxNow = undefined;
  42039. });
  42040. return fxNow = Date.now();
  42041. }
  42042. // Generate parameters to create a standard animation
  42043. function genFx(type, includeWidth) {
  42044. var which,
  42045. i = 0,
  42046. attrs = { height: type };
  42047. // If we include width, step value is 1 to do all cssExpand values,
  42048. // otherwise step value is 2 to skip over Left and Right
  42049. includeWidth = includeWidth ? 1 : 0;
  42050. for (; i < 4; i += 2 - includeWidth) {
  42051. which = cssExpand[i];
  42052. attrs["margin" + which] = attrs["padding" + which] = type;
  42053. }
  42054. if (includeWidth) {
  42055. attrs.opacity = attrs.width = type;
  42056. }
  42057. return attrs;
  42058. }
  42059. function createTween(value, prop, animation) {
  42060. var tween,
  42061. collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
  42062. index = 0,
  42063. length = collection.length;
  42064. for (; index < length; index++) {
  42065. if (tween = collection[index].call(animation, prop, value)) {
  42066. // We're done with this property
  42067. return tween;
  42068. }
  42069. }
  42070. }
  42071. function defaultPrefilter(elem, props, opts) {
  42072. var prop,
  42073. value,
  42074. toggle,
  42075. hooks,
  42076. oldfire,
  42077. propTween,
  42078. restoreDisplay,
  42079. display,
  42080. isBox = "width" in props || "height" in props,
  42081. anim = this,
  42082. orig = {},
  42083. style = elem.style,
  42084. hidden = elem.nodeType && isHiddenWithinTree(elem),
  42085. dataShow = dataPriv.get(elem, "fxshow");
  42086. // Queue-skipping animations hijack the fx hooks
  42087. if (!opts.queue) {
  42088. hooks = jQuery._queueHooks(elem, "fx");
  42089. if (hooks.unqueued == null) {
  42090. hooks.unqueued = 0;
  42091. oldfire = hooks.empty.fire;
  42092. hooks.empty.fire = function () {
  42093. if (!hooks.unqueued) {
  42094. oldfire();
  42095. }
  42096. };
  42097. }
  42098. hooks.unqueued++;
  42099. anim.always(function () {
  42100. // Ensure the complete handler is called before this completes
  42101. anim.always(function () {
  42102. hooks.unqueued--;
  42103. if (!jQuery.queue(elem, "fx").length) {
  42104. hooks.empty.fire();
  42105. }
  42106. });
  42107. });
  42108. }
  42109. // Detect show/hide animations
  42110. for (prop in props) {
  42111. value = props[prop];
  42112. if (rfxtypes.test(value)) {
  42113. delete props[prop];
  42114. toggle = toggle || value === "toggle";
  42115. if (value === (hidden ? "hide" : "show")) {
  42116. // Pretend to be hidden if this is a "show" and
  42117. // there is still data from a stopped show/hide
  42118. if (value === "show" && dataShow && dataShow[prop] !== undefined) {
  42119. hidden = true;
  42120. // Ignore all other no-op show/hide data
  42121. } else {
  42122. continue;
  42123. }
  42124. }
  42125. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  42126. }
  42127. }
  42128. // Bail out if this is a no-op like .hide().hide()
  42129. propTween = !jQuery.isEmptyObject(props);
  42130. if (!propTween && jQuery.isEmptyObject(orig)) {
  42131. return;
  42132. }
  42133. // Restrict "overflow" and "display" styles during box animations
  42134. if (isBox && elem.nodeType === 1) {
  42135. // Support: IE <=9 - 11, Edge 12 - 15
  42136. // Record all 3 overflow attributes because IE does not infer the shorthand
  42137. // from identically-valued overflowX and overflowY and Edge just mirrors
  42138. // the overflowX value there.
  42139. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  42140. // Identify a display type, preferring old show/hide data over the CSS cascade
  42141. restoreDisplay = dataShow && dataShow.display;
  42142. if (restoreDisplay == null) {
  42143. restoreDisplay = dataPriv.get(elem, "display");
  42144. }
  42145. display = jQuery.css(elem, "display");
  42146. if (display === "none") {
  42147. if (restoreDisplay) {
  42148. display = restoreDisplay;
  42149. } else {
  42150. // Get nonempty value(s) by temporarily forcing visibility
  42151. showHide([elem], true);
  42152. restoreDisplay = elem.style.display || restoreDisplay;
  42153. display = jQuery.css(elem, "display");
  42154. showHide([elem]);
  42155. }
  42156. }
  42157. // Animate inline elements as inline-block
  42158. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  42159. if (jQuery.css(elem, "float") === "none") {
  42160. // Restore the original display value at the end of pure show/hide animations
  42161. if (!propTween) {
  42162. anim.done(function () {
  42163. style.display = restoreDisplay;
  42164. });
  42165. if (restoreDisplay == null) {
  42166. display = style.display;
  42167. restoreDisplay = display === "none" ? "" : display;
  42168. }
  42169. }
  42170. style.display = "inline-block";
  42171. }
  42172. }
  42173. }
  42174. if (opts.overflow) {
  42175. style.overflow = "hidden";
  42176. anim.always(function () {
  42177. style.overflow = opts.overflow[0];
  42178. style.overflowX = opts.overflow[1];
  42179. style.overflowY = opts.overflow[2];
  42180. });
  42181. }
  42182. // Implement show/hide animations
  42183. propTween = false;
  42184. for (prop in orig) {
  42185. // General show/hide setup for this element animation
  42186. if (!propTween) {
  42187. if (dataShow) {
  42188. if ("hidden" in dataShow) {
  42189. hidden = dataShow.hidden;
  42190. }
  42191. } else {
  42192. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  42193. }
  42194. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  42195. if (toggle) {
  42196. dataShow.hidden = !hidden;
  42197. }
  42198. // Show elements before animating them
  42199. if (hidden) {
  42200. showHide([elem], true);
  42201. }
  42202. /* eslint-disable no-loop-func */
  42203. anim.done(function () {
  42204. /* eslint-enable no-loop-func */
  42205. // The final step of a "hide" animation is actually hiding the element
  42206. if (!hidden) {
  42207. showHide([elem]);
  42208. }
  42209. dataPriv.remove(elem, "fxshow");
  42210. for (prop in orig) {
  42211. jQuery.style(elem, prop, orig[prop]);
  42212. }
  42213. });
  42214. }
  42215. // Per-property setup
  42216. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  42217. if (!(prop in dataShow)) {
  42218. dataShow[prop] = propTween.start;
  42219. if (hidden) {
  42220. propTween.end = propTween.start;
  42221. propTween.start = 0;
  42222. }
  42223. }
  42224. }
  42225. }
  42226. function propFilter(props, specialEasing) {
  42227. var index, name, easing, value, hooks;
  42228. // camelCase, specialEasing and expand cssHook pass
  42229. for (index in props) {
  42230. name = camelCase(index);
  42231. easing = specialEasing[name];
  42232. value = props[index];
  42233. if (Array.isArray(value)) {
  42234. easing = value[1];
  42235. value = props[index] = value[0];
  42236. }
  42237. if (index !== name) {
  42238. props[name] = value;
  42239. delete props[index];
  42240. }
  42241. hooks = jQuery.cssHooks[name];
  42242. if (hooks && "expand" in hooks) {
  42243. value = hooks.expand(value);
  42244. delete props[name];
  42245. // Not quite $.extend, this won't overwrite existing keys.
  42246. // Reusing 'index' because we have the correct "name"
  42247. for (index in value) {
  42248. if (!(index in props)) {
  42249. props[index] = value[index];
  42250. specialEasing[index] = easing;
  42251. }
  42252. }
  42253. } else {
  42254. specialEasing[name] = easing;
  42255. }
  42256. }
  42257. }
  42258. function Animation(elem, properties, options) {
  42259. var result,
  42260. stopped,
  42261. index = 0,
  42262. length = Animation.prefilters.length,
  42263. deferred = jQuery.Deferred().always(function () {
  42264. // Don't match elem in the :animated selector
  42265. delete tick.elem;
  42266. }),
  42267. tick = function tick() {
  42268. if (stopped) {
  42269. return false;
  42270. }
  42271. var currentTime = fxNow || createFxNow(),
  42272. remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
  42273. // Support: Android 2.3 only
  42274. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  42275. temp = remaining / animation.duration || 0,
  42276. percent = 1 - temp,
  42277. index = 0,
  42278. length = animation.tweens.length;
  42279. for (; index < length; index++) {
  42280. animation.tweens[index].run(percent);
  42281. }
  42282. deferred.notifyWith(elem, [animation, percent, remaining]);
  42283. // If there's more to do, yield
  42284. if (percent < 1 && length) {
  42285. return remaining;
  42286. }
  42287. // If this was an empty animation, synthesize a final progress notification
  42288. if (!length) {
  42289. deferred.notifyWith(elem, [animation, 1, 0]);
  42290. }
  42291. // Resolve the animation and report its conclusion
  42292. deferred.resolveWith(elem, [animation]);
  42293. return false;
  42294. },
  42295. animation = deferred.promise({
  42296. elem: elem,
  42297. props: jQuery.extend({}, properties),
  42298. opts: jQuery.extend(true, {
  42299. specialEasing: {},
  42300. easing: jQuery.easing._default
  42301. }, options),
  42302. originalProperties: properties,
  42303. originalOptions: options,
  42304. startTime: fxNow || createFxNow(),
  42305. duration: options.duration,
  42306. tweens: [],
  42307. createTween: function createTween(prop, end) {
  42308. var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
  42309. animation.tweens.push(tween);
  42310. return tween;
  42311. },
  42312. stop: function stop(gotoEnd) {
  42313. var index = 0,
  42314. // If we are going to the end, we want to run all the tweens
  42315. // otherwise we skip this part
  42316. length = gotoEnd ? animation.tweens.length : 0;
  42317. if (stopped) {
  42318. return this;
  42319. }
  42320. stopped = true;
  42321. for (; index < length; index++) {
  42322. animation.tweens[index].run(1);
  42323. }
  42324. // Resolve when we played the last frame; otherwise, reject
  42325. if (gotoEnd) {
  42326. deferred.notifyWith(elem, [animation, 1, 0]);
  42327. deferred.resolveWith(elem, [animation, gotoEnd]);
  42328. } else {
  42329. deferred.rejectWith(elem, [animation, gotoEnd]);
  42330. }
  42331. return this;
  42332. }
  42333. }),
  42334. props = animation.props;
  42335. propFilter(props, animation.opts.specialEasing);
  42336. for (; index < length; index++) {
  42337. result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
  42338. if (result) {
  42339. if (isFunction(result.stop)) {
  42340. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
  42341. }
  42342. return result;
  42343. }
  42344. }
  42345. jQuery.map(props, createTween, animation);
  42346. if (isFunction(animation.opts.start)) {
  42347. animation.opts.start.call(elem, animation);
  42348. }
  42349. // Attach callbacks from options
  42350. animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  42351. jQuery.fx.timer(jQuery.extend(tick, {
  42352. elem: elem,
  42353. anim: animation,
  42354. queue: animation.opts.queue
  42355. }));
  42356. return animation;
  42357. }
  42358. jQuery.Animation = jQuery.extend(Animation, {
  42359. tweeners: {
  42360. "*": [function (prop, value) {
  42361. var tween = this.createTween(prop, value);
  42362. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  42363. return tween;
  42364. }]
  42365. },
  42366. tweener: function tweener(props, callback) {
  42367. if (isFunction(props)) {
  42368. callback = props;
  42369. props = ["*"];
  42370. } else {
  42371. props = props.match(rnothtmlwhite);
  42372. }
  42373. var prop,
  42374. index = 0,
  42375. length = props.length;
  42376. for (; index < length; index++) {
  42377. prop = props[index];
  42378. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  42379. Animation.tweeners[prop].unshift(callback);
  42380. }
  42381. },
  42382. prefilters: [defaultPrefilter],
  42383. prefilter: function prefilter(callback, prepend) {
  42384. if (prepend) {
  42385. Animation.prefilters.unshift(callback);
  42386. } else {
  42387. Animation.prefilters.push(callback);
  42388. }
  42389. }
  42390. });
  42391. jQuery.speed = function (speed, easing, fn) {
  42392. var opt = speed && (typeof speed === "undefined" ? "undefined" : _typeof(speed)) === "object" ? jQuery.extend({}, speed) : {
  42393. complete: fn || !fn && easing || isFunction(speed) && speed,
  42394. duration: speed,
  42395. easing: fn && easing || easing && !isFunction(easing) && easing
  42396. };
  42397. // Go to the end state if fx are off
  42398. if (jQuery.fx.off) {
  42399. opt.duration = 0;
  42400. } else {
  42401. if (typeof opt.duration !== "number") {
  42402. if (opt.duration in jQuery.fx.speeds) {
  42403. opt.duration = jQuery.fx.speeds[opt.duration];
  42404. } else {
  42405. opt.duration = jQuery.fx.speeds._default;
  42406. }
  42407. }
  42408. }
  42409. // Normalize opt.queue - true/undefined/null -> "fx"
  42410. if (opt.queue == null || opt.queue === true) {
  42411. opt.queue = "fx";
  42412. }
  42413. // Queueing
  42414. opt.old = opt.complete;
  42415. opt.complete = function () {
  42416. if (isFunction(opt.old)) {
  42417. opt.old.call(this);
  42418. }
  42419. if (opt.queue) {
  42420. jQuery.dequeue(this, opt.queue);
  42421. }
  42422. };
  42423. return opt;
  42424. };
  42425. jQuery.fn.extend({
  42426. fadeTo: function fadeTo(speed, to, easing, callback) {
  42427. // Show any hidden elements after setting opacity to 0
  42428. return this.filter(isHiddenWithinTree).css("opacity", 0).show()
  42429. // Animate to the value specified
  42430. .end().animate({ opacity: to }, speed, easing, callback);
  42431. },
  42432. animate: function animate(prop, speed, easing, callback) {
  42433. var empty = jQuery.isEmptyObject(prop),
  42434. optall = jQuery.speed(speed, easing, callback),
  42435. doAnimation = function doAnimation() {
  42436. // Operate on a copy of prop so per-property easing won't be lost
  42437. var anim = Animation(this, jQuery.extend({}, prop), optall);
  42438. // Empty animations, or finishing resolves immediately
  42439. if (empty || dataPriv.get(this, "finish")) {
  42440. anim.stop(true);
  42441. }
  42442. };
  42443. doAnimation.finish = doAnimation;
  42444. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  42445. },
  42446. stop: function stop(type, clearQueue, gotoEnd) {
  42447. var stopQueue = function stopQueue(hooks) {
  42448. var stop = hooks.stop;
  42449. delete hooks.stop;
  42450. stop(gotoEnd);
  42451. };
  42452. if (typeof type !== "string") {
  42453. gotoEnd = clearQueue;
  42454. clearQueue = type;
  42455. type = undefined;
  42456. }
  42457. if (clearQueue && type !== false) {
  42458. this.queue(type || "fx", []);
  42459. }
  42460. return this.each(function () {
  42461. var dequeue = true,
  42462. index = type != null && type + "queueHooks",
  42463. timers = jQuery.timers,
  42464. data = dataPriv.get(this);
  42465. if (index) {
  42466. if (data[index] && data[index].stop) {
  42467. stopQueue(data[index]);
  42468. }
  42469. } else {
  42470. for (index in data) {
  42471. if (data[index] && data[index].stop && rrun.test(index)) {
  42472. stopQueue(data[index]);
  42473. }
  42474. }
  42475. }
  42476. for (index = timers.length; index--;) {
  42477. if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
  42478. timers[index].anim.stop(gotoEnd);
  42479. dequeue = false;
  42480. timers.splice(index, 1);
  42481. }
  42482. }
  42483. // Start the next in the queue if the last step wasn't forced.
  42484. // Timers currently will call their complete callbacks, which
  42485. // will dequeue but only if they were gotoEnd.
  42486. if (dequeue || !gotoEnd) {
  42487. jQuery.dequeue(this, type);
  42488. }
  42489. });
  42490. },
  42491. finish: function finish(type) {
  42492. if (type !== false) {
  42493. type = type || "fx";
  42494. }
  42495. return this.each(function () {
  42496. var index,
  42497. data = dataPriv.get(this),
  42498. queue = data[type + "queue"],
  42499. hooks = data[type + "queueHooks"],
  42500. timers = jQuery.timers,
  42501. length = queue ? queue.length : 0;
  42502. // Enable finishing flag on private data
  42503. data.finish = true;
  42504. // Empty the queue first
  42505. jQuery.queue(this, type, []);
  42506. if (hooks && hooks.stop) {
  42507. hooks.stop.call(this, true);
  42508. }
  42509. // Look for any active animations, and finish them
  42510. for (index = timers.length; index--;) {
  42511. if (timers[index].elem === this && timers[index].queue === type) {
  42512. timers[index].anim.stop(true);
  42513. timers.splice(index, 1);
  42514. }
  42515. }
  42516. // Look for any animations in the old queue and finish them
  42517. for (index = 0; index < length; index++) {
  42518. if (queue[index] && queue[index].finish) {
  42519. queue[index].finish.call(this);
  42520. }
  42521. }
  42522. // Turn off finishing flag
  42523. delete data.finish;
  42524. });
  42525. }
  42526. });
  42527. jQuery.each(["toggle", "show", "hide"], function (i, name) {
  42528. var cssFn = jQuery.fn[name];
  42529. jQuery.fn[name] = function (speed, easing, callback) {
  42530. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
  42531. };
  42532. });
  42533. // Generate shortcuts for custom animations
  42534. jQuery.each({
  42535. slideDown: genFx("show"),
  42536. slideUp: genFx("hide"),
  42537. slideToggle: genFx("toggle"),
  42538. fadeIn: { opacity: "show" },
  42539. fadeOut: { opacity: "hide" },
  42540. fadeToggle: { opacity: "toggle" }
  42541. }, function (name, props) {
  42542. jQuery.fn[name] = function (speed, easing, callback) {
  42543. return this.animate(props, speed, easing, callback);
  42544. };
  42545. });
  42546. jQuery.timers = [];
  42547. jQuery.fx.tick = function () {
  42548. var timer,
  42549. i = 0,
  42550. timers = jQuery.timers;
  42551. fxNow = Date.now();
  42552. for (; i < timers.length; i++) {
  42553. timer = timers[i];
  42554. // Run the timer and safely remove it when done (allowing for external removal)
  42555. if (!timer() && timers[i] === timer) {
  42556. timers.splice(i--, 1);
  42557. }
  42558. }
  42559. if (!timers.length) {
  42560. jQuery.fx.stop();
  42561. }
  42562. fxNow = undefined;
  42563. };
  42564. jQuery.fx.timer = function (timer) {
  42565. jQuery.timers.push(timer);
  42566. jQuery.fx.start();
  42567. };
  42568. jQuery.fx.interval = 13;
  42569. jQuery.fx.start = function () {
  42570. if (inProgress) {
  42571. return;
  42572. }
  42573. inProgress = true;
  42574. schedule();
  42575. };
  42576. jQuery.fx.stop = function () {
  42577. inProgress = null;
  42578. };
  42579. jQuery.fx.speeds = {
  42580. slow: 600,
  42581. fast: 200,
  42582. // Default speed
  42583. _default: 400
  42584. };
  42585. // Based off of the plugin by Clint Helfers, with permission.
  42586. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  42587. jQuery.fn.delay = function (time, type) {
  42588. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  42589. type = type || "fx";
  42590. return this.queue(type, function (next, hooks) {
  42591. var timeout = window.setTimeout(next, time);
  42592. hooks.stop = function () {
  42593. window.clearTimeout(timeout);
  42594. };
  42595. });
  42596. };
  42597. (function () {
  42598. var input = document.createElement("input"),
  42599. select = document.createElement("select"),
  42600. opt = select.appendChild(document.createElement("option"));
  42601. input.type = "checkbox";
  42602. // Support: Android <=4.3 only
  42603. // Default value for a checkbox should be "on"
  42604. support.checkOn = input.value !== "";
  42605. // Support: IE <=11 only
  42606. // Must access selectedIndex to make default options select
  42607. support.optSelected = opt.selected;
  42608. // Support: IE <=11 only
  42609. // An input loses its value after becoming a radio
  42610. input = document.createElement("input");
  42611. input.value = "t";
  42612. input.type = "radio";
  42613. support.radioValue = input.value === "t";
  42614. })();
  42615. var boolHook,
  42616. attrHandle = jQuery.expr.attrHandle;
  42617. jQuery.fn.extend({
  42618. attr: function attr(name, value) {
  42619. return access(this, jQuery.attr, name, value, arguments.length > 1);
  42620. },
  42621. removeAttr: function removeAttr(name) {
  42622. return this.each(function () {
  42623. jQuery.removeAttr(this, name);
  42624. });
  42625. }
  42626. });
  42627. jQuery.extend({
  42628. attr: function attr(elem, name, value) {
  42629. var ret,
  42630. hooks,
  42631. nType = elem.nodeType;
  42632. // Don't get/set attributes on text, comment and attribute nodes
  42633. if (nType === 3 || nType === 8 || nType === 2) {
  42634. return;
  42635. }
  42636. // Fallback to prop when attributes are not supported
  42637. if (typeof elem.getAttribute === "undefined") {
  42638. return jQuery.prop(elem, name, value);
  42639. }
  42640. // Attribute hooks are determined by the lowercase version
  42641. // Grab necessary hook if one is defined
  42642. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  42643. hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
  42644. }
  42645. if (value !== undefined) {
  42646. if (value === null) {
  42647. jQuery.removeAttr(elem, name);
  42648. return;
  42649. }
  42650. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  42651. return ret;
  42652. }
  42653. elem.setAttribute(name, value + "");
  42654. return value;
  42655. }
  42656. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  42657. return ret;
  42658. }
  42659. ret = jQuery.find.attr(elem, name);
  42660. // Non-existent attributes return null, we normalize to undefined
  42661. return ret == null ? undefined : ret;
  42662. },
  42663. attrHooks: {
  42664. type: {
  42665. set: function set(elem, value) {
  42666. if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
  42667. var val = elem.value;
  42668. elem.setAttribute("type", value);
  42669. if (val) {
  42670. elem.value = val;
  42671. }
  42672. return value;
  42673. }
  42674. }
  42675. }
  42676. },
  42677. removeAttr: function removeAttr(elem, value) {
  42678. var name,
  42679. i = 0,
  42680. // Attribute names can contain non-HTML whitespace characters
  42681. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  42682. attrNames = value && value.match(rnothtmlwhite);
  42683. if (attrNames && elem.nodeType === 1) {
  42684. while (name = attrNames[i++]) {
  42685. elem.removeAttribute(name);
  42686. }
  42687. }
  42688. }
  42689. });
  42690. // Hooks for boolean attributes
  42691. boolHook = {
  42692. set: function set(elem, value, name) {
  42693. if (value === false) {
  42694. // Remove boolean attributes when set to false
  42695. jQuery.removeAttr(elem, name);
  42696. } else {
  42697. elem.setAttribute(name, name);
  42698. }
  42699. return name;
  42700. }
  42701. };
  42702. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
  42703. var getter = attrHandle[name] || jQuery.find.attr;
  42704. attrHandle[name] = function (elem, name, isXML) {
  42705. var ret,
  42706. handle,
  42707. lowercaseName = name.toLowerCase();
  42708. if (!isXML) {
  42709. // Avoid an infinite loop by temporarily removing this function from the getter
  42710. handle = attrHandle[lowercaseName];
  42711. attrHandle[lowercaseName] = ret;
  42712. ret = getter(elem, name, isXML) != null ? lowercaseName : null;
  42713. attrHandle[lowercaseName] = handle;
  42714. }
  42715. return ret;
  42716. };
  42717. });
  42718. var rfocusable = /^(?:input|select|textarea|button)$/i,
  42719. rclickable = /^(?:a|area)$/i;
  42720. jQuery.fn.extend({
  42721. prop: function prop(name, value) {
  42722. return access(this, jQuery.prop, name, value, arguments.length > 1);
  42723. },
  42724. removeProp: function removeProp(name) {
  42725. return this.each(function () {
  42726. delete this[jQuery.propFix[name] || name];
  42727. });
  42728. }
  42729. });
  42730. jQuery.extend({
  42731. prop: function prop(elem, name, value) {
  42732. var ret,
  42733. hooks,
  42734. nType = elem.nodeType;
  42735. // Don't get/set properties on text, comment and attribute nodes
  42736. if (nType === 3 || nType === 8 || nType === 2) {
  42737. return;
  42738. }
  42739. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  42740. // Fix name and attach hooks
  42741. name = jQuery.propFix[name] || name;
  42742. hooks = jQuery.propHooks[name];
  42743. }
  42744. if (value !== undefined) {
  42745. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  42746. return ret;
  42747. }
  42748. return elem[name] = value;
  42749. }
  42750. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  42751. return ret;
  42752. }
  42753. return elem[name];
  42754. },
  42755. propHooks: {
  42756. tabIndex: {
  42757. get: function get(elem) {
  42758. // Support: IE <=9 - 11 only
  42759. // elem.tabIndex doesn't always return the
  42760. // correct value when it hasn't been explicitly set
  42761. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  42762. // Use proper attribute retrieval(#12072)
  42763. var tabindex = jQuery.find.attr(elem, "tabindex");
  42764. if (tabindex) {
  42765. return parseInt(tabindex, 10);
  42766. }
  42767. if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
  42768. return 0;
  42769. }
  42770. return -1;
  42771. }
  42772. }
  42773. },
  42774. propFix: {
  42775. "for": "htmlFor",
  42776. "class": "className"
  42777. }
  42778. });
  42779. // Support: IE <=11 only
  42780. // Accessing the selectedIndex property
  42781. // forces the browser to respect setting selected
  42782. // on the option
  42783. // The getter ensures a default option is selected
  42784. // when in an optgroup
  42785. // eslint rule "no-unused-expressions" is disabled for this code
  42786. // since it considers such accessions noop
  42787. if (!support.optSelected) {
  42788. jQuery.propHooks.selected = {
  42789. get: function get(elem) {
  42790. /* eslint no-unused-expressions: "off" */
  42791. var parent = elem.parentNode;
  42792. if (parent && parent.parentNode) {
  42793. parent.parentNode.selectedIndex;
  42794. }
  42795. return null;
  42796. },
  42797. set: function set(elem) {
  42798. /* eslint no-unused-expressions: "off" */
  42799. var parent = elem.parentNode;
  42800. if (parent) {
  42801. parent.selectedIndex;
  42802. if (parent.parentNode) {
  42803. parent.parentNode.selectedIndex;
  42804. }
  42805. }
  42806. }
  42807. };
  42808. }
  42809. jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
  42810. jQuery.propFix[this.toLowerCase()] = this;
  42811. });
  42812. // Strip and collapse whitespace according to HTML spec
  42813. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  42814. function stripAndCollapse(value) {
  42815. var tokens = value.match(rnothtmlwhite) || [];
  42816. return tokens.join(" ");
  42817. }
  42818. function getClass(elem) {
  42819. return elem.getAttribute && elem.getAttribute("class") || "";
  42820. }
  42821. function classesToArray(value) {
  42822. if (Array.isArray(value)) {
  42823. return value;
  42824. }
  42825. if (typeof value === "string") {
  42826. return value.match(rnothtmlwhite) || [];
  42827. }
  42828. return [];
  42829. }
  42830. jQuery.fn.extend({
  42831. addClass: function addClass(value) {
  42832. var classes,
  42833. elem,
  42834. cur,
  42835. curValue,
  42836. clazz,
  42837. j,
  42838. finalValue,
  42839. i = 0;
  42840. if (isFunction(value)) {
  42841. return this.each(function (j) {
  42842. jQuery(this).addClass(value.call(this, j, getClass(this)));
  42843. });
  42844. }
  42845. classes = classesToArray(value);
  42846. if (classes.length) {
  42847. while (elem = this[i++]) {
  42848. curValue = getClass(elem);
  42849. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  42850. if (cur) {
  42851. j = 0;
  42852. while (clazz = classes[j++]) {
  42853. if (cur.indexOf(" " + clazz + " ") < 0) {
  42854. cur += clazz + " ";
  42855. }
  42856. }
  42857. // Only assign if different to avoid unneeded rendering.
  42858. finalValue = stripAndCollapse(cur);
  42859. if (curValue !== finalValue) {
  42860. elem.setAttribute("class", finalValue);
  42861. }
  42862. }
  42863. }
  42864. }
  42865. return this;
  42866. },
  42867. removeClass: function removeClass(value) {
  42868. var classes,
  42869. elem,
  42870. cur,
  42871. curValue,
  42872. clazz,
  42873. j,
  42874. finalValue,
  42875. i = 0;
  42876. if (isFunction(value)) {
  42877. return this.each(function (j) {
  42878. jQuery(this).removeClass(value.call(this, j, getClass(this)));
  42879. });
  42880. }
  42881. if (!arguments.length) {
  42882. return this.attr("class", "");
  42883. }
  42884. classes = classesToArray(value);
  42885. if (classes.length) {
  42886. while (elem = this[i++]) {
  42887. curValue = getClass(elem);
  42888. // This expression is here for better compressibility (see addClass)
  42889. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  42890. if (cur) {
  42891. j = 0;
  42892. while (clazz = classes[j++]) {
  42893. // Remove *all* instances
  42894. while (cur.indexOf(" " + clazz + " ") > -1) {
  42895. cur = cur.replace(" " + clazz + " ", " ");
  42896. }
  42897. }
  42898. // Only assign if different to avoid unneeded rendering.
  42899. finalValue = stripAndCollapse(cur);
  42900. if (curValue !== finalValue) {
  42901. elem.setAttribute("class", finalValue);
  42902. }
  42903. }
  42904. }
  42905. }
  42906. return this;
  42907. },
  42908. toggleClass: function toggleClass(value, stateVal) {
  42909. var type = typeof value === "undefined" ? "undefined" : _typeof(value),
  42910. isValidValue = type === "string" || Array.isArray(value);
  42911. if (typeof stateVal === "boolean" && isValidValue) {
  42912. return stateVal ? this.addClass(value) : this.removeClass(value);
  42913. }
  42914. if (isFunction(value)) {
  42915. return this.each(function (i) {
  42916. jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
  42917. });
  42918. }
  42919. return this.each(function () {
  42920. var className, i, self, classNames;
  42921. if (isValidValue) {
  42922. // Toggle individual class names
  42923. i = 0;
  42924. self = jQuery(this);
  42925. classNames = classesToArray(value);
  42926. while (className = classNames[i++]) {
  42927. // Check each className given, space separated list
  42928. if (self.hasClass(className)) {
  42929. self.removeClass(className);
  42930. } else {
  42931. self.addClass(className);
  42932. }
  42933. }
  42934. // Toggle whole class name
  42935. } else if (value === undefined || type === "boolean") {
  42936. className = getClass(this);
  42937. if (className) {
  42938. // Store className if set
  42939. dataPriv.set(this, "__className__", className);
  42940. }
  42941. // If the element has a class name or if we're passed `false`,
  42942. // then remove the whole classname (if there was one, the above saved it).
  42943. // Otherwise bring back whatever was previously saved (if anything),
  42944. // falling back to the empty string if nothing was stored.
  42945. if (this.setAttribute) {
  42946. this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || "");
  42947. }
  42948. }
  42949. });
  42950. },
  42951. hasClass: function hasClass(selector) {
  42952. var className,
  42953. elem,
  42954. i = 0;
  42955. className = " " + selector + " ";
  42956. while (elem = this[i++]) {
  42957. if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
  42958. return true;
  42959. }
  42960. }
  42961. return false;
  42962. }
  42963. });
  42964. var rreturn = /\r/g;
  42965. jQuery.fn.extend({
  42966. val: function val(value) {
  42967. var hooks,
  42968. ret,
  42969. valueIsFunction,
  42970. elem = this[0];
  42971. if (!arguments.length) {
  42972. if (elem) {
  42973. hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  42974. if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
  42975. return ret;
  42976. }
  42977. ret = elem.value;
  42978. // Handle most common string cases
  42979. if (typeof ret === "string") {
  42980. return ret.replace(rreturn, "");
  42981. }
  42982. // Handle cases where value is null/undef or number
  42983. return ret == null ? "" : ret;
  42984. }
  42985. return;
  42986. }
  42987. valueIsFunction = isFunction(value);
  42988. return this.each(function (i) {
  42989. var val;
  42990. if (this.nodeType !== 1) {
  42991. return;
  42992. }
  42993. if (valueIsFunction) {
  42994. val = value.call(this, i, jQuery(this).val());
  42995. } else {
  42996. val = value;
  42997. }
  42998. // Treat null/undefined as ""; convert numbers to string
  42999. if (val == null) {
  43000. val = "";
  43001. } else if (typeof val === "number") {
  43002. val += "";
  43003. } else if (Array.isArray(val)) {
  43004. val = jQuery.map(val, function (value) {
  43005. return value == null ? "" : value + "";
  43006. });
  43007. }
  43008. hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  43009. // If set returns undefined, fall back to normal setting
  43010. if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
  43011. this.value = val;
  43012. }
  43013. });
  43014. }
  43015. });
  43016. jQuery.extend({
  43017. valHooks: {
  43018. option: {
  43019. get: function get(elem) {
  43020. var val = jQuery.find.attr(elem, "value");
  43021. return val != null ? val :
  43022. // Support: IE <=10 - 11 only
  43023. // option.text throws exceptions (#14686, #14858)
  43024. // Strip and collapse whitespace
  43025. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  43026. stripAndCollapse(jQuery.text(elem));
  43027. }
  43028. },
  43029. select: {
  43030. get: function get(elem) {
  43031. var value,
  43032. option,
  43033. i,
  43034. options = elem.options,
  43035. index = elem.selectedIndex,
  43036. one = elem.type === "select-one",
  43037. values = one ? null : [],
  43038. max = one ? index + 1 : options.length;
  43039. if (index < 0) {
  43040. i = max;
  43041. } else {
  43042. i = one ? index : 0;
  43043. }
  43044. // Loop through all the selected options
  43045. for (; i < max; i++) {
  43046. option = options[i];
  43047. // Support: IE <=9 only
  43048. // IE8-9 doesn't update selected after form reset (#2551)
  43049. if ((option.selected || i === index) &&
  43050. // Don't return options that are disabled or in a disabled optgroup
  43051. !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
  43052. // Get the specific value for the option
  43053. value = jQuery(option).val();
  43054. // We don't need an array for one selects
  43055. if (one) {
  43056. return value;
  43057. }
  43058. // Multi-Selects return an array
  43059. values.push(value);
  43060. }
  43061. }
  43062. return values;
  43063. },
  43064. set: function set(elem, value) {
  43065. var optionSet,
  43066. option,
  43067. options = elem.options,
  43068. values = jQuery.makeArray(value),
  43069. i = options.length;
  43070. while (i--) {
  43071. option = options[i];
  43072. /* eslint-disable no-cond-assign */
  43073. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
  43074. optionSet = true;
  43075. }
  43076. /* eslint-enable no-cond-assign */
  43077. }
  43078. // Force browsers to behave consistently when non-matching value is set
  43079. if (!optionSet) {
  43080. elem.selectedIndex = -1;
  43081. }
  43082. return values;
  43083. }
  43084. }
  43085. }
  43086. });
  43087. // Radios and checkboxes getter/setter
  43088. jQuery.each(["radio", "checkbox"], function () {
  43089. jQuery.valHooks[this] = {
  43090. set: function set(elem, value) {
  43091. if (Array.isArray(value)) {
  43092. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  43093. }
  43094. }
  43095. };
  43096. if (!support.checkOn) {
  43097. jQuery.valHooks[this].get = function (elem) {
  43098. return elem.getAttribute("value") === null ? "on" : elem.value;
  43099. };
  43100. }
  43101. });
  43102. // Return jQuery for attributes-only inclusion
  43103. support.focusin = "onfocusin" in window;
  43104. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  43105. stopPropagationCallback = function stopPropagationCallback(e) {
  43106. e.stopPropagation();
  43107. };
  43108. jQuery.extend(jQuery.event, {
  43109. trigger: function trigger(event, data, elem, onlyHandlers) {
  43110. var i,
  43111. cur,
  43112. tmp,
  43113. bubbleType,
  43114. ontype,
  43115. handle,
  43116. special,
  43117. lastElement,
  43118. eventPath = [elem || document],
  43119. type = hasOwn.call(event, "type") ? event.type : event,
  43120. namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
  43121. cur = lastElement = tmp = elem = elem || document;
  43122. // Don't do events on text and comment nodes
  43123. if (elem.nodeType === 3 || elem.nodeType === 8) {
  43124. return;
  43125. }
  43126. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  43127. if (rfocusMorph.test(type + jQuery.event.triggered)) {
  43128. return;
  43129. }
  43130. if (type.indexOf(".") > -1) {
  43131. // Namespaced trigger; create a regexp to match event type in handle()
  43132. namespaces = type.split(".");
  43133. type = namespaces.shift();
  43134. namespaces.sort();
  43135. }
  43136. ontype = type.indexOf(":") < 0 && "on" + type;
  43137. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  43138. event = event[jQuery.expando] ? event : new jQuery.Event(type, (typeof event === "undefined" ? "undefined" : _typeof(event)) === "object" && event);
  43139. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  43140. event.isTrigger = onlyHandlers ? 2 : 3;
  43141. event.namespace = namespaces.join(".");
  43142. event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  43143. // Clean up the event in case it is being reused
  43144. event.result = undefined;
  43145. if (!event.target) {
  43146. event.target = elem;
  43147. }
  43148. // Clone any incoming data and prepend the event, creating the handler arg list
  43149. data = data == null ? [event] : jQuery.makeArray(data, [event]);
  43150. // Allow special events to draw outside the lines
  43151. special = jQuery.event.special[type] || {};
  43152. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  43153. return;
  43154. }
  43155. // Determine event propagation path in advance, per W3C events spec (#9951)
  43156. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  43157. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  43158. bubbleType = special.delegateType || type;
  43159. if (!rfocusMorph.test(bubbleType + type)) {
  43160. cur = cur.parentNode;
  43161. }
  43162. for (; cur; cur = cur.parentNode) {
  43163. eventPath.push(cur);
  43164. tmp = cur;
  43165. }
  43166. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  43167. if (tmp === (elem.ownerDocument || document)) {
  43168. eventPath.push(tmp.defaultView || tmp.parentWindow || window);
  43169. }
  43170. }
  43171. // Fire handlers on the event path
  43172. i = 0;
  43173. while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
  43174. lastElement = cur;
  43175. event.type = i > 1 ? bubbleType : special.bindType || type;
  43176. // jQuery handler
  43177. handle = (dataPriv.get(cur, "events") || {})[event.type] && dataPriv.get(cur, "handle");
  43178. if (handle) {
  43179. handle.apply(cur, data);
  43180. }
  43181. // Native handler
  43182. handle = ontype && cur[ontype];
  43183. if (handle && handle.apply && acceptData(cur)) {
  43184. event.result = handle.apply(cur, data);
  43185. if (event.result === false) {
  43186. event.preventDefault();
  43187. }
  43188. }
  43189. }
  43190. event.type = type;
  43191. // If nobody prevented the default action, do it now
  43192. if (!onlyHandlers && !event.isDefaultPrevented()) {
  43193. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  43194. // Call a native DOM method on the target with the same name as the event.
  43195. // Don't do default actions on window, that's where global variables be (#6170)
  43196. if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
  43197. // Don't re-trigger an onFOO event when we call its FOO() method
  43198. tmp = elem[ontype];
  43199. if (tmp) {
  43200. elem[ontype] = null;
  43201. }
  43202. // Prevent re-triggering of the same event, since we already bubbled it above
  43203. jQuery.event.triggered = type;
  43204. if (event.isPropagationStopped()) {
  43205. lastElement.addEventListener(type, stopPropagationCallback);
  43206. }
  43207. elem[type]();
  43208. if (event.isPropagationStopped()) {
  43209. lastElement.removeEventListener(type, stopPropagationCallback);
  43210. }
  43211. jQuery.event.triggered = undefined;
  43212. if (tmp) {
  43213. elem[ontype] = tmp;
  43214. }
  43215. }
  43216. }
  43217. }
  43218. return event.result;
  43219. },
  43220. // Piggyback on a donor event to simulate a different one
  43221. // Used only for `focus(in | out)` events
  43222. simulate: function simulate(type, elem, event) {
  43223. var e = jQuery.extend(new jQuery.Event(), event, {
  43224. type: type,
  43225. isSimulated: true
  43226. });
  43227. jQuery.event.trigger(e, null, elem);
  43228. }
  43229. });
  43230. jQuery.fn.extend({
  43231. trigger: function trigger(type, data) {
  43232. return this.each(function () {
  43233. jQuery.event.trigger(type, data, this);
  43234. });
  43235. },
  43236. triggerHandler: function triggerHandler(type, data) {
  43237. var elem = this[0];
  43238. if (elem) {
  43239. return jQuery.event.trigger(type, data, elem, true);
  43240. }
  43241. }
  43242. });
  43243. // Support: Firefox <=44
  43244. // Firefox doesn't have focus(in | out) events
  43245. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  43246. //
  43247. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  43248. // focus(in | out) events fire after focus & blur events,
  43249. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  43250. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  43251. if (!support.focusin) {
  43252. jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) {
  43253. // Attach a single capturing handler on the document while someone wants focusin/focusout
  43254. var handler = function handler(event) {
  43255. jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
  43256. };
  43257. jQuery.event.special[fix] = {
  43258. setup: function setup() {
  43259. var doc = this.ownerDocument || this,
  43260. attaches = dataPriv.access(doc, fix);
  43261. if (!attaches) {
  43262. doc.addEventListener(orig, handler, true);
  43263. }
  43264. dataPriv.access(doc, fix, (attaches || 0) + 1);
  43265. },
  43266. teardown: function teardown() {
  43267. var doc = this.ownerDocument || this,
  43268. attaches = dataPriv.access(doc, fix) - 1;
  43269. if (!attaches) {
  43270. doc.removeEventListener(orig, handler, true);
  43271. dataPriv.remove(doc, fix);
  43272. } else {
  43273. dataPriv.access(doc, fix, attaches);
  43274. }
  43275. }
  43276. };
  43277. });
  43278. }
  43279. var location = window.location;
  43280. var nonce = Date.now();
  43281. var rquery = /\?/;
  43282. // Cross-browser xml parsing
  43283. jQuery.parseXML = function (data) {
  43284. var xml;
  43285. if (!data || typeof data !== "string") {
  43286. return null;
  43287. }
  43288. // Support: IE 9 - 11 only
  43289. // IE throws on parseFromString with invalid input.
  43290. try {
  43291. xml = new window.DOMParser().parseFromString(data, "text/xml");
  43292. } catch (e) {
  43293. xml = undefined;
  43294. }
  43295. if (!xml || xml.getElementsByTagName("parsererror").length) {
  43296. jQuery.error("Invalid XML: " + data);
  43297. }
  43298. return xml;
  43299. };
  43300. var rbracket = /\[\]$/,
  43301. rCRLF = /\r?\n/g,
  43302. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  43303. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  43304. function buildParams(prefix, obj, traditional, add) {
  43305. var name;
  43306. if (Array.isArray(obj)) {
  43307. // Serialize array item.
  43308. jQuery.each(obj, function (i, v) {
  43309. if (traditional || rbracket.test(prefix)) {
  43310. // Treat each array item as a scalar.
  43311. add(prefix, v);
  43312. } else {
  43313. // Item is non-scalar (array or object), encode its numeric index.
  43314. buildParams(prefix + "[" + ((typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && v != null ? i : "") + "]", v, traditional, add);
  43315. }
  43316. });
  43317. } else if (!traditional && toType(obj) === "object") {
  43318. // Serialize object item.
  43319. for (name in obj) {
  43320. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  43321. }
  43322. } else {
  43323. // Serialize scalar item.
  43324. add(prefix, obj);
  43325. }
  43326. }
  43327. // Serialize an array of form elements or a set of
  43328. // key/values into a query string
  43329. jQuery.param = function (a, traditional) {
  43330. var prefix,
  43331. s = [],
  43332. add = function add(key, valueOrFunction) {
  43333. // If value is a function, invoke it and use its return value
  43334. var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;
  43335. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
  43336. };
  43337. // If an array was passed in, assume that it is an array of form elements.
  43338. if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  43339. // Serialize the form elements
  43340. jQuery.each(a, function () {
  43341. add(this.name, this.value);
  43342. });
  43343. } else {
  43344. // If traditional, encode the "old" way (the way 1.3.2 or older
  43345. // did it), otherwise encode params recursively.
  43346. for (prefix in a) {
  43347. buildParams(prefix, a[prefix], traditional, add);
  43348. }
  43349. }
  43350. // Return the resulting serialization
  43351. return s.join("&");
  43352. };
  43353. jQuery.fn.extend({
  43354. serialize: function serialize() {
  43355. return jQuery.param(this.serializeArray());
  43356. },
  43357. serializeArray: function serializeArray() {
  43358. return this.map(function () {
  43359. // Can add propHook for "elements" to filter or add form elements
  43360. var elements = jQuery.prop(this, "elements");
  43361. return elements ? jQuery.makeArray(elements) : this;
  43362. }).filter(function () {
  43363. var type = this.type;
  43364. // Use .is( ":disabled" ) so that fieldset[disabled] works
  43365. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
  43366. }).map(function (i, elem) {
  43367. var val = jQuery(this).val();
  43368. if (val == null) {
  43369. return null;
  43370. }
  43371. if (Array.isArray(val)) {
  43372. return jQuery.map(val, function (val) {
  43373. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  43374. });
  43375. }
  43376. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  43377. }).get();
  43378. }
  43379. });
  43380. var r20 = /%20/g,
  43381. rhash = /#.*$/,
  43382. rantiCache = /([?&])_=[^&]*/,
  43383. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  43384. // #7653, #8125, #8152: local protocol detection
  43385. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  43386. rnoContent = /^(?:GET|HEAD)$/,
  43387. rprotocol = /^\/\//,
  43388. /* Prefilters
  43389. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  43390. * 2) These are called:
  43391. * - BEFORE asking for a transport
  43392. * - AFTER param serialization (s.data is a string if s.processData is true)
  43393. * 3) key is the dataType
  43394. * 4) the catchall symbol "*" can be used
  43395. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  43396. */
  43397. prefilters = {},
  43398. /* Transports bindings
  43399. * 1) key is the dataType
  43400. * 2) the catchall symbol "*" can be used
  43401. * 3) selection will start with transport dataType and THEN go to "*" if needed
  43402. */
  43403. transports = {},
  43404. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  43405. allTypes = "*/".concat("*"),
  43406. // Anchor tag for parsing the document origin
  43407. originAnchor = document.createElement("a");
  43408. originAnchor.href = location.href;
  43409. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  43410. function addToPrefiltersOrTransports(structure) {
  43411. // dataTypeExpression is optional and defaults to "*"
  43412. return function (dataTypeExpression, func) {
  43413. if (typeof dataTypeExpression !== "string") {
  43414. func = dataTypeExpression;
  43415. dataTypeExpression = "*";
  43416. }
  43417. var dataType,
  43418. i = 0,
  43419. dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  43420. if (isFunction(func)) {
  43421. // For each dataType in the dataTypeExpression
  43422. while (dataType = dataTypes[i++]) {
  43423. // Prepend if requested
  43424. if (dataType[0] === "+") {
  43425. dataType = dataType.slice(1) || "*";
  43426. (structure[dataType] = structure[dataType] || []).unshift(func);
  43427. // Otherwise append
  43428. } else {
  43429. (structure[dataType] = structure[dataType] || []).push(func);
  43430. }
  43431. }
  43432. }
  43433. };
  43434. }
  43435. // Base inspection function for prefilters and transports
  43436. function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
  43437. var inspected = {},
  43438. seekingTransport = structure === transports;
  43439. function inspect(dataType) {
  43440. var selected;
  43441. inspected[dataType] = true;
  43442. jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
  43443. var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
  43444. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  43445. options.dataTypes.unshift(dataTypeOrTransport);
  43446. inspect(dataTypeOrTransport);
  43447. return false;
  43448. } else if (seekingTransport) {
  43449. return !(selected = dataTypeOrTransport);
  43450. }
  43451. });
  43452. return selected;
  43453. }
  43454. return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
  43455. }
  43456. // A special extend for ajax options
  43457. // that takes "flat" options (not to be deep extended)
  43458. // Fixes #9887
  43459. function ajaxExtend(target, src) {
  43460. var key,
  43461. deep,
  43462. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  43463. for (key in src) {
  43464. if (src[key] !== undefined) {
  43465. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  43466. }
  43467. }
  43468. if (deep) {
  43469. jQuery.extend(true, target, deep);
  43470. }
  43471. return target;
  43472. }
  43473. /* Handles responses to an ajax request:
  43474. * - finds the right dataType (mediates between content-type and expected dataType)
  43475. * - returns the corresponding response
  43476. */
  43477. function ajaxHandleResponses(s, jqXHR, responses) {
  43478. var ct,
  43479. type,
  43480. finalDataType,
  43481. firstDataType,
  43482. contents = s.contents,
  43483. dataTypes = s.dataTypes;
  43484. // Remove auto dataType and get content-type in the process
  43485. while (dataTypes[0] === "*") {
  43486. dataTypes.shift();
  43487. if (ct === undefined) {
  43488. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  43489. }
  43490. }
  43491. // Check if we're dealing with a known content-type
  43492. if (ct) {
  43493. for (type in contents) {
  43494. if (contents[type] && contents[type].test(ct)) {
  43495. dataTypes.unshift(type);
  43496. break;
  43497. }
  43498. }
  43499. }
  43500. // Check to see if we have a response for the expected dataType
  43501. if (dataTypes[0] in responses) {
  43502. finalDataType = dataTypes[0];
  43503. } else {
  43504. // Try convertible dataTypes
  43505. for (type in responses) {
  43506. if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
  43507. finalDataType = type;
  43508. break;
  43509. }
  43510. if (!firstDataType) {
  43511. firstDataType = type;
  43512. }
  43513. }
  43514. // Or just use first one
  43515. finalDataType = finalDataType || firstDataType;
  43516. }
  43517. // If we found a dataType
  43518. // We add the dataType to the list if needed
  43519. // and return the corresponding response
  43520. if (finalDataType) {
  43521. if (finalDataType !== dataTypes[0]) {
  43522. dataTypes.unshift(finalDataType);
  43523. }
  43524. return responses[finalDataType];
  43525. }
  43526. }
  43527. /* Chain conversions given the request and the original response
  43528. * Also sets the responseXXX fields on the jqXHR instance
  43529. */
  43530. function ajaxConvert(s, response, jqXHR, isSuccess) {
  43531. var conv2,
  43532. current,
  43533. conv,
  43534. tmp,
  43535. prev,
  43536. converters = {},
  43537. // Work with a copy of dataTypes in case we need to modify it for conversion
  43538. dataTypes = s.dataTypes.slice();
  43539. // Create converters map with lowercased keys
  43540. if (dataTypes[1]) {
  43541. for (conv in s.converters) {
  43542. converters[conv.toLowerCase()] = s.converters[conv];
  43543. }
  43544. }
  43545. current = dataTypes.shift();
  43546. // Convert to each sequential dataType
  43547. while (current) {
  43548. if (s.responseFields[current]) {
  43549. jqXHR[s.responseFields[current]] = response;
  43550. }
  43551. // Apply the dataFilter if provided
  43552. if (!prev && isSuccess && s.dataFilter) {
  43553. response = s.dataFilter(response, s.dataType);
  43554. }
  43555. prev = current;
  43556. current = dataTypes.shift();
  43557. if (current) {
  43558. // There's only work to do if current dataType is non-auto
  43559. if (current === "*") {
  43560. current = prev;
  43561. // Convert response if prev dataType is non-auto and differs from current
  43562. } else if (prev !== "*" && prev !== current) {
  43563. // Seek a direct converter
  43564. conv = converters[prev + " " + current] || converters["* " + current];
  43565. // If none found, seek a pair
  43566. if (!conv) {
  43567. for (conv2 in converters) {
  43568. // If conv2 outputs current
  43569. tmp = conv2.split(" ");
  43570. if (tmp[1] === current) {
  43571. // If prev can be converted to accepted input
  43572. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  43573. if (conv) {
  43574. // Condense equivalence converters
  43575. if (conv === true) {
  43576. conv = converters[conv2];
  43577. // Otherwise, insert the intermediate dataType
  43578. } else if (converters[conv2] !== true) {
  43579. current = tmp[0];
  43580. dataTypes.unshift(tmp[1]);
  43581. }
  43582. break;
  43583. }
  43584. }
  43585. }
  43586. }
  43587. // Apply converter (if not an equivalence)
  43588. if (conv !== true) {
  43589. // Unless errors are allowed to bubble, catch and return them
  43590. if (conv && s.throws) {
  43591. response = conv(response);
  43592. } else {
  43593. try {
  43594. response = conv(response);
  43595. } catch (e) {
  43596. return {
  43597. state: "parsererror",
  43598. error: conv ? e : "No conversion from " + prev + " to " + current
  43599. };
  43600. }
  43601. }
  43602. }
  43603. }
  43604. }
  43605. }
  43606. return { state: "success", data: response };
  43607. }
  43608. jQuery.extend({
  43609. // Counter for holding the number of active queries
  43610. active: 0,
  43611. // Last-Modified header cache for next request
  43612. lastModified: {},
  43613. etag: {},
  43614. ajaxSettings: {
  43615. url: location.href,
  43616. type: "GET",
  43617. isLocal: rlocalProtocol.test(location.protocol),
  43618. global: true,
  43619. processData: true,
  43620. async: true,
  43621. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  43622. /*
  43623. timeout: 0,
  43624. data: null,
  43625. dataType: null,
  43626. username: null,
  43627. password: null,
  43628. cache: null,
  43629. throws: false,
  43630. traditional: false,
  43631. headers: {},
  43632. */
  43633. accepts: {
  43634. "*": allTypes,
  43635. text: "text/plain",
  43636. html: "text/html",
  43637. xml: "application/xml, text/xml",
  43638. json: "application/json, text/javascript"
  43639. },
  43640. contents: {
  43641. xml: /\bxml\b/,
  43642. html: /\bhtml/,
  43643. json: /\bjson\b/
  43644. },
  43645. responseFields: {
  43646. xml: "responseXML",
  43647. text: "responseText",
  43648. json: "responseJSON"
  43649. },
  43650. // Data converters
  43651. // Keys separate source (or catchall "*") and destination types with a single space
  43652. converters: {
  43653. // Convert anything to text
  43654. "* text": String,
  43655. // Text to html (true = no transformation)
  43656. "text html": true,
  43657. // Evaluate text as a json expression
  43658. "text json": JSON.parse,
  43659. // Parse text as xml
  43660. "text xml": jQuery.parseXML
  43661. },
  43662. // For options that shouldn't be deep extended:
  43663. // you can add your own custom options here if
  43664. // and when you create one that shouldn't be
  43665. // deep extended (see ajaxExtend)
  43666. flatOptions: {
  43667. url: true,
  43668. context: true
  43669. }
  43670. },
  43671. // Creates a full fledged settings object into target
  43672. // with both ajaxSettings and settings fields.
  43673. // If target is omitted, writes into ajaxSettings.
  43674. ajaxSetup: function ajaxSetup(target, settings) {
  43675. return settings ?
  43676. // Building a settings object
  43677. ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
  43678. // Extending ajaxSettings
  43679. ajaxExtend(jQuery.ajaxSettings, target);
  43680. },
  43681. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  43682. ajaxTransport: addToPrefiltersOrTransports(transports),
  43683. // Main method
  43684. ajax: function ajax(url, options) {
  43685. // If url is an object, simulate pre-1.5 signature
  43686. if ((typeof url === "undefined" ? "undefined" : _typeof(url)) === "object") {
  43687. options = url;
  43688. url = undefined;
  43689. }
  43690. // Force options to be an object
  43691. options = options || {};
  43692. var transport,
  43693. // URL without anti-cache param
  43694. cacheURL,
  43695. // Response headers
  43696. responseHeadersString,
  43697. responseHeaders,
  43698. // timeout handle
  43699. timeoutTimer,
  43700. // Url cleanup var
  43701. urlAnchor,
  43702. // Request state (becomes false upon send and true upon completion)
  43703. completed,
  43704. // To know if global events are to be dispatched
  43705. fireGlobals,
  43706. // Loop variable
  43707. i,
  43708. // uncached part of the url
  43709. uncached,
  43710. // Create the final options object
  43711. s = jQuery.ajaxSetup({}, options),
  43712. // Callbacks context
  43713. callbackContext = s.context || s,
  43714. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  43715. globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
  43716. // Deferreds
  43717. deferred = jQuery.Deferred(),
  43718. completeDeferred = jQuery.Callbacks("once memory"),
  43719. // Status-dependent callbacks
  43720. _statusCode = s.statusCode || {},
  43721. // Headers (they are sent all at once)
  43722. requestHeaders = {},
  43723. requestHeadersNames = {},
  43724. // Default abort message
  43725. strAbort = "canceled",
  43726. // Fake xhr
  43727. jqXHR = {
  43728. readyState: 0,
  43729. // Builds headers hashtable if needed
  43730. getResponseHeader: function getResponseHeader(key) {
  43731. var match;
  43732. if (completed) {
  43733. if (!responseHeaders) {
  43734. responseHeaders = {};
  43735. while (match = rheaders.exec(responseHeadersString)) {
  43736. responseHeaders[match[1].toLowerCase()] = match[2];
  43737. }
  43738. }
  43739. match = responseHeaders[key.toLowerCase()];
  43740. }
  43741. return match == null ? null : match;
  43742. },
  43743. // Raw string
  43744. getAllResponseHeaders: function getAllResponseHeaders() {
  43745. return completed ? responseHeadersString : null;
  43746. },
  43747. // Caches the header
  43748. setRequestHeader: function setRequestHeader(name, value) {
  43749. if (completed == null) {
  43750. name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
  43751. requestHeaders[name] = value;
  43752. }
  43753. return this;
  43754. },
  43755. // Overrides response content-type header
  43756. overrideMimeType: function overrideMimeType(type) {
  43757. if (completed == null) {
  43758. s.mimeType = type;
  43759. }
  43760. return this;
  43761. },
  43762. // Status-dependent callbacks
  43763. statusCode: function statusCode(map) {
  43764. var code;
  43765. if (map) {
  43766. if (completed) {
  43767. // Execute the appropriate callbacks
  43768. jqXHR.always(map[jqXHR.status]);
  43769. } else {
  43770. // Lazy-add the new callbacks in a way that preserves old ones
  43771. for (code in map) {
  43772. _statusCode[code] = [_statusCode[code], map[code]];
  43773. }
  43774. }
  43775. }
  43776. return this;
  43777. },
  43778. // Cancel the request
  43779. abort: function abort(statusText) {
  43780. var finalText = statusText || strAbort;
  43781. if (transport) {
  43782. transport.abort(finalText);
  43783. }
  43784. done(0, finalText);
  43785. return this;
  43786. }
  43787. };
  43788. // Attach deferreds
  43789. deferred.promise(jqXHR);
  43790. // Add protocol if not provided (prefilters might expect it)
  43791. // Handle falsy url in the settings object (#10093: consistency with old signature)
  43792. // We also use the url parameter if available
  43793. s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");
  43794. // Alias method option to type as per ticket #12004
  43795. s.type = options.method || options.type || s.method || s.type;
  43796. // Extract dataTypes list
  43797. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  43798. // A cross-domain request is in order when the origin doesn't match the current origin.
  43799. if (s.crossDomain == null) {
  43800. urlAnchor = document.createElement("a");
  43801. // Support: IE <=8 - 11, Edge 12 - 15
  43802. // IE throws exception on accessing the href property if url is malformed,
  43803. // e.g. http://example.com:80x/
  43804. try {
  43805. urlAnchor.href = s.url;
  43806. // Support: IE <=8 - 11 only
  43807. // Anchor's host property isn't correctly set when s.url is relative
  43808. urlAnchor.href = urlAnchor.href;
  43809. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
  43810. } catch (e) {
  43811. // If there is an error parsing the URL, assume it is crossDomain,
  43812. // it can be rejected by the transport if it is invalid
  43813. s.crossDomain = true;
  43814. }
  43815. }
  43816. // Convert data if not already a string
  43817. if (s.data && s.processData && typeof s.data !== "string") {
  43818. s.data = jQuery.param(s.data, s.traditional);
  43819. }
  43820. // Apply prefilters
  43821. inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
  43822. // If request was aborted inside a prefilter, stop there
  43823. if (completed) {
  43824. return jqXHR;
  43825. }
  43826. // We can fire global events as of now if asked to
  43827. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  43828. fireGlobals = jQuery.event && s.global;
  43829. // Watch for a new set of requests
  43830. if (fireGlobals && jQuery.active++ === 0) {
  43831. jQuery.event.trigger("ajaxStart");
  43832. }
  43833. // Uppercase the type
  43834. s.type = s.type.toUpperCase();
  43835. // Determine if request has content
  43836. s.hasContent = !rnoContent.test(s.type);
  43837. // Save the URL in case we're toying with the If-Modified-Since
  43838. // and/or If-None-Match header later on
  43839. // Remove hash to simplify url manipulation
  43840. cacheURL = s.url.replace(rhash, "");
  43841. // More options handling for requests with no content
  43842. if (!s.hasContent) {
  43843. // Remember the hash so we can put it back
  43844. uncached = s.url.slice(cacheURL.length);
  43845. // If data is available and should be processed, append data to url
  43846. if (s.data && (s.processData || typeof s.data === "string")) {
  43847. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  43848. // #9682: remove data so that it's not used in an eventual retry
  43849. delete s.data;
  43850. }
  43851. // Add or update anti-cache param if needed
  43852. if (s.cache === false) {
  43853. cacheURL = cacheURL.replace(rantiCache, "$1");
  43854. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++ + uncached;
  43855. }
  43856. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  43857. s.url = cacheURL + uncached;
  43858. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  43859. } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  43860. s.data = s.data.replace(r20, "+");
  43861. }
  43862. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  43863. if (s.ifModified) {
  43864. if (jQuery.lastModified[cacheURL]) {
  43865. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  43866. }
  43867. if (jQuery.etag[cacheURL]) {
  43868. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  43869. }
  43870. }
  43871. // Set the correct header, if data is being sent
  43872. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  43873. jqXHR.setRequestHeader("Content-Type", s.contentType);
  43874. }
  43875. // Set the Accepts header for the server, depending on the dataType
  43876. 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["*"]);
  43877. // Check for headers option
  43878. for (i in s.headers) {
  43879. jqXHR.setRequestHeader(i, s.headers[i]);
  43880. }
  43881. // Allow custom headers/mimetypes and early abort
  43882. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {
  43883. // Abort if not done already and return
  43884. return jqXHR.abort();
  43885. }
  43886. // Aborting is no longer a cancellation
  43887. strAbort = "abort";
  43888. // Install callbacks on deferreds
  43889. completeDeferred.add(s.complete);
  43890. jqXHR.done(s.success);
  43891. jqXHR.fail(s.error);
  43892. // Get transport
  43893. transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
  43894. // If no transport, we auto-abort
  43895. if (!transport) {
  43896. done(-1, "No Transport");
  43897. } else {
  43898. jqXHR.readyState = 1;
  43899. // Send global event
  43900. if (fireGlobals) {
  43901. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  43902. }
  43903. // If request was aborted inside ajaxSend, stop there
  43904. if (completed) {
  43905. return jqXHR;
  43906. }
  43907. // Timeout
  43908. if (s.async && s.timeout > 0) {
  43909. timeoutTimer = window.setTimeout(function () {
  43910. jqXHR.abort("timeout");
  43911. }, s.timeout);
  43912. }
  43913. try {
  43914. completed = false;
  43915. transport.send(requestHeaders, done);
  43916. } catch (e) {
  43917. // Rethrow post-completion exceptions
  43918. if (completed) {
  43919. throw e;
  43920. }
  43921. // Propagate others as results
  43922. done(-1, e);
  43923. }
  43924. }
  43925. // Callback for when everything is done
  43926. function done(status, nativeStatusText, responses, headers) {
  43927. var isSuccess,
  43928. success,
  43929. error,
  43930. response,
  43931. modified,
  43932. statusText = nativeStatusText;
  43933. // Ignore repeat invocations
  43934. if (completed) {
  43935. return;
  43936. }
  43937. completed = true;
  43938. // Clear timeout if it exists
  43939. if (timeoutTimer) {
  43940. window.clearTimeout(timeoutTimer);
  43941. }
  43942. // Dereference transport for early garbage collection
  43943. // (no matter how long the jqXHR object will be used)
  43944. transport = undefined;
  43945. // Cache response headers
  43946. responseHeadersString = headers || "";
  43947. // Set readyState
  43948. jqXHR.readyState = status > 0 ? 4 : 0;
  43949. // Determine if successful
  43950. isSuccess = status >= 200 && status < 300 || status === 304;
  43951. // Get response data
  43952. if (responses) {
  43953. response = ajaxHandleResponses(s, jqXHR, responses);
  43954. }
  43955. // Convert no matter what (that way responseXXX fields are always set)
  43956. response = ajaxConvert(s, response, jqXHR, isSuccess);
  43957. // If successful, handle type chaining
  43958. if (isSuccess) {
  43959. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  43960. if (s.ifModified) {
  43961. modified = jqXHR.getResponseHeader("Last-Modified");
  43962. if (modified) {
  43963. jQuery.lastModified[cacheURL] = modified;
  43964. }
  43965. modified = jqXHR.getResponseHeader("etag");
  43966. if (modified) {
  43967. jQuery.etag[cacheURL] = modified;
  43968. }
  43969. }
  43970. // if no content
  43971. if (status === 204 || s.type === "HEAD") {
  43972. statusText = "nocontent";
  43973. // if not modified
  43974. } else if (status === 304) {
  43975. statusText = "notmodified";
  43976. // If we have data, let's convert it
  43977. } else {
  43978. statusText = response.state;
  43979. success = response.data;
  43980. error = response.error;
  43981. isSuccess = !error;
  43982. }
  43983. } else {
  43984. // Extract error from statusText and normalize for non-aborts
  43985. error = statusText;
  43986. if (status || !statusText) {
  43987. statusText = "error";
  43988. if (status < 0) {
  43989. status = 0;
  43990. }
  43991. }
  43992. }
  43993. // Set data for the fake xhr object
  43994. jqXHR.status = status;
  43995. jqXHR.statusText = (nativeStatusText || statusText) + "";
  43996. // Success/Error
  43997. if (isSuccess) {
  43998. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  43999. } else {
  44000. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  44001. }
  44002. // Status-dependent callbacks
  44003. jqXHR.statusCode(_statusCode);
  44004. _statusCode = undefined;
  44005. if (fireGlobals) {
  44006. globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
  44007. }
  44008. // Complete
  44009. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  44010. if (fireGlobals) {
  44011. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  44012. // Handle the global AJAX counter
  44013. if (! --jQuery.active) {
  44014. jQuery.event.trigger("ajaxStop");
  44015. }
  44016. }
  44017. }
  44018. return jqXHR;
  44019. },
  44020. getJSON: function getJSON(url, data, callback) {
  44021. return jQuery.get(url, data, callback, "json");
  44022. },
  44023. getScript: function getScript(url, callback) {
  44024. return jQuery.get(url, undefined, callback, "script");
  44025. }
  44026. });
  44027. jQuery.each(["get", "post"], function (i, method) {
  44028. jQuery[method] = function (url, data, callback, type) {
  44029. // Shift arguments if data argument was omitted
  44030. if (isFunction(data)) {
  44031. type = type || callback;
  44032. callback = data;
  44033. data = undefined;
  44034. }
  44035. // The url can be an options object (which then must have .url)
  44036. return jQuery.ajax(jQuery.extend({
  44037. url: url,
  44038. type: method,
  44039. dataType: type,
  44040. data: data,
  44041. success: callback
  44042. }, jQuery.isPlainObject(url) && url));
  44043. };
  44044. });
  44045. jQuery._evalUrl = function (url) {
  44046. return jQuery.ajax({
  44047. url: url,
  44048. // Make this explicit, since user can override this through ajaxSetup (#11264)
  44049. type: "GET",
  44050. dataType: "script",
  44051. cache: true,
  44052. async: false,
  44053. global: false,
  44054. "throws": true
  44055. });
  44056. };
  44057. jQuery.fn.extend({
  44058. wrapAll: function wrapAll(html) {
  44059. var wrap;
  44060. if (this[0]) {
  44061. if (isFunction(html)) {
  44062. html = html.call(this[0]);
  44063. }
  44064. // The elements to wrap the target around
  44065. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  44066. if (this[0].parentNode) {
  44067. wrap.insertBefore(this[0]);
  44068. }
  44069. wrap.map(function () {
  44070. var elem = this;
  44071. while (elem.firstElementChild) {
  44072. elem = elem.firstElementChild;
  44073. }
  44074. return elem;
  44075. }).append(this);
  44076. }
  44077. return this;
  44078. },
  44079. wrapInner: function wrapInner(html) {
  44080. if (isFunction(html)) {
  44081. return this.each(function (i) {
  44082. jQuery(this).wrapInner(html.call(this, i));
  44083. });
  44084. }
  44085. return this.each(function () {
  44086. var self = jQuery(this),
  44087. contents = self.contents();
  44088. if (contents.length) {
  44089. contents.wrapAll(html);
  44090. } else {
  44091. self.append(html);
  44092. }
  44093. });
  44094. },
  44095. wrap: function wrap(html) {
  44096. var htmlIsFunction = isFunction(html);
  44097. return this.each(function (i) {
  44098. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
  44099. });
  44100. },
  44101. unwrap: function unwrap(selector) {
  44102. this.parent(selector).not("body").each(function () {
  44103. jQuery(this).replaceWith(this.childNodes);
  44104. });
  44105. return this;
  44106. }
  44107. });
  44108. jQuery.expr.pseudos.hidden = function (elem) {
  44109. return !jQuery.expr.pseudos.visible(elem);
  44110. };
  44111. jQuery.expr.pseudos.visible = function (elem) {
  44112. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  44113. };
  44114. jQuery.ajaxSettings.xhr = function () {
  44115. try {
  44116. return new window.XMLHttpRequest();
  44117. } catch (e) {}
  44118. };
  44119. var xhrSuccessStatus = {
  44120. // File protocol always yields status code 0, assume 200
  44121. 0: 200,
  44122. // Support: IE <=9 only
  44123. // #1450: sometimes IE returns 1223 when it should be 204
  44124. 1223: 204
  44125. },
  44126. xhrSupported = jQuery.ajaxSettings.xhr();
  44127. support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  44128. support.ajax = xhrSupported = !!xhrSupported;
  44129. jQuery.ajaxTransport(function (options) {
  44130. var _callback, errorCallback;
  44131. // Cross domain only allowed if supported through XMLHttpRequest
  44132. if (support.cors || xhrSupported && !options.crossDomain) {
  44133. return {
  44134. send: function send(headers, complete) {
  44135. var i,
  44136. xhr = options.xhr();
  44137. xhr.open(options.type, options.url, options.async, options.username, options.password);
  44138. // Apply custom fields if provided
  44139. if (options.xhrFields) {
  44140. for (i in options.xhrFields) {
  44141. xhr[i] = options.xhrFields[i];
  44142. }
  44143. }
  44144. // Override mime type if needed
  44145. if (options.mimeType && xhr.overrideMimeType) {
  44146. xhr.overrideMimeType(options.mimeType);
  44147. }
  44148. // X-Requested-With header
  44149. // For cross-domain requests, seeing as conditions for a preflight are
  44150. // akin to a jigsaw puzzle, we simply never set it to be sure.
  44151. // (it can always be set on a per-request basis or even using ajaxSetup)
  44152. // For same-domain requests, won't change header if already provided.
  44153. if (!options.crossDomain && !headers["X-Requested-With"]) {
  44154. headers["X-Requested-With"] = "XMLHttpRequest";
  44155. }
  44156. // Set headers
  44157. for (i in headers) {
  44158. xhr.setRequestHeader(i, headers[i]);
  44159. }
  44160. // Callback
  44161. _callback = function callback(type) {
  44162. return function () {
  44163. if (_callback) {
  44164. _callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
  44165. if (type === "abort") {
  44166. xhr.abort();
  44167. } else if (type === "error") {
  44168. // Support: IE <=9 only
  44169. // On a manual native abort, IE9 throws
  44170. // errors on any property access that is not readyState
  44171. if (typeof xhr.status !== "number") {
  44172. complete(0, "error");
  44173. } else {
  44174. complete(
  44175. // File: protocol always yields status 0; see #8605, #14207
  44176. xhr.status, xhr.statusText);
  44177. }
  44178. } else {
  44179. complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText,
  44180. // Support: IE <=9 only
  44181. // IE9 has no XHR2 but throws on binary (trac-11426)
  44182. // For XHR2 non-text, let the caller handle it (gh-2498)
  44183. (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders());
  44184. }
  44185. }
  44186. };
  44187. };
  44188. // Listen to events
  44189. xhr.onload = _callback();
  44190. errorCallback = xhr.onerror = xhr.ontimeout = _callback("error");
  44191. // Support: IE 9 only
  44192. // Use onreadystatechange to replace onabort
  44193. // to handle uncaught aborts
  44194. if (xhr.onabort !== undefined) {
  44195. xhr.onabort = errorCallback;
  44196. } else {
  44197. xhr.onreadystatechange = function () {
  44198. // Check readyState before timeout as it changes
  44199. if (xhr.readyState === 4) {
  44200. // Allow onerror to be called first,
  44201. // but that will not handle a native abort
  44202. // Also, save errorCallback to a variable
  44203. // as xhr.onerror cannot be accessed
  44204. window.setTimeout(function () {
  44205. if (_callback) {
  44206. errorCallback();
  44207. }
  44208. });
  44209. }
  44210. };
  44211. }
  44212. // Create the abort callback
  44213. _callback = _callback("abort");
  44214. try {
  44215. // Do send the request (this may raise an exception)
  44216. xhr.send(options.hasContent && options.data || null);
  44217. } catch (e) {
  44218. // #14683: Only rethrow if this hasn't been notified as an error yet
  44219. if (_callback) {
  44220. throw e;
  44221. }
  44222. }
  44223. },
  44224. abort: function abort() {
  44225. if (_callback) {
  44226. _callback();
  44227. }
  44228. }
  44229. };
  44230. }
  44231. });
  44232. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  44233. jQuery.ajaxPrefilter(function (s) {
  44234. if (s.crossDomain) {
  44235. s.contents.script = false;
  44236. }
  44237. });
  44238. // Install script dataType
  44239. jQuery.ajaxSetup({
  44240. accepts: {
  44241. script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript"
  44242. },
  44243. contents: {
  44244. script: /\b(?:java|ecma)script\b/
  44245. },
  44246. converters: {
  44247. "text script": function textScript(text) {
  44248. jQuery.globalEval(text);
  44249. return text;
  44250. }
  44251. }
  44252. });
  44253. // Handle cache's special case and crossDomain
  44254. jQuery.ajaxPrefilter("script", function (s) {
  44255. if (s.cache === undefined) {
  44256. s.cache = false;
  44257. }
  44258. if (s.crossDomain) {
  44259. s.type = "GET";
  44260. }
  44261. });
  44262. // Bind script tag hack transport
  44263. jQuery.ajaxTransport("script", function (s) {
  44264. // This transport only deals with cross domain requests
  44265. if (s.crossDomain) {
  44266. var script, _callback2;
  44267. return {
  44268. send: function send(_, complete) {
  44269. script = jQuery("<script>").prop({
  44270. charset: s.scriptCharset,
  44271. src: s.url
  44272. }).on("load error", _callback2 = function callback(evt) {
  44273. script.remove();
  44274. _callback2 = null;
  44275. if (evt) {
  44276. complete(evt.type === "error" ? 404 : 200, evt.type);
  44277. }
  44278. });
  44279. // Use native DOM manipulation to avoid our domManip AJAX trickery
  44280. document.head.appendChild(script[0]);
  44281. },
  44282. abort: function abort() {
  44283. if (_callback2) {
  44284. _callback2();
  44285. }
  44286. }
  44287. };
  44288. }
  44289. });
  44290. var oldCallbacks = [],
  44291. rjsonp = /(=)\?(?=&|$)|\?\?/;
  44292. // Default jsonp settings
  44293. jQuery.ajaxSetup({
  44294. jsonp: "callback",
  44295. jsonpCallback: function jsonpCallback() {
  44296. var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce++;
  44297. this[callback] = true;
  44298. return callback;
  44299. }
  44300. });
  44301. // Detect, normalize options and install callbacks for jsonp requests
  44302. jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
  44303. var callbackName,
  44304. overwritten,
  44305. responseContainer,
  44306. 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");
  44307. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  44308. if (jsonProp || s.dataTypes[0] === "jsonp") {
  44309. // Get callback name, remembering preexisting value associated with it
  44310. callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  44311. // Insert callback into url or form data
  44312. if (jsonProp) {
  44313. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  44314. } else if (s.jsonp !== false) {
  44315. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  44316. }
  44317. // Use data converter to retrieve json after script execution
  44318. s.converters["script json"] = function () {
  44319. if (!responseContainer) {
  44320. jQuery.error(callbackName + " was not called");
  44321. }
  44322. return responseContainer[0];
  44323. };
  44324. // Force json dataType
  44325. s.dataTypes[0] = "json";
  44326. // Install callback
  44327. overwritten = window[callbackName];
  44328. window[callbackName] = function () {
  44329. responseContainer = arguments;
  44330. };
  44331. // Clean-up function (fires after converters)
  44332. jqXHR.always(function () {
  44333. // If previous value didn't exist - remove it
  44334. if (overwritten === undefined) {
  44335. jQuery(window).removeProp(callbackName);
  44336. // Otherwise restore preexisting value
  44337. } else {
  44338. window[callbackName] = overwritten;
  44339. }
  44340. // Save back as free
  44341. if (s[callbackName]) {
  44342. // Make sure that re-using the options doesn't screw things around
  44343. s.jsonpCallback = originalSettings.jsonpCallback;
  44344. // Save the callback name for future use
  44345. oldCallbacks.push(callbackName);
  44346. }
  44347. // Call if it was a function and we have a response
  44348. if (responseContainer && isFunction(overwritten)) {
  44349. overwritten(responseContainer[0]);
  44350. }
  44351. responseContainer = overwritten = undefined;
  44352. });
  44353. // Delegate to script
  44354. return "script";
  44355. }
  44356. });
  44357. // Support: Safari 8 only
  44358. // In Safari 8 documents created via document.implementation.createHTMLDocument
  44359. // collapse sibling forms: the second one becomes a child of the first one.
  44360. // Because of that, this security measure has to be disabled in Safari 8.
  44361. // https://bugs.webkit.org/show_bug.cgi?id=137337
  44362. support.createHTMLDocument = function () {
  44363. var body = document.implementation.createHTMLDocument("").body;
  44364. body.innerHTML = "<form></form><form></form>";
  44365. return body.childNodes.length === 2;
  44366. }();
  44367. // Argument "data" should be string of html
  44368. // context (optional): If specified, the fragment will be created in this context,
  44369. // defaults to document
  44370. // keepScripts (optional): If true, will include scripts passed in the html string
  44371. jQuery.parseHTML = function (data, context, keepScripts) {
  44372. if (typeof data !== "string") {
  44373. return [];
  44374. }
  44375. if (typeof context === "boolean") {
  44376. keepScripts = context;
  44377. context = false;
  44378. }
  44379. var base, parsed, scripts;
  44380. if (!context) {
  44381. // Stop scripts or inline event handlers from being executed immediately
  44382. // by using document.implementation
  44383. if (support.createHTMLDocument) {
  44384. context = document.implementation.createHTMLDocument("");
  44385. // Set the base href for the created document
  44386. // so any parsed elements with URLs
  44387. // are based on the document's URL (gh-2965)
  44388. base = context.createElement("base");
  44389. base.href = document.location.href;
  44390. context.head.appendChild(base);
  44391. } else {
  44392. context = document;
  44393. }
  44394. }
  44395. parsed = rsingleTag.exec(data);
  44396. scripts = !keepScripts && [];
  44397. // Single tag
  44398. if (parsed) {
  44399. return [context.createElement(parsed[1])];
  44400. }
  44401. parsed = buildFragment([data], context, scripts);
  44402. if (scripts && scripts.length) {
  44403. jQuery(scripts).remove();
  44404. }
  44405. return jQuery.merge([], parsed.childNodes);
  44406. };
  44407. /**
  44408. * Load a url into a page
  44409. */
  44410. jQuery.fn.load = function (url, params, callback) {
  44411. var selector,
  44412. type,
  44413. response,
  44414. self = this,
  44415. off = url.indexOf(" ");
  44416. if (off > -1) {
  44417. selector = stripAndCollapse(url.slice(off));
  44418. url = url.slice(0, off);
  44419. }
  44420. // If it's a function
  44421. if (isFunction(params)) {
  44422. // We assume that it's the callback
  44423. callback = params;
  44424. params = undefined;
  44425. // Otherwise, build a param string
  44426. } else if (params && (typeof params === "undefined" ? "undefined" : _typeof(params)) === "object") {
  44427. type = "POST";
  44428. }
  44429. // If we have elements to modify, make the request
  44430. if (self.length > 0) {
  44431. jQuery.ajax({
  44432. url: url,
  44433. // If "type" variable is undefined, then "GET" method will be used.
  44434. // Make value of this field explicit since
  44435. // user can override it through ajaxSetup method
  44436. type: type || "GET",
  44437. dataType: "html",
  44438. data: params
  44439. }).done(function (responseText) {
  44440. // Save response for use in complete callback
  44441. response = arguments;
  44442. self.html(selector ?
  44443. // If a selector was specified, locate the right elements in a dummy div
  44444. // Exclude scripts to avoid IE 'Permission Denied' errors
  44445. jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
  44446. // Otherwise use the full result
  44447. responseText);
  44448. // If the request succeeds, this function gets "data", "status", "jqXHR"
  44449. // but they are ignored because response was set above.
  44450. // If it fails, this function gets "jqXHR", "status", "error"
  44451. }).always(callback && function (jqXHR, status) {
  44452. self.each(function () {
  44453. callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  44454. });
  44455. });
  44456. }
  44457. return this;
  44458. };
  44459. // Attach a bunch of functions for handling common AJAX events
  44460. jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) {
  44461. jQuery.fn[type] = function (fn) {
  44462. return this.on(type, fn);
  44463. };
  44464. });
  44465. jQuery.expr.pseudos.animated = function (elem) {
  44466. return jQuery.grep(jQuery.timers, function (fn) {
  44467. return elem === fn.elem;
  44468. }).length;
  44469. };
  44470. jQuery.offset = {
  44471. setOffset: function setOffset(elem, options, i) {
  44472. var curPosition,
  44473. curLeft,
  44474. curCSSTop,
  44475. curTop,
  44476. curOffset,
  44477. curCSSLeft,
  44478. calculatePosition,
  44479. position = jQuery.css(elem, "position"),
  44480. curElem = jQuery(elem),
  44481. props = {};
  44482. // Set position first, in-case top/left are set even on static elem
  44483. if (position === "static") {
  44484. elem.style.position = "relative";
  44485. }
  44486. curOffset = curElem.offset();
  44487. curCSSTop = jQuery.css(elem, "top");
  44488. curCSSLeft = jQuery.css(elem, "left");
  44489. calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  44490. // Need to be able to calculate position if either
  44491. // top or left is auto and position is either absolute or fixed
  44492. if (calculatePosition) {
  44493. curPosition = curElem.position();
  44494. curTop = curPosition.top;
  44495. curLeft = curPosition.left;
  44496. } else {
  44497. curTop = parseFloat(curCSSTop) || 0;
  44498. curLeft = parseFloat(curCSSLeft) || 0;
  44499. }
  44500. if (isFunction(options)) {
  44501. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  44502. options = options.call(elem, i, jQuery.extend({}, curOffset));
  44503. }
  44504. if (options.top != null) {
  44505. props.top = options.top - curOffset.top + curTop;
  44506. }
  44507. if (options.left != null) {
  44508. props.left = options.left - curOffset.left + curLeft;
  44509. }
  44510. if ("using" in options) {
  44511. options.using.call(elem, props);
  44512. } else {
  44513. curElem.css(props);
  44514. }
  44515. }
  44516. };
  44517. jQuery.fn.extend({
  44518. // offset() relates an element's border box to the document origin
  44519. offset: function offset(options) {
  44520. // Preserve chaining for setter
  44521. if (arguments.length) {
  44522. return options === undefined ? this : this.each(function (i) {
  44523. jQuery.offset.setOffset(this, options, i);
  44524. });
  44525. }
  44526. var rect,
  44527. win,
  44528. elem = this[0];
  44529. if (!elem) {
  44530. return;
  44531. }
  44532. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  44533. // Support: IE <=11 only
  44534. // Running getBoundingClientRect on a
  44535. // disconnected node in IE throws an error
  44536. if (!elem.getClientRects().length) {
  44537. return { top: 0, left: 0 };
  44538. }
  44539. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  44540. rect = elem.getBoundingClientRect();
  44541. win = elem.ownerDocument.defaultView;
  44542. return {
  44543. top: rect.top + win.pageYOffset,
  44544. left: rect.left + win.pageXOffset
  44545. };
  44546. },
  44547. // position() relates an element's margin box to its offset parent's padding box
  44548. // This corresponds to the behavior of CSS absolute positioning
  44549. position: function position() {
  44550. if (!this[0]) {
  44551. return;
  44552. }
  44553. var offsetParent,
  44554. offset,
  44555. doc,
  44556. elem = this[0],
  44557. parentOffset = { top: 0, left: 0 };
  44558. // position:fixed elements are offset from the viewport, which itself always has zero offset
  44559. if (jQuery.css(elem, "position") === "fixed") {
  44560. // Assume position:fixed implies availability of getBoundingClientRect
  44561. offset = elem.getBoundingClientRect();
  44562. } else {
  44563. offset = this.offset();
  44564. // Account for the *real* offset parent, which can be the document or its root element
  44565. // when a statically positioned element is identified
  44566. doc = elem.ownerDocument;
  44567. offsetParent = elem.offsetParent || doc.documentElement;
  44568. while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
  44569. offsetParent = offsetParent.parentNode;
  44570. }
  44571. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  44572. // Incorporate borders into its offset, since they are outside its content origin
  44573. parentOffset = jQuery(offsetParent).offset();
  44574. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  44575. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  44576. }
  44577. }
  44578. // Subtract parent offsets and element margins
  44579. return {
  44580. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  44581. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  44582. };
  44583. },
  44584. // This method will return documentElement in the following cases:
  44585. // 1) For the element inside the iframe without offsetParent, this method will return
  44586. // documentElement of the parent window
  44587. // 2) For the hidden or detached element
  44588. // 3) For body or html element, i.e. in case of the html node - it will return itself
  44589. //
  44590. // but those exceptions were never presented as a real life use-cases
  44591. // and might be considered as more preferable results.
  44592. //
  44593. // This logic, however, is not guaranteed and can change at any point in the future
  44594. offsetParent: function offsetParent() {
  44595. return this.map(function () {
  44596. var offsetParent = this.offsetParent;
  44597. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  44598. offsetParent = offsetParent.offsetParent;
  44599. }
  44600. return offsetParent || documentElement;
  44601. });
  44602. }
  44603. });
  44604. // Create scrollLeft and scrollTop methods
  44605. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) {
  44606. var top = "pageYOffset" === prop;
  44607. jQuery.fn[method] = function (val) {
  44608. return access(this, function (elem, method, val) {
  44609. // Coalesce documents and windows
  44610. var win;
  44611. if (isWindow(elem)) {
  44612. win = elem;
  44613. } else if (elem.nodeType === 9) {
  44614. win = elem.defaultView;
  44615. }
  44616. if (val === undefined) {
  44617. return win ? win[prop] : elem[method];
  44618. }
  44619. if (win) {
  44620. win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset);
  44621. } else {
  44622. elem[method] = val;
  44623. }
  44624. }, method, val, arguments.length);
  44625. };
  44626. });
  44627. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  44628. // Add the top/left cssHooks using jQuery.fn.position
  44629. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  44630. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  44631. // getComputedStyle returns percent when specified for top/left/bottom/right;
  44632. // rather than make the css module depend on the offset module, just check for it here
  44633. jQuery.each(["top", "left"], function (i, prop) {
  44634. jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) {
  44635. if (computed) {
  44636. computed = curCSS(elem, prop);
  44637. // If curCSS returns percentage, fallback to offset
  44638. return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
  44639. }
  44640. });
  44641. });
  44642. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  44643. jQuery.each({ Height: "height", Width: "width" }, function (name, type) {
  44644. jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) {
  44645. // Margin is only for outerHeight, outerWidth
  44646. jQuery.fn[funcName] = function (margin, value) {
  44647. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
  44648. extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  44649. return access(this, function (elem, type, value) {
  44650. var doc;
  44651. if (isWindow(elem)) {
  44652. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  44653. return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
  44654. }
  44655. // Get document width or height
  44656. if (elem.nodeType === 9) {
  44657. doc = elem.documentElement;
  44658. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  44659. // whichever is greatest
  44660. return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);
  44661. }
  44662. return value === undefined ?
  44663. // Get width or height on the element, requesting but not forcing parseFloat
  44664. jQuery.css(elem, type, extra) :
  44665. // Set width or height on the element
  44666. jQuery.style(elem, type, value, extra);
  44667. }, type, chainable ? margin : undefined, chainable);
  44668. };
  44669. });
  44670. });
  44671. 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) {
  44672. // Handle event binding
  44673. jQuery.fn[name] = function (data, fn) {
  44674. return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
  44675. };
  44676. });
  44677. jQuery.fn.extend({
  44678. hover: function hover(fnOver, fnOut) {
  44679. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  44680. }
  44681. });
  44682. jQuery.fn.extend({
  44683. bind: function bind(types, data, fn) {
  44684. return this.on(types, null, data, fn);
  44685. },
  44686. unbind: function unbind(types, fn) {
  44687. return this.off(types, null, fn);
  44688. },
  44689. delegate: function delegate(selector, types, data, fn) {
  44690. return this.on(types, selector, data, fn);
  44691. },
  44692. undelegate: function undelegate(selector, types, fn) {
  44693. // ( namespace ) or ( selector, types [, fn] )
  44694. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
  44695. }
  44696. });
  44697. // Bind a function to a context, optionally partially applying any
  44698. // arguments.
  44699. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  44700. // However, it is not slated for removal any time soon
  44701. jQuery.proxy = function (fn, context) {
  44702. var tmp, args, proxy;
  44703. if (typeof context === "string") {
  44704. tmp = fn[context];
  44705. context = fn;
  44706. fn = tmp;
  44707. }
  44708. // Quick check to determine if target is callable, in the spec
  44709. // this throws a TypeError, but we will just return undefined.
  44710. if (!isFunction(fn)) {
  44711. return undefined;
  44712. }
  44713. // Simulated bind
  44714. args = _slice.call(arguments, 2);
  44715. proxy = function proxy() {
  44716. return fn.apply(context || this, args.concat(_slice.call(arguments)));
  44717. };
  44718. // Set the guid of unique handler to the same of original handler, so it can be removed
  44719. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  44720. return proxy;
  44721. };
  44722. jQuery.holdReady = function (hold) {
  44723. if (hold) {
  44724. jQuery.readyWait++;
  44725. } else {
  44726. jQuery.ready(true);
  44727. }
  44728. };
  44729. jQuery.isArray = Array.isArray;
  44730. jQuery.parseJSON = JSON.parse;
  44731. jQuery.nodeName = nodeName;
  44732. jQuery.isFunction = isFunction;
  44733. jQuery.isWindow = isWindow;
  44734. jQuery.camelCase = camelCase;
  44735. jQuery.type = toType;
  44736. jQuery.now = Date.now;
  44737. jQuery.isNumeric = function (obj) {
  44738. // As of jQuery 3.0, isNumeric is limited to
  44739. // strings and numbers (primitives or objects)
  44740. // that can be coerced to finite numbers (gh-2662)
  44741. var type = jQuery.type(obj);
  44742. return (type === "number" || type === "string") &&
  44743. // parseFloat NaNs numeric-cast false positives ("")
  44744. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  44745. // subtraction forces infinities to NaN
  44746. !isNaN(obj - parseFloat(obj));
  44747. };
  44748. // Register as a named AMD module, since jQuery can be concatenated with other
  44749. // files that may use define, but not via a proper concatenation script that
  44750. // understands anonymous AMD modules. A named AMD is safest and most robust
  44751. // way to register. Lowercase jquery is used because AMD module names are
  44752. // derived from file names, and jQuery is normally delivered in a lowercase
  44753. // file name. Do this after creating the global so that if an AMD module wants
  44754. // to call noConflict to hide this version of jQuery, it will work.
  44755. // Note that for maximum portability, libraries that are not jQuery should
  44756. // declare themselves as anonymous modules, and avoid setting a global if an
  44757. // AMD loader is present. jQuery is a special case. For more information, see
  44758. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  44759. if (true) {
  44760. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  44761. return jQuery;
  44762. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  44763. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  44764. }
  44765. var
  44766. // Map over jQuery in case of overwrite
  44767. _jQuery = window.jQuery,
  44768. // Map over the $ in case of overwrite
  44769. _$ = window.$;
  44770. jQuery.noConflict = function (deep) {
  44771. if (window.$ === jQuery) {
  44772. window.$ = _$;
  44773. }
  44774. if (deep && window.jQuery === jQuery) {
  44775. window.jQuery = _jQuery;
  44776. }
  44777. return jQuery;
  44778. };
  44779. // Expose jQuery and $ identifiers, even in AMD
  44780. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  44781. // and CommonJS for browser emulators (#13566)
  44782. if (!noGlobal) {
  44783. window.jQuery = window.$ = jQuery;
  44784. }
  44785. return jQuery;
  44786. });
  44787. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
  44788. /***/ }),
  44789. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  44790. /*!********************************************************!*\
  44791. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  44792. \********************************************************/
  44793. /*! no static exports found */
  44794. /***/ (function(module, exports, __webpack_require__) {
  44795. "use strict";
  44796. Object.defineProperty(exports, "__esModule", {
  44797. value: true
  44798. });
  44799. var LanguageService = /** @class */function () {
  44800. function LanguageService(lsKey, defaultLang) {
  44801. if (defaultLang === void 0) {
  44802. defaultLang = 'pt';
  44803. }
  44804. this.lsKey = lsKey;
  44805. this.defaultLang = defaultLang;
  44806. this.listeners = [];
  44807. this.document = document;
  44808. this.setupListener();
  44809. }
  44810. LanguageService.prototype.setupListener = function () {
  44811. var _this = this;
  44812. if (this.document !== null) {
  44813. this.document.addEventListener("storage", function (event) {
  44814. var e = event;
  44815. if (e.key === _this.lsKey) {
  44816. _this.listeners.forEach(function (l) {
  44817. return l();
  44818. });
  44819. }
  44820. });
  44821. }
  44822. };
  44823. LanguageService.prototype.getLang = function () {
  44824. var lang = localStorage.getItem(this.lsKey);
  44825. if (lang === null || lang === undefined) {
  44826. console.warn("Internal Error: User language information has not been set. Returning default...");
  44827. return this.getDefaultLang();
  44828. }
  44829. return lang;
  44830. };
  44831. LanguageService.prototype.getDefaultLang = function () {
  44832. return this.defaultLang;
  44833. };
  44834. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  44835. this.listeners.push(listener);
  44836. };
  44837. return LanguageService;
  44838. }();
  44839. exports.LanguageService = LanguageService;
  44840. /***/ }),
  44841. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  44842. /*!************************************************************!*\
  44843. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  44844. \************************************************************/
  44845. /*! no static exports found */
  44846. /***/ (function(module, exports, __webpack_require__) {
  44847. "use strict";
  44848. Object.defineProperty(exports, "__esModule", {
  44849. value: true
  44850. });
  44851. var LanguageServiceNoLS = /** @class */function () {
  44852. function LanguageServiceNoLS(lang) {
  44853. this.lang = lang;
  44854. this.listeners = [];
  44855. }
  44856. LanguageServiceNoLS.prototype.setupListener = function () {};
  44857. LanguageServiceNoLS.prototype.notifyChange = function () {
  44858. this.listeners.forEach(function (l) {
  44859. return l();
  44860. });
  44861. };
  44862. LanguageServiceNoLS.prototype.setLang = function (lang) {
  44863. this.lang = lang;
  44864. this.notifyChange();
  44865. };
  44866. LanguageServiceNoLS.prototype.getLang = function () {
  44867. return this.lang;
  44868. };
  44869. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  44870. return this.lang;
  44871. };
  44872. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  44873. this.listeners.push(listener);
  44874. };
  44875. return LanguageServiceNoLS;
  44876. }();
  44877. exports.LanguageServiceNoLS = LanguageServiceNoLS;
  44878. /***/ }),
  44879. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  44880. /*!*********************************************************!*\
  44881. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  44882. \*********************************************************/
  44883. /*! no static exports found */
  44884. /***/ (function(module, exports, __webpack_require__) {
  44885. "use strict";
  44886. Object.defineProperty(exports, "__esModule", {
  44887. value: true
  44888. });
  44889. exports.LocalizedStrings = undefined;
  44890. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  44891. var LocalizedStrings = /** @class */function () {
  44892. function LocalizedStrings(service, i18nData, listenToChange) {
  44893. if (listenToChange === void 0) {
  44894. listenToChange = false;
  44895. }
  44896. var _this = this;
  44897. this.service = service;
  44898. this.i18nData = i18nData;
  44899. this.listenToChange = listenToChange;
  44900. this.document = document;
  44901. if (this.listenToChange) {
  44902. service.registerLanguageChangeListener(function () {
  44903. _this.updateTagText();
  44904. });
  44905. }
  44906. }
  44907. LocalizedStrings.prototype.getString = function (id, type) {
  44908. var i18nObj = this.i18nData[this.service.getLang()];
  44909. if (!!!i18nObj) {
  44910. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  44911. i18nObj = this.i18nData[this.service.getDefaultLang()];
  44912. }
  44913. if (!!!i18nObj[type]) {
  44914. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  44915. } else if (!!!i18nObj[type][id]) {
  44916. return "{MISSING_I18N_IDENTIFIER}";
  44917. } else {
  44918. return i18nObj[type][id];
  44919. }
  44920. };
  44921. LocalizedStrings.prototype.getOR = function () {
  44922. return this.getUI('join_or');
  44923. };
  44924. LocalizedStrings.prototype.getError = function (id, context) {
  44925. if (context === void 0) {
  44926. context = [];
  44927. }
  44928. var text = this.getString(id, _StringTypes.StringTypes.ERROR);
  44929. return this.processString(text, context);
  44930. };
  44931. LocalizedStrings.prototype.getMessage = function (id, context) {
  44932. if (context === void 0) {
  44933. context = [];
  44934. }
  44935. var text = this.getString(id, _StringTypes.StringTypes.MESSAGE);
  44936. return this.processString(text, context);
  44937. };
  44938. LocalizedStrings.prototype.getUI = function (id, context) {
  44939. if (context === void 0) {
  44940. context = [];
  44941. }
  44942. var text = this.getString(id, _StringTypes.StringTypes.UI);
  44943. return this.processString(text, context);
  44944. };
  44945. LocalizedStrings.prototype.processString = function (text, context) {
  44946. for (var i = 0; i < context.length; i++) {
  44947. var v = context[i];
  44948. text = text.replace('\$' + i, v);
  44949. }
  44950. return text;
  44951. };
  44952. LocalizedStrings.prototype.updateTagText = function (func) {
  44953. var _this = this;
  44954. if (func === void 0) {
  44955. func = null;
  44956. }
  44957. if (this.document !== null) {
  44958. var list = this.document.querySelectorAll("data.i18n");
  44959. list.forEach(function (node) {
  44960. if (func === null) {
  44961. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  44962. } else {
  44963. node.innerHTML = func(node.getAttribute("value"));
  44964. }
  44965. });
  44966. }
  44967. };
  44968. LocalizedStrings.prototype.processTagTex = function (text) {
  44969. if (text === null) {
  44970. return "<Invalid i18n identifier>";
  44971. }
  44972. var opts = text.split(':');
  44973. var type = opts[0].toLowerCase();
  44974. var id = opts[1];
  44975. if (_StringTypes.StringTypes.ERROR === type) {
  44976. return this.getError(id);
  44977. } else if (_StringTypes.StringTypes.MESSAGE === type) {
  44978. return this.getMessage(id);
  44979. } else if (_StringTypes.StringTypes.UI === type) {
  44980. return this.getUI(id);
  44981. } else {
  44982. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  44983. return this.getString(id, type);
  44984. }
  44985. };
  44986. return LocalizedStrings;
  44987. }();
  44988. exports.LocalizedStrings = LocalizedStrings;
  44989. /***/ }),
  44990. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  44991. /*!****************************************************!*\
  44992. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  44993. \****************************************************/
  44994. /*! no static exports found */
  44995. /***/ (function(module, exports, __webpack_require__) {
  44996. "use strict";
  44997. Object.defineProperty(exports, "__esModule", {
  44998. value: true
  44999. });
  45000. var StringTypes = exports.StringTypes = undefined;
  45001. (function (StringTypes) {
  45002. StringTypes["ERROR"] = "error";
  45003. StringTypes["MESSAGE"] = "message";
  45004. StringTypes["UI"] = "ui";
  45005. })(StringTypes || (exports.StringTypes = StringTypes = {}));
  45006. /***/ }),
  45007. /***/ "./node_modules/line-i18n/dist/index.js":
  45008. /*!**********************************************!*\
  45009. !*** ./node_modules/line-i18n/dist/index.js ***!
  45010. \**********************************************/
  45011. /*! no static exports found */
  45012. /***/ (function(module, exports, __webpack_require__) {
  45013. "use strict";
  45014. Object.defineProperty(exports, "__esModule", {
  45015. value: true
  45016. });
  45017. var _LanguageService = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  45018. var _LocalizedStrings = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  45019. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  45020. var _LanguageServiceNoLS = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  45021. exports.default = {
  45022. LanguageService: _LanguageService.LanguageService,
  45023. LanguageServiceNoLS: _LanguageServiceNoLS.LanguageServiceNoLS,
  45024. LocalizedStrings: _LocalizedStrings.LocalizedStrings,
  45025. StringTypes: _StringTypes.StringTypes
  45026. };
  45027. /***/ }),
  45028. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  45029. /*!***************************************************!*\
  45030. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  45031. \***************************************************/
  45032. /*! no static exports found */
  45033. /***/ (function(module, exports, __webpack_require__) {
  45034. "use strict";
  45035. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
  45036. * DEVELOPED BY
  45037. * GIL LOPES BUENO
  45038. * gilbueno.mail@gmail.com
  45039. *
  45040. * WORKS WITH:
  45041. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  45042. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  45043. *
  45044. * FORK:
  45045. * https://github.com/melanke/Watch.JS
  45046. *
  45047. * LICENSE: MIT
  45048. */
  45049. 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; };
  45050. (function (factory) {
  45051. if (( false ? undefined : _typeof(exports)) === 'object') {
  45052. // Node. Does not work with strict CommonJS, but
  45053. // only CommonJS-like enviroments that support module.exports,
  45054. // like Node.
  45055. module.exports = factory();
  45056. } else if (true) {
  45057. // AMD. Register as an anonymous module.
  45058. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  45059. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  45060. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  45061. __WEBPACK_AMD_DEFINE_FACTORY__),
  45062. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  45063. } else {}
  45064. })(function () {
  45065. var WatchJS = {
  45066. noMore: false, // use WatchJS.suspend(obj) instead
  45067. useDirtyCheck: false, // use only dirty checking to track changes.
  45068. preserveExistingSetters: false
  45069. },
  45070. lengthsubjects = [];
  45071. var dirtyChecklist = [];
  45072. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  45073. var supportDefineProperty = false;
  45074. try {
  45075. supportDefineProperty = Object.defineProperty && Object.defineProperty({}, 'x', {});
  45076. } catch (ex) {/* not supported */}
  45077. var isFunction = function isFunction(functionToCheck) {
  45078. var getType = {};
  45079. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  45080. };
  45081. var isInt = function isInt(x) {
  45082. return x % 1 === 0;
  45083. };
  45084. var isArray = function isArray(obj) {
  45085. return Object.prototype.toString.call(obj) === '[object Array]';
  45086. };
  45087. var isObject = function isObject(obj) {
  45088. return {}.toString.apply(obj) === '[object Object]';
  45089. };
  45090. var getObjDiff = function getObjDiff(a, b) {
  45091. var aplus = [],
  45092. bplus = [];
  45093. if (!(typeof a == "string") && !(typeof b == "string")) {
  45094. if (isArray(a) && b) {
  45095. for (var i = 0; i < a.length; i++) {
  45096. if (b[i] === undefined) aplus.push(i);
  45097. }
  45098. } else {
  45099. for (var i in a) {
  45100. if (a.hasOwnProperty(i)) {
  45101. if (b && !b.hasOwnProperty(i)) {
  45102. aplus.push(i);
  45103. }
  45104. }
  45105. }
  45106. }
  45107. if (isArray(b) && a) {
  45108. for (var j = 0; j < b.length; j++) {
  45109. if (a[j] === undefined) bplus.push(j);
  45110. }
  45111. } else {
  45112. for (var j in b) {
  45113. if (b.hasOwnProperty(j)) {
  45114. if (a && !a.hasOwnProperty(j)) {
  45115. bplus.push(j);
  45116. }
  45117. }
  45118. }
  45119. }
  45120. }
  45121. return {
  45122. added: aplus,
  45123. removed: bplus
  45124. };
  45125. };
  45126. var clone = function clone(obj) {
  45127. if (null == obj || "object" != (typeof obj === 'undefined' ? 'undefined' : _typeof(obj))) {
  45128. return obj;
  45129. }
  45130. var copy = obj.constructor();
  45131. for (var attr in obj) {
  45132. copy[attr] = obj[attr];
  45133. }
  45134. return copy;
  45135. };
  45136. var getExistingSetter = function getExistingSetter(obj, propName) {
  45137. if (WatchJS.preserveExistingSetters) {
  45138. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  45139. return existing.set;
  45140. }
  45141. return undefined;
  45142. };
  45143. var defineGetAndSet = function defineGetAndSet(obj, propName, getter, setter) {
  45144. try {
  45145. var existingSetter = getExistingSetter(obj, propName);
  45146. Object.defineProperty(obj, propName, {
  45147. get: getter,
  45148. set: function set(value) {
  45149. setter.call(this, value, true); // coalesce changes
  45150. if (existingSetter) {
  45151. existingSetter(value);
  45152. }
  45153. },
  45154. enumerable: true,
  45155. configurable: true
  45156. });
  45157. } catch (e1) {
  45158. try {
  45159. Object.prototype.__defineGetter__.call(obj, propName, getter);
  45160. Object.prototype.__defineSetter__.call(obj, propName, function (value) {
  45161. setter.call(this, value, true); // coalesce changes
  45162. });
  45163. } catch (e2) {
  45164. observeDirtyChanges(obj, propName, setter);
  45165. //throw new Error("watchJS error: browser not supported :/")
  45166. }
  45167. }
  45168. };
  45169. var defineProp = function defineProp(obj, propName, value) {
  45170. try {
  45171. Object.defineProperty(obj, propName, {
  45172. enumerable: false,
  45173. configurable: true,
  45174. writable: false,
  45175. value: value
  45176. });
  45177. } catch (error) {
  45178. obj[propName] = value;
  45179. }
  45180. };
  45181. var observeDirtyChanges = function observeDirtyChanges(obj, propName, setter) {
  45182. dirtyChecklist[dirtyChecklist.length] = {
  45183. prop: propName,
  45184. object: obj,
  45185. orig: clone(obj[propName]),
  45186. callback: setter
  45187. };
  45188. };
  45189. var watch = function watch() {
  45190. if (isFunction(arguments[1])) {
  45191. watchAll.apply(this, arguments);
  45192. } else if (isArray(arguments[1])) {
  45193. watchMany.apply(this, arguments);
  45194. } else {
  45195. watchOne.apply(this, arguments);
  45196. }
  45197. };
  45198. var watchAll = function watchAll(obj, watcher, level, addNRemove) {
  45199. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45200. //accepts only objects and array (not string)
  45201. return;
  45202. }
  45203. if (isArray(obj)) {
  45204. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  45205. if (level === undefined || level > 0) {
  45206. for (var prop = 0; prop < obj.length; prop++) {
  45207. // watch objects in array
  45208. watchAll(obj[prop], watcher, level, addNRemove);
  45209. }
  45210. }
  45211. } else {
  45212. var prop,
  45213. props = [];
  45214. for (prop in obj) {
  45215. //for each attribute if obj is an object
  45216. if (prop == "$val" || !supportDefineProperty && prop === 'watchers') {
  45217. continue;
  45218. }
  45219. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  45220. props.push(prop); //put in the props
  45221. }
  45222. }
  45223. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  45224. }
  45225. if (addNRemove) {
  45226. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  45227. }
  45228. };
  45229. var watchMany = function watchMany(obj, props, watcher, level, addNRemove) {
  45230. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45231. //accepts only objects and array (not string)
  45232. return;
  45233. }
  45234. for (var i = 0; i < props.length; i++) {
  45235. //watch each property
  45236. var prop = props[i];
  45237. watchOne(obj, prop, watcher, level, addNRemove);
  45238. }
  45239. };
  45240. var watchOne = function watchOne(obj, prop, watcher, level, addNRemove) {
  45241. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45242. //accepts only objects and array (not string)
  45243. return;
  45244. }
  45245. if (isFunction(obj[prop])) {
  45246. //dont watch if it is a function
  45247. return;
  45248. }
  45249. if (obj[prop] != null && (level === undefined || level > 0)) {
  45250. watchAll(obj[prop], watcher, level !== undefined ? level - 1 : level); //recursively watch all attributes of this
  45251. }
  45252. defineWatcher(obj, prop, watcher, level);
  45253. if (addNRemove && (level === undefined || level > 0)) {
  45254. pushToLengthSubjects(obj, prop, watcher, level);
  45255. }
  45256. };
  45257. var unwatch = function unwatch() {
  45258. if (isFunction(arguments[1])) {
  45259. unwatchAll.apply(this, arguments);
  45260. } else if (isArray(arguments[1])) {
  45261. unwatchMany.apply(this, arguments);
  45262. } else {
  45263. unwatchOne.apply(this, arguments);
  45264. }
  45265. };
  45266. var unwatchAll = function unwatchAll(obj, watcher) {
  45267. if (obj instanceof String || !(obj instanceof Object) && !isArray(obj)) {
  45268. //accepts only objects and array (not string)
  45269. return;
  45270. }
  45271. if (isArray(obj)) {
  45272. var props = ['__watchall__'];
  45273. for (var prop = 0; prop < obj.length; prop++) {
  45274. //for each item if obj is an array
  45275. props.push(prop); //put in the props
  45276. }
  45277. unwatchMany(obj, props, watcher); //watch all itens of the props
  45278. } else {
  45279. var unwatchPropsInObject = function unwatchPropsInObject(obj2) {
  45280. var props = [];
  45281. for (var prop2 in obj2) {
  45282. //for each attribute if obj is an object
  45283. if (obj2.hasOwnProperty(prop2)) {
  45284. if (obj2[prop2] instanceof Object) {
  45285. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  45286. } else {
  45287. props.push(prop2); //put in the props
  45288. }
  45289. }
  45290. }
  45291. unwatchMany(obj2, props, watcher); //unwatch all of the props
  45292. };
  45293. unwatchPropsInObject(obj);
  45294. }
  45295. };
  45296. var unwatchMany = function unwatchMany(obj, props, watcher) {
  45297. for (var prop2 in props) {
  45298. //watch each attribute of "props" if is an object
  45299. if (props.hasOwnProperty(prop2)) {
  45300. unwatchOne(obj, props[prop2], watcher);
  45301. }
  45302. }
  45303. };
  45304. var timeouts = [],
  45305. timerID = null;
  45306. function clearTimerID() {
  45307. timerID = null;
  45308. for (var i = 0; i < timeouts.length; i++) {
  45309. timeouts[i]();
  45310. }
  45311. timeouts.length = 0;
  45312. }
  45313. var getTimerID = function getTimerID() {
  45314. if (!timerID) {
  45315. timerID = setTimeout(clearTimerID);
  45316. }
  45317. return timerID;
  45318. };
  45319. var registerTimeout = function registerTimeout(fn) {
  45320. // register function to be called on timeout
  45321. if (timerID == null) getTimerID();
  45322. timeouts[timeouts.length] = fn;
  45323. };
  45324. // Track changes made to an array, object or an object's property
  45325. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  45326. // Syntax:
  45327. // trackChange(obj, callback, recursive, addNRemove)
  45328. // trackChange(obj, prop, callback, recursive, addNRemove)
  45329. var trackChange = function trackChange() {
  45330. var fn = isFunction(arguments[2]) ? trackProperty : trackObject;
  45331. fn.apply(this, arguments);
  45332. };
  45333. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  45334. var trackObject = function trackObject(obj, callback, recursive, addNRemove) {
  45335. var change = null,
  45336. lastTimerID = -1;
  45337. var isArr = isArray(obj);
  45338. var level,
  45339. fn = function fn(prop, action, newValue, oldValue) {
  45340. var timerID = getTimerID();
  45341. if (lastTimerID !== timerID) {
  45342. // check if timer has changed since last update
  45343. lastTimerID = timerID;
  45344. change = {
  45345. type: 'update'
  45346. };
  45347. change['value'] = obj;
  45348. change['splices'] = null;
  45349. registerTimeout(function () {
  45350. callback.call(this, change);
  45351. change = null;
  45352. });
  45353. }
  45354. // create splices for array changes
  45355. if (isArr && obj === this && change !== null) {
  45356. if (action === 'pop' || action === 'shift') {
  45357. newValue = [];
  45358. oldValue = [oldValue];
  45359. } else if (action === 'push' || action === 'unshift') {
  45360. newValue = [newValue];
  45361. oldValue = [];
  45362. } else if (action !== 'splice') {
  45363. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  45364. }
  45365. if (!change.splices) change.splices = [];
  45366. change.splices[change.splices.length] = {
  45367. index: prop,
  45368. deleteCount: oldValue ? oldValue.length : 0,
  45369. addedCount: newValue ? newValue.length : 0,
  45370. added: newValue,
  45371. deleted: oldValue
  45372. };
  45373. }
  45374. };
  45375. level = recursive == true ? undefined : 0;
  45376. watchAll(obj, fn, level, addNRemove);
  45377. };
  45378. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  45379. var trackProperty = function trackProperty(obj, prop, callback, recursive, addNRemove) {
  45380. if (obj && prop) {
  45381. watchOne(obj, prop, function (prop, action, newvalue, oldvalue) {
  45382. var change = {
  45383. type: 'update'
  45384. };
  45385. change['value'] = newvalue;
  45386. change['oldvalue'] = oldvalue;
  45387. if (recursive && isObject(newvalue) || isArray(newvalue)) {
  45388. trackObject(newvalue, callback, recursive, addNRemove);
  45389. }
  45390. callback.call(this, change);
  45391. }, 0);
  45392. if (recursive && isObject(obj[prop]) || isArray(obj[prop])) {
  45393. trackObject(obj[prop], callback, recursive, addNRemove);
  45394. }
  45395. }
  45396. };
  45397. var defineWatcher = function defineWatcher(obj, prop, watcher, level) {
  45398. var newWatcher = false;
  45399. var isArr = isArray(obj);
  45400. if (!obj.watchers) {
  45401. defineProp(obj, "watchers", {});
  45402. if (isArr) {
  45403. // watch array functions
  45404. watchFunctions(obj, function (index, action, newValue, oldValue) {
  45405. addPendingChange(obj, index, action, newValue, oldValue);
  45406. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  45407. var i,
  45408. n,
  45409. ln,
  45410. wAll,
  45411. watchList = obj.watchers[prop];
  45412. if (wAll = obj.watchers['__watchall__']) {
  45413. watchList = watchList ? watchList.concat(wAll) : wAll;
  45414. }
  45415. ln = watchList ? watchList.length : 0;
  45416. for (i = 0; i < ln; i++) {
  45417. if (action !== 'splice') {
  45418. watchAll(newValue, watchList[i], level === undefined ? level : level - 1);
  45419. } else {
  45420. // watch spliced values
  45421. for (n = 0; n < newValue.length; n++) {
  45422. watchAll(newValue[n], watchList[i], level === undefined ? level : level - 1);
  45423. }
  45424. }
  45425. }
  45426. }
  45427. });
  45428. }
  45429. }
  45430. if (!obj.watchers[prop]) {
  45431. obj.watchers[prop] = [];
  45432. if (!isArr) newWatcher = true;
  45433. }
  45434. for (var i = 0; i < obj.watchers[prop].length; i++) {
  45435. if (obj.watchers[prop][i] === watcher) {
  45436. return;
  45437. }
  45438. }
  45439. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  45440. if (newWatcher) {
  45441. var val = obj[prop];
  45442. var getter = function getter() {
  45443. return val;
  45444. };
  45445. var setter = function setter(newval, delayWatcher) {
  45446. var oldval = val;
  45447. val = newval;
  45448. if (level !== 0 && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop])) && !obj[prop].watchers) {
  45449. // watch sub properties
  45450. var i,
  45451. ln = obj.watchers[prop].length;
  45452. for (i = 0; i < ln; i++) {
  45453. watchAll(obj[prop], obj.watchers[prop][i], level === undefined ? level : level - 1);
  45454. }
  45455. }
  45456. //watchFunctions(obj, prop);
  45457. if (isSuspended(obj, prop)) {
  45458. resume(obj, prop);
  45459. return;
  45460. }
  45461. if (!WatchJS.noMore) {
  45462. // this does not work with Object.observe
  45463. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  45464. if (oldval !== newval) {
  45465. if (!delayWatcher) {
  45466. callWatchers(obj, prop, "set", newval, oldval);
  45467. } else {
  45468. addPendingChange(obj, prop, "set", newval, oldval);
  45469. }
  45470. WatchJS.noMore = false;
  45471. }
  45472. }
  45473. };
  45474. if (WatchJS.useDirtyCheck) {
  45475. observeDirtyChanges(obj, prop, setter);
  45476. } else {
  45477. defineGetAndSet(obj, prop, getter, setter);
  45478. }
  45479. }
  45480. };
  45481. var callWatchers = function callWatchers(obj, prop, action, newval, oldval) {
  45482. if (prop !== undefined) {
  45483. var ln,
  45484. wl,
  45485. watchList = obj.watchers[prop];
  45486. if (wl = obj.watchers['__watchall__']) {
  45487. watchList = watchList ? watchList.concat(wl) : wl;
  45488. }
  45489. ln = watchList ? watchList.length : 0;
  45490. for (var wr = 0; wr < ln; wr++) {
  45491. watchList[wr].call(obj, prop, action, newval, oldval);
  45492. }
  45493. } else {
  45494. for (var prop in obj) {
  45495. //call all
  45496. if (obj.hasOwnProperty(prop)) {
  45497. callWatchers(obj, prop, action, newval, oldval);
  45498. }
  45499. }
  45500. }
  45501. };
  45502. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  45503. var defineArrayMethodWatcher = function defineArrayMethodWatcher(obj, original, methodName, callback) {
  45504. defineProp(obj, methodName, function () {
  45505. var index = 0;
  45506. var i, newValue, oldValue, response;
  45507. // get values before splicing array
  45508. if (methodName === 'splice') {
  45509. var start = arguments[0];
  45510. var end = start + arguments[1];
  45511. oldValue = obj.slice(start, end);
  45512. newValue = [];
  45513. for (i = 2; i < arguments.length; i++) {
  45514. newValue[i - 2] = arguments[i];
  45515. }
  45516. index = start;
  45517. } else {
  45518. newValue = arguments.length > 0 ? arguments[0] : undefined;
  45519. }
  45520. response = original.apply(obj, arguments);
  45521. if (methodName !== 'slice') {
  45522. if (methodName === 'pop') {
  45523. oldValue = response;
  45524. index = obj.length;
  45525. } else if (methodName === 'push') {
  45526. index = obj.length - 1;
  45527. } else if (methodName === 'shift') {
  45528. oldValue = response;
  45529. } else if (methodName !== 'unshift' && newValue === undefined) {
  45530. newValue = response;
  45531. }
  45532. callback.call(obj, index, methodName, newValue, oldValue);
  45533. }
  45534. return response;
  45535. });
  45536. };
  45537. var watchFunctions = function watchFunctions(obj, callback) {
  45538. if (!isFunction(callback) || !obj || obj instanceof String || !isArray(obj)) {
  45539. return;
  45540. }
  45541. for (var i = methodNames.length, methodName; i--;) {
  45542. methodName = methodNames[i];
  45543. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  45544. }
  45545. };
  45546. var unwatchOne = function unwatchOne(obj, prop, watcher) {
  45547. if (prop) {
  45548. if (obj.watchers && obj.watchers[prop]) {
  45549. if (watcher === undefined) {
  45550. delete obj.watchers[prop]; // remove all property watchers
  45551. } else {
  45552. for (var i = 0; i < obj.watchers[prop].length; i++) {
  45553. var w = obj.watchers[prop][i];
  45554. if (w == watcher) {
  45555. obj.watchers[prop].splice(i, 1);
  45556. }
  45557. }
  45558. }
  45559. }
  45560. } else {
  45561. delete obj.watchers;
  45562. }
  45563. removeFromLengthSubjects(obj, prop, watcher);
  45564. removeFromDirtyChecklist(obj, prop);
  45565. };
  45566. // suspend watchers until next update cycle
  45567. var suspend = function suspend(obj, prop) {
  45568. if (obj.watchers) {
  45569. var name = '__wjs_suspend__' + (prop !== undefined ? prop : '');
  45570. obj.watchers[name] = true;
  45571. }
  45572. };
  45573. var isSuspended = function isSuspended(obj, prop) {
  45574. return obj.watchers && (obj.watchers['__wjs_suspend__'] || obj.watchers['__wjs_suspend__' + prop]);
  45575. };
  45576. // resumes preivously suspended watchers
  45577. var resume = function resume(obj, prop) {
  45578. registerTimeout(function () {
  45579. delete obj.watchers['__wjs_suspend__'];
  45580. delete obj.watchers['__wjs_suspend__' + prop];
  45581. });
  45582. };
  45583. var pendingTimerID = null;
  45584. var addPendingChange = function addPendingChange(obj, prop, mode, newval, oldval) {
  45585. pendingChanges[pendingChanges.length] = {
  45586. obj: obj,
  45587. prop: prop,
  45588. mode: mode,
  45589. newval: newval,
  45590. oldval: oldval
  45591. };
  45592. if (pendingTimerID === null) {
  45593. pendingTimerID = setTimeout(applyPendingChanges);
  45594. }
  45595. };
  45596. var applyPendingChanges = function applyPendingChanges() {
  45597. // apply pending changes
  45598. var change = null;
  45599. pendingTimerID = null;
  45600. for (var i = 0; i < pendingChanges.length; i++) {
  45601. change = pendingChanges[i];
  45602. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  45603. }
  45604. if (change) {
  45605. pendingChanges = [];
  45606. change = null;
  45607. }
  45608. };
  45609. var loop = function loop() {
  45610. // check for new or deleted props
  45611. for (var i = 0; i < lengthsubjects.length; i++) {
  45612. var subj = lengthsubjects[i];
  45613. if (subj.prop === "$$watchlengthsubjectroot") {
  45614. var difference = getObjDiff(subj.obj, subj.actual);
  45615. if (difference.added.length || difference.removed.length) {
  45616. if (difference.added.length) {
  45617. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  45618. }
  45619. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  45620. }
  45621. subj.actual = clone(subj.obj);
  45622. } else {
  45623. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  45624. if (difference.added.length || difference.removed.length) {
  45625. if (difference.added.length) {
  45626. for (var j = 0; j < subj.obj.watchers[subj.prop].length; j++) {
  45627. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  45628. }
  45629. }
  45630. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  45631. }
  45632. subj.actual = clone(subj.obj[subj.prop]);
  45633. }
  45634. }
  45635. // start dirty check
  45636. var n, value;
  45637. if (dirtyChecklist.length > 0) {
  45638. for (var i = 0; i < dirtyChecklist.length; i++) {
  45639. n = dirtyChecklist[i];
  45640. value = n.object[n.prop];
  45641. if (!compareValues(n.orig, value)) {
  45642. n.orig = clone(value);
  45643. n.callback(value);
  45644. }
  45645. }
  45646. }
  45647. };
  45648. var compareValues = function compareValues(a, b) {
  45649. var i,
  45650. state = true;
  45651. if (a !== b) {
  45652. if (isObject(a)) {
  45653. for (i in a) {
  45654. if (!supportDefineProperty && i === 'watchers') continue;
  45655. if (a[i] !== b[i]) {
  45656. state = false;
  45657. break;
  45658. };
  45659. }
  45660. } else {
  45661. state = false;
  45662. }
  45663. }
  45664. return state;
  45665. };
  45666. var pushToLengthSubjects = function pushToLengthSubjects(obj, prop, watcher, level) {
  45667. var actual;
  45668. if (prop === "$$watchlengthsubjectroot") {
  45669. actual = clone(obj);
  45670. } else {
  45671. actual = clone(obj[prop]);
  45672. }
  45673. lengthsubjects.push({
  45674. obj: obj,
  45675. prop: prop,
  45676. actual: actual,
  45677. watcher: watcher,
  45678. level: level
  45679. });
  45680. };
  45681. var removeFromLengthSubjects = function removeFromLengthSubjects(obj, prop, watcher) {
  45682. for (var i = 0; i < lengthsubjects.length; i++) {
  45683. var subj = lengthsubjects[i];
  45684. if (subj.obj == obj) {
  45685. if (!prop || subj.prop == prop) {
  45686. if (!watcher || subj.watcher == watcher) {
  45687. // if we splice off one item at position i
  45688. // we need to decrement i as the array is one item shorter
  45689. // so when we increment i in the loop statement we
  45690. // will land at the correct index.
  45691. // if it's not decremented, you won't delete all length subjects
  45692. lengthsubjects.splice(i--, 1);
  45693. }
  45694. }
  45695. }
  45696. }
  45697. };
  45698. var removeFromDirtyChecklist = function removeFromDirtyChecklist(obj, prop) {
  45699. var notInUse;
  45700. for (var i = 0; i < dirtyChecklist.length; i++) {
  45701. var n = dirtyChecklist[i];
  45702. var watchers = n.object.watchers;
  45703. notInUse = n.object == obj && (!prop || n.prop == prop) && watchers && (!prop || !watchers[prop] || watchers[prop].length == 0);
  45704. if (notInUse) {
  45705. // we use the same syntax as in removeFromLengthSubjects
  45706. dirtyChecklist.splice(i--, 1);
  45707. }
  45708. }
  45709. };
  45710. setInterval(loop, 50);
  45711. WatchJS.watch = watch;
  45712. WatchJS.unwatch = unwatch;
  45713. WatchJS.callWatchers = callWatchers;
  45714. WatchJS.suspend = suspend; // suspend watchers
  45715. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  45716. return WatchJS;
  45717. });
  45718. /***/ }),
  45719. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  45720. /*!******************************************************!*\
  45721. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  45722. \******************************************************/
  45723. /*! no static exports found */
  45724. /***/ (function(module, exports, __webpack_require__) {
  45725. "use strict";
  45726. /***/ }),
  45727. /***/ "./node_modules/webpack/buildin/module.js":
  45728. /*!***********************************!*\
  45729. !*** (webpack)/buildin/module.js ***!
  45730. \***********************************/
  45731. /*! no static exports found */
  45732. /***/ (function(module, exports, __webpack_require__) {
  45733. "use strict";
  45734. module.exports = function (module) {
  45735. if (!module.webpackPolyfill) {
  45736. module.deprecate = function () {};
  45737. module.paths = [];
  45738. // module.parent = undefined by default
  45739. if (!module.children) module.children = [];
  45740. Object.defineProperty(module, "loaded", {
  45741. enumerable: true,
  45742. get: function get() {
  45743. return module.l;
  45744. }
  45745. });
  45746. Object.defineProperty(module, "id", {
  45747. enumerable: true,
  45748. get: function get() {
  45749. return module.i;
  45750. }
  45751. });
  45752. module.webpackPolyfill = 1;
  45753. }
  45754. return module;
  45755. };
  45756. /***/ })
  45757. /******/ });
  45758. });
  45759. //# sourceMappingURL=ivprog.bundle.js.map